Skip to content

feat(web2app): DEV-847 Android SDK redemption surface#812

Open
shameondev wants to merge 2 commits into
developfrom
feature/web2app-m1-v2
Open

feat(web2app): DEV-847 Android SDK redemption surface#812
shameondev wants to merge 2 commits into
developfrom
feature/web2app-m1-v2

Conversation

@shameondev
Copy link
Copy Markdown
Contributor

DEV-847 (Web 2 App M1 — Mobile SDK).

Public API added

  • `Qonversion.shared.handleRedemptionLink(uri, callback)` — App Link email→app entry; POSTs `/v4/web/redeem`
  • `Qonversion.shared.presentReissueUI(activity, onCompletion)` — fallback email-input `DialogFragment`; POSTs `/v4/web/redeem/reissue`
  • `RedemptionResult` enum — 5 cases (Success, TokenExpired, AlreadyConsumed, InvalidToken, NetworkError); mirrors iOS

Behavior

  • Parses `https://screens.qonversion.io/r/{project_uid}/{token}\` Uri → POST `/v4/web/redeem`
  • On 200 → existing `Qonversion.shared.identify(userID:)` for merge → `Success`
  • On 409 → POST `/v4/web/redeem/status` → `consumed=true` → `AlreadyConsumed`
  • 429/503 messaging per plan §SDK reissue UI

Security (RT2-W3 + RT-F11)

  • Email transport = App Links only (https + `autoVerify=true` + assetlinks.json on host)
  • `qonversion://` NOT registered for email links in sample (hijack vector)
  • Sample `AndroidManifest.xml` updated with App Link intent-filter

Build + tests

  • `./gradlew :sdk:compileDebugKotlin` — BUILD SUCCESSFUL
  • `./gradlew :sdk:assembleDebug` — BUILD SUCCESSFUL
  • `./gradlew :sdk:testDebugUnitTest` — 9/9 PASSED

Test coverage: Uri parsing (valid/malformed/prefix-only), 200/404/410/409/network → result mapping, RT5-N2 identify contract.

Test plan

  • Uri parsing handles edge cases
  • Status code → RedemptionResult mapping
  • Identify-flow recovery on 409
  • App Link intent-filter in sample
  • qonversion:// NOT for email links
  • E2E with real backend (after staging deploy)

Refs: plan §Mobile SDK API surface → Android, §DEV-847 (M1.5), RT2-W3, RT5-N2

Per plan §Mobile SDK API surface and §DEV-847:
- handleRedemptionLink(uri:callback:) — AL email->app entry; POSTs /v4/web/redeem
- presentReissueUI(activity:onCompletion:) — fallback email-input UI;
  POSTs /v4/web/redeem/reissue
- 5-case RedemptionResult enum (mirrors iOS)
- 409 handling via POST /v4/web/redeem/status + identify-flow recovery (RT4-W2)
- Sample manifest updated: App Links (https + autoVerify=true) for email links
- DROP qonversion://redeem registration as email transport (hijack vector per RT2-W3)

Custom qonversion:// scheme remains only for host-app->SDK in-process forwarding.
RT2-W3 — App Links only as email-link transport
RedemptionManager.extractToken now requires the URI scheme to be
literally "https" (App Link with android:autoVerify="true") and
rejects everything else BEFORE any token extraction or network
call. Previously any blank-scheme guard let the custom
`qonversion://` form through, allowing an installed app that
registers the scheme in its intent-filter to hijack the redemption
token. The custom scheme is reserved for in-process host→SDK
forwarding and is not exercised by this entry point.

RT5-N2 — identify() launch contract
New QProductCenterManagerIdentifyContractTest pins the behaviour that
QProductCenterManager.processIdentity calls
launchResultCache.clearPermissionsCache + launch(RequestTrigger.Identify)
on the cross-user branch (QProductCenterManager.kt:221-257). The
web→app recovery flow described in r8-overview §"POST
/v4/web/redeem/status" relies on this — sign-in must trigger a fresh
entitlement fetch via the merged identity. Any future change that
defers or skips the launch will now fail CI.

Sample app bundled M1 work:
* MainActivity adds intent-filter handling + Qonversion.handleRedeem
  demo wiring for end-to-end QA of the deep-link flow.
* AndroidManifest declares the verified App Link intent-filter.
* build.gradle adds the sample-app dependency on the SDK.

Tests added: scheme rejection unit tests + 5 contract tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant