Enqueue profile refresh sync after badge redemption.

This commit is contained in:
Alex Hart
2022-05-16 09:52:23 -03:00
committed by Cody Henthorne
parent 25788ef751
commit 2d57cb4ed0
3 changed files with 17 additions and 11 deletions

View File

@@ -72,14 +72,16 @@ public class BoostReceiptRequestResponseJob extends BaseJob {
}
public static JobManager.Chain createJobChainForBoost(@NonNull StripeApi.PaymentIntent paymentIntent) {
BoostReceiptRequestResponseJob requestReceiptJob = createJob(paymentIntent, DonationErrorSource.BOOST, Long.parseLong(SubscriptionLevels.BOOST_LEVEL));
DonationReceiptRedemptionJob redeemReceiptJob = DonationReceiptRedemptionJob.createJobForBoost();
RefreshOwnProfileJob refreshOwnProfileJob = RefreshOwnProfileJob.forBoost();
BoostReceiptRequestResponseJob requestReceiptJob = createJob(paymentIntent, DonationErrorSource.BOOST, Long.parseLong(SubscriptionLevels.BOOST_LEVEL));
DonationReceiptRedemptionJob redeemReceiptJob = DonationReceiptRedemptionJob.createJobForBoost();
RefreshOwnProfileJob refreshOwnProfileJob = RefreshOwnProfileJob.forBoost();
MultiDeviceProfileContentUpdateJob multiDeviceProfileContentUpdateJob = new MultiDeviceProfileContentUpdateJob();
return ApplicationDependencies.getJobManager()
.startChain(requestReceiptJob)
.then(redeemReceiptJob)
.then(refreshOwnProfileJob);
.then(refreshOwnProfileJob)
.then(multiDeviceProfileContentUpdateJob);
}
public static JobManager.Chain createJobChainForGift(@NonNull StripeApi.PaymentIntent paymentIntent,

View File

@@ -89,11 +89,13 @@ public class DonationReceiptRedemptionJob extends BaseJob {
.setLifespan(TimeUnit.DAYS.toMillis(1))
.build());
RefreshOwnProfileJob refreshOwnProfileJob = new RefreshOwnProfileJob();
RefreshOwnProfileJob refreshOwnProfileJob = new RefreshOwnProfileJob();
MultiDeviceProfileContentUpdateJob multiDeviceProfileContentUpdateJob = new MultiDeviceProfileContentUpdateJob();
return ApplicationDependencies.getJobManager()
.startChain(redeemReceiptJob)
.then(refreshOwnProfileJob);
.then(refreshOwnProfileJob)
.then(multiDeviceProfileContentUpdateJob);
}
private DonationReceiptRedemptionJob(long giftMessageId, boolean primary, @NonNull DonationErrorSource errorSource, @NonNull Job.Parameters parameters) {

View File

@@ -90,15 +90,17 @@ public class SubscriptionReceiptRequestResponseJob extends BaseJob {
}
public static JobManager.Chain createSubscriptionContinuationJobChain(boolean isForKeepAlive) {
Subscriber subscriber = SignalStore.donationsValues().requireSubscriber();
SubscriptionReceiptRequestResponseJob requestReceiptJob = createJob(subscriber.getSubscriberId(), isForKeepAlive);
DonationReceiptRedemptionJob redeemReceiptJob = DonationReceiptRedemptionJob.createJobForSubscription(requestReceiptJob.getErrorSource());
RefreshOwnProfileJob refreshOwnProfileJob = RefreshOwnProfileJob.forSubscription();
Subscriber subscriber = SignalStore.donationsValues().requireSubscriber();
SubscriptionReceiptRequestResponseJob requestReceiptJob = createJob(subscriber.getSubscriberId(), isForKeepAlive);
DonationReceiptRedemptionJob redeemReceiptJob = DonationReceiptRedemptionJob.createJobForSubscription(requestReceiptJob.getErrorSource());
RefreshOwnProfileJob refreshOwnProfileJob = RefreshOwnProfileJob.forSubscription();
MultiDeviceProfileContentUpdateJob multiDeviceProfileContentUpdateJob = new MultiDeviceProfileContentUpdateJob();
return ApplicationDependencies.getJobManager()
.startChain(requestReceiptJob)
.then(redeemReceiptJob)
.then(refreshOwnProfileJob);
.then(refreshOwnProfileJob)
.then(multiDeviceProfileContentUpdateJob);
}
private SubscriptionReceiptRequestResponseJob(@NonNull Parameters parameters,