From a2fef15440b20912db4c76fdef21741253240702 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Sat, 12 Aug 2023 14:17:00 +0100 Subject: [PATCH] android: disable app data backup competely (#2907) --- .../android/src/main/AndroidManifest.xml | 5 ++- .../main/java/chat/simplex/app/BackupAgent.kt | 18 ---------- .../java/chat/simplex/app/model/SimpleXAPI.kt | 1 - .../app/views/database/DatabaseView.kt | 36 ++++--------------- 4 files changed, 9 insertions(+), 51 deletions(-) delete mode 100644 apps/multiplatform/android/src/main/java/chat/simplex/app/BackupAgent.kt diff --git a/apps/multiplatform/android/src/main/AndroidManifest.xml b/apps/multiplatform/android/src/main/AndroidManifest.xml index f3d48fe88f..459b1bc05a 100644 --- a/apps/multiplatform/android/src/main/AndroidManifest.xml +++ b/apps/multiplatform/android/src/main/AndroidManifest.xml @@ -24,9 +24,8 @@ , chatArchiveTime: MutableState, chatLastStart: MutableState, - privacyFullBackup: SharedPreference, appFilesCountAndSize: MutableState>, chatItemTTL: MutableState, currentUser: User?, @@ -173,6 +171,13 @@ fun DatabaseLayout( SectionView(stringResource(MR.strings.run_chat_section)) { RunChatSetting(runChat, stopped, startChat, stopChatAlert) } + SectionTextFooter( + if (stopped) { + stringResource(MR.strings.you_must_use_the_most_recent_version_of_database) + } else { + stringResource(MR.strings.stop_chat_to_enable_database_actions) + } + ) SectionDividerSpaced() SectionView(stringResource(MR.strings.chat_database_section)) { @@ -185,8 +190,6 @@ fun DatabaseLayout( iconColor = if (unencrypted) WarningOrange else MaterialTheme.colors.secondary, disabled = operationsDisabled ) - AppDataBackupPreference(privacyFullBackup, initialRandomDBPassphrase) - SectionDividerSpaced(maxBottomPadding = false) SettingsActionItem( painterResource(MR.images.ic_ios_share), stringResource(MR.strings.export_database), @@ -230,13 +233,6 @@ fun DatabaseLayout( disabled = operationsDisabled ) } - SectionTextFooter( - if (stopped) { - stringResource(MR.strings.you_must_use_the_most_recent_version_of_database) - } else { - stringResource(MR.strings.stop_chat_to_enable_database_actions) - } - ) SectionDividerSpaced(maxTopPadding = true) SectionView(stringResource(MR.strings.files_and_media_section).uppercase()) { @@ -263,23 +259,6 @@ fun DatabaseLayout( } } -@Composable -private fun AppDataBackupPreference(privacyFullBackup: SharedPreference, initialRandomDBPassphrase: SharedPreference) { - SettingsPreferenceItem( - painterResource(MR.images.ic_backup), - iconColor = MaterialTheme.colors.secondary, - pref = privacyFullBackup, - text = stringResource(MR.strings.full_backup) - ) { - if (initialRandomDBPassphrase.get()) { - exportProhibitedAlert() - privacyFullBackup.set(false) - } else { - privacyFullBackup.set(it) - } - } -} - private fun setChatItemTTLAlert( m: ChatModel, selectedChatItemTTL: MutableState, progressIndicator: MutableState, @@ -723,7 +702,6 @@ fun PreviewDatabaseLayout() { chatArchiveName = remember { mutableStateOf("dummy_archive") }, chatArchiveTime = remember { mutableStateOf(Clock.System.now()) }, chatLastStart = remember { mutableStateOf(Clock.System.now()) }, - privacyFullBackup = SharedPreference({ true }, {}), appFilesCountAndSize = remember { mutableStateOf(0 to 0L) }, chatItemTTL = remember { mutableStateOf(ChatItemTTL.None) }, currentUser = User.sampleData,