fix(navigation): back-fill newly-added nav bar buttons into persisted order - #1157
Merged
Conversation
… order Users who customized their nav bar order before Tips was added to the NavBarButton enum (#1121) had a persisted order string without Tips. NavBarConfig.deserialize only fell back to defaultOrder on an empty list, so it reconstructed the stored order verbatim, missing Tips. The scanner nav bar filter can only remove buttons, never add them, so enabling the tipping beta flag never surfaced the Tips tab on those devices. deserialize now merges any button missing from the persisted order, inserting each at its position in defaultOrder. Self-heals affected devices on next launch with no migration.
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
Toggling the Tipping beta flag on two users' devices never surfaced the Tips tab on the scanner — on any restart.
The Tips tab is gated by the persisted nav bar order (
FeatureFlag.NavBaroption), not the beta flag directly.ScannerNavigationBarbuilds its buttons by filtering the deserializedNavBarConfig.order— it can only ever remove buttons, never inject them:config.order.filter { option -> when (option) { NavBarButton.Tips -> state.isTippingEnabled // only keeps Tips if already in order ... } }Tipswas added to theNavBarButtonenum anddefaultOrderin #1121, after the drag-to-reorder nav bar settings shipped in #767. Any user who customized their nav bar order in between persisted a string likeDiscover,Give,Send,Wallet|Cash— noTips.NavBarConfig.deserializeonly fell back todefaultOrderwhen the parsed list was empty, so it reconstructed the legacy order verbatim, permanently missingTips. Enabling the tipping flag flippedisTippingEnabledcorrectly, but there was noTipsinconfig.orderfor the filter to keep.Fresh users and users who never opened the reorder sheet were unaffected (their default option is the current
NavBarConfig.Default.serialize(), which includesTips) — which is why it worked on some devices but not these two.Fix
NavBarConfig.deserializenow merges anyNavBarButtonmissing from a persisted order, inserting each at its position indefaultOrder. Self-heals affected devices on next launch — no data migration needed.Tests
Added
NavBarConfigTest(6 cases, all passing), including the regression: a legacyDiscover,Give,Send,Wallet|Cashstring now deserializes withTipsback-filled betweenSendandWallet. Also covers custom-order preservation, unknown-name dropping, and empty/blank fallback.