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 3b16c0eaba..9e83e7c09d 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 @@ -89,6 +89,7 @@ class AppPreferences(val context: Context) { val laNoticeShown = mkBoolPreference(SHARED_PREFS_LA_NOTICE_SHOWN, false) val webrtcIceServers = mkStrPreference(SHARED_PREFS_WEBRTC_ICE_SERVERS, null) 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) val experimentalCalls = mkBoolPreference(SHARED_PREFS_EXPERIMENTAL_CALLS, false) val chatArchiveName = mkStrPreference(SHARED_PREFS_CHAT_ARCHIVE_NAME, null) @@ -178,6 +179,7 @@ class AppPreferences(val context: Context) { private const val SHARED_PREFS_LA_NOTICE_SHOWN = "LANoticeShown" private const val SHARED_PREFS_WEBRTC_ICE_SERVERS = "WebrtcICEServers" private const val SHARED_PREFS_PRIVACY_ACCEPT_IMAGES = "PrivacyAcceptImages" + private const val SHARED_PREFS_PRIVACY_TRANSFER_IMAGES_INLINE = "PrivacyTransferImagesInline" private const val SHARED_PREFS_PRIVACY_LINK_PREVIEWS = "PrivacyLinkPreviews" private const val SHARED_PREFS_EXPERIMENTAL_CALLS = "ExperimentalCalls" private const val SHARED_PREFS_CHAT_ARCHIVE_NAME = "ChatArchiveName" @@ -739,8 +741,8 @@ open class ChatController(var ctrl: ChatCtrl?, val ntfManager: NtfManager, val a return false } - suspend fun apiReceiveFile(fileId: Long): AChatItem? { - val r = sendCmd(CC.ReceiveFile(fileId)) + suspend fun apiReceiveFile(fileId: Long, inline: Boolean): AChatItem? { + val r = sendCmd(CC.ReceiveFile(fileId, inline)) return when (r) { is CR.RcvFileAccepted -> r.chatItem is CR.RcvFileAcceptedSndCancelled -> { @@ -1118,7 +1120,8 @@ open class ChatController(var ctrl: ChatCtrl?, val ntfManager: NtfManager, val a } suspend fun receiveFile(fileId: Long) { - val chatItem = apiReceiveFile(fileId) + val inline = appPrefs.privacyTransferImagesInline.get() + val chatItem = apiReceiveFile(fileId, inline) if (chatItem != null) { chatItemSimpleUpdate(chatItem) } @@ -1465,7 +1468,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): CC() + class ReceiveFile(val fileId: Long, val inline: Boolean): CC() val cmdString: String get() = when (this) { is Console -> cmd @@ -1529,7 +1532,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" + is ReceiveFile -> "/freceive $fileId inline=${onOff(inline)}" } val cmdType: String get() = when (this) { 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 eb46e36e6e..a2276626a7 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 @@ -4,19 +4,15 @@ import SectionDivider import SectionSpacer import SectionView import androidx.compose.foundation.layout.* -import androidx.compose.material.* import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.outlined.Image -import androidx.compose.material.icons.outlined.TravelExplore +import androidx.compose.material.icons.outlined.* import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource -import androidx.compose.ui.unit.dp import chat.simplex.app.R import chat.simplex.app.model.ChatModel import chat.simplex.app.views.helpers.AppBarTitle -import chat.simplex.app.views.helpers.generalGetString @Composable fun PrivacySettingsView(chatModel: ChatModel, setPerformLA: (Boolean) -> Unit) { @@ -33,6 +29,10 @@ fun PrivacySettingsView(chatModel: ChatModel, setPerformLA: (Boolean) -> Unit) { SectionView(stringResource(R.string.settings_section_title_chats)) { SettingsPreferenceItem(Icons.Outlined.Image, stringResource(R.string.auto_accept_images), chatModel.controller.appPrefs.privacyAcceptImages) SectionDivider() + if (chatModel.controller.appPrefs.developerTools.get()) { + 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) } } 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 11c3541b50..bd6cafaa22 100644 --- a/apps/android/app/src/main/res/values-de/strings.xml +++ b/apps/android/app/src/main/res/values-de/strings.xml @@ -549,6 +549,7 @@ Datenschutz & Sicherheit Meine Privatsphäre Bilder automatisch akzeptieren + *** Transfer images faster (BETA) Link-Vorschau senden 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 fad7078b8d..46d4d681a6 100644 --- a/apps/android/app/src/main/res/values-ru/strings.xml +++ b/apps/android/app/src/main/res/values-ru/strings.xml @@ -549,6 +549,7 @@ Конфиденциальность Конфиденциальность Автоприем изображений + Передавать изображения быстрее (BETA) Отправлять картинки ссылок diff --git a/apps/android/app/src/main/res/values/strings.xml b/apps/android/app/src/main/res/values/strings.xml index a576e9c1ec..16729b912c 100644 --- a/apps/android/app/src/main/res/values/strings.xml +++ b/apps/android/app/src/main/res/values/strings.xml @@ -549,6 +549,7 @@ Privacy & security Your privacy Auto-accept images + Transfer images faster (BETA) Send link previews