1
0
Fork 0

For #7661: Add variant-specific schemas for deep links

In order to target specific variants of Fenix, we're adding schemas that
are specific that app in order to avoid collisions with the other
variants and with other forks of fenix that may have the same schemas.

The current schema for variants:
 - Fenix Nightly: `fenix-nightly://`
 - Fenix Beta: `fenix-beta://`
 - Everything else: `fenix://`
master
Jonathan Almeida 2020-02-27 10:43:43 -05:00 committed by Jonathan Almeida
parent ca05863138
commit ffd4cdd970
4 changed files with 26 additions and 11 deletions

View File

@ -45,9 +45,12 @@ android {
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: 'true'
manifestPlaceholders.isRaptorEnabled = "false"
resValue "bool", "IS_DEBUG", "false"
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "false"
manifestPlaceholders = [
"isRaptorEnabled": "false",
"deepLinkScheme": "fenix"
]
}
def releaseTemplate = {
@ -74,10 +77,12 @@ android {
fenixNightly releaseTemplate >> {
applicationIdSuffix ".fenix.nightly"
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
manifestPlaceholders = ["deepLinkScheme": "fenix-nightly"]
}
fenixBeta releaseTemplate >> {
applicationIdSuffix ".fenix.beta"
buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true"
manifestPlaceholders = ["deepLinkScheme": "fenix-beta"]
}
fenixProduction releaseTemplate >> {
applicationIdSuffix ".fenix"

View File

@ -77,23 +77,23 @@
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="fenix"
<data android:scheme="${deepLinkScheme}"
android:host="home"/>
<data android:scheme="fenix"
<data android:scheme="${deepLinkScheme}"
android:host="settings"/>
<data android:scheme="fenix"
<data android:scheme="${deepLinkScheme}"
android:host="turn_on_sync"/>
<data android:scheme="fenix"
<data android:scheme="${deepLinkScheme}"
android:host="settings_search_engine"/>
<data android:scheme="fenix"
<data android:scheme="${deepLinkScheme}"
android:host="settings_accessibility"/>
<data android:scheme="fenix"
<data android:scheme="${deepLinkScheme}"
android:host="settings_delete_browsing_data"/>
<data android:scheme="fenix"
<data android:scheme="${deepLinkScheme}"
android:host="enable_private_browsing"/>
<data android:scheme="fenix"
<data android:scheme="${deepLinkScheme}"
android:host="open"/>
<data android:scheme="fenix"
<data android:scheme="${deepLinkScheme}"
android:host="make_default_browser"/>
</intent-filter>
</activity>

View File

@ -24,7 +24,8 @@ class DeepLinkIntentProcessor(
) : HomeIntentProcessor {
override fun process(intent: Intent, navController: NavController, out: Intent): Boolean {
return if (intent.scheme == "fenix") {
val scheme = intent.scheme?.contains("fenix") ?: return false
return if (scheme) {
intent.data?.let { handleDeepLink(it, navController) }
true
} else {

View File

@ -58,6 +58,15 @@ class DeepLinkIntentProcessorTest {
verify { out wasNot Called }
}
@Test
fun `return true if scheme is a fenix variant`() {
assertTrue(processor.process(testIntent("fenix-beta://test"), navController, out))
verify { activity wasNot Called }
verify { navController wasNot Called }
verify { out wasNot Called }
}
@Test
fun `process home deep link`() {
assertTrue(processor.process(testIntent("fenix://home"), navController, out))