diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index aeb23c5a1429..56833ffda7ab 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,6 +3,7 @@
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
@@ -16,7 +17,9 @@
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:name=".FenixApplication">
-
+
@@ -24,6 +27,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/mozilla/fenix/MainActivity.kt b/app/src/main/java/mozilla/fenix/BrowserActivity.kt
similarity index 82%
rename from app/src/main/java/mozilla/fenix/MainActivity.kt
rename to app/src/main/java/mozilla/fenix/BrowserActivity.kt
index 3d0da9bd6870..62deeab15ae6 100644
--- a/app/src/main/java/mozilla/fenix/MainActivity.kt
+++ b/app/src/main/java/mozilla/fenix/BrowserActivity.kt
@@ -12,18 +12,21 @@ import android.view.View
import mozilla.components.browser.tabstray.BrowserTabsTray
import mozilla.components.concept.engine.EngineView
import mozilla.components.concept.tabstray.TabsTray
+import mozilla.components.feature.session.SessionIntentProcessor
+import mozilla.components.support.utils.SafeIntent
import mozilla.fenix.ext.components
import mozilla.fenix.fragment.BackHandler
import mozilla.fenix.fragment.BrowserFragment
-class MainActivity : AppCompatActivity() {
+open class BrowserActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
if (savedInstanceState == null) {
+ val sessionId = SafeIntent(intent).getStringExtra(SessionIntentProcessor.ACTIVE_SESSION_ID)
supportFragmentManager?.beginTransaction()?.apply {
- replace(R.id.container, BrowserFragment.create())
+ replace(R.id.container, BrowserFragment.create(sessionId))
commit()
}
}
diff --git a/app/src/main/java/mozilla/fenix/CustomTabActivity.kt b/app/src/main/java/mozilla/fenix/CustomTabActivity.kt
new file mode 100644
index 000000000000..05332ea9c67d
--- /dev/null
+++ b/app/src/main/java/mozilla/fenix/CustomTabActivity.kt
@@ -0,0 +1,3 @@
+package mozilla.fenix
+
+class CustomTabActivity : BrowserActivity()
\ No newline at end of file
diff --git a/app/src/main/java/mozilla/fenix/IntentReceiverActivity.kt b/app/src/main/java/mozilla/fenix/IntentReceiverActivity.kt
new file mode 100644
index 000000000000..ea856bfdaa7d
--- /dev/null
+++ b/app/src/main/java/mozilla/fenix/IntentReceiverActivity.kt
@@ -0,0 +1,28 @@
+package mozilla.fenix
+
+import android.app.Activity
+import android.content.Intent
+import android.os.Bundle
+import mozilla.components.browser.session.tab.CustomTabConfig
+import mozilla.components.support.utils.SafeIntent
+import mozilla.fenix.ext.components
+
+class IntentReceiverActivity : Activity() {
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ components.sessionIntentProcessor.process(intent)
+
+ val intent = Intent(intent)
+ if (CustomTabConfig.isCustomTabIntent(SafeIntent(intent))) {
+ intent.setClassName(applicationContext, CustomTabActivity::class.java.name)
+ } else {
+ intent.setClassName(applicationContext, BrowserActivity::class.java.name)
+ }
+
+ startActivity(intent)
+ finish()
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/mozilla/fenix/components/Components.kt b/app/src/main/java/mozilla/fenix/components/Components.kt
index 9a819510f4e6..0a68aeb8141c 100644
--- a/app/src/main/java/mozilla/fenix/components/Components.kt
+++ b/app/src/main/java/mozilla/fenix/components/Components.kt
@@ -15,6 +15,7 @@ import mozilla.components.browser.session.SessionManager
import mozilla.components.browser.session.storage.DefaultSessionStorage
import mozilla.components.concept.engine.Engine
import mozilla.components.feature.search.SearchUseCases
+import mozilla.components.feature.session.SessionIntentProcessor
import mozilla.components.feature.session.SessionUseCases
import mozilla.components.feature.tabs.TabsUseCases
import mozilla.fenix.R
@@ -45,6 +46,7 @@ class Components(private val applicationContext: Context) {
}
val sessionUseCases = SessionUseCases(sessionManager)
+ val sessionIntentProcessor by lazy { SessionIntentProcessor(sessionUseCases, sessionManager) }
// Search
private val searchEngineManager by lazy {
diff --git a/app/src/main/res/layout/fragment_browser.xml b/app/src/main/res/layout/fragment_browser.xml
index 853ca226f5b8..fc7fefc6e55d 100644
--- a/app/src/main/res/layout/fragment_browser.xml
+++ b/app/src/main/res/layout/fragment_browser.xml
@@ -7,7 +7,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- tools:context=".MainActivity">
+ tools:context=".BrowserActivity">