Sync education sheet seen status for admin delete.

This commit is contained in:
Michelle Tang
2026-03-09 14:07:47 -04:00
committed by jeffrey-signal
parent 6a3d1634b9
commit 04813fe345
35 changed files with 43 additions and 10 deletions

View File

@@ -145,7 +145,8 @@ object AccountDataArchiveProcessor {
chatWallpaper = chatWallpaper,
backupMode = exportState.backupMode
),
allowAutomaticKeyVerification = signalStore.settingsValues.automaticVerificationEnabled
allowAutomaticKeyVerification = signalStore.settingsValues.automaticVerificationEnabled,
hasSeenAdminDeleteEducationDialog = signalStore.uiHintValues.hasSeenAdminDeleteEducationDialog()
),
donationSubscriberData = donationSubscriber?.toSubscriberData(signalStore.inAppPaymentValues.isDonationSubscriptionManuallyCancelled()),
backupsSubscriberData = backupSubscriberRecord?.toIAPSubscriberData(),
@@ -345,6 +346,10 @@ object AccountDataArchiveProcessor {
if (settings.hasCompletedUsernameOnboarding) {
SignalStore.uiHints.setHasCompletedUsernameOnboarding(true)
}
if (settings.hasSeenAdminDeleteEducationDialog) {
SignalStore.uiHints.setHasSeenAdminDeleteEducationDialog()
}
}
private fun PhoneNumberPrivacyValues.PhoneNumberSharingMode.toRemotePhoneNumberSharingMode(): AccountData.PhoneNumberSharingMode {

View File

@@ -33,6 +33,7 @@ public class UiHintValues extends SignalStoreValues {
private static final String HAS_SEEN_PINNED_MESSAGE_SHEET = "uihints.has_seen_pinned_message_sheet";
private static final String HAS_SEEN_VERIFY_AUTO_SHEET = "uihints.has_seen_verify_auto_sheet";
private static final String HAS_DISMISSED_MEMBER_LABEL_ABOUT_OVERRIDE_WARNING = "uihints.has_dismissed_member_label_about_override_warning";
private static final String HAS_SEEN_ADMIN_DELETE_EDUCATION_DIALOG = "uihints.has_seen_admin_delete_education_dialog";
UiHintValues(@NonNull KeyValueStore store) {
super(store);
@@ -250,4 +251,12 @@ public class UiHintValues extends SignalStoreValues {
public void markMemberLabelAboutOverrideWarningDismissed() {
putBoolean(HAS_DISMISSED_MEMBER_LABEL_ABOUT_OVERRIDE_WARNING, true);
}
public boolean hasSeenAdminDeleteEducationDialog() {
return getBoolean(HAS_SEEN_ADMIN_DELETE_EDUCATION_DIALOG, false);
}
public void setHasSeenAdminDeleteEducationDialog() {
putBoolean(HAS_SEEN_ADMIN_DELETE_EDUCATION_DIALOG, true);
}
}

View File

@@ -139,6 +139,7 @@ class AccountRecordProcessor(
notificationProfileManualOverride = remote.proto.notificationProfileManualOverride
backupTier = local.proto.backupTier ?: remote.proto.backupTier
automaticKeyVerificationDisabled = remote.proto.automaticKeyVerificationDisabled
hasSeenAdminDeleteEducationDialog = remote.proto.hasSeenAdminDeleteEducationDialog
safeSetPayments(payments?.enabled == true, payments?.entropy?.toByteArray())
safeSetSubscriber(donationSubscriberId, donationSubscriberCurrencyCode)

View File

@@ -196,6 +196,7 @@ object StorageSyncHelper {
safeSetPayments(SignalStore.payments.mobileCoinPaymentsEnabled(), Optional.ofNullable(SignalStore.payments.paymentsEntropy).map { obj: Entropy -> obj.bytes }.orElse(null))
automaticKeyVerificationDisabled = !SignalStore.settings.automaticVerificationEnabled
hasSeenAdminDeleteEducationDialog = SignalStore.uiHints.hasSeenAdminDeleteEducationDialog()
}
return accountRecord.toSignalAccountRecord(StorageId.forAccount(storageId)).toSignalStorageRecord()
@@ -264,6 +265,10 @@ object StorageSyncHelper {
}
SignalStore.settings.automaticVerificationEnabled = !update.new.proto.automaticKeyVerificationDisabled
if (update.new.proto.hasSeenAdminDeleteEducationDialog) {
SignalStore.uiHints.setHasSeenAdminDeleteEducationDialog()
}
if (update.new.proto.storyViewReceiptsEnabled == OptionalBool.UNSET) {
SignalStore.story.viewedReceiptsEnabled = update.new.proto.readReceipts
} else {

View File

@@ -10,7 +10,9 @@ import org.thoughtcrime.securesms.database.SignalDatabase
import org.thoughtcrime.securesms.database.model.MessageRecord
import org.thoughtcrime.securesms.jobs.MultiDeviceDeleteSyncJob
import org.thoughtcrime.securesms.keyvalue.SignalStore
import org.thoughtcrime.securesms.recipients.Recipient
import org.thoughtcrime.securesms.sms.MessageSender
import org.thoughtcrime.securesms.storage.StorageSyncHelper
import org.thoughtcrime.securesms.util.task.ProgressDialogAsyncTask
object DeleteDialog {
@@ -75,15 +77,24 @@ object DeleteDialog {
}
private fun handleAdminDeleteForEveryone(context: Context, messageRecords: Set<MessageRecord>, emitter: SingleEmitter<Pair<Boolean, Boolean>>) {
MaterialAlertDialogBuilder(context)
.setTitle("${context.getString(R.string.ConversationFragment_delete_for_everyone_title)} - INTERNAL ONLY")
.setMessage(R.string.ConversationFragment_delete_for_everyone_body)
.setPositiveButton(R.string.ConversationFragment_delete_for_everyone) { _, _ ->
handleDeleteForEveryone(context = context, messageRecords = messageRecords, emitter = emitter)
}
.setNegativeButton(android.R.string.cancel) { _, _ -> emitter.onSuccess(Pair(false, false)) }
.setOnCancelListener { emitter.onSuccess(Pair(false, false)) }
.show()
if (SignalStore.uiHints.hasSeenAdminDeleteEducationDialog()) {
handleDeleteForEveryone(context = context, messageRecords = messageRecords, emitter = emitter)
} else {
MaterialAlertDialogBuilder(context)
.setTitle("${context.getString(R.string.ConversationFragment_delete_for_everyone_title)} - INTERNAL ONLY")
.setMessage(R.string.ConversationFragment_delete_for_everyone_body)
.setPositiveButton(R.string.ConversationFragment_delete_for_everyone) { _, _ ->
SignalStore.uiHints.setHasSeenAdminDeleteEducationDialog()
SignalExecutors.BOUNDED.execute {
SignalDatabase.recipients.markNeedsSync(Recipient.self().id)
StorageSyncHelper.scheduleSyncForDataChange()
}
handleDeleteForEveryone(context = context, messageRecords = messageRecords, emitter = emitter)
}
.setNegativeButton(android.R.string.cancel) { _, _ -> emitter.onSuccess(Pair(false, false)) }
.setOnCancelListener { emitter.onSuccess(Pair(false, false)) }
.show()
}
}
private fun handleDeleteForEveryone(context: Context, messageRecords: Set<MessageRecord>, emitter: SingleEmitter<Pair<Boolean, Boolean>>) {

View File

@@ -135,6 +135,7 @@ message AccountData {
CallsUseLessDataSetting callsUseLessDataSetting = 29; // If unset, treat the same as "Unknown" case
bool allowSealedSenderFromAnyone = 30;
bool allowAutomaticKeyVerification = 31;
bool hasSeenAdminDeleteEducationDialog = 32;
}
message SubscriberData {

View File

@@ -296,6 +296,7 @@ message AccountRecord {
NotificationProfileManualOverride notificationProfileManualOverride = 44;
bool notificationProfileSyncDisabled = 45;
bool automaticKeyVerificationDisabled = 46;
bool hasSeenAdminDeleteEducationDialog = 47;
}
message StoryDistributionListRecord {