1
0
Fork 0

Added A-C version 48.0.20200626213814

master
Marc Leclair 2020-06-26 18:36:06 -04:00 committed by Jonathan Almeida
parent 101ecfbf66
commit ff5d00362b
8 changed files with 31 additions and 29 deletions

View File

@ -42,6 +42,7 @@ android {
} }
def releaseTemplate = { def releaseTemplate = {
signingConfig signingConfigs.debug
shrinkResources true shrinkResources true
minifyEnabled true minifyEnabled true
proguardFiles 'proguard-android-optimize-3.5.0-modified.txt', 'proguard-rules.pro' proguardFiles 'proguard-android-optimize-3.5.0-modified.txt', 'proguard-rules.pro'

View File

@ -9,8 +9,6 @@ import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.os.StrictMode import android.os.StrictMode
import androidx.annotation.VisibleForTesting import androidx.annotation.VisibleForTesting
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import mozilla.components.feature.intent.processing.IntentProcessor import mozilla.components.feature.intent.processing.IntentProcessor
import org.mozilla.fenix.components.IntentProcessorType import org.mozilla.fenix.components.IntentProcessorType
import org.mozilla.fenix.components.getType import org.mozilla.fenix.components.getType
@ -33,19 +31,17 @@ class IntentReceiverActivity : Activity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
MainScope().launch { // The intent property is nullable, but the rest of the code below
// 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
// assumes it is not. If it's null, then we make a new one and open // the HomeActivity.
// the HomeActivity. val intent = intent?.let { Intent(it) } ?: Intent()
val intent = intent?.let { Intent(it) } ?: Intent() intent.stripUnwantedFlags()
intent.stripUnwantedFlags() processIntent(intent)
processIntent(intent)
}
StartupTimeline.onActivityCreateEndIntentReceiver() StartupTimeline.onActivityCreateEndIntentReceiver()
} }
suspend fun processIntent(intent: Intent) { fun processIntent(intent: Intent) {
// Call process for side effects, short on the first that returns true // Call process for side effects, short on the first that returns true
val processor = getIntentProcessors().firstOrNull { it.process(intent) } val processor = getIntentProcessors().firstOrNull { it.process(intent) }
val intentProcessorType = components.intentProcessors.getType(processor) val intentProcessorType = components.intentProcessors.getType(processor)

View File

@ -188,7 +188,7 @@ class Core(private val context: Context) {
WebNotificationFeature( WebNotificationFeature(
context, engine, icons, R.drawable.ic_status_logo, context, engine, icons, R.drawable.ic_status_logo,
HomeActivity::class.java permissionStorage.permissionsStorage, HomeActivity::class.java
) )
} }
} }

View File

@ -9,6 +9,7 @@ import android.content.Intent
import android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT import android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT
import androidx.annotation.VisibleForTesting import androidx.annotation.VisibleForTesting
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import kotlinx.coroutines.runBlocking
import mozilla.components.browser.session.Session import mozilla.components.browser.session.Session
import mozilla.components.browser.session.Session.Source import mozilla.components.browser.session.Session.Source
import mozilla.components.browser.session.SessionManager 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 * 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. * the scope defined in the manifest.
*/ */
override suspend fun process(intent: Intent): Boolean { override fun process(intent: Intent): Boolean {
val safeIntent = intent.toSafeIntent() val safeIntent = intent.toSafeIntent()
val url = safeIntent.dataString val url = safeIntent.dataString
return if (!url.isNullOrEmpty() && matches(intent)) { return if (!url.isNullOrEmpty() && matches(intent)) {
val webAppManifest = loadManifest(safeIntent, url) runBlocking {
val session = Session(url, private = false, source = Source.HOME_SCREEN) val webAppManifest = loadManifest(safeIntent, url)
session.webAppManifest = webAppManifest
session.customTabConfig = webAppManifest?.toCustomTabConfig() ?: createFallbackCustomTabConfig()
sessionManager.add(session) val session = Session(url, private = false, source = Source.HOME_SCREEN)
loadUrlUseCase(url, session, EngineSession.LoadUrlFlags.external()) 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.putSessionId(session.id)
intent.flags = FLAG_ACTIVITY_NEW_DOCUMENT
intent.putWebAppManifest(webAppManifest) if (webAppManifest != null) {
intent.flags = FLAG_ACTIVITY_NEW_DOCUMENT
intent.putWebAppManifest(webAppManifest)
}
true
} }
true
} else { } else {
false false
} }

View File

@ -35,7 +35,7 @@ class FennecBookmarkShortcutsIntentProcessor(
* If this is an Intent for a Fennec pinned website shortcut * If this is an Intent for a Fennec pinned website shortcut
* prepare it for opening website's URL in a new tab. * 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 safeIntent = intent.toSafeIntent()
val url = safeIntent.dataString val url = safeIntent.dataString

View File

@ -28,7 +28,7 @@ class NewTabShortcutIntentProcessor : IntentProcessor {
* @param intent The intent to process. * @param intent The intent to process.
* @return True if the intent was processed, otherwise false. * @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 safeIntent = SafeIntent(intent)
val (searchExtra, startPrivateMode) = when (safeIntent.action) { val (searchExtra, startPrivateMode) = when (safeIntent.action) {
ACTION_OPEN_TAB -> StartSearchIntentProcessor.STATIC_SHORTCUT_NEW_TAB to false ACTION_OPEN_TAB -> StartSearchIntentProcessor.STATIC_SHORTCUT_NEW_TAB to false

View File

@ -100,7 +100,7 @@ class IntentProcessorTypeTest {
@Test @Test
fun `get type for generic intent processor`() { fun `get type for generic intent processor`() {
val processor = object : IntentProcessor { val processor = object : IntentProcessor {
override suspend fun process(intent: Intent) = true override fun process(intent: Intent) = true
} }
val type = testContext.components.intentProcessors.getType(processor) val type = testContext.components.intentProcessors.getType(processor)

View File

@ -3,5 +3,5 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
object AndroidComponents { object AndroidComponents {
const val VERSION = "48.0.20200626130049" const val VERSION = "48.0.20200626213814"
} }