Commit 44807351 authored by Alex Catarineu's avatar Alex Catarineu Committed by Matthew Finkel
Browse files

Bug 40007: Port external helper app prompting

Together with the corresponding fenix patch, this allows all `startActivity`
that may open external apps to be replaced by `TorUtils.startActivityPrompt`.
parent f6027eb0
Loading
Loading
Loading
Loading
+1 −0
Changes for components/feature/app-links/build.gradle: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ dependencies {

    implementation Dependencies.kotlin_stdlib
    implementation Dependencies.kotlin_coroutines
    implementation project(path: ':support-utils')

    testImplementation project(':support-test')
    testImplementation project(':support-test-libstate')
+1 −1
Changes for components/feature/app-links/src/main/java/mozilla/components/feature/app/links/AppLinksFeature.kt: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ class AppLinksFeature(
            )
        }

        if (!tab.content.private || fragmentManager == null) {
        if (true || !tab.content.private || fragmentManager == null) {
            doOpenApp()
            return
        }
+2 −1
Changes for components/feature/app-links/src/main/java/mozilla/components/feature/app/links/AppLinksUseCases.kt: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import mozilla.components.support.ktx.android.net.isHttpOrHttps
import java.lang.Exception
import java.lang.NullPointerException
import java.net.URISyntaxException
import mozilla.components.support.utils.TorUtils

private const val EXTRA_BROWSER_FALLBACK_URL = "browser_fallback_url"
private const val MARKET_INTENT_URI_PACKAGE_PREFIX = "market://details?id="
@@ -211,7 +212,7 @@ class AppLinksUseCases(
                    if (launchInNewTask) {
                        it.flags = it.flags or Intent.FLAG_ACTIVITY_NEW_TASK
                    }
                    context.startActivity(it)
                    TorUtils.startActivityPrompt(context, it)
                } catch (e: Exception) {
                    when (e) {
                        is ActivityNotFoundException, is SecurityException, is NullPointerException -> {
+2 −1
Changes for components/feature/contextmenu/src/main/java/mozilla/components/feature/contextmenu/ContextMenuCandidate.kt: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import mozilla.components.support.ktx.android.content.addContact
import mozilla.components.support.ktx.android.content.share
import mozilla.components.support.ktx.kotlin.stripMailToProtocol
import mozilla.components.support.ktx.kotlin.takeOrReplace
import mozilla.components.support.utils.TorUtils

/**
 * A candidate for an item to be displayed in the context menu.
@@ -326,7 +327,7 @@ data class ContextMenuCandidate(
                    context.getString(R.string.mozac_feature_contextmenu_share_link)
                ).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)

                context.startActivity(shareIntent)
                TorUtils.startActivityPrompt(context, shareIntent)
            }
        )

+2 −1
Changes for components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ import mozilla.components.support.ktx.kotlin.ifNullOrEmpty
import mozilla.components.support.ktx.kotlin.sanitizeURL
import mozilla.components.support.ktx.kotlinx.coroutines.throttleLatest
import mozilla.components.support.utils.DownloadUtils
import mozilla.components.support.utils.TorUtils
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
@@ -979,7 +980,7 @@ abstract class AbstractFetchDownloadService : Service() {
            }

            return try {
                context.startActivity(newIntent)
                TorUtils.startActivityPrompt(context, newIntent)
                true
            } catch (error: ActivityNotFoundException) {
                false
Loading