Rename DonationValues to InAppPaymentValues.

This commit is contained in:
Alex Hart
2024-06-27 09:57:16 -03:00
committed by Cody Henthorne
parent b943df1ce4
commit 77d3116431
49 changed files with 204 additions and 204 deletions

View File

@@ -21,8 +21,8 @@ class AppSettingsViewModel : ViewModel() {
AppSettingsState(
Recipient.self(),
0,
SignalStore.donations.getExpiredGiftBadge() != null,
SignalStore.donations.isLikelyASustainer() || InAppDonations.hasAtLeastOnePaymentMethodAvailable(),
SignalStore.inAppPayments.getExpiredGiftBadge() != null,
SignalStore.inAppPayments.isLikelyASustainer() || InAppDonations.hasAtLeastOnePaymentMethodAvailable(),
TextSecurePreferences.isUnauthorizedReceived(AppDependencies.application) || !SignalStore.account.isRegistered,
SignalStore.misc.isClientDeprecated
)
@@ -62,6 +62,6 @@ class AppSettingsViewModel : ViewModel() {
}
fun refreshExpiredGiftBadge() {
store.update { it.copy(hasExpiredGiftBadge = SignalStore.donations.getExpiredGiftBadge() != null) }
store.update { it.copy(hasExpiredGiftBadge = SignalStore.inAppPayments.getExpiredGiftBadge() != null) }
}
}

View File

@@ -69,7 +69,7 @@ class InternalPendingOneTimeDonationConfigurationFragment : ComposeFragment() {
viewModel.state.value = viewModel.state.value.copy(error = viewModel.state.value.error!!.copy(code = it))
},
onSave = {
SignalStore.donations.setPendingOneTimeDonation(viewModel.state.value)
SignalStore.inAppPayments.setPendingOneTimeDonation(viewModel.state.value)
findNavController().popBackStack()
}
)

View File

