Repository navigation
fix: rebuild the trigger for a different widget on the same content - #33
Conversation
Both overlay managers kept the trigger on screen when the incoming widget had the same content public_id and trigger type, so two widgets on one content (say a blue card on home and a navy, open card on another page) showed whichever was built first. The current widget id now has to match too; the same widget tracked again still keeps its trigger as it is.
There was a problem hiding this comment.
Code Review
This pull request updates the PoltioOverlayManager on both Android and iOS to distinguish between widgets that share the same content (public ID) and trigger type but have different widget IDs. It introduces a currentWidgetId property and an isCurrent helper method to ensure that triggers are correctly replaced when a different widget ID is encountered. Additionally, a unit test has been added to the Android test suite to verify this behavior. I have no feedback to provide.
gcg
left a comment
There was a problem hiding this comment.
Tested on the Android emulator (Pixel_10_Pro_XL) and the iOS simulator (iPhone 17 Pro) at c13dc93 with the demo account. Full write-up with before/after screenshots: https://claude.ai/artifact/EM8Pgd7CV3uwmYVrb6vP9F
All four demo screens show the same content through their own widgets (Home/Shop 498, Lookbook 497, Phones 500, TVs 501), so this setup hits the bug directly.
| Navigation | Before (#32 build) | This PR |
|---|---|---|
| Home/Shop → TVs | Keeps Home's blue card | Shows TVs' navy card, open (Android and iOS) |
| Lookbook → Phones | Keeps Lookbook's left box | Shows Phones' navy box on the right (Android and iOS) |
| Phones → Logs → Phones | — | Keeps the same trigger view (Android) |
make test-android 97/97, including the new overlay test. make test-ios 69/69.
Code: no issues. currentWidgetId is cleared everywhere the content id and trigger type are, a response without an id behaves as before, and retries only continue for the same widget.
Worth noting: the bug also credited the wrong widget. The kept trigger reported a view for the new widget, and opening it passed the old widget's id, so widgets that share content were getting each other's views and opens. Worth a line in the release notes.
Already on main, not from this PR (iOS only):
- The card's Poltio wordmark uses
.secondaryLabel(PoltioBrandingMarkView.swift:38), so it's barely readable on a dark card like TVs'. Android uses a fixed grey that stays readable. - A bottom-docked box (Phones) sits partly behind the example app's floating tab bar.
- Triggers dock by physical side: left/right anchors on iOS, LEFT/RIGHT gravity on Android, so a right-to-left language no longer flips a trigger onto the edge its corners aren't drawn for. The widget's close button is top-right in every language too. (Poltio/issues#6434) - iOS: bottom-docked triggers sit above the host app's visible tab bar, which the overlay window's safe area can't see; found under child controllers too, where SwiftUI's TabView keeps it. (Poltio/issues#6435) - Android: the widget sheet never hosts the trigger, and with no host resumed the widget waits for the next host to resume instead of being dropped after 2s of retries; a host rebuilt by a configuration change carries its trigger over. (Poltio/issues#6436) - iOS: the card's Poltio wordmark is light on dark cards and dark on light ones, instead of following the system appearance. (Poltio/issues#6437)
…widget open Review of #34 found the trigger attached but invisible after rotating with the sheet open and closing it. Two causes: - The kept trigger was shown as the host resumed, and the sheet's dismiss callback then ran the entrance animation again. It took the trigger's current translation as its resting place, still the 80dp entry offset, so the trigger settled off-screen. The entrance now always settles at 0, and the dismiss callback only restores a trigger the sheet hid. - A host rebuilt behind the open sheet resumes for a moment and pauses again, which attached and counted the trigger under the sheet. The kept trigger is now shown from a posted check that the host is still resumed. A trigger carried over a configuration change is no longer counted again: a plain rotation counted twice once the host re-tracked its screen.
#34 measured the host tab bar once, when the trigger was built, so a trigger that stayed up didn't follow the bar hiding (hidesBottomBarWhenPushed), coming back, or changing height on rotation. The overlay manager now keeps the bottom constraint and measures the bar again on the reuse path (after any host transition in flight finishes), when the overlay window changes size, and when the widget sheet closes. A new constant also marks the layout stale; without it the next layout pass kept the old position.
CI failed the rotation test on b5c1276: Robolectric's recreate() drains the main looper while the rebuilt host is briefly resumed, so the posted "still resumed?" check ran mid-way and attached the trigger under the sheet. That check relied on looper timing, not on the sheet being up. The overlay manager now tracks the widget sheet through the lifecycle callbacks, open from its creation until it's destroyed for good (a rotation rebuilding it doesn't count), and shows the kept trigger only once the sheet is closed and a host is resumed, in either order. The test helper is inline so a failing assertion reports its own line.
fix(ios): keep bottom triggers clear of the tab bar when it changes
fix: RTL docking, tab bar clearance, rotation and wordmark contrast
75298cb
into
fix/android-left-trigger-fullscreen-widget
Stacked on #32 (which is on #31). Both SDKs kept the trigger on screen when the next widget had the same content and trigger type, so a second widget on that content never showed its own copy, colors or position.
Test: in the example app with the PoltioDemoAccount key, go straight from Shop (blue card) to TVs; it shows the navy, open card instead of keeping the blue one.