Remove unused preferences

This commit is contained in:
bemusementpark 2024-07-10 12:18:42 +09:30
parent 84b1fb6527
commit 6b2979da68

View File

@ -198,27 +198,21 @@ interface TextSecurePreferences {
const val DISABLE_PASSPHRASE_PREF = "pref_disable_passphrase"
const val LANGUAGE_PREF = "pref_language"
const val THREAD_TRIM_NOW = "pref_trim_now"
const val LAST_VERSION_CODE_PREF = "last_version_code"
const val RINGTONE_PREF = "pref_key_ringtone"
const val VIBRATE_PREF = "pref_key_vibrate"
const val NOTIFICATION_PREF = "pref_key_enable_notifications"
const val LED_COLOR_PREF = "pref_led_color"
const val LED_COLOR_PREF_PRIMARY = "pref_led_color_primary"
const val LED_BLINK_PREF = "pref_led_blink"
const val LED_BLINK_PREF_CUSTOM = "pref_led_blink_custom"
const val PASSPHRASE_TIMEOUT_INTERVAL_PREF = "pref_timeout_interval"
const val PASSPHRASE_TIMEOUT_PREF = "pref_timeout_passphrase"
const val SCREEN_SECURITY_PREF = "pref_screen_security"
const val ENTER_SENDS_PREF = "pref_enter_sends"
const val THREAD_TRIM_ENABLED = "pref_trim_threads"
const val LOCAL_NUMBER_PREF = "pref_local_number"
const val REGISTERED_GCM_PREF = "pref_gcm_registered"
const val UPDATE_APK_REFRESH_TIME_PREF = "pref_update_apk_refresh_time"
const val UPDATE_APK_DOWNLOAD_ID = "pref_update_apk_download_id"
const val UPDATE_APK_DIGEST = "pref_update_apk_digest"
const val IN_THREAD_NOTIFICATION_PREF = "pref_key_inthread_notifications"
const val IN_APP_NOTIFICATION_SOUNDS = "pref_sound_when_app_open"
const val MESSAGE_BODY_TEXT_SIZE_PREF = "pref_message_body_text_size"
const val LOCAL_REGISTRATION_ID_PREF = "pref_local_registration_id"
const val REPEAT_ALERTS_PREF = "pref_repeat_alerts"
@ -244,7 +238,6 @@ interface TextSecurePreferences {
const val BACKUP_PASSPHRASE = "pref_backup_passphrase"
const val ENCRYPTED_BACKUP_PASSPHRASE = "pref_encrypted_backup_passphrase"
const val BACKUP_TIME = "pref_backup_next_time"
const val BACKUP_NOW = "pref_backup_create"
const val BACKUP_SAVE_DIR = "pref_save_dir"
const val SCREEN_LOCK = "pref_android_screen_lock"
const val SCREEN_LOCK_TIMEOUT = "pref_android_screen_lock_timeout"
@ -296,16 +289,6 @@ interface TextSecurePreferences {
const val ALLOW_MESSAGE_REQUESTS = "libsession.ALLOW_MESSAGE_REQUESTS"
@JvmStatic
fun getLastConfigurationSyncTime(context: Context): Long {
return getLongPreference(context, LAST_CONFIGURATION_SYNC_TIME, 0)
}
@JvmStatic
fun setLastConfigurationSyncTime(context: Context, value: Long) {
setLongPreference(context, LAST_CONFIGURATION_SYNC_TIME, value)
}
@JvmStatic
fun getConfigurationMessageSynced(context: Context): Boolean {
return getBooleanPreference(context, CONFIGURATION_SYNCED, false)
@ -322,21 +305,11 @@ interface TextSecurePreferences {
return getBooleanPreference(context, IS_PUSH_ENABLED, false)
}
@JvmStatic
fun setPushEnabled(context: Context, value: Boolean) {
setBooleanPreference(context, IS_PUSH_ENABLED, value)
}
@JvmStatic
fun getPushToken(context: Context): String? {
return getStringPreference(context, PUSH_TOKEN, "")
}
@JvmStatic
fun setPushToken(context: Context, value: String?) {
setStringPreference(context, PUSH_TOKEN, value)
}
fun getPushRegisterTime(context: Context): Long {
return getLongPreference(context, PUSH_REGISTER_TIME, 0)
}
@ -366,58 +339,6 @@ interface TextSecurePreferences {
setLongPreference(context, SCREEN_LOCK_TIMEOUT, value)
}
@JvmStatic
fun setBackupPassphrase(context: Context, passphrase: String?) {
setStringPreference(context, BACKUP_PASSPHRASE, passphrase)
}
@JvmStatic
fun getBackupPassphrase(context: Context): String? {
return getStringPreference(context, BACKUP_PASSPHRASE, null)
}
@JvmStatic
fun setEncryptedBackupPassphrase(context: Context, encryptedPassphrase: String?) {
setStringPreference(context, ENCRYPTED_BACKUP_PASSPHRASE, encryptedPassphrase)
}
@JvmStatic
fun getEncryptedBackupPassphrase(context: Context): String? {
return getStringPreference(context, ENCRYPTED_BACKUP_PASSPHRASE, null)
}
fun setBackupEnabled(context: Context, value: Boolean) {
setBooleanPreference(context, BACKUP_ENABLED, value)
}
@JvmStatic
fun isBackupEnabled(context: Context): Boolean {
return getBooleanPreference(context, BACKUP_ENABLED, false)
}
@JvmStatic
fun setNextBackupTime(context: Context, time: Long) {
setLongPreference(context, BACKUP_TIME, time)
}
@JvmStatic
fun getNextBackupTime(context: Context): Long {
return getLongPreference(context, BACKUP_TIME, -1)
}
fun setBackupSaveDir(context: Context, dirUri: String?) {
setStringPreference(context, BACKUP_SAVE_DIR, dirUri)
}
fun getBackupSaveDir(context: Context): String? {
return getStringPreference(context, BACKUP_SAVE_DIR, null)
}
@JvmStatic
fun getNeedsSqlCipherMigration(context: Context): Boolean {
return getBooleanPreference(context, NEEDS_SQLCIPHER_MIGRATION, false)
}
@JvmStatic
fun setAttachmentEncryptedSecret(context: Context, secret: String) {
setStringPreference(context, ATTACHMENT_ENCRYPTED_SECRET, secret)
@ -595,41 +516,11 @@ interface TextSecurePreferences {
setIntegerPreference(context, LOCAL_REGISTRATION_ID_PREF, registrationId)
}
@JvmStatic
fun isInThreadNotifications(context: Context): Boolean {
return getBooleanPreference(context, IN_THREAD_NOTIFICATION_PREF, true)
}
@JvmStatic
fun isUniversalUnidentifiedAccess(context: Context): Boolean {
return getBooleanPreference(context, UNIVERSAL_UNIDENTIFIED_ACCESS, false)
}
@JvmStatic
fun getUpdateApkRefreshTime(context: Context): Long {
return getLongPreference(context, UPDATE_APK_REFRESH_TIME_PREF, 0L)
}
@JvmStatic
fun setUpdateApkRefreshTime(context: Context, value: Long) {
setLongPreference(context, UPDATE_APK_REFRESH_TIME_PREF, value)
}
@JvmStatic
fun setUpdateApkDownloadId(context: Context, value: Long) {
setLongPreference(context, UPDATE_APK_DOWNLOAD_ID, value)
}
@JvmStatic
fun getUpdateApkDownloadId(context: Context): Long {
return getLongPreference(context, UPDATE_APK_DOWNLOAD_ID, -1)
}
@JvmStatic
fun setUpdateApkDigest(context: Context, value: String?) {
setStringPreference(context, UPDATE_APK_DIGEST, value)
}
@JvmStatic
fun getUpdateApkDigest(context: Context): String? {
return getStringPreference(context, UPDATE_APK_DIGEST, null)
@ -640,11 +531,6 @@ interface TextSecurePreferences {
return getStringPreference(context, LOCAL_NUMBER_PREF, null)
}
@JvmStatic
fun getHasLegacyConfig(context: Context): Boolean {
return getBooleanPreference(context, HAS_RECEIVED_LEGACY_CONFIG, false)
}
@JvmStatic
fun setHasLegacyConfig(context: Context, newValue: Boolean) {
setBooleanPreference(context, HAS_RECEIVED_LEGACY_CONFIG, newValue)
@ -655,10 +541,6 @@ interface TextSecurePreferences {
setStringPreference(context, LOCAL_NUMBER_PREF, localNumber.toLowerCase())
}
fun removeLocalNumber(context: Context) {
removePreference(context, LOCAL_NUMBER_PREF)
}
@JvmStatic
fun isEnterSendsEnabled(context: Context): Boolean {
return getBooleanPreference(context, ENTER_SENDS_PREF, false)
@ -718,21 +600,6 @@ interface TextSecurePreferences {
return Uri.parse(result)
}
@JvmStatic
fun removeNotificationRingtone(context: Context) {
removePreference(context, RINGTONE_PREF)
}
@JvmStatic
fun setNotificationRingtone(context: Context, ringtone: String?) {
setStringPreference(context, RINGTONE_PREF, ringtone)
}
@JvmStatic
fun setNotificationVibrateEnabled(context: Context, enabled: Boolean) {
setBooleanPreference(context, VIBRATE_PREF, enabled)
}
@JvmStatic
fun isNotificationVibrateEnabled(context: Context): Boolean {
return getBooleanPreference(context, VIBRATE_PREF, true)
@ -882,10 +749,6 @@ interface TextSecurePreferences {
setLongPreference(context, "restoration_time", time)
}
fun getRestorationTime(context: Context): Long {
return getLongPreference(context, "restoration_time", 0)
}
@JvmStatic
fun getLastProfilePictureUpload(context: Context): Long {
return getLongPreference(context, "last_profile_picture_upload", 0)
@ -922,14 +785,6 @@ interface TextSecurePreferences {
setLongPreference(context, LAST_OPEN_DATE, System.currentTimeMillis())
}
fun hasSeenLinkPreviewSuggestionDialog(context: Context): Boolean {
return getBooleanPreference(context, "has_seen_link_preview_suggestion_dialog", false)
}
fun setHasSeenLinkPreviewSuggestionDialog(context: Context) {
setBooleanPreference(context, "has_seen_link_preview_suggestion_dialog", true)
}
@JvmStatic
fun hasHiddenMessageRequests(context: Context): Boolean {
return getBooleanPreference(context, HAS_HIDDEN_MESSAGE_REQUESTS, false)
@ -945,17 +800,6 @@ interface TextSecurePreferences {
return getBooleanPreference(context, CALL_NOTIFICATIONS_ENABLED, false)
}
@JvmStatic
fun setShownCallWarning(context: Context): Boolean {
val previousValue = getBooleanPreference(context, SHOWN_CALL_WARNING, false)
if (previousValue) {
return false
}
val setValue = true
setBooleanPreference(context, SHOWN_CALL_WARNING, setValue)
return previousValue != setValue
}
@JvmStatic
fun getLastVacuumTime(context: Context): Long {
return getLongPreference(context, LAST_VACUUM_TIME, 0)