mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-20 08:45:50 +01:00
Disable unread reminders for existing users.
This commit is contained in:
committed by
Greyson Parrelli
parent
e94ce8a094
commit
56d64b24ff
@@ -68,6 +68,7 @@ import org.thoughtcrime.securesms.migrations.CopyUsernameToSignalStoreMigrationJ
|
||||
import org.thoughtcrime.securesms.migrations.DatabaseMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.DeleteDeprecatedLogsMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.DirectoryRefreshMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.DisableUnreadReminderMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.DuplicateE164MigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.E164FormattingMigrationJob;
|
||||
import org.thoughtcrime.securesms.migrations.EmojiDownloadMigrationJob;
|
||||
@@ -344,6 +345,7 @@ public final class JobManagerFactories {
|
||||
put(DatabaseMigrationJob.KEY, new DatabaseMigrationJob.Factory());
|
||||
put(DeleteDeprecatedLogsMigrationJob.KEY, new DeleteDeprecatedLogsMigrationJob.Factory());
|
||||
put(DirectoryRefreshMigrationJob.KEY, new DirectoryRefreshMigrationJob.Factory());
|
||||
put(DisableUnreadReminderMigrationJob.KEY, new DisableUnreadReminderMigrationJob.Factory());
|
||||
put(DuplicateE164MigrationJob.KEY, new DuplicateE164MigrationJob.Factory());
|
||||
put(E164FormattingMigrationJob.KEY, new E164FormattingMigrationJob.Factory());
|
||||
put(EmojiDownloadMigrationJob.KEY, new EmojiDownloadMigrationJob.Factory());
|
||||
|
||||
@@ -216,9 +216,10 @@ public class ApplicationMigrations {
|
||||
static final int ENABLE_MUTED_CALL_SETTING = 171;
|
||||
static final int CLEAR_ZK_CREDENTIALS = 172;
|
||||
static final int SVR2_ENCLAVE_UPDATE_7 = 173;
|
||||
static final int DISABLE_UNREAD_REMINDER = 174;
|
||||
}
|
||||
|
||||
public static final int CURRENT_VERSION = 173;
|
||||
public static final int CURRENT_VERSION = 174;
|
||||
|
||||
/**
|
||||
* This *must* be called after the {@link JobManager} has been instantiated, but *before* the call
|
||||
@@ -1001,6 +1002,10 @@ public class ApplicationMigrations {
|
||||
jobs.put(Version.SVR2_ENCLAVE_UPDATE_7, new Svr2MirrorMigrationJob());
|
||||
}
|
||||
|
||||
if (lastSeenVersion < Version.DISABLE_UNREAD_REMINDER) {
|
||||
jobs.put(Version.DISABLE_UNREAD_REMINDER, new DisableUnreadReminderMigrationJob());
|
||||
}
|
||||
|
||||
return jobs;
|
||||
}
|
||||
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package org.thoughtcrime.securesms.migrations
|
||||
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.signal.core.util.logging.Log.tag
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase
|
||||
import org.thoughtcrime.securesms.jobmanager.Job
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper
|
||||
|
||||
/**
|
||||
* Turns off setting for unread reminders for existing users.
|
||||
*/
|
||||
internal class DisableUnreadReminderMigrationJob private constructor(parameters: Parameters) : MigrationJob(parameters) {
|
||||
|
||||
companion object {
|
||||
|
||||
const val KEY = "DisableUnreadReminderMigrationJob"
|
||||
|
||||
private val TAG: String = tag(DisableUnreadReminderMigrationJob::class.java)
|
||||
}
|
||||
|
||||
internal constructor() : this(Parameters.Builder().build())
|
||||
|
||||
override fun isUiBlocking(): Boolean = false
|
||||
|
||||
override fun getFactoryKey(): String = KEY
|
||||
|
||||
override fun performMigration() {
|
||||
if (!SignalStore.account.isRegistered || SignalStore.account.aci == null || SignalStore.account.pni == null) {
|
||||
Log.i(TAG, "Unregistered, skipping.")
|
||||
return
|
||||
}
|
||||
|
||||
Log.i(TAG, "Disabling unread reminders")
|
||||
SignalStore.settings.unreadReminderEnabled = false
|
||||
SignalDatabase.recipients.markNeedsSync(Recipient.self().id)
|
||||
StorageSyncHelper.scheduleSyncForDataChange()
|
||||
}
|
||||
|
||||
override fun shouldRetry(e: Exception): Boolean = false
|
||||
|
||||
class Factory : Job.Factory<DisableUnreadReminderMigrationJob> {
|
||||
override fun create(parameters: Parameters, serializedData: ByteArray?): DisableUnreadReminderMigrationJob {
|
||||
return DisableUnreadReminderMigrationJob(parameters)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user