mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-09 15:27:55 -04:00
#4083 fixed external link popup not showing for external links not for donation
This commit is contained in:
parent
b9d662f3da
commit
393d645918
@ -128,7 +128,6 @@ class GetContentShortcutTest {
|
|||||||
clickSettingsOnSideNav(SettingsRobot::assertMenuSettingsDisplayed)
|
clickSettingsOnSideNav(SettingsRobot::assertMenuSettingsDisplayed)
|
||||||
clickHelpOnSideNav(HelpRobot::assertToolbarDisplayed)
|
clickHelpOnSideNav(HelpRobot::assertToolbarDisplayed)
|
||||||
clickSupportKiwixOnSideNav()
|
clickSupportKiwixOnSideNav()
|
||||||
assertExternalLinkDialogDisplayed()
|
|
||||||
pressBack()
|
pressBack()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1677,10 +1677,6 @@ abstract class CoreReaderFragment :
|
|||||||
externalLinkOpener?.openExternalUrl(intent)
|
externalLinkOpener?.openExternalUrl(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun openExternalUrl(intent: Intent, showExternalLinkPopup: Boolean) {
|
|
||||||
externalLinkOpener?.openExternalUrl(intent, showExternalLinkPopup)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun showSaveOrOpenUnsupportedFilesDialog(url: String, documentType: String?) {
|
override fun showSaveOrOpenUnsupportedFilesDialog(url: String, documentType: String?) {
|
||||||
unsupportedMimeTypeHandler?.showSaveOrOpenUnsupportedFilesDialog(
|
unsupportedMimeTypeHandler?.showSaveOrOpenUnsupportedFilesDialog(
|
||||||
url,
|
url,
|
||||||
|
@ -33,14 +33,10 @@ class ExternalLinkOpener @Inject constructor(
|
|||||||
private val alertDialogShower: AlertDialogShower
|
private val alertDialogShower: AlertDialogShower
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun openExternalUrl(intent: Intent) {
|
fun openExternalUrl(
|
||||||
// Show popup with warning that this url is external and could lead to additional costs
|
intent: Intent,
|
||||||
// or may event not work when the user is offline.
|
showExternalLinkPopup: Boolean = sharedPreferenceUtil.prefExternalLinkPopup
|
||||||
openExternalUrl(intent, sharedPreferenceUtil.prefExternalLinkPopup)
|
) {
|
||||||
}
|
|
||||||
|
|
||||||
// Overload for ignoring sharedPreferenceUtil.prefExternalLinkPopup
|
|
||||||
fun openExternalUrl(intent: Intent, showExternalLinkPopup: Boolean) {
|
|
||||||
if (intent.resolveActivity(activity.packageManager) != null) {
|
if (intent.resolveActivity(activity.packageManager) != null) {
|
||||||
if (showExternalLinkPopup) {
|
if (showExternalLinkPopup) {
|
||||||
requestOpenLink(intent)
|
requestOpenLink(intent)
|
||||||
|
@ -170,12 +170,16 @@ class CustomMainActivity : CoreMainActivity() {
|
|||||||
override fun onNavigationItemSelected(item: MenuItem): Boolean {
|
override fun onNavigationItemSelected(item: MenuItem): Boolean {
|
||||||
return when (item.itemId) {
|
return when (item.itemId) {
|
||||||
org.kiwix.kiwixmobile.core.R.id.menu_about_app -> {
|
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
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
org.kiwix.kiwixmobile.core.R.id.menu_support_kiwix -> {
|
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
|
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 getIconResId() = R.mipmap.ic_launcher
|
||||||
|
|
||||||
override fun createApplicationShortcuts() {
|
override fun createApplicationShortcuts() {
|
||||||
|
@ -348,7 +348,7 @@ class CustomReaderFragment : CoreReaderFragment() {
|
|||||||
|
|
||||||
override fun openKiwixSupportUrl() {
|
override fun openKiwixSupportUrl() {
|
||||||
if (BuildConfig.SUPPORT_URL.isNotEmpty()) {
|
if (BuildConfig.SUPPORT_URL.isNotEmpty()) {
|
||||||
openExternalUrl(BuildConfig.SUPPORT_URL.toUri().browserIntent(), false)
|
externalLinkOpener?.openExternalUrl(BuildConfig.SUPPORT_URL.toUri().browserIntent(), false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user