Repository navigation
feat(referral): trigger post-signup referral code prompt on first home session - #6901
SeniorZhai wants to merge 12 commits into
Conversation
Keep the landing indicator clear of the bottom buttons on short windows, stop locking orientation for capture, avatar, gallery and web fullscreen exit, skip sensor rotation on large or multi-window media pages, drop the legacy max_aspect meta-data and unused accompanist dependencies.
Manage Compose artifacts through compose-bom 2026.09.00, replace all constraintlayout-compose layouts with standard Compose layouts and remove the dependency, and migrate value-based BasicTextField, Material 2 TextField/OutlinedTextField, and VisualTransformation usages to TextFieldState with InputTransformation/OutputTransformation.
Raise targetSdk to 37 with ACCESS_LOCAL_NETWORK permission handling for LAN transfer and read-only dynamically loaded native libraries, replace app-window physical screen size calls with window metrics, move video preview pause/resume to onStart/onStop for multi-resume continuity, and preserve non-sensitive Compose interactive state with rememberSaveable.
…pport Add BOM-managed Material 3 with a coexisting MixinAppTheme ColorScheme bridge, migrate five setting pages as the reference module, and add hardware keyboard shortcuts (Enter to send, Shift+Enter newline, Ctrl+F search, Esc to dismiss panels), toolbar tooltips, and mouse context-click on message items.
|
AI review done for Quality: Needs a fix before merge. I verified the remaining signup recovery gap by tracing PIN persistence, restart routing, and Home’s referral eligibility check in the checked-out code.
|
There was a problem hiding this comment.
AI review · GPT · 0ebd79a
Changes requested. git diff --check and XML parsing passed, and a standalone Kotlin check with in-memory preference stubs reproduced a referral-store regression. Android lint and unit tests were blocked during offline Gradle configuration because the Foojay resolver plugin was unavailable.
| if (ctx is Activity || ctx is InputMethodService || ctx is Application) { | ||
| return ctx | ||
| } | ||
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && ctx.isUiContext) { |
There was a problem hiding this comment.
On Android 11, inflating the Chats search view passes a wrapped context to this helper and can throw NoSuchMethodError. The guard admits API 30, but ContextWrapper.isUiContext() was added in API 31. Guard this call with VERSION_CODES.S and keep unwrapping on API 30.
| } | ||
| if (intent.action == Intent.ACTION_VIEW && PendingReferralStore.isOneLinkUrl(intent.dataString)) { | ||
| // The referral code is saved by the AppsFlyer deep link listener; stay on the home tab. | ||
| intent.data = null |
There was a problem hiding this comment.
A OneLink delivered to an existing singleTop home activity loses its URL before AppsFlyer can resolve it. onNewIntent() installs this same intent with setIntent(), and this branch clears its data before the SDK's documented resume-time read. Preserve the URL through resume or explicitly forward it to AppsFlyer before clearing it.
| } | ||
| val savedAt = sharedPrefs.getLong(KEY_SAVED_AT, 0L) | ||
| if (savedAt <= 0L || nowMs - savedAt > EXPIRY_MILLIS) { | ||
| clear(context) |
There was a problem hiding this comment.
An expired code on first home entry disables the prompt for the rest of that session. getForPostSignUp() consumes the signup marker, then this clear() also resets session eligibility. A standalone check confirmed that a fresh code was saved and emitted afterward, but getForPostSignUp() still returned null. Expire only the stored code and timestamp here so the session can accept a fresh callback.
| } | ||
| if (shouldOpenMainActivity) { | ||
| if (tipBundle.tipType == TipType.Create) { | ||
| PendingReferralStore.markSignUpCompleted(context) |
There was a problem hiding this comment.
The referral prompt can be lost if the process exits after Safe registration. registerPublicKey() persists the registered account before suspending for address lookups, so a restart can reach home with a PIN and Safe while this marker is still missing. Persist referral eligibility with the signup state that lets startup skip PIN setup, or recover it when resuming an interrupted signup.
| } | ||
| intent.getParcelableExtraCompat(ARGS_COMMAND, TransferCommand::class.java)?.apply { | ||
| handleCommand(this) | ||
| withLocalNetworkPermission { |
There was a problem hiding this comment.
Desktop commands bypass this permission check when the transfer screen is already on top. TransferActivity.show() uses FLAG_ACTIVITY_SINGLE_TOP, and onNewIntent() calls handleCommand() directly, allowing it to start LAN work without ACCESS_LOCAL_NETWORK on Android 17. Route both intent entry points through the same permission-gated command handler.
There was a problem hiding this comment.
AI review · GPT · 7795a26
Changes requested for three confirmed referral-flow defects covering warm OneLink delivery, expired-code session state, and process interruption during Safe registration. git diff --check passed for both the previous-review range and the PR range. Full Android lint and unit tests were not runnable because offline Gradle configuration lacked the Foojay resolver plugin.
| } | ||
| if (intent.action == Intent.ACTION_VIEW && PendingReferralStore.isOneLinkUrl(intent.dataString)) { | ||
| // The referral code is saved by the AppsFlyer deep link listener; stay on the home tab. | ||
| intent.data = null |
There was a problem hiding this comment.
A warm OneLink launch can lose its referral URL before AppsFlyer processes it. onNewIntent() first installs this intent with setIntent(), then this branch clears intent.data, while the explicit performDeepLinking() call exists only on the early onCreate() exits. Preserve the URL until AppsFlyer reads it, or explicitly pass it to AppsFlyer from this warm-launch path before clearing it.
| } | ||
| val savedAt = sharedPrefs.getLong(KEY_SAVED_AT, 0L) | ||
| if (savedAt <= 0L || nowMs - savedAt > EXPIRY_MILLIS) { | ||
| clear(context) |
There was a problem hiding this comment.
When the first home check finds an expired code, clear() also sets postSignUpSessionActive = false and removes the signup-session eligibility. A later AppsFlyer callback can save a fresh code, but getForPostSignUp() then returns null for the rest of that process. Expire only the stored code and timestamp here, while retaining the active post-signup session.
| } | ||
| if (shouldOpenMainActivity) { | ||
| if (tipBundle.tipType == TipType.Create) { | ||
| PendingReferralStore.markSignUpCompleted(context) |
There was a problem hiding this comment.
Referral eligibility is persisted only after registerPublicKey() has returned. In the registration path, Session.storeAccount(account) runs before the suspending address lookups, so a process death during those lookups leaves a persisted account that can resume directly to Home without KEY_SIGN_UP_PENDING. Persist the marker with the signup state before this interruptible registration work, or recover it on startup when the signup completed but the marker is absent.
- Forward OneLink URLs to AppsFlyer before clearing intent.data in MainActivity.handlerCode - Expire only the stored referral code and timestamp in PendingReferralStore.get without resetting post-sign-up session eligibility - Persist the post-sign-up referral marker synchronously before storing a safe-registered account in TipFlowInteractor.registerPublicKey - Replace Robolectric in PendingReferralStorePostSignUpTest with an in-memory SharedPreferences context to avoid exhausting the default test worker heap during SystemUIManagerTest
There was a problem hiding this comment.
AI review · GPT · de271ef
Changes requested. git diff --check passed for both the full PR and the changes since the previous review, and all four changed XML files parsed. Android lint and unit tests were blocked during Gradle setup because the Foojay resolver plugin was unavailable offline.
| internal fun shouldMarkPostSignUpReferral( | ||
| tipType: TipType, | ||
| shouldOpenMainActivity: Boolean, | ||
| ): Boolean = shouldOpenMainActivity && tipType == TipType.Create |
There was a problem hiding this comment.
If the app closes after signup saves the PIN but before Safe registration returns, the first Home session can skip the referral prompt even with a valid code saved. On restart, LoadingFragment selects TipType.Upgrade, which this check excludes, and Home’s Safe registration dialog also completes without setting the marker. Persist signup eligibility before the PIN update can commit, and carry it through Safe registration recovery.
No description provided.