Attributes tab: Done dismisses POI editor when tags unchanged#955
Open
tordans wants to merge 1 commit into
Open
Attributes tab: Done dismisses POI editor when tags unchanged#955tordans wants to merge 1 commit into
tordans wants to merge 1 commit into
Conversation
When the tag dictionary matches the map object, Done now dismisses without calling commitChanges(). When tags changed, behavior is unchanged: dismiss then commit. Removed viewWillAppear logic that disabled Done when there were no edits. Fix Done dismiss when tags unchanged on Common/All Tags tabs Disabled UIBarButtonItem does not invoke done:, so gray checkmark could highlight without closing. Keep Done enabled and use tint for gray/blue; only commit when isTagDictChanged(). Shared updateSaveButton on POITabBarController. Co-Authored-By: Tobias <t@tobiasjordans.de>
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
On POI editor tabs (Common Tags, All Tags, Attributes), the navigation Done (checkmark) was disabled when tags were unchanged (
saveButton.isEnabled = false). A disabled bar button does not rundone(_:), so the checkmark could highlight but the sheet stayed open. With edits, Done was enabled (blue) and dismissed + saved as expected.Expected: Gray checkmark when unchanged, but tap still dismisses without saving. Blue checkmark when there are edits: save and dismiss.
Why: This allows users to aways close the panel with the top right button which is easer to remember and easer to reach. Also when nothing changed, using "save changes" is OK because it changes nothing…
Implementation notes (by Cursor)
Root cause:
UIBarButtonItem.isEnabled = falseblocks the action selector.Fix:
POITabBarController.updateSaveButton(_:hasUnsavedTagChanges:)— Done stays enabled (tappable); tint is gray (.tertiaryLabel) when unchanged, default accent when changed;isModalInPresentationstill tracks unsaved changes.done(_:)on Common Tags, All Tags, and Attributes: alwaysdismiss, callcommitChanges()only whenisTagDictChanged().saveButton.isEnabled = isTagDictChanged()call sites in those controllers withupdateSaveButton.Note: New objects hide the Attributes tab; the behavior you see on “tags panel” is Common Tags (first tab).
Automated testing: Not covered by XCTest in this PR.
Testing notes (@tordans)
ok-dismiss--before.min.mov
ok-dismiss--after.min.mov