From 6dd2f47fc99fe9881f1b1ecd893015252d37ccc2 Mon Sep 17 00:00:00 2001 From: davotoula Date: Fri, 12 Sep 2025 21:39:57 +0200 Subject: [PATCH 1/2] catch exception when sharing image Show toast --- .../ui/components/ZoomableContentView.kt | 31 ++++++++++++------- amethyst/src/main/res/values/strings.xml | 1 + 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt index 888e81e29..12fa577dc 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/components/ZoomableContentView.kt @@ -22,6 +22,8 @@ package com.vitorpamplona.amethyst.ui.components import android.content.Context import android.content.Intent +import android.util.Log +import android.widget.Toast import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.AnimatedVisibilityScope import androidx.compose.animation.fadeIn @@ -786,21 +788,26 @@ private suspend fun shareImageFile( videoUri: String, mimeType: String?, ) { - // Get sharable URI and file extension - val (uri, fileExtension) = ShareHelper.getSharableUriFromUrl(context, videoUri) + try { + // Get sharable URI and file extension + val (uri, fileExtension) = ShareHelper.getSharableUriFromUrl(context, videoUri) - // Determine mime type, use provided or derive from extension - val determinedMimeType = mimeType ?: "image/$fileExtension" + // Determine mime type, use provided or derive from extension + val determinedMimeType = mimeType ?: "image/$fileExtension" - // Create share intent - val shareIntent = - Intent(Intent.ACTION_SEND).apply { - type = determinedMimeType - putExtra(Intent.EXTRA_STREAM, uri) - addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) - } + // Create share intent + val shareIntent = + Intent(Intent.ACTION_SEND).apply { + type = determinedMimeType + putExtra(Intent.EXTRA_STREAM, uri) + addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) + } - context.startActivity(Intent.createChooser(shareIntent, null)) + context.startActivity(Intent.createChooser(shareIntent, null)) + } catch (e: Exception) { + Log.w("ZoomableContentView", "Failed to share image: $videoUri", e) + Toast.makeText(context, context.getString(R.string.unable_to_share_image), Toast.LENGTH_SHORT).show() + } } private fun verifyHash(content: MediaUrlContent): Boolean? { diff --git a/amethyst/src/main/res/values/strings.xml b/amethyst/src/main/res/values/strings.xml index 0c41605dc..1cb4a92c5 100644 --- a/amethyst/src/main/res/values/strings.xml +++ b/amethyst/src/main/res/values/strings.xml @@ -1238,6 +1238,7 @@ Chat Relay The relay that all users of this chat connect to Share image… + Unable to share image, please try again later… Search hashtag: #%1$s From 613978d7ba9f3e95f50130489f37861b141f35d7 Mon Sep 17 00:00:00 2001 From: Crowdin Bot Date: Sat, 13 Sep 2025 14:48:30 +0000 Subject: [PATCH 2/2] New Crowdin translations by GitHub Action --- amethyst/src/main/res/values-pl-rPL/strings.xml | 1 + amethyst/src/main/res/values-zh-rCN/strings.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/amethyst/src/main/res/values-pl-rPL/strings.xml b/amethyst/src/main/res/values-pl-rPL/strings.xml index c38a05009..82fe2b56d 100644 --- a/amethyst/src/main/res/values-pl-rPL/strings.xml +++ b/amethyst/src/main/res/values-pl-rPL/strings.xml @@ -437,6 +437,7 @@ Nie Lista obserwowanych Obserwowane + Wszyscy obserwujący Obserwuje przez proxy W pobliżu Wszystkie diff --git a/amethyst/src/main/res/values-zh-rCN/strings.xml b/amethyst/src/main/res/values-zh-rCN/strings.xml index 9877508b4..0cac7d7bb 100644 --- a/amethyst/src/main/res/values-zh-rCN/strings.xml +++ b/amethyst/src/main/res/values-zh-rCN/strings.xml @@ -440,6 +440,7 @@ 关注列表 所有关注 + 所有用户关注 通过代理关注 周围的人 全球