fix: resolve import backup silently failing due to deactivated widget context#112
Open
ivanwongtf wants to merge 160 commits into
Open
fix: resolve import backup silently failing due to deactivated widget context#112ivanwongtf wants to merge 160 commits into
ivanwongtf wants to merge 160 commits into
Conversation
…h-10803040634688039088 🧹 refactor: remove unused `_swatch` variable in `flauncher_app.dart`
Adds `test/models/category_test.dart` to verify the constructors and fields of the `Category` model, as well as the `unmodifiable()` method. Also adds a basic test for `LauncherSpacer`. This resolves the issue of missing tests for the Category model.
…6392016201667835771 🧪 Add unit tests for Category model
…toggle-16740655243048156961 🧪 Add tests for LauncherState.toggleLauncherVisibility
Removed dead code in `test/widgets/app_card_test.dart` including an unused import, and unused local variables (`movedDirection`, `state`, and `moveEnded`). This resolves linting warnings and improves the test's clarity.
…used-variables-5594749462216507943 🧹 fix unused local variables in app_card_test.dart
…uilds - New Accessibility settings page with default launcher status and 'Set as default launcher' button (opens system home picker) - Android: added openDefaultLauncherSettings method channel handler - Dart: added openDefaultLauncherSettings to FLauncherChannel - L10n: added English and Spanish translations - Gitignore: drift_schemas/, test/generated_migrations/, test/mocks.mocks.dart, .vscode/ Co-authored-by: pre-existing refactoring (database migration safety, test renames, widget improvements)
…ety, and accessibility docs
…tion safety, and accessibility docs" This reverts commit 497d707.
- Add TV Input selector status bar button next to settings - Configure ndk.abiFilters to package only ARM architectures - Fix category order jumbling and SD card reboot app-loss
… context The _import() function was called with a context that becomes deactivated when the confirmation dialog is popped, causing context.read<BackupService>() to throw an unsafe ancestor lookup error. The error was silently swallowed because _import() was not awaited. Fix: read service providers before showing the dialog while the context is still valid, then call importBackup directly without relying on the widget context.
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.
Summary
Fixes #111
Import Backup in settings silently fails because the confirmation dialog's pop deactivates the parent widget context before
_import()can access service providers.Problem
In
_confirmFileImport(), after the user clicks Import:Navigator.of(dialogContext).pop()closes the confirmation dialog_import(context, ...)is called with the now-deactivated parent contextcontext.read<BackupService>()throws"Looking up a deactivated widget's ancestor is unsafe"_import()is called withoutawait, the error becomes an unhandled async exception and is silently swallowedFix
Read service providers before showing the dialog while the context is still valid:
Changes
lib/widgets/settings/backup_restore_page.dart: Read services before dialog, callimportBackup()directly_import()helper method that was the source of the deactivated context bugTesting
Verified on Samsung SM-F946U (Android 16) with 188 apps across 13 categories - import now works correctly.