From 04680eb535db9d8dbc8662a595bcb5acb2649ba1 Mon Sep 17 00:00:00 2001 From: Brandon McAnsh Date: Sat, 30 May 2026 21:05:46 -0400 Subject: [PATCH] fix(billing): guard billing client connection behind requiresIapForRegistration flag The billing client was eagerly connecting on every app foreground and auth state change, even though the purchase feature is unused. This triggered a known Play Billing Library crash in ProxyBillingActivity on certain devices during cold launch. Only connect the billing client when the server flag is enabled. Signed-off-by: Brandon McAnsh --- .../com/flipcash/app/session/internal/RealSessionController.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/flipcash/shared/session/src/main/kotlin/com/flipcash/app/session/internal/RealSessionController.kt b/apps/flipcash/shared/session/src/main/kotlin/com/flipcash/app/session/internal/RealSessionController.kt index 155c2fa95..85971996e 100644 --- a/apps/flipcash/shared/session/src/main/kotlin/com/flipcash/app/session/internal/RealSessionController.kt +++ b/apps/flipcash/shared/session/src/main/kotlin/com/flipcash/app/session/internal/RealSessionController.kt @@ -173,6 +173,7 @@ class RealSessionController @Inject constructor( .mapNotNull { it.authState } .filter { it.isAtLeastRegistered } .distinctUntilChanged() + .filter { userManager.state.value.flags?.requiresIapForRegistration == true } .onEach { billingClient.connect() } .launchIn(scope) @@ -242,7 +243,7 @@ class RealSessionController @Inject constructor( checkPendingItemsInFeed() bringActivityFeedCurrent() shareSheetController.checkForShare() - if (userManager.authState.isAtLeastRegistered) { + if (userManager.authState.isAtLeastRegistered && userManager.state.value.flags?.requiresIapForRegistration == true) { billingClient.connect() } }