Do not show donate megaphone if currently awaiting a donation to clear.
This commit is contained in:
parent
f5d9fbe91c
commit
71b5645801
2 changed files with 8 additions and 0 deletions
|
@ -24,6 +24,12 @@ object DonationRedemptionJobWatcher {
|
|||
ONE_TIME
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@WorkerThread
|
||||
fun hasPendingRedemptionJob(): Boolean {
|
||||
return getDonationRedemptionJobStatus(RedemptionType.SUBSCRIPTION).isInProgress() || getDonationRedemptionJobStatus(RedemptionType.ONE_TIME).isInProgress()
|
||||
}
|
||||
|
||||
fun watchSubscriptionRedemption(): Observable<DonationRedemptionJobStatus> = watch(RedemptionType.SUBSCRIPTION)
|
||||
|
||||
@JvmStatic
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.signal.core.util.logging.Log
|
|||
import org.thoughtcrime.securesms.badges.models.Badge
|
||||
import org.thoughtcrime.securesms.components.settings.app.subscription.InAppDonations
|
||||
import org.thoughtcrime.securesms.components.settings.app.subscription.donate.DonateToSignalActivity
|
||||
import org.thoughtcrime.securesms.components.settings.app.subscription.manage.DonationRedemptionJobWatcher
|
||||
import org.thoughtcrime.securesms.database.RemoteMegaphoneTable
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase
|
||||
import org.thoughtcrime.securesms.database.model.RemoteMegaphoneRecord
|
||||
|
@ -123,6 +124,7 @@ object RemoteMegaphoneRepository {
|
|||
private fun shouldShowDonateMegaphone(): Boolean {
|
||||
return VersionTracker.getDaysSinceFirstInstalled(context) >= 7 &&
|
||||
InAppDonations.hasAtLeastOnePaymentMethodAvailable() &&
|
||||
!DonationRedemptionJobWatcher.hasPendingRedemptionJob() &&
|
||||
Recipient.self()
|
||||
.badges
|
||||
.stream()
|
||||
|
|
Loading…
Add table
Reference in a new issue