Verified Commit f980f6cf authored by Alex Catarineu's avatar Alex Catarineu Committed by Pier Angelo Vendrame
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 e4d552ec
Loading
Loading
Loading
Loading
+1 −0
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
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ class AppLinksFeature(
            )
        }

        if (!tab.content.private || fragmentManager == null) {
        if (true || !tab.content.private || fragmentManager == null) {
            doOpenApp()
            return
        }
+2 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import java.lang.Exception
import java.lang.NullPointerException
import java.lang.NumberFormatException
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="
@@ -209,7 +210,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 -> {
+3 −1
Original line number Diff line number Diff line
@@ -27,6 +27,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.
@@ -438,7 +439,8 @@ data class ContextMenuCandidate(
                    flags = Intent.FLAG_ACTIVITY_NEW_TASK
                    putExtra(Intent.EXTRA_TEXT, hitResult.getLink())
                }
                context.startActivity(
                TorUtils.startActivityPrompt(
                    context,
                    createShareIntent(
                        intent,
                        context,
+2 −1
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
@@ -953,7 +954,7 @@ abstract class AbstractFetchDownloadService : Service() {
            }

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