mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 20:48:43 +00:00
Add checks for user registration when attempting to access dontations or perform keep-alive.
This commit is contained in:
@@ -41,7 +41,7 @@ class AppSettingsViewModel : ViewModel() {
|
||||
disposables += RecurringInAppPaymentRepository.getActiveSubscription(InAppPaymentSubscriberRecord.Type.DONATION).subscribeBy(
|
||||
onSuccess = { activeSubscription ->
|
||||
store.update { state ->
|
||||
state.copy(allowUserToGoToDonationManagementScreen = activeSubscription.isActive || InAppDonations.hasAtLeastOnePaymentMethodAvailable())
|
||||
state.copy(allowUserToGoToDonationManagementScreen = SignalStore.account.isRegistered && (activeSubscription.isActive || InAppDonations.hasAtLeastOnePaymentMethodAvailable()))
|
||||
}
|
||||
},
|
||||
onError = {}
|
||||
|
||||
@@ -95,6 +95,11 @@ class InAppPaymentKeepAliveJob private constructor(
|
||||
}
|
||||
|
||||
private fun doRun() {
|
||||
if (!SignalStore.account.isRegistered) {
|
||||
warn(type, "User is not registered. Skipping.")
|
||||
return
|
||||
}
|
||||
|
||||
val subscriber: InAppPaymentSubscriberRecord? = InAppPaymentsRepository.getSubscriber(type)
|
||||
if (subscriber == null) {
|
||||
info(type, "Subscriber not present. Skipping.")
|
||||
|
||||
Reference in New Issue
Block a user