From 1db46d6a8430be8063d9d2f25a1c00a0b5409262 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 18 Oct 2025 08:48:12 +0000 Subject: [PATCH 1/2] Initial plan From 12014b219004bdccac941287cc9e840ee7e645dd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 18 Oct 2025 08:55:14 +0000 Subject: [PATCH 2/2] Add "Open with" option to 3 dots menu for browser selection Co-authored-by: yogeshpaliyal <9381846+yogeshpaliyal@users.noreply.github.com> --- .../deepr/ui/screens/home/DeeprItem.kt | 18 +++++++++++++++ .../deepr/ui/screens/home/Home.kt | 6 +++++ .../com/yogeshpaliyal/deepr/util/Utils.kt | 23 +++++++++++++++++++ app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-hi/strings.xml | 1 + app/src/main/res/values-ur/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 9 files changed, 53 insertions(+) diff --git a/app/src/main/java/com/yogeshpaliyal/deepr/ui/screens/home/DeeprItem.kt b/app/src/main/java/com/yogeshpaliyal/deepr/ui/screens/home/DeeprItem.kt index c8aca8ef..9970b519 100644 --- a/app/src/main/java/com/yogeshpaliyal/deepr/ui/screens/home/DeeprItem.kt +++ b/app/src/main/java/com/yogeshpaliyal/deepr/ui/screens/home/DeeprItem.kt @@ -47,6 +47,7 @@ import com.yogeshpaliyal.deepr.R import com.yogeshpaliyal.deepr.Tags import compose.icons.TablerIcons import compose.icons.tablericons.DotsVertical +import compose.icons.tablericons.ExternalLink import compose.icons.tablericons.Note import compose.icons.tablericons.Refresh import java.text.DateFormat @@ -61,6 +62,10 @@ sealed class MenuItem( item: GetLinksAndTags, ) : MenuItem(item) + class OpenWith( + item: GetLinksAndTags, + ) : MenuItem(item) + class Shortcut( item: GetLinksAndTags, ) : MenuItem(item) @@ -233,6 +238,19 @@ fun DeeprItem( }, ) } + DropdownMenuItem( + text = { Text(stringResource(R.string.open_with)) }, + onClick = { + onItemClick(MenuItem.OpenWith(account)) + expanded = false + }, + leadingIcon = { + Icon( + TablerIcons.ExternalLink, + contentDescription = stringResource(R.string.open_with), + ) + }, + ) // Display last opened time if (account.lastOpenedAt != null) { diff --git a/app/src/main/java/com/yogeshpaliyal/deepr/ui/screens/home/Home.kt b/app/src/main/java/com/yogeshpaliyal/deepr/ui/screens/home/Home.kt index e265bd3e..c60dc772 100644 --- a/app/src/main/java/com/yogeshpaliyal/deepr/ui/screens/home/Home.kt +++ b/app/src/main/java/com/yogeshpaliyal/deepr/ui/screens/home/Home.kt @@ -86,6 +86,7 @@ import com.yogeshpaliyal.deepr.util.QRScanner import com.yogeshpaliyal.deepr.util.isValidDeeplink import com.yogeshpaliyal.deepr.util.normalizeLink import com.yogeshpaliyal.deepr.util.openDeeplink +import com.yogeshpaliyal.deepr.util.openDeeplinkWithChooser import com.yogeshpaliyal.deepr.viewmodel.AccountViewModel import compose.icons.TablerIcons import compose.icons.tablericons.ArrowLeft @@ -485,6 +486,11 @@ fun Content( openDeeplink(context, it.item.link) } + is MenuItem.OpenWith -> { + viewModel.incrementOpenedCount(it.item.id) + openDeeplinkWithChooser(context, it.item.link) + } + is MenuItem.Delete -> showDeleteConfirmDialog = it.item is MenuItem.Edit -> editDeepr(it.item) is MenuItem.FavouriteClick -> viewModel.toggleFavourite(it.item.id) diff --git a/app/src/main/java/com/yogeshpaliyal/deepr/util/Utils.kt b/app/src/main/java/com/yogeshpaliyal/deepr/util/Utils.kt index d3c77edf..79236443 100644 --- a/app/src/main/java/com/yogeshpaliyal/deepr/util/Utils.kt +++ b/app/src/main/java/com/yogeshpaliyal/deepr/util/Utils.kt @@ -33,6 +33,29 @@ fun openDeeplink( } } +fun openDeeplinkWithChooser( + context: Context, + link: String, +): Boolean { + if (!isValidDeeplink(link)) return false + val normalizedLink = normalizeLink(link) + return try { + val intent = Intent(Intent.ACTION_VIEW, normalizedLink.toUri()) + val chooserIntent = Intent.createChooser(intent, null) + context.startActivity(chooserIntent) + true + } catch (e: Exception) { + e.printStackTrace() + Toast + .makeText( + context, + context.getString(R.string.invalid_deeplink_toast, normalizedLink), + Toast.LENGTH_SHORT, + ).show() + false + } +} + fun getShortcutAppIcon( context: Context, link: String, diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 0c9c1b6b..5f5b1c3d 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -25,6 +25,7 @@ Weitere Optionen + Öffnen mit Link kopieren Link kopiert Löschen diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 49727448..c5d88f05 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -25,6 +25,7 @@ Más opciones + Abrir con Copiar enlace Enlace copiado Eliminar diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 0078ab57..7cdc8ea6 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -25,6 +25,7 @@ Plus d\'options + Ouvrir avec Copier le lien Lien copié Supprimer diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml index 3ab97cc8..45518ba6 100644 --- a/app/src/main/res/values-hi/strings.xml +++ b/app/src/main/res/values-hi/strings.xml @@ -25,6 +25,7 @@ अधिक विकल्प + इसके साथ खोलें लिंक कॉपी करें लिंक कॉपी किया गया हटाएं diff --git a/app/src/main/res/values-ur/strings.xml b/app/src/main/res/values-ur/strings.xml index 6f03fe40..8eae7c18 100644 --- a/app/src/main/res/values-ur/strings.xml +++ b/app/src/main/res/values-ur/strings.xml @@ -25,6 +25,7 @@ مزید اختیارات + اس کے ساتھ کھولیں لنک کاپی کریں لنک کاپی ہو گیا حذف کریں diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 325c6db7..11b079e5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -28,6 +28,7 @@ More options + Open with Copy link Link copied Delete