Added A-C version 48.0.20200626213814
parent
101ecfbf66
commit
ff5d00362b
|
@ -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'
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue