mobile: sync personal wildcards in the background, match from SQLite - #385
Open
haumacher wants to merge 1 commit into
Open
mobile: sync personal wildcards in the background, match from SQLite#385haumacher wants to merge 1 commit into
haumacher wants to merge 1 commit into
Conversation
User asked whether the recently added server-side wildcard blocklist entries (#377, PERSONALIZATION.WILDCARD) are synced with the app. They were only reconciled when the blacklist page was opened; the daily WorkManager task synced just the global community blocklist. So a wildcard added on the website or another device only reached the phone when the user happened to open the blacklist view. The server cannot evaluate personal prefix wildcards during the anonymized SHA1 online check, so the match must happen locally on every call (it already did, via the unified decideAndRespond path) and the local set must stay fresh. The blocker for a background refresh: the WorkManager isolate has no Activity, so the previous SQLite -> SharedPreferences (via setWildcardPrefixes MethodChannel) -> CallChecker propagation could not complete there. Fix: - CallChecker now reads wildcard prefixes directly from the wildcard_blocks SQLite table (mirroring the existing lookupLocalBlocklist read), making SQLite the single source of truth and removing the MethodChannel dependency. - The daily WorkManager task also reconciles personal wildcards via a new context-free syncPersonalWildcards()/reconcileWildcards() pair, extracted from the former _syncWildcards() State method. - Removed the now-dead SharedPreferences path: syncWildcardPrefixesToNative(), the native setWildcardPrefixes/getWildcardPrefixes handlers and methods, and the unused Dart getWildcardPrefixes() DB helper. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
Persönliche Wildcard-Blocklist-Einträge (#377,
PERSONALIZATION.WILDCARD) wurden in der App nur dann mit dem Server abgeglichen, wenn der Nutzer die Blacklist-Ansicht öffnete. Der tägliche WorkManager-Hintergrundtask synchronisierte ausschließlich die globale Community-Blocklist. Eine auf der Website (oder einem anderen Gerät) angelegte Wildcard erreichte das Handy also nur, wenn die Blacklist-Seite zufällig geöffnet wurde.Der Server kann persönliche Prefix-Wildcards bei der anonymisierten SHA1-Online-Abfrage prinzipbedingt nicht prüfen — das Matching muss daher bei jedem Anruf lokal erfolgen (tat es bereits über den gemeinsamen
decideAndRespond-Pfad), und der lokale Bestand muss aktuell gehalten werden.Blocker für einen Hintergrund-Abgleich: Das WorkManager-Isolate hat keine Activity, daher konnte der bisherige Weg SQLite → SharedPreferences (
setWildcardPrefixesvia MethodChannel) → CallChecker dort nicht abschließen.Lösung
wildcard_blocks(analog zum bestehendenlookupLocalBlocklist). SQLite ist damit die einzige Quelle und der MethodChannel-Umweg entfällt.syncPersonalWildcards()/reconcileWildcards(), ausgelagert aus der früheren State-Methode_syncWildcards().syncWildcardPrefixesToNative(), die nativensetWildcardPrefixes/getWildcardPrefixes-Handler und -Methoden sowie den ungenutzten Dart-getWildcardPrefixes()-DB-Helper.Aktualität nach dieser Änderung
Bewusst kein Push-Trigger: Es bleibt ein Restfenster von bis zu ~24 h, falls der Nutzer die Ansicht nie öffnet und in diesem Zeitraum ein passender Anruf eingeht. Bei der niedrigen Frequenz persönlicher Wildcards ist das akzeptabel.
Verifikation
flutter analyzeder geänderten Dart-Dateien: keine neuen Issues../gradlew :app:compileDebugJavaWithJavac: erfolgreich.🤖 Generated with Claude Code