Skip to content

POI: hide Attributes tab for pending local geometry#19

Draft
tordans wants to merge 1 commit into
masterfrom
cursor/poi-hide-attributes-tab-a5db
Draft

POI: hide Attributes tab for pending local geometry#19
tordans wants to merge 1 commit into
masterfrom
cursor/poi-hide-attributes-tab-a5db

Conversation

@tordans

@tordans tordans commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Context

This PR extracts only the Attributes-tab behavior from the closed combined PR bryceco/GoMap#959. That PR mixed two goals (Attributes visibility + All Tags header tap targets). Per upstream discussion, those are being split into separate PRs. The All Tags / keyboard navigation work is out of scope here.


Problem / user story

The POI editor has three tabs: Common Tags (0), All Tags (1), Attributes (2). POITabBarController restores the last-used tab from UserPrefs.poiTabIndex.

For a new standalone node (selectedPrimary == nil), the Attributes tab is already removed and a saved index of 2 is clamped to 0 — so you never land on a missing third tab.

For a new way, area, or relation that already exists in memory (ident < 0 until upload), selectedPrimary is non-nil, so Attributes used to stay visible and index 2 could still be restored — even though that tab has no useful server-backed metadata yet.

User story: After editing an uploaded object on Attributes, opening the editor for any not-yet-uploaded geometry (nil selection or local negative id) should match the new-node behavior: only Common Tags and All Tags. Attributes returns once the object has a positive server id.


Implementation notes (Cursor)

POITabBarController.swift

  • shouldHideAttributesTab(for:)true when selection == nil or ident < 0.
  • resolvedTabBar(savedIndex:selection:) — resolves tab count (2 vs 3) and clamps saved index 2 → 0 when Attributes is hidden.
  • viewDidLoad uses resolvedTabBar; removeAttributesTabFromViewControllers() strips the Attributes nav stack.
  • Removed the redundant updatePOIAttributesTabBarItemVisibility helper (logic consolidated in viewDidLoad).

POITabBarControllerTestCase.swift

Unit tests for shouldHideAttributesTab and resolvedTabBar across nil selection, pending node/way, and uploaded node.

Out of scope: Refreshing tabs if selection goes from pending → uploaded while POI stays open.


Testing notes (manual — @tordans)

  1. Uploaded node → Attributes → then new node (pushpin) → two tabs only; if last index was 2, land on Common Tags.
  2. Same with last session on Attributes (index 2) before new node → Common Tags, no Attributes.
  3. New way/area (ident < 0) → POI → Attributes hidden; index 2 does not select a missing third tab.
  4. After upload or selecting an existing object (ident > 0) → three tabs; index 2 restores normally.

Automated: Run GoMapTestsPOITabBarControllerTestCase.

Open in Web Open in Cursor 

Extract Attributes-tab behavior from bryceco#959 (closed combined PR).
Hide the third tab when selection is nil or ident < 0; clamp saved index 2 to 0.

Co-authored-by: Tobias <t@tobiasjordans.de>
@bryceco

bryceco commented Jun 9, 2026

Copy link
Copy Markdown

It looks like this is forked from the 5.6.3 version rather than from the latest version on master which includes the tab switch control built into the keyboard toolbar. Since tab selection occurs in two places now (three if we add the keyboard toolbar to Common Tags, TBD) this PR should be rebased onto the latest master.

One side effect of this change is it leads to the keyboard toolbar tab selector being reduced to a single usable button: since Attributes is removed and All Tags is disabled (because it's the current tab).

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants