From ae38a3fdface25e112accdf017f59e1020ff9cb3 Mon Sep 17 00:00:00 2001 From: Tuomas Airaksinen Date: Thu, 14 Sep 2023 16:24:40 +0300 Subject: [PATCH] Force-ask if user wants to open links (for in-document external links) (#1825) --- .../android/view/activity/page/BibleJavascriptInterface.kt | 2 +- app/src/main/java/net/bible/service/common/CommonUtils.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/net/bible/android/view/activity/page/BibleJavascriptInterface.kt b/app/src/main/java/net/bible/android/view/activity/page/BibleJavascriptInterface.kt index 530406b332..a460888a68 100644 --- a/app/src/main/java/net/bible/android/view/activity/page/BibleJavascriptInterface.kt +++ b/app/src/main/java/net/bible/android/view/activity/page/BibleJavascriptInterface.kt @@ -260,7 +260,7 @@ class BibleJavascriptInterface( } } else -> { - CommonUtils.openLink(link) + CommonUtils.openLink(link, forceAsk=true) } } } diff --git a/app/src/main/java/net/bible/service/common/CommonUtils.kt b/app/src/main/java/net/bible/service/common/CommonUtils.kt index 447259843a..2c633984fe 100644 --- a/app/src/main/java/net/bible/service/common/CommonUtils.kt +++ b/app/src/main/java/net/bible/service/common/CommonUtils.kt @@ -1015,9 +1015,9 @@ object CommonUtils : CommonUtilsBase() { d.findViewById(android.R.id.message)!!.movementMethod = LinkMovementMethod.getInstance() } - fun openLink(link: String) { + fun openLink(link: String, forceAsk: Boolean = false) { val activity = CurrentActivityHolder.currentActivity!! - if (isDiscrete) { + if (isDiscrete || forceAsk) { activity.lifecycleScope.launch(Dispatchers.Main) { if(Dialogs.simpleQuestion(activity, message = net.bible.android.view.activity.page.application.getString(R.string.external_link_question, link),