diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/DonationPaymentRepository.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/DonationPaymentRepository.kt index 8951feaa88..84b869001f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/DonationPaymentRepository.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/DonationPaymentRepository.kt @@ -200,6 +200,7 @@ class DonationPaymentRepository(activity: Activity) : StripeApi.PaymentIntentFet if (it.status == 200 || it.status == 204) { Log.d(TAG, "Successfully set user subscription to level $subscriptionLevel with response code ${it.status}", true) SignalStore.donationsValues().clearUserManuallyCancelled() + scheduleSyncForAccountRecordChange() SignalStore.donationsValues().clearLevelOperations() LevelUpdate.updateProcessingState(false) Completable.complete() diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/subscribe/SubscribeViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/subscribe/SubscribeViewModel.kt index 06898bf6e5..57dca4e999 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/subscribe/SubscribeViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/subscription/subscribe/SubscribeViewModel.kt @@ -188,6 +188,7 @@ class SubscribeViewModel( SignalStore.donationsValues().markUserManuallyCancelled() refreshActiveSubscription() MultiDeviceSubscriptionSyncRequestJob.enqueue() + donationPaymentRepository.scheduleSyncForAccountRecordChange() store.update { it.copy(stage = SubscribeState.Stage.READY) } }, onError = { throwable -> diff --git a/app/src/main/java/org/thoughtcrime/securesms/storage/AccountRecordProcessor.java b/app/src/main/java/org/thoughtcrime/securesms/storage/AccountRecordProcessor.java index 2b787428f7..e01f248b6b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/storage/AccountRecordProcessor.java +++ b/app/src/main/java/org/thoughtcrime/securesms/storage/AccountRecordProcessor.java @@ -91,26 +91,27 @@ public class AccountRecordProcessor extends DefaultStorageRecordProcessor pinnedConversations = remote.getPinnedConversations(); - AccountRecord.PhoneNumberSharingMode phoneNumberSharingMode = remote.getPhoneNumberSharingMode(); - boolean preferContactAvatars = remote.isPreferContactAvatars(); - int universalExpireTimer = remote.getUniversalExpireTimer(); - boolean primarySendsSms = local.isPrimarySendsSms(); - String e164 = local.getE164(); - List defaultReactions = remote.getDefaultReactions().size() > 0 ? remote.getDefaultReactions() : local.getDefaultReactions(); - boolean displayBadgesOnProfile = remote.isDisplayBadgesOnProfile(); - boolean matchesRemote = doParamsMatch(remote, unknownFields, givenName, familyName, avatarUrlPath, profileKey, noteToSelfArchived, noteToSelfForcedUnread, readReceipts, typingIndicators, sealedSenderIndicators, linkPreviews, phoneNumberSharingMode, unlisted, pinnedConversations, preferContactAvatars, payments, universalExpireTimer, primarySendsSms, e164, defaultReactions, subscriber, displayBadgesOnProfile); - boolean matchesLocal = doParamsMatch(local, unknownFields, givenName, familyName, avatarUrlPath, profileKey, noteToSelfArchived, noteToSelfForcedUnread, readReceipts, typingIndicators, sealedSenderIndicators, linkPreviews, phoneNumberSharingMode, unlisted, pinnedConversations, preferContactAvatars, payments, universalExpireTimer, primarySendsSms, e164, defaultReactions, subscriber, displayBadgesOnProfile); + byte[] unknownFields = remote.serializeUnknownFields(); + String avatarUrlPath = remote.getAvatarUrlPath().or(local.getAvatarUrlPath()).or(""); + byte[] profileKey = remote.getProfileKey().or(local.getProfileKey()).orNull(); + boolean noteToSelfArchived = remote.isNoteToSelfArchived(); + boolean noteToSelfForcedUnread = remote.isNoteToSelfForcedUnread(); + boolean readReceipts = remote.isReadReceiptsEnabled(); + boolean typingIndicators = remote.isTypingIndicatorsEnabled(); + boolean sealedSenderIndicators = remote.isSealedSenderIndicatorsEnabled(); + boolean linkPreviews = remote.isLinkPreviewsEnabled(); + boolean unlisted = remote.isPhoneNumberUnlisted(); + List pinnedConversations = remote.getPinnedConversations(); + AccountRecord.PhoneNumberSharingMode phoneNumberSharingMode = remote.getPhoneNumberSharingMode(); + boolean preferContactAvatars = remote.isPreferContactAvatars(); + int universalExpireTimer = remote.getUniversalExpireTimer(); + boolean primarySendsSms = local.isPrimarySendsSms(); + String e164 = local.getE164(); + List defaultReactions = remote.getDefaultReactions().size() > 0 ? remote.getDefaultReactions() : local.getDefaultReactions(); + boolean displayBadgesOnProfile = remote.isDisplayBadgesOnProfile(); + boolean subscriptionManuallyCancelled = remote.isSubscriptionManuallyCancelled(); + boolean matchesRemote = doParamsMatch(remote, unknownFields, givenName, familyName, avatarUrlPath, profileKey, noteToSelfArchived, noteToSelfForcedUnread, readReceipts, typingIndicators, sealedSenderIndicators, linkPreviews, phoneNumberSharingMode, unlisted, pinnedConversations, preferContactAvatars, payments, universalExpireTimer, primarySendsSms, e164, defaultReactions, subscriber, displayBadgesOnProfile, subscriptionManuallyCancelled); + boolean matchesLocal = doParamsMatch(local, unknownFields, givenName, familyName, avatarUrlPath, profileKey, noteToSelfArchived, noteToSelfForcedUnread, readReceipts, typingIndicators, sealedSenderIndicators, linkPreviews, phoneNumberSharingMode, unlisted, pinnedConversations, preferContactAvatars, payments, universalExpireTimer, primarySendsSms, e164, defaultReactions, subscriber, displayBadgesOnProfile, subscriptionManuallyCancelled); if (matchesRemote) { return remote; @@ -141,6 +142,7 @@ public class AccountRecordProcessor extends DefaultStorageRecordProcessor defaultReactions, @NonNull SignalAccountRecord.Subscriber subscriber, - boolean displayBadgesOnProfile) + boolean displayBadgesOnProfile, + boolean subscriptionManuallyCancelled) { return Arrays.equals(contact.serializeUnknownFields(), unknownFields) && Objects.equals(contact.getGivenName().or(""), givenName) && @@ -205,6 +208,7 @@ public class AccountRecordProcessor extends DefaultStorageRecordProcessor