diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/chat/ComposeView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/chat/ComposeView.kt index 560e9525c..4aabd428a 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/chat/ComposeView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/chat/ComposeView.kt @@ -14,6 +14,7 @@ import android.os.Build import android.provider.MediaStore import android.webkit.MimeTypeMap import android.widget.Toast +import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContract import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.CircleShape @@ -260,13 +261,17 @@ fun ComposeView( } } } - val mediaLauncherWithFiles = rememberGetMultipleContentsLauncher { processPickedMedia(it, null) } + val galleryImageLauncher = rememberLauncherForActivityResult(contract = PickMultipleImagesFromGallery()) { processPickedMedia(it, null) } + val galleryImageLauncherFallback = rememberGetMultipleContentsLauncher { processPickedMedia(it, null) } + val galleryVideoLauncher = rememberLauncherForActivityResult(contract = PickMultipleVideosFromGallery()) { processPickedMedia(it, null) } + val galleryVideoLauncherFallback = rememberGetMultipleContentsLauncher { processPickedMedia(it, null) } + val filesLauncher = rememberGetContentLauncher { processPickedFile(it, null) } val recState: MutableState = remember { mutableStateOf(RecordingState.NotStarted) } LaunchedEffect(attachmentOption.value) { when (attachmentOption.value) { - AttachmentOption.TakePhoto -> { + AttachmentOption.CameraPhoto -> { when (PackageManager.PERMISSION_GRANTED) { ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) -> { cameraLauncher.launchWithFallback() @@ -277,11 +282,23 @@ fun ComposeView( } attachmentOption.value = null } - AttachmentOption.PickMedia -> { - mediaLauncherWithFiles.launch("image/*;video/*") + AttachmentOption.GalleryImage -> { + try { + galleryImageLauncher.launch(0) + } catch (e: ActivityNotFoundException) { + galleryImageLauncherFallback.launch("image/*") + } attachmentOption.value = null } - AttachmentOption.PickFile -> { + AttachmentOption.GalleryVideo -> { + try { + galleryVideoLauncher.launch(0) + } catch (e: ActivityNotFoundException) { + galleryVideoLauncherFallback.launch("video/*") + } + attachmentOption.value = null + } + AttachmentOption.File -> { filesLauncher.launch("*/*") attachmentOption.value = null } diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/helpers/ChooseAttachmentView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/helpers/ChooseAttachmentView.kt index 9d8121f3a..41237633b 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/helpers/ChooseAttachmentView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/helpers/ChooseAttachmentView.kt @@ -13,9 +13,10 @@ import chat.simplex.app.R import chat.simplex.app.views.newchat.ActionButton sealed class AttachmentOption { - object TakePhoto: AttachmentOption() - object PickMedia: AttachmentOption() - object PickFile: AttachmentOption() + object CameraPhoto: AttachmentOption() + object GalleryImage: AttachmentOption() + object GalleryVideo: AttachmentOption() + object File: AttachmentOption() } @Composable @@ -38,15 +39,19 @@ fun ChooseAttachmentView( horizontalArrangement = Arrangement.SpaceEvenly ) { ActionButton(null, stringResource(R.string.use_camera_button), icon = Icons.Outlined.PhotoCamera) { - attachmentOption.value = AttachmentOption.TakePhoto + attachmentOption.value = AttachmentOption.CameraPhoto hide() } - ActionButton(null, stringResource(R.string.from_gallery_button), icon = Icons.Outlined.Collections) { - attachmentOption.value = AttachmentOption.PickMedia + ActionButton(null, stringResource(R.string.gallery_image_button), icon = Icons.Outlined.Image) { + attachmentOption.value = AttachmentOption.GalleryImage + hide() + } + ActionButton(null, stringResource(R.string.gallery_video_button), icon = Icons.Outlined.SmartDisplay) { + attachmentOption.value = AttachmentOption.GalleryVideo hide() } ActionButton(null, stringResource(R.string.choose_file), icon = Icons.Outlined.InsertDriveFile) { - attachmentOption.value = AttachmentOption.PickFile + attachmentOption.value = AttachmentOption.File hide() } } diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/helpers/GetImageView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/helpers/GetImageView.kt index d05b86390..c50d43417 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/helpers/GetImageView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/helpers/GetImageView.kt @@ -18,8 +18,7 @@ import androidx.activity.result.contract.ActivityResultContracts import androidx.annotation.CallSuper import androidx.compose.foundation.layout.* import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.outlined.Collections -import androidx.compose.material.icons.outlined.PhotoCamera +import androidx.compose.material.icons.outlined.* import androidx.compose.runtime.* import androidx.compose.runtime.saveable.Saver import androidx.compose.runtime.saveable.rememberSaveable @@ -259,7 +258,7 @@ fun GetImageBottomSheet( } } } - ActionButton(null, stringResource(R.string.from_gallery_button), icon = Icons.Outlined.Collections) { + ActionButton(null, stringResource(R.string.from_gallery_button), icon = Icons.Outlined.Image) { try { galleryLauncher.launch(0) } catch (e: ActivityNotFoundException) { 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 d24300a0e..d915440f3 100644 --- a/apps/android/app/src/main/res/values-cs/strings.xml +++ b/apps/android/app/src/main/res/values-cs/strings.xml @@ -186,9 +186,11 @@ (sdílet s kontaktem) (uloženo pouze členy skupiny) Oprávnění zamítnuto! - Použít fotoaparát + Fotoaparát Z Galerie - Vybrat soubor + Soubor + Obrázek + Video Pro zahájení nové konverzace Klepněte na tlačítko potom: 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 ae6404f0c..01f5e3c94 100644 --- a/apps/android/app/src/main/res/values-de/strings.xml +++ b/apps/android/app/src/main/res/values-de/strings.xml @@ -254,9 +254,11 @@ (Wird nur von Gruppenmitgliedern gespeichert) Berechtigung verweigert! - Kamera\nverwenden + Kamera Aus dem\nFotoalbum - Datei\nauswählen + Datei + Bild + Video Danke, dass Sie SimpleX Chat installiert haben! Sie können sich mit SimpleX Chat Entwicklern verbinden, um Fragen zu stellen und Updates zu erhalten. diff --git a/apps/android/app/src/main/res/values-es/strings.xml b/apps/android/app/src/main/res/values-es/strings.xml index 00183ab27..e4313d3aa 100644 --- a/apps/android/app/src/main/res/values-es/strings.xml +++ b/apps/android/app/src/main/res/values-es/strings.xml @@ -263,7 +263,7 @@ Limpiar ¿Cambiar rol de grupo\? Compara los códigos de seguridad con tus contactos - Elije archivo + Archivo Limpiar Limpiar chat Configurar servidores ICE @@ -359,6 +359,8 @@ Error al guardar archivo Error De la Galería + Imagen + Video Si has recibido el enlace de invitación a SimpleX Chat, puedes abrirlo en tu navegador: Si eliges rechazar, el remitente NO será notificado. ¡Enlace no válido! @@ -748,7 +750,7 @@ no leído Escribe un nombre para el contacto… ¿Cambiar dirección de recepción\? - Usar cámara + Cámara ¡El contacto con el que has compartido este enlace NO podrá conectarse! Mostrar código QR ¡El enlace no es un enlace de conexión válido! 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 ab3fa09c3..2489d62d6 100644 --- a/apps/android/app/src/main/res/values-fr/strings.xml +++ b/apps/android/app/src/main/res/values-fr/strings.xml @@ -201,7 +201,9 @@ (à partager avec votre contact) Créer un groupe secret Depuis la Phototèque - Choisir le fichier + Fichier + Image + Vidéo Pour démarrer une nouvelle discussion Appuyez sur le bouton Scanner un code QR : pour vous connecter à votre contact qui vous montre un code QR. @@ -294,7 +296,7 @@ En attente du fichier Message vocal Autorisation refusée ! - Utiliser l\'Appareil photo + Appareil\nphoto Merci d\'avoir installé SimpleX Chat ! Vous pouvez vous connecter aux développeurs de SimpleX Chat pour leur poser des questions et recevoir des réponses :. ci-dessus, puis : 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 fba2709de..b53d01772 100644 --- a/apps/android/app/src/main/res/values-it/strings.xml +++ b/apps/android/app/src/main/res/values-it/strings.xml @@ -298,7 +298,7 @@ Nome da mostrare Aggiungi un contatto: per creare il tuo codice QR una tantum per il tuo contatto. Scansiona codice QR: per connetterti al contatto che ti mostra il codice QR. - Scegli file + File Svuota chat Svuotare la chat\? Svuota @@ -308,6 +308,8 @@ Crea gruppo segreto 💻 desktop: scansiona dall\'app il codice QR mostrato, tramite Scansiona codice QR. Dalla Galleria + Immagine + Video Se scegli di rifiutare, il mittente NON verrà avvisato. Svuota Pulsante di chiusura @@ -545,7 +547,7 @@ Per connettersi via link (da condividere con il tuo contatto) Per iniziare una nuova chat - Usa la fotocamera + Fotocamera Puoi connetterti con gli sviluppatori di SimpleX Chat per porre domande e ricevere aggiornamenti. Link non valido! Codice QR non valido diff --git a/apps/android/app/src/main/res/values-nl/strings.xml b/apps/android/app/src/main/res/values-nl/strings.xml index 3679f8f89..7829957b5 100644 --- a/apps/android/app/src/main/res/values-nl/strings.xml +++ b/apps/android/app/src/main/res/values-nl/strings.xml @@ -385,6 +385,8 @@ Bestand niet gevonden Bestand opgeslagen Galerij + Foto + Video Fout bij opslaan van ICE servers geëindigd Groepsleden kunnen verdwijnende berichten sturen. diff --git a/apps/android/app/src/main/res/values-pl/strings.xml b/apps/android/app/src/main/res/values-pl/strings.xml index 282bd5b01..1e0b0aef5 100644 --- a/apps/android/app/src/main/res/values-pl/strings.xml +++ b/apps/android/app/src/main/res/values-pl/strings.xml @@ -224,9 +224,9 @@ Zeskanuj kod QR Rozpocznij nowy czat (aby udostępnić Twojemu kontaktowi) - Wybierz plik + Plik Odmowa Uprawnienia! - Użyj Aparatu + Aparatu Akceptuj Akceptuj incognito Wszystkie wiadomości zostaną usunięte - nie można tego cofnąć! Wiadomości zostaną usunięte TYLKO dla Ciebie. @@ -968,6 +968,8 @@ \n- usuwać wiadomości członków. \n- wyłączyć członków (rola \"obserwatora\") Z Galerii + Obraz + Wideo zaproponował %s: %2s Tylko właściciele grup mogą włączyć wiadomości głosowe. Hosty onion nie będą używane. diff --git a/apps/android/app/src/main/res/values-pt-rBR/strings.xml b/apps/android/app/src/main/res/values-pt-rBR/strings.xml index caa0fd137..6d50174f7 100644 --- a/apps/android/app/src/main/res/values-pt-rBR/strings.xml +++ b/apps/android/app/src/main/res/values-pt-rBR/strings.xml @@ -24,7 +24,7 @@ Pediu para receber a imagem Cancelar mensagem ao vivo Voltar - Selecione o arquivo + Arquivo Adicionar novo contato: para criar seu QR code de uso único para seu contato. Escanear código QR: para se conectar ao seu contato que mostra o código QR para você. Aceitar @@ -352,6 +352,7 @@ anônimo via link único Ocultar Da Galeria + Vídeo Os membros do grupo podem enviar mensagens que desaparecem. Arquivo Nome completo: @@ -499,7 +500,7 @@ Salvar cor interface italiana Notificações periódicas - Usar câmera + Câmera Seus servidores ICE Seus servidores ICE Sua privacidade 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 afa9b408b..5b893d8ba 100644 --- a/apps/android/app/src/main/res/values-ru/strings.xml +++ b/apps/android/app/src/main/res/values-ru/strings.xml @@ -258,7 +258,9 @@ Разрешение не получено! Камера Галерея - Файлы + Изображение + Видео + Файл Спасибо, что установили SimpleX Chat! Вы можете соединиться с разработчиками, чтобы задать любые вопросы или получать уведомления о новых версиях. diff --git a/apps/android/app/src/main/res/values-zh-rCN/strings.xml b/apps/android/app/src/main/res/values-zh-rCN/strings.xml index a73b7af97..f332936ae 100644 --- a/apps/android/app/src/main/res/values-zh-rCN/strings.xml +++ b/apps/android/app/src/main/res/values-zh-rCN/strings.xml @@ -238,7 +238,7 @@ 已连接 连接 连接 - 选择文件 + 文件 聊天资料 按聊天资料(默认)或按连接(BETA)。 检查服务器地址并再试一次。 @@ -435,6 +435,8 @@ 目前支持的最大文件尺寸是 %1$s 文件将在您的联系人在线时收到,请稍等或稍后再查看! 从图库 + 照片 + 视频 退出而不保存 翻转相机 启用自动删除消息? @@ -855,7 +857,7 @@ 权限被拒绝! 点击按钮 感谢您安装 SimpleX Chat - 使用相机 + 相机 预设服务器地址 扫描服务器二维码 服务器测试失败! diff --git a/apps/android/app/src/main/res/values-zh-rTW/strings.xml b/apps/android/app/src/main/res/values-zh-rTW/strings.xml index fcea69d46..f35979aed 100644 --- a/apps/android/app/src/main/res/values-zh-rTW/strings.xml +++ b/apps/android/app/src/main/res/values-zh-rTW/strings.xml @@ -52,7 +52,7 @@ 新增新的聯絡人:新增新的聯絡人可以使用二維碼建立你的一次性二維碼。 掃描二維碼:連接到向你出示二維碼的聯絡人。 選擇檔案 - 使用相機 + 相機 從圖片庫選擇圖片 接受匿名聊天模式 所有訊息記錄會刪除 - 這不能還原!這些訊息只會在你裝置中刪除。 diff --git a/apps/android/app/src/main/res/values/strings.xml b/apps/android/app/src/main/res/values/strings.xml index 3717e8224..1be28ae23 100644 --- a/apps/android/app/src/main/res/values/strings.xml +++ b/apps/android/app/src/main/res/values/strings.xml @@ -360,9 +360,11 @@ Permission Denied! - Use Camera + Camera From Gallery - Choose file + File + Image + Video Thank you for installing SimpleX Chat!