diff --git a/app/build.gradle b/app/build.gradle index 4f29b5e47..3a3d0deba 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,6 +42,7 @@ android { } def releaseTemplate = { + signingConfig signingConfigs.debug shrinkResources true minifyEnabled true proguardFiles 'proguard-android-optimize-3.5.0-modified.txt', 'proguard-rules.pro' diff --git a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt index 268426dba..033a4827e 100644 --- a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt @@ -9,8 +9,6 @@ import android.content.Intent import android.os.Bundle import android.os.StrictMode import androidx.annotation.VisibleForTesting -import kotlinx.coroutines.MainScope -import kotlinx.coroutines.launch import mozilla.components.feature.intent.processing.IntentProcessor import org.mozilla.fenix.components.IntentProcessorType import org.mozilla.fenix.components.getType @@ -33,19 +31,17 @@ class IntentReceiverActivity : Activity() { super.onCreate(savedInstanceState) } - MainScope().launch { - // The intent property is nullable, but the rest of the code below - // assumes it is not. If it's null, then we make a new one and open - // the HomeActivity. - val intent = intent?.let { Intent(it) } ?: Intent() - intent.stripUnwantedFlags() - processIntent(intent) - } + // The intent property is nullable, but the rest of the code below + // assumes it is not. If it's null, then we make a new one and open + // the HomeActivity. + val intent = intent?.let { Intent(it) } ?: Intent() + intent.stripUnwantedFlags() + processIntent(intent) StartupTimeline.onActivityCreateEndIntentReceiver() } - suspend fun processIntent(intent: Intent) { + fun processIntent(intent: Intent) { // Call process for side effects, short on the first that returns true val processor = getIntentProcessors().firstOrNull { it.process(intent) } val intentProcessorType = components.intentProcessors.getType(processor) diff --git a/app/src/main/java/org/mozilla/fenix/components/Core.kt b/app/src/main/java/org/mozilla/fenix/components/Core.kt index 3f2b0dbf3..9bfe78f1c 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Core.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Core.kt @@ -188,7 +188,7 @@ class Core(private val context: Context) { WebNotificationFeature( context, engine, icons, R.drawable.ic_status_logo, - HomeActivity::class.java + permissionStorage.permissionsStorage, HomeActivity::class.java ) } } diff --git a/app/src/main/java/org/mozilla/fenix/customtabs/FennecWebAppIntentProcessor.kt b/app/src/main/java/org/mozilla/fenix/customtabs/FennecWebAppIntentProcessor.kt index f890dcc3b..c7f9e2860 100644 --- a/app/src/main/java/org/mozilla/fenix/customtabs/FennecWebAppIntentProcessor.kt +++ b/app/src/main/java/org/mozilla/fenix/customtabs/FennecWebAppIntentProcessor.kt @@ -9,6 +9,7 @@ import android.content.Intent import android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT import androidx.annotation.VisibleForTesting import androidx.core.content.ContextCompat +import kotlinx.coroutines.runBlocking import mozilla.components.browser.session.Session import mozilla.components.browser.session.Session.Source import mozilla.components.browser.session.SessionManager @@ -52,28 +53,32 @@ class FennecWebAppIntentProcessor( * A custom tab config is also set so a custom tab toolbar can be shown when the user leaves * the scope defined in the manifest. */ - override suspend fun process(intent: Intent): Boolean { + override fun process(intent: Intent): Boolean { val safeIntent = intent.toSafeIntent() val url = safeIntent.dataString return if (!url.isNullOrEmpty() && matches(intent)) { - val webAppManifest = loadManifest(safeIntent, url) + runBlocking { - val session = Session(url, private = false, source = Source.HOME_SCREEN) - session.webAppManifest = webAppManifest - session.customTabConfig = webAppManifest?.toCustomTabConfig() ?: createFallbackCustomTabConfig() + val webAppManifest = loadManifest(safeIntent, url) - sessionManager.add(session) - loadUrlUseCase(url, session, EngineSession.LoadUrlFlags.external()) + val session = Session(url, private = false, source = Source.HOME_SCREEN) + session.webAppManifest = webAppManifest + session.customTabConfig = + webAppManifest?.toCustomTabConfig() ?: createFallbackCustomTabConfig() - intent.putSessionId(session.id) + sessionManager.add(session) + loadUrlUseCase(url, session, EngineSession.LoadUrlFlags.external()) - if (webAppManifest != null) { - intent.flags = FLAG_ACTIVITY_NEW_DOCUMENT - intent.putWebAppManifest(webAppManifest) + intent.putSessionId(session.id) + + if (webAppManifest != null) { + intent.flags = FLAG_ACTIVITY_NEW_DOCUMENT + intent.putWebAppManifest(webAppManifest) + } + + true } - - true } else { false } diff --git a/app/src/main/java/org/mozilla/fenix/home/intent/FennecBookmarkShortcutsIntentProcessor.kt b/app/src/main/java/org/mozilla/fenix/home/intent/FennecBookmarkShortcutsIntentProcessor.kt index 686347b10..fa51bcc37 100644 --- a/app/src/main/java/org/mozilla/fenix/home/intent/FennecBookmarkShortcutsIntentProcessor.kt +++ b/app/src/main/java/org/mozilla/fenix/home/intent/FennecBookmarkShortcutsIntentProcessor.kt @@ -35,7 +35,7 @@ class FennecBookmarkShortcutsIntentProcessor( * If this is an Intent for a Fennec pinned website shortcut * prepare it for opening website's URL in a new tab. */ - override suspend fun process(intent: Intent): Boolean { + override fun process(intent: Intent): Boolean { val safeIntent = intent.toSafeIntent() val url = safeIntent.dataString diff --git a/app/src/main/java/org/mozilla/fenix/shortcut/NewTabShortcutIntentProcessor.kt b/app/src/main/java/org/mozilla/fenix/shortcut/NewTabShortcutIntentProcessor.kt index 94463aa53..a54809a43 100644 --- a/app/src/main/java/org/mozilla/fenix/shortcut/NewTabShortcutIntentProcessor.kt +++ b/app/src/main/java/org/mozilla/fenix/shortcut/NewTabShortcutIntentProcessor.kt @@ -28,7 +28,7 @@ class NewTabShortcutIntentProcessor : IntentProcessor { * @param intent The intent to process. * @return True if the intent was processed, otherwise false. */ - override suspend fun process(intent: Intent): Boolean { + override fun process(intent: Intent): Boolean { val safeIntent = SafeIntent(intent) val (searchExtra, startPrivateMode) = when (safeIntent.action) { ACTION_OPEN_TAB -> StartSearchIntentProcessor.STATIC_SHORTCUT_NEW_TAB to false diff --git a/app/src/test/java/org/mozilla/fenix/components/IntentProcessorTypeTest.kt b/app/src/test/java/org/mozilla/fenix/components/IntentProcessorTypeTest.kt index 50274af81..76523c7ea 100644 --- a/app/src/test/java/org/mozilla/fenix/components/IntentProcessorTypeTest.kt +++ b/app/src/test/java/org/mozilla/fenix/components/IntentProcessorTypeTest.kt @@ -100,7 +100,7 @@ class IntentProcessorTypeTest { @Test fun `get type for generic intent processor`() { val processor = object : IntentProcessor { - override suspend fun process(intent: Intent) = true + override fun process(intent: Intent) = true } val type = testContext.components.intentProcessors.getType(processor) diff --git a/buildSrc/src/main/java/AndroidComponents.kt b/buildSrc/src/main/java/AndroidComponents.kt index eb09f595f..0b2276e7f 100644 --- a/buildSrc/src/main/java/AndroidComponents.kt +++ b/buildSrc/src/main/java/AndroidComponents.kt @@ -3,5 +3,5 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ object AndroidComponents { - const val VERSION = "48.0.20200626130049" + const val VERSION = "48.0.20200626213814" }