#4083 fixed external link popup not showing for external links not for donation

This commit is contained in:
ArctikCircle 2024-12-12 15:09:43 +05:30 committed by MohitMaliFtechiz
parent b9d662f3da
commit 393d645918
5 changed files with 11 additions and 23 deletions

View File

@ -128,7 +128,6 @@ class GetContentShortcutTest {
clickSettingsOnSideNav(SettingsRobot::assertMenuSettingsDisplayed)
clickHelpOnSideNav(HelpRobot::assertToolbarDisplayed)
clickSupportKiwixOnSideNav()
assertExternalLinkDialogDisplayed()
pressBack()
}
}

View File

@ -1677,10 +1677,6 @@ abstract class CoreReaderFragment :
externalLinkOpener?.openExternalUrl(intent)
}
fun openExternalUrl(intent: Intent, showExternalLinkPopup: Boolean) {
externalLinkOpener?.openExternalUrl(intent, showExternalLinkPopup)
}
override fun showSaveOrOpenUnsupportedFilesDialog(url: String, documentType: String?) {
unsupportedMimeTypeHandler?.showSaveOrOpenUnsupportedFilesDialog(
url,

View File

@ -33,14 +33,10 @@ class ExternalLinkOpener @Inject constructor(
private val alertDialogShower: AlertDialogShower
) {
fun openExternalUrl(intent: Intent) {
// Show popup with warning that this url is external and could lead to additional costs
// or may event not work when the user is offline.
openExternalUrl(intent, sharedPreferenceUtil.prefExternalLinkPopup)
}
// Overload for ignoring sharedPreferenceUtil.prefExternalLinkPopup
fun openExternalUrl(intent: Intent, showExternalLinkPopup: Boolean) {
fun openExternalUrl(
intent: Intent,
showExternalLinkPopup: Boolean = sharedPreferenceUtil.prefExternalLinkPopup
) {
if (intent.resolveActivity(activity.packageManager) != null) {
if (showExternalLinkPopup) {
requestOpenLink(intent)

View File

@ -170,12 +170,16 @@ class CustomMainActivity : CoreMainActivity() {
override fun onNavigationItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
org.kiwix.kiwixmobile.core.R.id.menu_about_app -> {
openExternalUrl(BuildConfig.ABOUT_APP_URL)
if (BuildConfig.ABOUT_APP_URL.isNotEmpty()) {
externalLinkOpener.openExternalUrl(BuildConfig.ABOUT_APP_URL.toUri().browserIntent())
}
true
}
org.kiwix.kiwixmobile.core.R.id.menu_support_kiwix -> {
openExternalUrl(BuildConfig.SUPPORT_URL)
if (BuildConfig.SUPPORT_URL.isNotEmpty()) {
externalLinkOpener.openExternalUrl(BuildConfig.SUPPORT_URL.toUri().browserIntent(), false)
}
true
}
@ -183,13 +187,6 @@ class CustomMainActivity : CoreMainActivity() {
}
}
private fun openExternalUrl(url: String) {
// check if the provided url is not empty.
if (url.isNotEmpty()) {
externalLinkOpener.openExternalUrl(url.toUri().browserIntent(), false)
}
}
override fun getIconResId() = R.mipmap.ic_launcher
override fun createApplicationShortcuts() {

View File

@ -348,7 +348,7 @@ class CustomReaderFragment : CoreReaderFragment() {
override fun openKiwixSupportUrl() {
if (BuildConfig.SUPPORT_URL.isNotEmpty()) {
openExternalUrl(BuildConfig.SUPPORT_URL.toUri().browserIntent(), false)
externalLinkOpener?.openExternalUrl(BuildConfig.SUPPORT_URL.toUri().browserIntent(), false)
}
}