mobile: remove option "transfer images faster" (#1891)

This commit is contained in:
Evgeny Poberezkin
2023-02-05 11:25:31 +00:00
committed by GitHub
parent 958299784d
commit 06a2f7e4da
22 changed files with 16 additions and 66 deletions

View File

@@ -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<SimplexLinkMode> = 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"
}

View File

@@ -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 = {

View File

@@ -467,7 +467,6 @@
<string name="privacy_and_security">Ochrana osobních údajů a zabezpečení</string>
<string name="your_privacy">Vaše soukromí</string>
<string name="protect_app_screen">Ochrana obrazovky aplikace</string>
<string name="transfer_images_faster">Rychlejší přenos obrázků (BETA)</string>
<string name="send_link_previews">Odesílání náhledů odkazů</string>
<string name="full_backup">Zálohování dat aplikace</string>
<string name="confirm_new_passphrase">Confirm new passphrase…</string>

View File

@@ -559,7 +559,6 @@
<string name="your_privacy">Meine Privatsphäre</string>
<string name="protect_app_screen">App-Bildschirm schützen</string>
<string name="auto_accept_images">Bilder automatisch akzeptieren</string>
<string name="transfer_images_faster">Bilder schneller übertragen (BETA)</string>
<string name="send_link_previews">Link-Vorschau senden</string>
<string name="full_backup">App-Datensicherung</string>
<!-- Settings sections -->

View File

@@ -623,7 +623,6 @@
<string name="privacy_and_security">Vie privée et sécurité</string>
<string name="protect_app_screen">Protéger l\'écran de l\'app</string>
<string name="auto_accept_images">Images auto-acceptées</string>
<string name="transfer_images_faster">Transfert d\'images plus rapide (BETA)</string>
<string name="full_backup">Sauvegarde des données de l\'app</string>
<string name="settings_section_title_you">VOUS</string>
<string name="settings_section_title_help">AIDE</string>

View File

@@ -742,7 +742,6 @@
<string name="settings_section_title_support">SUPPORTA SIMPLEX CHAT</string>
<string name="settings_section_title_themes">TEMI</string>
<string name="delete_chat_profile_action_cannot_be_undone_warning">Questa azione non può essere annullata: il tuo profilo, i contatti, i messaggi e i file andranno persi in modo irreversibile.</string>
<string name="transfer_images_faster">Trasferisci immagini più velocemente (BETA)</string>
<string name="settings_section_title_you">TU</string>
<string name="your_chat_database">Il tuo database della chat</string>
<string name="your_current_chat_database_will_be_deleted_and_replaced_with_the_imported_one">Il tuo attuale database di chat verrà ELIMINATO e SOSTITUITO con quello importato.

View File

@@ -560,7 +560,6 @@
<string name="your_privacy">Конфиденциальность</string>
<string name="protect_app_screen">Защитить экран приложения</string>
<string name="auto_accept_images">Автоприем изображений</string>
<string name="transfer_images_faster">Передавать изображения в том же соединении (БЕТА)</string>
<string name="send_link_previews">Отправлять картинки ссылок</string>
<string name="full_backup">Резервная копия данных</string>
<!-- Settings sections -->

View File

@@ -673,7 +673,6 @@
<string name="your_privacy">Your privacy</string>
<string name="protect_app_screen">Protect app screen</string>
<string name="auto_accept_images">Auto-accept images</string>
<string name="transfer_images_faster">Transfer images inline (BETA)</string>
<string name="send_link_previews">Send link previews</string>
<string name="full_backup">App data backup</string>

View File

@@ -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 }

View File

@@ -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)
}

View File

@@ -3297,11 +3297,6 @@ Sie werden aufgefordert, die Authentifizierung abzuschließen, bevor diese Funkt
<target>Um die Ende-zu-Ende-Verschlüsselung mit Ihrem Kontakt zu überprüfen, müssen Sie den Sicherheitscode in Ihren Apps vergleichen oder scannen.</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Transfer images inline (BETA)" xml:space="preserve">
<source>Transfer images inline (BETA)</source>
<target>Bilder schneller übertragen (BETA)</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Transport isolation" xml:space="preserve">
<source>Transport isolation</source>
<target>Transport-Isolation</target>

View File

@@ -3297,11 +3297,6 @@ You will be prompted to complete authentication before this feature is enabled.<
<target>To verify end-to-end encryption with your contact compare (or scan) the code on your devices.</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Transfer images inline (BETA)" xml:space="preserve">
<source>Transfer images inline (BETA)</source>
<target>Transfer images inline (BETA)</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Transport isolation" xml:space="preserve">
<source>Transport isolation</source>
<target>Transport isolation</target>

View File

@@ -3284,11 +3284,6 @@ Vous serez invité à confirmer l'authentification avant que cette fonction ne s
<target>Pour vérifier le chiffrement de bout en bout avec votre contact, comparez (ou scannez) le code sur vos appareils.</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Transfer images inline (BETA)" xml:space="preserve">
<source>Transfer images inline (BETA)</source>
<target>Transfert d'images plus rapide (BETA)</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Transport isolation" xml:space="preserve">
<source>Transport isolation</source>
<target>Isolement du transport</target>

View File

@@ -3297,11 +3297,6 @@ Ti verrà chiesto di completare l'autenticazione prima di attivare questa funzio
<target>Per verificare la crittografia end-to-end con il tuo contatto, confrontate (o scansionate) il codice sui vostri dispositivi.</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Transfer images inline (BETA)" xml:space="preserve">
<source>Transfer images inline (BETA)</source>
<target>Trasferisci immagini più velocemente (BETA)</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Transport isolation" xml:space="preserve">
<source>Transport isolation</source>
<target>Isolamento del trasporto</target>

View File

@@ -3297,11 +3297,6 @@ You will be prompted to complete authentication before this feature is enabled.<
<target>Чтобы подтвердить end-to-end шифрование с вашим контактом сравните (или сканируйте) код безопасности на ваших устройствах.</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Transfer images inline (BETA)" xml:space="preserve">
<source>Transfer images inline (BETA)</source>
<target>Передавать изображения в том же соединении0 (БЕТА)</target>
<note>No comment provided by engineer.</note>
</trans-unit>
<trans-unit id="Transport isolation" xml:space="preserve">
<source>Transport isolation</source>
<target>Отдельные сессии для</target>

View File

@@ -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))")

View File

@@ -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
}

View File

@@ -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"

View File

@@ -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";

View File

@@ -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";

View File

@@ -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";

View File

@@ -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" = "Отдельные сессии для";