@@ -557,9 +557,9 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
clickPref(
title = DSLSettingsText.from("Clear keep-alive timestamps"),
onClick = {
SignalStore.donations.subscriptionEndOfPeriodRedemptionStarted = 0L
SignalStore.donations.subscriptionEndOfPeriodConversionStarted = 0L
SignalStore.donations.setLastEndOfPeriod(0L)
SignalStore.inAppPayments.subscriptionEndOfPeriodRedemptionStarted = 0L
SignalStore.inAppPayments.subscriptionEndOfPeriodConversionStarted = 0L
SignalStore.inAppPayments.setLastEndOfPeriod(0L)
Toast.makeText(context, "Cleared", Toast.LENGTH_SHORT).show()
}
)
@@ -570,7 +570,7 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
clickPref(
title = DSLSettingsText.from("Clear pending one-time donation."),
onClick = {
SignalStore.donations.setPendingOneTimeDonation(null)
SignalStore.inAppPayments.setPendingOneTimeDonation(null)
}
)
} else {

View File

@@ -23,7 +23,7 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
store.update { it.copy(emojiVersion = version) }
}
val pendingOneTimeDonation: Observable<Boolean> = SignalStore.donations.observablePendingOneTimeDonation
val pendingOneTimeDonation: Observable<Boolean> = SignalStore.inAppPayments.observablePendingOneTimeDonation
.distinctUntilChanged()
.map { it.isPresent }
@@ -159,7 +159,7 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
canClearOnboardingState = SignalStore.story.hasDownloadedOnboardingStory && Stories.isFeatureEnabled(),
pnpInitialized = SignalStore.misc.hasPniInitializedDevices,
useConversationItemV2ForMedia = SignalStore.internal.useConversationItemV2Media(),
hasPendingOneTimeDonation = SignalStore.donations.getPendingOneTimeDonation() != null
hasPendingOneTimeDonation = SignalStore.inAppPayments.getPendingOneTimeDonation() != null
)
fun onClearOnboardingState() {

View File

@@ -38,7 +38,7 @@ class InternalTerminalDonationConfigurationFragment : ComposeFragment() {
override fun FragmentContent() {
InternalTerminalDonationConfigurationContent(
onAddClick = {
SignalStore.donations.appendToTerminalDonationQueue(it)
SignalStore.inAppPayments.appendToTerminalDonationQueue(it)
findNavController().popBackStack()
}
)

View File

@@ -117,11 +117,11 @@ class InternalDonorErrorConfigurationViewModel : ViewModel() {
fun clearErrorState(): Completable {
return Completable.fromAction {
synchronized(InAppPaymentSubscriberRecord.Type.DONATION) {
SignalStore.donations.setExpiredBadge(null)
SignalStore.donations.setExpiredGiftBadge(null)
SignalStore.donations.unexpectedSubscriptionCancelationReason = null
SignalStore.donations.unexpectedSubscriptionCancelationTimestamp = 0L
SignalStore.donations.setUnexpectedSubscriptionCancelationChargeFailure(null)
SignalStore.inAppPayments.setExpiredBadge(null)
SignalStore.inAppPayments.setExpiredGiftBadge(null)
SignalStore.inAppPayments.unexpectedSubscriptionCancelationReason = null
SignalStore.inAppPayments.unexpectedSubscriptionCancelationTimestamp = 0L
SignalStore.inAppPayments.setUnexpectedSubscriptionCancelationChargeFailure(null)
}
store.update {
@@ -135,24 +135,24 @@ class InternalDonorErrorConfigurationViewModel : ViewModel() {
}
private fun handleBoostExpiration(state: InternalDonorErrorConfigurationState) {
SignalStore.donations.setExpiredBadge(state.selectedBadge)
SignalStore.inAppPayments.setExpiredBadge(state.selectedBadge)
}
private fun handleGiftExpiration(state: InternalDonorErrorConfigurationState) {
SignalStore.donations.setExpiredGiftBadge(state.selectedBadge)
SignalStore.inAppPayments.setExpiredGiftBadge(state.selectedBadge)
}
private fun handleSubscriptionExpiration(state: InternalDonorErrorConfigurationState) {
SignalStore.donations.updateLocalStateForLocalSubscribe(InAppPaymentSubscriberRecord.Type.DONATION)
SignalStore.donations.setExpiredBadge(state.selectedBadge)
SignalStore.inAppPayments.updateLocalStateForLocalSubscribe(InAppPaymentSubscriberRecord.Type.DONATION)
SignalStore.inAppPayments.setExpiredBadge(state.selectedBadge)
handleSubscriptionPaymentFailure(state)
}
private fun handleSubscriptionPaymentFailure(state: InternalDonorErrorConfigurationState) {
SignalStore.donations.unexpectedSubscriptionCancelationReason = state.selectedUnexpectedSubscriptionCancellation?.status
SignalStore.donations.unexpectedSubscriptionCancelationTimestamp = System.currentTimeMillis()
SignalStore.donations.showMonthlyDonationCanceledDialog = true
SignalStore.donations.setUnexpectedSubscriptionCancelationChargeFailure(
SignalStore.inAppPayments.unexpectedSubscriptionCancelationReason = state.selectedUnexpectedSubscriptionCancellation?.status
SignalStore.inAppPayments.unexpectedSubscriptionCancelationTimestamp = System.currentTimeMillis()
SignalStore.inAppPayments.showMonthlyDonationCanceledDialog = true
SignalStore.inAppPayments.setUnexpectedSubscriptionCancelationChargeFailure(
state.selectedStripeDeclineCode?.let {
ActiveSubscription.ChargeFailure(
it.code,

View File

@@ -62,7 +62,7 @@ object InAppDonations {
* Whether the user is using a device that supports GooglePay, based off Wallet API and phone number.
*/
fun isGooglePayAvailable(): Boolean {
return SignalStore.donations.isGooglePayReady && !LocaleRemoteConfig.isGooglePayDisabled()
return SignalStore.inAppPayments.isGooglePayReady && !LocaleRemoteConfig.isGooglePayDisabled()
}
/**

View File

@@ -313,7 +313,7 @@ object InAppPaymentsRepository {
return if (paymentMethodType != InAppPaymentData.PaymentMethodType.UNKNOWN) {
paymentMethodType
} else if (subscriberType == InAppPaymentSubscriberRecord.Type.DONATION) {
SignalStore.donations.getSubscriptionPaymentSourceType().toPaymentMethodType()
SignalStore.inAppPayments.getSubscriptionPaymentSourceType().toPaymentMethodType()
} else {
return InAppPaymentData.PaymentMethodType.UNKNOWN
}
@@ -325,9 +325,9 @@ object InAppPaymentsRepository {
@JvmStatic
fun isUserManuallyCancelled(subscriberType: InAppPaymentSubscriberRecord.Type): Boolean {
return if (subscriberType == InAppPaymentSubscriberRecord.Type.DONATION) {
SignalStore.donations.isDonationSubscriptionManuallyCancelled()
SignalStore.inAppPayments.isDonationSubscriptionManuallyCancelled()
} else {
SignalStore.donations.isBackupSubscriptionManuallyCancelled()
SignalStore.inAppPayments.isBackupSubscriptionManuallyCancelled()
}
}
@@ -341,7 +341,7 @@ object InAppPaymentsRepository {
@JvmStatic
fun getFallbackLastEndOfPeriod(subscriberType: InAppPaymentSubscriberRecord.Type): Duration {
return if (subscriberType == InAppPaymentSubscriberRecord.Type.DONATION) {
SignalStore.donations.getLastEndOfPeriod().seconds
SignalStore.inAppPayments.getLastEndOfPeriod().seconds
} else {
0.seconds
}
@@ -361,7 +361,7 @@ object InAppPaymentsRepository {
@WorkerThread
fun setShouldCancelSubscriptionBeforeNextSubscribeAttempt(subscriberType: InAppPaymentSubscriberRecord.Type, subscriberId: SubscriberId?, shouldCancel: Boolean) {
if (subscriberType == InAppPaymentSubscriberRecord.Type.DONATION) {
SignalStore.donations.shouldCancelSubscriptionBeforeNextSubscribeAttempt = shouldCancel
SignalStore.inAppPayments.shouldCancelSubscriptionBeforeNextSubscribeAttempt = shouldCancel
}
if (subscriberId == null) {
@@ -384,7 +384,7 @@ object InAppPaymentsRepository {
val latestSubscriber = getSubscriber(subscriberType)
return latestSubscriber?.requiresCancel ?: if (subscriberType == InAppPaymentSubscriberRecord.Type.DONATION) {
SignalStore.donations.shouldCancelSubscriptionBeforeNextSubscribeAttempt
SignalStore.inAppPayments.shouldCancelSubscriptionBeforeNextSubscribeAttempt
} else {
false
}
@@ -401,7 +401,7 @@ object InAppPaymentsRepository {
val subscriber = SignalDatabase.inAppPaymentSubscribers.getByCurrencyCode(currency.currencyCode, type)
return if (subscriber == null && type == InAppPaymentSubscriberRecord.Type.DONATION) {
SignalStore.donations.getSubscriber(currency)
SignalStore.inAppPayments.getSubscriber(currency)
} else {
subscriber
}
@@ -413,7 +413,7 @@ object InAppPaymentsRepository {
@JvmStatic
@WorkerThread
fun getSubscriber(type: InAppPaymentSubscriberRecord.Type): InAppPaymentSubscriberRecord? {
val currency = SignalStore.donations.getSubscriptionCurrency(type)
val currency = SignalStore.inAppPayments.getSubscriptionCurrency(type)
Log.d(TAG, "Attempting to retrieve subscriber of type $type for ${currency.currencyCode}")
return getSubscriber(currency, type)

View File

@@ -52,7 +52,7 @@ object RecurringInAppPaymentRepository {
.subscribeOn(Schedulers.io())
.flatMap(ServiceResponse<ActiveSubscription>::flattenResult)
.doOnSuccess { activeSubscription ->
if (activeSubscription.isActive && activeSubscription.activeSubscription.endOfCurrentPeriod > SignalStore.donations.getLastEndOfPeriod()) {
if (activeSubscription.isActive && activeSubscription.activeSubscription.endOfCurrentPeriod > SignalStore.inAppPayments.getLastEndOfPeriod()) {
InAppPaymentKeepAliveJob.enqueueAndTrackTime(System.currentTimeMillis().milliseconds)
}
}
@@ -121,7 +121,7 @@ object RecurringInAppPaymentRepository {
InAppPaymentsRepository.setSubscriber(
InAppPaymentSubscriberRecord(
subscriberId = subscriberId,
currency = SignalStore.donations.getSubscriptionCurrency(subscriberType),
currency = SignalStore.inAppPayments.getSubscriptionCurrency(subscriberType),
type = subscriberType,
requiresCancel = false,
paymentMethodType = InAppPaymentData.PaymentMethodType.UNKNOWN
@@ -141,7 +141,7 @@ object RecurringInAppPaymentRepository {
serviceResponse.resultOrThrow
Log.d(TAG, "Cancelled active subscription.", true)
SignalStore.donations.updateLocalStateForManualCancellation(subscriberType)
SignalStore.inAppPayments.updateLocalStateForManualCancellation(subscriberType)
MultiDeviceSubscriptionSyncRequestJob.enqueue()
InAppPaymentsRepository.scheduleSyncForAccountRecordChange()
}
@@ -157,7 +157,7 @@ object RecurringInAppPaymentRepository {
return Single.fromCallable { InAppPaymentsRepository.getShouldCancelSubscriptionBeforeNextSubscribeAttempt(subscriberType) }.flatMapCompletable {
if (it) {
cancelActiveSubscription(subscriberType).doOnComplete {
SignalStore.donations.updateLocalStateForManualCancellation(subscriberType)
SignalStore.inAppPayments.updateLocalStateForManualCancellation(subscriberType)
MultiDeviceSubscriptionSyncRequestJob.enqueue()
}
} else {
@@ -212,14 +212,14 @@ object RecurringInAppPaymentRepository {
.flatMapCompletable {
if (it.status == 200 || it.status == 204) {
Log.d(TAG, "Successfully set user subscription to level $subscriptionLevel with response code ${it.status}", true)
SignalStore.donations.updateLocalStateForLocalSubscribe(subscriberType)
SignalStore.inAppPayments.updateLocalStateForLocalSubscribe(subscriberType)
syncAccountRecord().subscribe()
LevelUpdate.updateProcessingState(false)
Completable.complete()
} else {
if (it.applicationError.isPresent) {
Log.w(TAG, "Failed to set user subscription to level $subscriptionLevel with response code ${it.status}", it.applicationError.get(), true)
SignalStore.donations.clearLevelOperations()
SignalStore.inAppPayments.clearLevelOperations()
} else {
Log.w(TAG, "Failed to set user subscription to level $subscriptionLevel", it.executionError.orElse(null), true)
}
@@ -256,14 +256,14 @@ object RecurringInAppPaymentRepository {
fun getOrCreateLevelUpdateOperation(tag: String, subscriptionLevel: String): LevelUpdateOperation {
Log.d(tag, "Retrieving level update operation for $subscriptionLevel")
val levelUpdateOperation = SignalStore.donations.getLevelOperation(subscriptionLevel)
val levelUpdateOperation = SignalStore.inAppPayments.getLevelOperation(subscriptionLevel)
return if (levelUpdateOperation == null) {
val newOperation = LevelUpdateOperation(
idempotencyKey = IdempotencyKey.generate(),
level = subscriptionLevel
)
SignalStore.donations.setLevelOperation(newOperation)
SignalStore.inAppPayments.setLevelOperation(newOperation)
LevelUpdate.updateProcessingState(true)
Log.d(tag, "Created a new operation for $subscriptionLevel")
newOperation
@@ -281,7 +281,7 @@ object RecurringInAppPaymentRepository {
private fun updateLocalSubscriptionStateAndScheduleDataSync(subscriberType: InAppPaymentSubscriberRecord.Type): Completable {
return Completable.fromAction {
Log.d(TAG, "Marking subscription cancelled...", true)
SignalStore.donations.updateLocalStateForManualCancellation(subscriberType)
SignalStore.inAppPayments.updateLocalStateForManualCancellation(subscriberType)
MultiDeviceSubscriptionSyncRequestJob.enqueue()
SignalDatabase.recipients.markNeedsSync(Recipient.self().id)
StorageSyncHelper.scheduleSyncForDataChange()

View File

@@ -42,7 +42,7 @@ class TerminalDonationDelegate(
private val badgeRepository = TerminalDonationRepository()
override fun onResume(owner: LifecycleOwner) {
val donations = SignalStore.donations.consumeTerminalDonations()
val donations = SignalStore.inAppPayments.consumeTerminalDonations()
for (donation in donations) {
if (donation.isLongRunningPaymentMethod && (donation.error == null || donation.error.type != DonationErrorValue.Type.REDEMPTION)) {
TerminalDonationBottomSheet.show(fragmentManager, donation)
@@ -57,7 +57,7 @@ class TerminalDonationDelegate(
}
}
val verifiedMonthlyDonation: Stripe3DSData? = SignalStore.donations.consumeVerifiedSubscription3DSData()
val verifiedMonthlyDonation: Stripe3DSData? = SignalStore.inAppPayments.consumeVerifiedSubscription3DSData()
if (verifiedMonthlyDonation != null) {
DonationPendingBottomSheet().apply {
arguments = DonationPendingBottomSheetArgs.Builder(verifiedMonthlyDonation.inAppPayment).build().toBundle()
@@ -80,7 +80,7 @@ class TerminalDonationDelegate(
DonationPendingBottomSheet().apply {
arguments = DonationPendingBottomSheetArgs.Builder(payment).build().toBundle()
}.show(fragmentManager, null)
} else if (payment.data.error != null && payment.data.cancellation != null && payment.data.cancellation.reason != InAppPaymentData.Cancellation.Reason.MANUAL && SignalStore.donations.showMonthlyDonationCanceledDialog) {
} else if (payment.data.error != null && payment.data.cancellation != null && payment.data.cancellation.reason != InAppPaymentData.Cancellation.Reason.MANUAL && SignalStore.inAppPayments.showMonthlyDonationCanceledDialog) {
MonthlyDonationCanceledBottomSheetDialogFragment.show(fragmentManager)
}
}

View File

@@ -46,7 +46,7 @@ class TerminalDonationViewModel(
disposables += repository.getBadge(donationCompleted)
.map { badge ->
val hasOtherBadges = Recipient.self().badges.filterNot { it.id == badge.id }.isNotEmpty()
val isDisplayingBadges = SignalStore.donations.getDisplayBadgesOnProfile()
val isDisplayingBadges = SignalStore.inAppPayments.getDisplayBadgesOnProfile()
val toggleType = when {
hasOtherBadges && isDisplayingBadges -> ToggleType.MAKE_FEATURED_BADGE

View File

@@ -24,9 +24,9 @@ class SetCurrencyViewModel(
private val store = Store(
SetCurrencyState(
selectedCurrencyCode = if (inAppPaymentType.recurring) {
SignalStore.donations.getSubscriptionCurrency(inAppPaymentType.requireSubscriberType()).currencyCode
SignalStore.inAppPayments.getSubscriptionCurrency(inAppPaymentType.requireSubscriberType()).currencyCode
} else {
SignalStore.donations.getOneTimeCurrency().currencyCode
SignalStore.inAppPayments.getOneTimeCurrency().currencyCode
},
currencies = supportedCurrencyCodes
.map(Currency::getInstance)
@@ -40,7 +40,7 @@ class SetCurrencyViewModel(
store.update { it.copy(selectedCurrencyCode = selectedCurrencyCode) }
if (!inAppPaymentType.recurring) {
SignalStore.donations.setOneTimeCurrency(Currency.getInstance(selectedCurrencyCode))
SignalStore.inAppPayments.setOneTimeCurrency(Currency.getInstance(selectedCurrencyCode))
} else {
val currency = Currency.getInstance(selectedCurrencyCode)
val subscriber = InAppPaymentsRepository.getSubscriber(currency, inAppPaymentType.requireSubscriberType())

View File

@@ -91,7 +91,7 @@ data class DonateToSignalState(
data class OneTimeDonationState(
val badge: Badge? = null,
val selectedCurrency: Currency = SignalStore.donations.getOneTimeCurrency(),
val selectedCurrency: Currency = SignalStore.inAppPayments.getOneTimeCurrency(),
val boosts: List<Boost> = emptyList(),
val selectedBoost: Boost? = null,
val customAmount: FiatMoney = FiatMoney(BigDecimal.ZERO, selectedCurrency),
@@ -114,7 +114,7 @@ data class DonateToSignalState(
}
data class MonthlyDonationState(
val selectedCurrency: Currency = SignalStore.donations.getSubscriptionCurrency(InAppPaymentSubscriberRecord.Type.DONATION),
val selectedCurrency: Currency = SignalStore.inAppPayments.getSubscriptionCurrency(InAppPaymentSubscriberRecord.Type.DONATION),
val subscriptions: List<Subscription> = emptyList(),
private val _activeSubscription: ActiveSubscription? = null,
val selectedSubscription: Subscription? = null,

View File

@@ -248,7 +248,7 @@ class DonateToSignalViewModel(
}
}.distinctUntilChanged()
val oneTimeDonationFromStore: Observable<Optional<PendingOneTimeDonation>> = SignalStore.donations.observablePendingOneTimeDonation
val oneTimeDonationFromStore: Observable<Optional<PendingOneTimeDonation>> = SignalStore.inAppPayments.observablePendingOneTimeDonation
.map { pending -> pending.filter { !it.isExpired } }
.distinctUntilChanged()
@@ -283,13 +283,13 @@ class DonateToSignalViewModel(
)
val boosts: Observable<Map<Currency, List<Boost>>> = oneTimeInAppPaymentRepository.getBoosts().toObservable()
val oneTimeCurrency: Observable<Currency> = SignalStore.donations.observableOneTimeCurrency
val oneTimeCurrency: Observable<Currency> = SignalStore.inAppPayments.observableOneTimeCurrency
oneTimeDonationDisposables += Observable.combineLatest(boosts, oneTimeCurrency) { boostMap, currency ->
val boostList = if (currency in boostMap) {
boostMap[currency]!!
} else {
SignalStore.donations.setOneTimeCurrency(PlatformCurrencyUtil.USD)
SignalStore.inAppPayments.setOneTimeCurrency(PlatformCurrencyUtil.USD)
listOf()
}
@@ -387,7 +387,7 @@ class DonateToSignalViewModel(
onSuccess = { subscriptions ->
if (subscriptions.isNotEmpty()) {
val priceCurrencies = subscriptions[0].prices.map { it.currency }
val selectedCurrency = SignalStore.donations.getSubscriptionCurrency(InAppPaymentSubscriberRecord.Type.DONATION)
val selectedCurrency = SignalStore.inAppPayments.getSubscriptionCurrency(InAppPaymentSubscriberRecord.Type.DONATION)
if (selectedCurrency !in priceCurrencies) {
Log.w(TAG, "Unsupported currency selection. Defaulting to USD. $selectedCurrency isn't supported.")
@@ -403,7 +403,7 @@ class DonateToSignalViewModel(
}
private fun monitorSubscriptionCurrency() {
monthlyDonationDisposables += SignalStore.donations.observableRecurringDonationCurrency.subscribe {
monthlyDonationDisposables += SignalStore.inAppPayments.observableRecurringDonationCurrency.subscribe {
store.update { state ->
state.copy(monthlyDonationState = state.monthlyDonationState.copy(selectedCurrency = it))
}

View File

@@ -42,7 +42,7 @@ class GatewaySelectorViewModel(
val gatewayConfiguration = gatewaySelectorRepository.getAvailableGatewayConfiguration(currencyCode = args.inAppPayment.data.amount!!.currencyCode)
disposables += Single.zip(isGooglePayAvailable, gatewayConfiguration, ::Pair).subscribeBy { (googlePayAvailable, gatewayConfiguration) ->
SignalStore.donations.isGooglePayReady = googlePayAvailable
SignalStore.inAppPayments.isGooglePayReady = googlePayAvailable
store.update {
it.copy(
loading = false,

View File

@@ -106,7 +106,7 @@ class PayPalPaymentInProgressViewModel(
disposables += RecurringInAppPaymentRepository.cancelActiveSubscription(subscriberType).subscribeBy(
onComplete = {
Log.d(TAG, "Cancellation succeeded", true)
SignalStore.donations.updateLocalStateForManualCancellation(subscriberType)
SignalStore.inAppPayments.updateLocalStateForManualCancellation(subscriberType)
MultiDeviceSubscriptionSyncRequestJob.enqueue()
RecurringInAppPaymentRepository.syncAccountRecord().subscribe()
store.update { DonationProcessorStage.COMPLETE }

View File

@@ -82,7 +82,7 @@ object DonationRedemptionJobWatcher {
val jobSpec: JobSpec? = externalLaunchJobSpec ?: redemptionJobSpec ?: receiptJobSpec
return if (redemptionType == RedemptionType.SUBSCRIPTION && jobSpec == null && SignalStore.donations.getSubscriptionRedemptionFailed()) {
return if (redemptionType == RedemptionType.SUBSCRIPTION && jobSpec == null && SignalStore.inAppPayments.getSubscriptionRedemptionFailed()) {
DonationRedemptionJobStatus.FailedSubscription
} else {
jobSpec?.toDonationRedemptionStatus(redemptionType) ?: DonationRedemptionJobStatus.None

View File

@@ -83,9 +83,9 @@ class ManageDonationsFragment :
BadgePreview.register(adapter)
NetworkFailure.register(adapter)
val expiredGiftBadge = SignalStore.donations.getExpiredGiftBadge()
val expiredGiftBadge = SignalStore.inAppPayments.getExpiredGiftBadge()
if (expiredGiftBadge != null) {
SignalStore.donations.setExpiredGiftBadge(null)
SignalStore.inAppPayments.setExpiredGiftBadge(null)
ExpiredGiftSheet.show(childFragmentManager, expiredGiftBadge)
}
@@ -227,7 +227,7 @@ class ManageDonationsFragment :
}
private fun DSLConfiguration.presentNetworkFailureSettings(state: ManageDonationsState, hasReceipts: Boolean) {
if (SignalStore.donations.isLikelyASustainer()) {
if (SignalStore.inAppPayments.isLikelyASustainer()) {
presentSubscriptionSettingsWithNetworkError(state)
} else {
presentNotADonorSettings(hasReceipts)
@@ -409,7 +409,7 @@ class ManageDonationsFragment :
startActivity(AppSettingsActivity.help(requireContext(), HelpFragment.DONATION_INDEX))
}
.setOnDismissListener {
SignalStore.donations.setPendingOneTimeDonation(null)
SignalStore.inAppPayments.setPendingOneTimeDonation(null)
}
.show()
}
@@ -429,7 +429,7 @@ class ManageDonationsFragment :
}
.setPositiveButton(android.R.string.ok, null)
.setOnDismissListener {
SignalStore.donations.setPendingOneTimeDonation(null)
SignalStore.inAppPayments.setPendingOneTimeDonation(null)
}
.show()
}

View File

@@ -94,7 +94,7 @@ class ManageDonationsViewModel : ViewModel() {
}
disposables += Observable.combineLatest(
SignalStore.donations.observablePendingOneTimeDonation,
SignalStore.inAppPayments.observablePendingOneTimeDonation,
InAppPaymentsRepository.observeInAppPaymentRedemption(InAppPaymentType.ONE_TIME_DONATION)
) { pendingFromStore, pendingFromJob ->
if (pendingFromStore.isPresent) {

View File

@@ -89,7 +89,7 @@ class ThanksForYourSupportBottomSheetDialogFragment : FixedRoundedCornerBottomSh
val otherBadges = Recipient.self().badges.filterNot { it.id == args.badge.id }
val hasOtherBadges = otherBadges.isNotEmpty()
val displayingBadges = SignalStore.donations.getDisplayBadgesOnProfile()
val displayingBadges = SignalStore.inAppPayments.getDisplayBadgesOnProfile()
if (hasOtherBadges && displayingBadges) {
switch.isChecked = false