diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsViewModel.kt index ef3ede818a..7083f4e081 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsViewModel.kt @@ -281,7 +281,7 @@ class RemoteBackupsSettingsViewModel : ViewModel() { val hasActiveGooglePlayBillingSubscription = when (val purchaseResult = AppDependencies.billingApi.queryPurchases()) { is BillingPurchaseResult.Success -> { Log.d(TAG, "[subscriptionStateMismatchDetected] Found a purchase: $purchaseResult") - purchaseResult.isAcknowledged && purchaseResult.isWithinTheLastMonth() && purchaseResult.isAutoRenewing + purchaseResult.isAcknowledged && purchaseResult.isAutoRenewing } else -> { Log.d(TAG, "[subscriptionStateMismatchDetected] No purchase found in Google Play Billing: $purchaseResult") diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/BackupSubscriptionCheckJob.kt b/app/src/main/java/org/thoughtcrime/securesms/jobs/BackupSubscriptionCheckJob.kt index 9167f14b64..55555aff1e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/BackupSubscriptionCheckJob.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/BackupSubscriptionCheckJob.kt @@ -103,7 +103,7 @@ class BackupSubscriptionCheckJob private constructor(parameters: Parameters) : C val purchase: BillingPurchaseResult = AppDependencies.billingApi.queryPurchases() Log.i(TAG, "Retrieved purchase result from Billing api: $purchase") - val hasActivePurchase = purchase is BillingPurchaseResult.Success && purchase.isAcknowledged && purchase.isWithinTheLastMonth() + val hasActivePurchase = purchase is BillingPurchaseResult.Success && purchase.isAcknowledged val product: BillingProduct? = AppDependencies.billingApi.queryProduct() if (product == null) { diff --git a/core-util/src/main/java/org/signal/core/util/billing/BillingPurchaseResult.kt b/core-util/src/main/java/org/signal/core/util/billing/BillingPurchaseResult.kt index ccda1386f9..d0aee02c3f 100644 --- a/core-util/src/main/java/org/signal/core/util/billing/BillingPurchaseResult.kt +++ b/core-util/src/main/java/org/signal/core/util/billing/BillingPurchaseResult.kt @@ -5,9 +5,6 @@ package org.signal.core.util.billing -import kotlin.time.Duration.Companion.days -import kotlin.time.Duration.Companion.milliseconds - /** * Sealed class hierarchy representing the different success * and error states of google play billing purchases. @@ -21,17 +18,6 @@ sealed interface BillingPurchaseResult { val isAutoRenewing: Boolean ) : BillingPurchaseResult { - /** - * @return true if purchaseTime is within the last month. - */ - fun isWithinTheLastMonth(): Boolean { - val now = System.currentTimeMillis().milliseconds - val oneMonthAgo = now - 31.days - val purchaseTime = this.purchaseTime.milliseconds - - return oneMonthAgo < purchaseTime - } - override fun toString(): String { return """ BillingPurchaseResult { @@ -40,7 +26,6 @@ sealed interface BillingPurchaseResult { purchaseTime: $purchaseTime isAcknowledged: $isAcknowledged isAutoRenewing: $isAutoRenewing - isWithinTheLastMonth: ${isWithinTheLastMonth()} } """.trimIndent() }