From 06a2f7e4da02f371ad42121fd95dad760ded6534 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Sun, 5 Feb 2023 11:25:31 +0000 Subject: [PATCH] mobile: remove option "transfer images faster" (#1891) --- .../src/main/java/chat/simplex/app/model/SimpleXAPI.kt | 10 ++++------ .../simplex/app/views/usersettings/PrivacySettings.kt | 2 -- apps/android/app/src/main/res/values-cs/strings.xml | 1 - apps/android/app/src/main/res/values-de/strings.xml | 1 - apps/android/app/src/main/res/values-fr/strings.xml | 1 - apps/android/app/src/main/res/values-it/strings.xml | 1 - apps/android/app/src/main/res/values-ru/strings.xml | 1 - apps/android/app/src/main/res/values/strings.xml | 1 - apps/ios/Shared/Model/SimpleXAPI.swift | 5 ++--- .../Shared/Views/UserSettings/PrivacySettings.swift | 4 ---- .../de.xcloc/Localized Contents/de.xliff | 5 ----- .../en.xcloc/Localized Contents/en.xliff | 5 ----- .../fr.xcloc/Localized Contents/fr.xliff | 5 ----- .../it.xcloc/Localized Contents/it.xliff | 5 ----- .../ru.xcloc/Localized Contents/ru.xliff | 5 ----- apps/ios/SimpleX NSE/NotificationService.swift | 8 +++----- apps/ios/SimpleXChat/APITypes.swift | 8 ++++++-- apps/ios/SimpleXChat/AppGroup.swift | 2 +- apps/ios/de.lproj/Localizable.strings | 3 --- apps/ios/fr.lproj/Localizable.strings | 3 --- apps/ios/it.lproj/Localizable.strings | 3 --- apps/ios/ru.lproj/Localizable.strings | 3 --- 22 files changed, 16 insertions(+), 66 deletions(-) diff --git a/apps/android/app/src/main/java/chat/simplex/app/model/SimpleXAPI.kt b/apps/android/app/src/main/java/chat/simplex/app/model/SimpleXAPI.kt index 8e53ef382..7b836452f 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/model/SimpleXAPI.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/model/SimpleXAPI.kt @@ -88,7 +88,6 @@ class AppPreferences(val context: Context) { val webrtcIceServers = mkStrPreference(SHARED_PREFS_WEBRTC_ICE_SERVERS, null) val privacyProtectScreen = mkBoolPreference(SHARED_PREFS_PRIVACY_PROTECT_SCREEN, true) val privacyAcceptImages = mkBoolPreference(SHARED_PREFS_PRIVACY_ACCEPT_IMAGES, true) - val privacyTransferImagesInline = mkBoolPreference(SHARED_PREFS_PRIVACY_TRANSFER_IMAGES_INLINE, false) val privacyLinkPreviews = mkBoolPreference(SHARED_PREFS_PRIVACY_LINK_PREVIEWS, true) private val _simplexLinkMode = mkStrPreference(SHARED_PREFS_PRIVACY_SIMPLEX_LINK_MODE, SimplexLinkMode.default.name) val simplexLinkMode: SharedPreference = SharedPreference( @@ -935,7 +934,7 @@ open class ChatController(var ctrl: ChatCtrl?, val ntfManager: NtfManager, val a return false } - suspend fun apiReceiveFile(fileId: Long, inline: Boolean): AChatItem? { + suspend fun apiReceiveFile(fileId: Long, inline: Boolean? = null): AChatItem? { val r = sendCmd(CC.ReceiveFile(fileId, inline)) return when (r) { is CR.RcvFileAccepted -> r.chatItem @@ -1424,8 +1423,7 @@ open class ChatController(var ctrl: ChatCtrl?, val ntfManager: NtfManager, val a } suspend fun receiveFile(user: User, fileId: Long) { - val inline = appPrefs.privacyTransferImagesInline.get() - val chatItem = apiReceiveFile(fileId, inline) + val chatItem = apiReceiveFile(fileId) if (chatItem != null) { chatItemSimpleUpdate(user, chatItem) } @@ -1798,7 +1796,7 @@ sealed class CC { class ApiRejectContact(val contactReqId: Long): CC() class ApiChatRead(val type: ChatType, val id: Long, val range: ItemRange): CC() class ApiChatUnread(val type: ChatType, val id: Long, val unreadChat: Boolean): CC() - class ReceiveFile(val fileId: Long, val inline: Boolean): CC() + class ReceiveFile(val fileId: Long, val inline: Boolean?): CC() class ShowVersion(): CC() val cmdString: String get() = when (this) { @@ -1873,7 +1871,7 @@ sealed class CC { is ApiCallStatus -> "/_call status @${contact.apiId} ${callStatus.value}" is ApiChatRead -> "/_read chat ${chatRef(type, id)} from=${range.from} to=${range.to}" is ApiChatUnread -> "/_unread chat ${chatRef(type, id)} ${onOff(unreadChat)}" - is ReceiveFile -> "/freceive $fileId inline=${onOff(inline)}" + is ReceiveFile -> if (inline == null) "/freceive $fileId" else "/freceive $fileId inline=${onOff(inline)}" is ShowVersion -> "/version" } diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/PrivacySettings.kt b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/PrivacySettings.kt index d2402f9f6..2a74a5e30 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/PrivacySettings.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/PrivacySettings.kt @@ -51,8 +51,6 @@ fun PrivacySettingsView( SectionView(stringResource(R.string.settings_section_title_chats)) { SettingsPreferenceItem(Icons.Outlined.Image, stringResource(R.string.auto_accept_images), chatModel.controller.appPrefs.privacyAcceptImages) SectionDivider() - SettingsPreferenceItem(Icons.Outlined.ImageAspectRatio, stringResource(R.string.transfer_images_faster), chatModel.controller.appPrefs.privacyTransferImagesInline) - SectionDivider() SettingsPreferenceItem(Icons.Outlined.TravelExplore, stringResource(R.string.send_link_previews), chatModel.controller.appPrefs.privacyLinkPreviews) SectionDivider() SectionItemView { SimpleXLinkOptions(chatModel.simplexLinkMode, onSelected = { diff --git a/apps/android/app/src/main/res/values-cs/strings.xml b/apps/android/app/src/main/res/values-cs/strings.xml index 07f36a95d..9bfba3b24 100644 --- a/apps/android/app/src/main/res/values-cs/strings.xml +++ b/apps/android/app/src/main/res/values-cs/strings.xml @@ -467,7 +467,6 @@ Ochrana osobních údajů a zabezpečení Vaše soukromí Ochrana obrazovky aplikace - Rychlejší přenos obrázků (BETA) Odesílání náhledů odkazů Zálohování dat aplikace Confirm new passphrase… diff --git a/apps/android/app/src/main/res/values-de/strings.xml b/apps/android/app/src/main/res/values-de/strings.xml index 083b24811..e8dbffcf0 100644 --- a/apps/android/app/src/main/res/values-de/strings.xml +++ b/apps/android/app/src/main/res/values-de/strings.xml @@ -559,7 +559,6 @@ Meine Privatsphäre App-Bildschirm schützen Bilder automatisch akzeptieren - Bilder schneller übertragen (BETA) Link-Vorschau senden App-Datensicherung diff --git a/apps/android/app/src/main/res/values-fr/strings.xml b/apps/android/app/src/main/res/values-fr/strings.xml index 2508ff42c..5aa5cb73f 100644 --- a/apps/android/app/src/main/res/values-fr/strings.xml +++ b/apps/android/app/src/main/res/values-fr/strings.xml @@ -623,7 +623,6 @@ Vie privée et sécurité Protéger l\'écran de l\'app Images auto-acceptées - Transfert d\'images plus rapide (BETA) Sauvegarde des données de l\'app VOUS AIDE diff --git a/apps/android/app/src/main/res/values-it/strings.xml b/apps/android/app/src/main/res/values-it/strings.xml index c60f68a65..87bede5d3 100644 --- a/apps/android/app/src/main/res/values-it/strings.xml +++ b/apps/android/app/src/main/res/values-it/strings.xml @@ -742,7 +742,6 @@ SUPPORTA SIMPLEX CHAT TEMI Questa azione non può essere annullata: il tuo profilo, i contatti, i messaggi e i file andranno persi in modo irreversibile. - Trasferisci immagini più velocemente (BETA) TU Il tuo database della chat Il tuo attuale database di chat verrà ELIMINATO e SOSTITUITO con quello importato. diff --git a/apps/android/app/src/main/res/values-ru/strings.xml b/apps/android/app/src/main/res/values-ru/strings.xml index 877d738d2..a4624bd46 100644 --- a/apps/android/app/src/main/res/values-ru/strings.xml +++ b/apps/android/app/src/main/res/values-ru/strings.xml @@ -560,7 +560,6 @@ Конфиденциальность Защитить экран приложения Автоприем изображений - Передавать изображения в том же соединении (БЕТА) Отправлять картинки ссылок Резервная копия данных diff --git a/apps/android/app/src/main/res/values/strings.xml b/apps/android/app/src/main/res/values/strings.xml index 0463e9350..a2db2ece1 100644 --- a/apps/android/app/src/main/res/values/strings.xml +++ b/apps/android/app/src/main/res/values/strings.xml @@ -673,7 +673,6 @@ Your privacy Protect app screen Auto-accept images - Transfer images inline (BETA) Send link previews App data backup diff --git a/apps/ios/Shared/Model/SimpleXAPI.swift b/apps/ios/Shared/Model/SimpleXAPI.swift index 1783e8aa0..939d50514 100644 --- a/apps/ios/Shared/Model/SimpleXAPI.swift +++ b/apps/ios/Shared/Model/SimpleXAPI.swift @@ -636,13 +636,12 @@ func apiChatUnread(type: ChatType, id: Int64, unreadChat: Bool) async throws { } func receiveFile(user: User, fileId: Int64) async { - let inline = privacyTransferImagesInlineGroupDefault.get() - if let chatItem = await apiReceiveFile(fileId: fileId, inline: inline) { + if let chatItem = await apiReceiveFile(fileId: fileId) { DispatchQueue.main.async { chatItemSimpleUpdate(user, chatItem) } } } -func apiReceiveFile(fileId: Int64, inline: Bool) async -> AChatItem? { +func apiReceiveFile(fileId: Int64, inline: Bool? = nil) async -> AChatItem? { let r = await chatSendCmd(.receiveFile(fileId: fileId, inline: inline)) let am = AlertManager.shared if case let .rcvFileAccepted(_, chatItem) = r { return chatItem } diff --git a/apps/ios/Shared/Views/UserSettings/PrivacySettings.swift b/apps/ios/Shared/Views/UserSettings/PrivacySettings.swift index c4a81c084..5b9cd4952 100644 --- a/apps/ios/Shared/Views/UserSettings/PrivacySettings.swift +++ b/apps/ios/Shared/Views/UserSettings/PrivacySettings.swift @@ -13,7 +13,6 @@ struct PrivacySettings: View { @AppStorage(DEFAULT_PRIVACY_ACCEPT_IMAGES) private var autoAcceptImages = true @AppStorage(DEFAULT_PRIVACY_LINK_PREVIEWS) private var useLinkPreviews = true @AppStorage(DEFAULT_DEVELOPER_TOOLS) private var developerTools = false - @AppStorage(GROUP_DEFAULT_PRIVACY_TRANSFER_IMAGES_INLINE, store: groupDefaults) private var transferImagesInline = false @State private var simplexLinkMode = privacySimplexLinkModeDefault.get() @AppStorage(DEFAULT_PRIVACY_PROTECT_SCREEN) private var protectScreen = false @@ -34,9 +33,6 @@ struct PrivacySettings: View { privacyAcceptImagesGroupDefault.set($0) } } - settingsRow("photo.on.rectangle") { - Toggle("Transfer images inline (BETA)", isOn: $transferImagesInline) - } settingsRow("network") { Toggle("Send link previews", isOn: $useLinkPreviews) } diff --git a/apps/ios/SimpleX Localizations/de.xcloc/Localized Contents/de.xliff b/apps/ios/SimpleX Localizations/de.xcloc/Localized Contents/de.xliff index 21b5e942f..16e8de7ee 100644 --- a/apps/ios/SimpleX Localizations/de.xcloc/Localized Contents/de.xliff +++ b/apps/ios/SimpleX Localizations/de.xcloc/Localized Contents/de.xliff @@ -3297,11 +3297,6 @@ Sie werden aufgefordert, die Authentifizierung abzuschließen, bevor diese Funkt Um die Ende-zu-Ende-Verschlüsselung mit Ihrem Kontakt zu überprüfen, müssen Sie den Sicherheitscode in Ihren Apps vergleichen oder scannen. No comment provided by engineer. - - Transfer images inline (BETA) - Bilder schneller übertragen (BETA) - No comment provided by engineer. - Transport isolation Transport-Isolation diff --git a/apps/ios/SimpleX Localizations/en.xcloc/Localized Contents/en.xliff b/apps/ios/SimpleX Localizations/en.xcloc/Localized Contents/en.xliff index c35e21597..4fba57e02 100644 --- a/apps/ios/SimpleX Localizations/en.xcloc/Localized Contents/en.xliff +++ b/apps/ios/SimpleX Localizations/en.xcloc/Localized Contents/en.xliff @@ -3297,11 +3297,6 @@ You will be prompted to complete authentication before this feature is enabled.< To verify end-to-end encryption with your contact compare (or scan) the code on your devices. No comment provided by engineer. - - Transfer images inline (BETA) - Transfer images inline (BETA) - No comment provided by engineer. - Transport isolation Transport isolation diff --git a/apps/ios/SimpleX Localizations/fr.xcloc/Localized Contents/fr.xliff b/apps/ios/SimpleX Localizations/fr.xcloc/Localized Contents/fr.xliff index f8e6054bc..1f9dc0315 100644 --- a/apps/ios/SimpleX Localizations/fr.xcloc/Localized Contents/fr.xliff +++ b/apps/ios/SimpleX Localizations/fr.xcloc/Localized Contents/fr.xliff @@ -3284,11 +3284,6 @@ Vous serez invité à confirmer l'authentification avant que cette fonction ne s Pour vérifier le chiffrement de bout en bout avec votre contact, comparez (ou scannez) le code sur vos appareils. No comment provided by engineer. - - Transfer images inline (BETA) - Transfert d'images plus rapide (BETA) - No comment provided by engineer. - Transport isolation Isolement du transport diff --git a/apps/ios/SimpleX Localizations/it.xcloc/Localized Contents/it.xliff b/apps/ios/SimpleX Localizations/it.xcloc/Localized Contents/it.xliff index 738a8876d..76dffe5e0 100644 --- a/apps/ios/SimpleX Localizations/it.xcloc/Localized Contents/it.xliff +++ b/apps/ios/SimpleX Localizations/it.xcloc/Localized Contents/it.xliff @@ -3297,11 +3297,6 @@ Ti verrà chiesto di completare l'autenticazione prima di attivare questa funzio Per verificare la crittografia end-to-end con il tuo contatto, confrontate (o scansionate) il codice sui vostri dispositivi. No comment provided by engineer. - - Transfer images inline (BETA) - Trasferisci immagini più velocemente (BETA) - No comment provided by engineer. - Transport isolation Isolamento del trasporto diff --git a/apps/ios/SimpleX Localizations/ru.xcloc/Localized Contents/ru.xliff b/apps/ios/SimpleX Localizations/ru.xcloc/Localized Contents/ru.xliff index d877fc51b..95f8047a0 100644 --- a/apps/ios/SimpleX Localizations/ru.xcloc/Localized Contents/ru.xliff +++ b/apps/ios/SimpleX Localizations/ru.xcloc/Localized Contents/ru.xliff @@ -3297,11 +3297,6 @@ You will be prompted to complete authentication before this feature is enabled.< Чтобы подтвердить end-to-end шифрование с вашим контактом сравните (или сканируйте) код безопасности на ваших устройствах. No comment provided by engineer. - - Transfer images inline (BETA) - Передавать изображения в том же соединении0 (БЕТА) - No comment provided by engineer. - Transport isolation Отдельные сессии для diff --git a/apps/ios/SimpleX NSE/NotificationService.swift b/apps/ios/SimpleX NSE/NotificationService.swift index 9f1ffb731..b6efc2086 100644 --- a/apps/ios/SimpleX NSE/NotificationService.swift +++ b/apps/ios/SimpleX NSE/NotificationService.swift @@ -225,16 +225,14 @@ func receivedMsgNtf(_ res: ChatResponse) async -> (String, UNMutableNotification if let file = cItem.file, file.fileSize <= MAX_IMAGE_SIZE_AUTO_RCV, privacyAcceptImagesGroupDefault.get() { - let inline = privacyTransferImagesInlineGroupDefault.get() - cItem = apiReceiveFile(fileId: file.fileId, inline: inline)?.chatItem ?? cItem + cItem = apiReceiveFile(fileId: file.fileId)?.chatItem ?? cItem } } else if case .voice = cItem.content.msgContent { // TODO check inlineFileMode != IFMSent if let file = cItem.file, file.fileSize <= MAX_IMAGE_SIZE, file.fileSize > MAX_VOICE_MESSAGE_SIZE_INLINE_SEND, privacyAcceptImagesGroupDefault.get() { - let inline = privacyTransferImagesInlineGroupDefault.get() - cItem = apiReceiveFile(fileId: file.fileId, inline: inline)?.chatItem ?? cItem + cItem = apiReceiveFile(fileId: file.fileId)?.chatItem ?? cItem } } return cItem.showMutableNotification ? (aChatItem.chatId, createMessageReceivedNtf(user, cInfo, cItem)) : nil @@ -308,7 +306,7 @@ func apiGetNtfMessage(nonce: String, encNtfInfo: String) -> NtfMessages? { return nil } -func apiReceiveFile(fileId: Int64, inline: Bool) -> AChatItem? { +func apiReceiveFile(fileId: Int64, inline: Bool? = nil) -> AChatItem? { let r = sendSimpleXCmd(.receiveFile(fileId: fileId, inline: inline)) if case let .rcvFileAccepted(_, chatItem) = r { return chatItem } logger.error("receiveFile error: \(responseError(r))") diff --git a/apps/ios/SimpleXChat/APITypes.swift b/apps/ios/SimpleXChat/APITypes.swift index 69b8ce851..5a562df10 100644 --- a/apps/ios/SimpleXChat/APITypes.swift +++ b/apps/ios/SimpleXChat/APITypes.swift @@ -91,7 +91,7 @@ public enum ChatCommand { case apiCallStatus(contact: Contact, callStatus: WebRTCCallStatus) case apiChatRead(type: ChatType, id: Int64, itemRange: (Int64, Int64)) case apiChatUnread(type: ChatType, id: Int64, unreadChat: Bool) - case receiveFile(fileId: Int64, inline: Bool) + case receiveFile(fileId: Int64, inline: Bool?) case showVersion case string(String) @@ -180,7 +180,11 @@ public enum ChatCommand { case let .apiCallStatus(contact, callStatus): return "/_call status @\(contact.apiId) \(callStatus.rawValue)" case let .apiChatRead(type, id, itemRange: (from, to)): return "/_read chat \(ref(type, id)) from=\(from) to=\(to)" case let .apiChatUnread(type, id, unreadChat): return "/_unread chat \(ref(type, id)) \(onOff(unreadChat))" - case let .receiveFile(fileId, inline): return "/freceive \(fileId) inline=\(onOff(inline))" + case let .receiveFile(fileId, inline): + if let inline = inline { + return "/freceive \(fileId) inline=\(onOff(inline))" + } + return "/freceive \(fileId)" case .showVersion: return "/version" case let .string(str): return str } diff --git a/apps/ios/SimpleXChat/AppGroup.swift b/apps/ios/SimpleXChat/AppGroup.swift index 8ac3d647c..6b31d661a 100644 --- a/apps/ios/SimpleXChat/AppGroup.swift +++ b/apps/ios/SimpleXChat/AppGroup.swift @@ -14,7 +14,7 @@ let GROUP_DEFAULT_DB_CONTAINER = "dbContainer" public let GROUP_DEFAULT_CHAT_LAST_START = "chatLastStart" let GROUP_DEFAULT_NTF_PREVIEW_MODE = "ntfPreviewMode" let GROUP_DEFAULT_PRIVACY_ACCEPT_IMAGES = "privacyAcceptImages" -public let GROUP_DEFAULT_PRIVACY_TRANSFER_IMAGES_INLINE = "privacyTransferImagesInline" +public let GROUP_DEFAULT_PRIVACY_TRANSFER_IMAGES_INLINE = "privacyTransferImagesInline" // no longer used let GROUP_DEFAULT_NTF_BADGE_COUNT = "ntgBadgeCount" let GROUP_DEFAULT_NETWORK_USE_ONION_HOSTS = "networkUseOnionHosts" let GROUP_DEFAULT_NETWORK_SESSION_MODE = "networkSessionMode" diff --git a/apps/ios/de.lproj/Localizable.strings b/apps/ios/de.lproj/Localizable.strings index 7c569903e..f6f5eea3c 100644 --- a/apps/ios/de.lproj/Localizable.strings +++ b/apps/ios/de.lproj/Localizable.strings @@ -2250,9 +2250,6 @@ /* No comment provided by engineer. */ "To verify end-to-end encryption with your contact compare (or scan) the code on your devices." = "Um die Ende-zu-Ende-Verschlüsselung mit Ihrem Kontakt zu überprüfen, müssen Sie den Sicherheitscode in Ihren Apps vergleichen oder scannen."; -/* No comment provided by engineer. */ -"Transfer images inline (BETA)" = "Bilder schneller übertragen (BETA)"; - /* No comment provided by engineer. */ "Transport isolation" = "Transport-Isolation"; diff --git a/apps/ios/fr.lproj/Localizable.strings b/apps/ios/fr.lproj/Localizable.strings index e3398ea16..41931ed6f 100644 --- a/apps/ios/fr.lproj/Localizable.strings +++ b/apps/ios/fr.lproj/Localizable.strings @@ -2211,9 +2211,6 @@ /* No comment provided by engineer. */ "To verify end-to-end encryption with your contact compare (or scan) the code on your devices." = "Pour vérifier le chiffrement de bout en bout avec votre contact, comparez (ou scannez) le code sur vos appareils."; -/* No comment provided by engineer. */ -"Transfer images inline (BETA)" = "Transfert d'images plus rapide (BETA)"; - /* No comment provided by engineer. */ "Transport isolation" = "Isolement du transport"; diff --git a/apps/ios/it.lproj/Localizable.strings b/apps/ios/it.lproj/Localizable.strings index 493c71f9c..553011588 100644 --- a/apps/ios/it.lproj/Localizable.strings +++ b/apps/ios/it.lproj/Localizable.strings @@ -2250,9 +2250,6 @@ /* No comment provided by engineer. */ "To verify end-to-end encryption with your contact compare (or scan) the code on your devices." = "Per verificare la crittografia end-to-end con il tuo contatto, confrontate (o scansionate) il codice sui vostri dispositivi."; -/* No comment provided by engineer. */ -"Transfer images inline (BETA)" = "Trasferisci immagini più velocemente (BETA)"; - /* No comment provided by engineer. */ "Transport isolation" = "Isolamento del trasporto"; diff --git a/apps/ios/ru.lproj/Localizable.strings b/apps/ios/ru.lproj/Localizable.strings index 15f1f353d..193d6c9bf 100644 --- a/apps/ios/ru.lproj/Localizable.strings +++ b/apps/ios/ru.lproj/Localizable.strings @@ -2250,9 +2250,6 @@ /* No comment provided by engineer. */ "To verify end-to-end encryption with your contact compare (or scan) the code on your devices." = "Чтобы подтвердить end-to-end шифрование с вашим контактом сравните (или сканируйте) код безопасности на ваших устройствах."; -/* No comment provided by engineer. */ -"Transfer images inline (BETA)" = "Передавать изображения в том же соединении0 (БЕТА)"; - /* No comment provided by engineer. */ "Transport isolation" = "Отдельные сессии для";