Skip to content

Commit 04680eb

Browse files
committed
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 <git@bmcreations.dev>
1 parent 95d6c81 commit 04680eb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

apps/flipcash/shared/session/src/main/kotlin/com/flipcash/app/session/internal/RealSessionController.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ class RealSessionController @Inject constructor(
173173
.mapNotNull { it.authState }
174174
.filter { it.isAtLeastRegistered }
175175
.distinctUntilChanged()
176+
.filter { userManager.state.value.flags?.requiresIapForRegistration == true }
176177
.onEach { billingClient.connect() }
177178
.launchIn(scope)
178179

@@ -242,7 +243,7 @@ class RealSessionController @Inject constructor(
242243
checkPendingItemsInFeed()
243244
bringActivityFeedCurrent()
244245
shareSheetController.checkForShare()
245-
if (userManager.authState.isAtLeastRegistered) {
246+
if (userManager.authState.isAtLeastRegistered && userManager.state.value.flags?.requiresIapForRegistration == true) {
246247
billingClient.connect()
247248
}
248249
}

0 commit comments

Comments
 (0)