fix: persist ignored-version lock so updates are suppressed#1351
Open
Phoenix1808 wants to merge 1 commit into
Open
fix: persist ignored-version lock so updates are suppressed#1351Phoenix1808 wants to merge 1 commit into
Phoenix1808 wants to merge 1 commit into
Conversation
ProductPreferences emitted lock changes through a MutableSharedFlow with no buffer (replay = 0, extraBufferCapacity = 0), so tryEmit() silently dropped the event when the collector was not ready. The SharedPreferences entry was saved, but the matching row in the lock table was never written, so the Updates tab and update notifications kept treating the ignored version as updatable until the next app restart rebuilt the lock table. Give the flow an unbounded buffer so tryEmit() never drops the event and the lock is written reliably. Fixes Droid-ify#1309
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.
Fix: "Ignore this version" does not take effect until app restart
Fixes #1309
Problem
Toggling "Ignore this version" correctly changed the action button to Launch, but the app continued to:
Appear in the Updates tab
Trigger update available notifications
The ignore action only took effect after a full application restart.
Root Cause
ProductPreferencesperforms two separate operations when an ignored version is toggled:Stores the preference in
SharedPreferencesSignals the database layer to write a corresponding entry into the
locktableThe
locktable is the source of truth used by:Update queries
Update notifications
Updatable version detection
The signal is sent through a
MutableSharedFlowconfigured with no replay and no buffer:The preference update uses:
Because the flow has:
tryEmit()silently drops emissions whenever no collector is actively ready to receive the value at that exact moment.As a result:
The
SharedPreferencesvalue was saved successfully.The corresponding
locktable entry was never written.The Updates screen continued treating the version as updatable.
Update notifications continued to appear.
The bug appeared intermittent because the application rebuilt the entire lock table during startup:
During initialization, ignored versions were reconstructed from
SharedPreferences, causing the issue to seemingly fix itself after restarting the app.Fix
Configure the flow with buffering so
tryEmit()cannot lose events.This preserves the existing architecture:
Database writes remain off the main thread.
Background collectors continue handling persistence.
Ignore events are guaranteed to be delivered.
Additionally, the lock write now invokes:
This immediately refreshes the Updates UI, causing ignored versions to disappear without requiring:
Manual sync
App restart
Process recreation
Before / After
Testing
Device Testing
Built and installed the debug variant on a physical Android device.
Test Steps
Installed an older version of an application so an update was available.
Opened the update screen.
Toggled Ignore this version.
Verified the application disappeared from the Updates tab immediately.
Verified no update notification was generated.
Toggled ignore off again.
Verified the update reappeared as expected.
Result
✅ Ignored versions disappear instantly from Updates.
✅ No restart required.
✅ No manual synchronization required.
✅ Un-ignore restores update visibility correctly.
Impact
This change ensures that:
Ignore-version actions are applied immediately.
Update notifications remain consistent with user preferences.
Lost flow emissions no longer create stale lock-table state.
UI and database state remain synchronized without requiring an application restart.