Skip to content

Dev 3362 loyalty methods#12

Open
Xyzcancer wants to merge 11 commits into
masterfrom
DEV-3362-loyalty-methods
Open

Dev 3362 loyalty methods#12
Xyzcancer wants to merge 11 commits into
masterfrom
DEV-3362-loyalty-methods

Conversation

@Xyzcancer

Copy link
Copy Markdown
Contributor

No description provided.

Xyzcancer added 11 commits June 25, 2026 14:24
…collection)

Mirror the native catalog read API in the Flutter SDK via Pigeon:
- getProfile(), getProductCounters(item), getCategory(category, {limit, page})
  and getCollection(collectionId), each returning a typed response model.
- Regenerate pigeon (Dart/Kotlin/Swift); implement the Android (Gson) and iOS
  (JSONSerialization) bridges; add Dart response models, exports and tests.
- Bump native deps to the releases that expose these managers:
  Android com.github.rees46:android-sdk v2.34.0, iOS REES46 3.29.0.
The REES46 API is inconsistent about numeric encoding — e.g. a product's
`price` comes back as the string "14990.0" from products/get while
`price_full` is a JSON number. `json['price'] as num?` threw
'String is not a subtype of type num?', so getProductInfo, search,
getRecommendation, getCategory and getCollection all failed to parse.

Add toDoubleOrNull/toIntOrNull helpers that accept num, String or null and
use them for every numeric field in the response models. Coerce `id` via
toString so numeric product ids don't break the String cast either.
Pushes were received but never shown: the plugin invoked the Pigeon FlutterApi
(a @UiThread API) directly from the FCM background thread, which threw and
aborted the message listener before anything was displayed.

Marshal all FlutterApi calls onto the main dispatcher and post a heads-up
BigPicture notification from a dedicated Rees46PushNotifier. Add a
Rees46PushInitProvider so a cold-started process (app killed) still installs
the notification channel and message listener before the first push arrives.
Cover catalog (profile/counters/category/collection), search
(blank/instant/full), recommendation, product info and loyalty against the
live REES46 API, and run them on an emulator in CI
(.github/workflows/integration-android.yaml).

Example app changes that make it reliably testable and match the native demo:
- request POST_NOTIFICATIONS from a Dart post-frame callback via a platform
  channel instead of MainActivity.onCreate, so the system dialog can't race
  Patrol's app-service handshake and hang the run
- use SingleChildScrollView + Column (not a lazy ListView) so every field and
  label is built and findable while off-screen
- pre-fill demo inputs with valid shop c1140c data; fix the setProfile email
  and the trackEvent custom field key

Test helpers (patrol_setup.dart): dismiss the notification dialog the
Patrol-native way; tap the search buttons by key (their text collides with the
card titles) and wait on the result/error label instead of the button.
The plugin displays incoming pushes itself, so it owns the small icon. It
was hardcoded to the REES46-branded NotificationResources.NOTIFICATION_ICON,
which would brand every client app's notifications with the REES46 logo.

Resolve the host's icon instead, mirroring FCM: com.rees46.push.notification_icon
meta-data, then the existing Firebase default_notification_icon (reused so hosts
don't duplicate config), then the launcher icon, and only as a last resort a
neutral non-branded white disc bundled in the plugin. Document the meta-data in
the README.
The "tracking buttons are visible" test scrolled to the trackEvent/trackPurchase
buttons by label text with the default 15 scrolls. Those buttons sit at the very
bottom of a long form: each timedDrag relies on fling momentum to cover distance,
and on a GPU-throttled CI emulator (Failed to find ColorBuffer) that momentum
shrinks, so 15 scrolls can undershoot and the finder never becomes hit-testable.

Scroll by widget key with maxScrolls raised to 40 so the buttons are reached even
when per-drag distance is reduced. No app or SDK change — flaky test only.
The CI `dart format --set-exit-if-changed .` check flagged 10 files (response
models, personalization_sdk, two integration tests, catalog_test and the
generated pigeon API) as unformatted. Run `dart format .` to bring them in
line. No behavioural change.
Generated Pigeon files (lib/src/pigeon/*.g.dart) are not hand-edited, so a regen
should not fail CI. Exclude them from `flutter analyze` via analysis_options
`analyzer: exclude`. `dart format` does not honour that list, so the formatting
step filters them out on the command line with a git pathspec instead.
patrol_smoke_test failed on the CI emulator at scrollTo("Tracking") — the same
GPU-stall fling-undershoot fixed in init_flow: the demo form's bottom sections
(Loyalty, Catalog, Tracking) sit far down, and the default 15 fling-drags can
fall short while the emulator's ColorBuffer errors throttle rendering.

Bump maxScrolls to 40 on every scroll that targets those three sections
(Loyalty status/join, all four Catalog buttons, the Tracking header and its two
buttons). Upper/mid sections scroll reliably and are left unchanged. Test-only.
…catalog reads

getProductInfo, setProfile and getRecommendation flaked on the CI emulator: they
read the result label right after waiting on the tapped button (which never
leaves the tree) or after pumpAndSettle (which returns before a network call
completes), so on a slow/GPU-throttled run the assertion ran before the result
rendered.

Wait for the outcome instead:
- product_info, products_list, recommendation, setProfile: result/error labels
  render only on completion -> waitForResultOrError / waitUntilExists.
- getSid/getDid: the label is always present (placeholder '-') -> new pumpUntil
  helper waits for its text to change.

products_list carried the same latent race (it passed by luck this run) and is
fixed too. Test-only, no app/SDK change.
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.

1 participant