Repository navigation
fix: keep confirmations working after recreation - #22886
criticalAY wants to merge 3 commits into
Conversation
The field editor forgot which field was tapped when it was recreated, for example by a night mode switch. An open field menu then acted on the first field, so Delete could remove the wrong one. Part of 22714 Assisted-by: Claude Opus 5.5
mikehardy
left a comment
There was a problem hiding this comment.
Assisted-by: Grok 4.7
Thank you — the card-type and field editor recreation fix looks solid, and the new Robolectric tests are a nice touch.
Rebased locally onto current main (clean replay; no force-push). Ran lint (lintAll, ktlintCheck, lint-rules:test), jacocoUnitTestReport, and emulator tests (TEST_RELEASE_BUILD=true via run_emulator_tests.py on emulator-5556 / API35_GAPI); all passed.
ConfirmationDialog now stores requestKey and a result Bundle in arguments so the positive button survives recreation via setFragmentResult, while still running any in-memory confirm when set. On the card template page, add/delete/reposition confirmations register fragment-result listeners on the activity’s FragmentManager; executeWithSyncCheck applies the bundle, and full-sync warnings reuse the same bundle through the dialog back stack. Field editor add/delete/reposition/sort follow the same pattern with saved currentPos. New recreation tests configuration-change to night mode before clicking confirm so a no-op restored button would fail.
some acceptable findings, no action required, just leaving for posterity: rename’s full-sync confirm is still an in-memory Runnable (recreation during rename can still drop it); ConfirmationDialog KDoc still mentions setArgs/setConfirm rather than newInstance; full-sync confirm for card-type add/delete does not reload the previewer (same as the old Runnable path).
28507b9 to
470806e
Compare
|
Leaving it for now until parent is merged |
ConfirmationDialog kept its action in memory, so after a night mode switch tapping Delete did nothing and the field menu came back. It can now send a fragment result, which the field editor uses to add, delete, reposition and sort fields. Part of 22714 Assisted-by: Claude Opus 5.5
After a night mode switch, confirming Add or Delete card type, or the full sync warning, did nothing, and cancelling the warning brought the previous confirmation back. The card type page now receives these as fragment results. Part of 22714 Assisted-by: Claude Opus 5.5
470806e to
5630578
Compare
Note
Assisted-by: Opus 5.5
Purpose / Description
After a night mode switch, confirming Add or Delete card type, or the full sync warning, did nothing. Cancelling the warning brought the previous confirmation back.
ConfirmationDialogloses callbacks on activity recreation #22714, covering the card template editor. Depends on fix(fields): keep confirmations working after recreation #22876.Fixes
ConfirmationDialogloses callbacks on activity recreation #22714Approach
Each card type page now gets its confirmations as fragment results. The full sync warning replaces the confirmation instead of opening on top of it, so Back on it now closes it too.
How Has This Been Tested?
test (fails without this change) and some more tests :)
Learning (optional, can help others)
NA
Checklist
Please, go through these checks before submitting the PR.