mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 20:48:43 +00:00
Quiet down auth check job.
This commit is contained in:
committed by
Greyson Parrelli
parent
16c8b88f0f
commit
57a70c3085
@@ -238,11 +238,11 @@ public class ApplicationContext extends MultiDexApplication implements AppForegr
|
||||
AppDependencies.getMegaphoneRepository().onAppForegrounded();
|
||||
AppDependencies.getDeadlockDetector().start();
|
||||
InAppPaymentKeepAliveJob.enqueueAndTrackTimeIfNecessary();
|
||||
AppDependencies.getJobManager().add(new InAppPaymentAuthCheckJob());
|
||||
FcmFetchManager.onForeground(this);
|
||||
startAnrDetector();
|
||||
|
||||
SignalExecutors.BOUNDED.execute(() -> {
|
||||
InAppPaymentAuthCheckJob.enqueueIfNeeded();
|
||||
RemoteConfig.refreshIfNecessary();
|
||||
RetrieveProfileJob.enqueueRoutineFetchIfNecessary();
|
||||
executePendingContactSync();
|
||||
|
||||
@@ -162,6 +162,13 @@ class InAppPaymentTable(context: Context, databaseHelper: SignalDatabase) : Data
|
||||
AppDependencies.databaseObserver.notifyInAppPaymentsObservers(inAppPayment)
|
||||
}
|
||||
|
||||
fun hasWaitingForAuth(): Boolean {
|
||||
return readableDatabase
|
||||
.exists(TABLE_NAME)
|
||||
.where("$STATE = ?", State.serialize(State.WAITING_FOR_AUTHORIZATION))
|
||||
.run()
|
||||
}
|
||||
|
||||
fun getAllWaitingForAuth(): List<InAppPayment> {
|
||||
return readableDatabase.select()
|
||||
.from(TABLE_NAME)
|
||||
|
||||
@@ -39,7 +39,7 @@ import kotlin.time.Duration.Companion.days
|
||||
*/
|
||||
class InAppPaymentAuthCheckJob private constructor(parameters: Parameters) : BaseJob(parameters), StripeApi.PaymentIntentFetcher, StripeApi.SetupIntentHelper {
|
||||
|
||||
constructor() : this(
|
||||
private constructor() : this(
|
||||
Parameters.Builder()
|
||||
.addConstraint(NetworkConstraint.KEY)
|
||||
.setMaxAttempts(Parameters.UNLIMITED)
|
||||
@@ -51,6 +51,13 @@ class InAppPaymentAuthCheckJob private constructor(parameters: Parameters) : Bas
|
||||
companion object {
|
||||
private val TAG = Log.tag(InAppPaymentAuthCheckJob::class.java)
|
||||
const val KEY = "InAppPaymentAuthCheckJob"
|
||||
|
||||
@JvmStatic
|
||||
fun enqueueIfNeeded() {
|
||||
if (SignalDatabase.inAppPayments.hasWaitingForAuth()) {
|
||||
AppDependencies.jobManager.add(InAppPaymentAuthCheckJob())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val stripeApi = StripeApi(Environment.Donations.STRIPE_CONFIGURATION, this, this, AppDependencies.okHttpClient)
|
||||
|
||||
Reference in New Issue
Block a user