Repository navigation
feat: calculate registration date locally from user ID - #110
Conversation
NextAlone
left a comment
There was a problem hiding this comment.
Thanks for the PR. Dropping the Nicegram call is the right direction: it removes a third-party request that leaked every viewed user ID, a hardcoded API key, and the network dependency (plus the old LRU path that still re-requested after a cache hit).
Two things need fixing before merge, both about displayed results being wrong rather than merely approximate; see the inline comments on the "newer than" constant and on the non-monotonic table. The rest are suggestions.
Not anchorable inline:
- [Suggestion]
xyz/nextalone/nnngram/remote/BaseController.kthas no subclasses left afterNicegramControlleris deleted (the translators use their ownBaseTranslator), so it should be removed in this PR as well. The ktor dependency itself is still used by the translate module. - [Question] Where does
id_date.jsoncome from, what is its license, and how is it expected to be updated? The table ends at ID 8461412540, so it will go stale without a refresh process.
Reviewed statically (diff + a script over the table); not built or tested on a device.
| "date": 1637590800 | ||
| }, | ||
| { | ||
| "id": 3318845111, |
There was a problem hiding this comment.
[Must fix] The dates in this table are not monotonic: 41 of the 134 intervals have a later ID with an earlier date, so linear interpolation makes accounts with larger IDs look older. The worst one is right here: 2138472342 (2021-11-22) → 3318845111 (2021-04-10), a 226-day step back. This point and 4317845111 look like outliers. The final interval (8454563873 → 8461412540) also goes back 108 days.
Please clean the table into a monotonic sequence before shipping it (at minimum drop these two points and fix the tail).
| private val json = Json { ignoreUnknownKeys = true } | ||
|
|
||
| private val profileDateDataList: List<ProfileDateData> by lazy { | ||
| runCatching { |
There was a problem hiding this comment.
[FYI] The first popup open reads and parses the asset on the main thread. The file is ~10 KB so the cost is small; mentioning it only in case the table grows.
it comes from nagram: |
|
Thanks for confirming the source of One more thing worth checking before we drop the API entirely. The official Nicegram Android client now calls a versioned endpoint, @waifucon could you test with a few new accounts (IDs above 8461412540, where the local table ends) and report:
This does not change the direction of the PR: the local table is still preferable for privacy and offline use. But the result tells us how far the local table lags behind the server for new accounts, which is relevant to the two must-fix comments above. |
87cc992 to
9c78f71
Compare
Co-authored-by: xtaodada <xtao@xtao.de>
9c78f71 to
28ded77
Compare
deleted basecontroller.kt |
script used to get the data. |
The table bundled in #110 was not monotonic: 41 of 134 intervals had a larger ID mapped to an earlier date, so interpolation could show a newer account as older. The tail was the visible case: IDs just below 8461412540 showed 2025-12 while larger ones showed "newer than 2025-08". Drop the two synthetic anchors in the unused 2.1B-5.1B ID gap (3318845111, 4317845111) and replace the remaining dates with their least-squares non-decreasing fit (pool adjacent violators). 78 dates move, by at most 82 days (median 20); no ID is added or renumbered. Also take the lower bound from the table instead of a hardcoded 1000000, guard against a null currentLocale, and fix import order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>


Description
dropped nicegram api call, using an local date calculator. the api call fails mostly for most new accs. it's instant the api had some delays.
merged in nullgram too:
qwq233/Nullgram#397
Check List