Fix/offline cache widget notifications - #160
Merged
maugauwi-hash merged 5 commits intoJul 28, 2026
Merged
Conversation
OfflineCache wrote raw response bytes keyed only by request-path hash, so a cached vault list could be served as "current" no matter how old it actually was — the same gap flagged in iOS ethos-protocol#25. Wrap cached entries in a small JSON envelope carrying the write timestamp, thread that through ApiResult/VaultViewModel as cachedAt, and have OfflineBanner show "as of X ago" whenever displayed data came from the cache.
OfflineCache never deleted anything from context.cacheDir/ttl_offline, so it grew without bound — the same gap as iOS ethos-protocol#26. Track access recency in-memory and evict least-recently-used entries once a save pushes the directory over a 5 MB cap, and wipe the whole cache on sign-out (ethos-protocol#59) so a previous account's cached vault data doesn't linger on a shared device.
VaultWidgetUpdateWorker.doWork() took result.data.firstOrNull(), showing whichever vault the API happened to return first — arbitrary, and inconsistent with iOS's TTLTimelineProvider, which filters to active vaults and picks the minimum ttlRemaining. Extract that same selection logic into VaultWidgetUpdateWorker.selectUrgentVault() so a user with multiple vaults sees the one closest to expiring on both platforms.
NotificationHelper.show() used vaultId.hashCode() as the notification ID, and String.hashCode() collisions between two distinct vault IDs are possible within the 32-bit hash space — one vault's check-in reminder could silently replace another's instead of both appearing. Persist a stable vaultId -> ID mapping in a reserved ID range instead, so distinct vault IDs are guaranteed distinct notification IDs, and group notifications by vault as a second line of defense against relying on ID uniqueness alone for replace-vs-append behavior.
|
@Valreb001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #77
Closes #78
Closes #79
Closes #80
Summary of what was implemented: