diff --git a/app/src/main/java/mozilla/fenix/MainActivity.kt b/app/src/main/java/mozilla/fenix/MainActivity.kt index 55a7a659838f..1be0c99dbe23 100644 --- a/app/src/main/java/mozilla/fenix/MainActivity.kt +++ b/app/src/main/java/mozilla/fenix/MainActivity.kt @@ -25,16 +25,15 @@ class MainActivity : AppCompatActivity() { setContentView(R.layout.activity_main) toolbarFeature = ToolbarFeature( - components.sessionManager, + components.sessionProvider.sessionManager, components.sessionUseCases.loadUrl, toolbar) sessionFeature = SessionFeature( - components.sessionManager, + components.sessionProvider, components.sessionUseCases, components.engine, - engineView, - components.sessionMapping) + engineView) lifecycle.addObserver(FeatureLifecycleObserver(sessionFeature, toolbarFeature)) } diff --git a/app/src/main/java/mozilla/fenix/components/Components.kt b/app/src/main/java/mozilla/fenix/components/Components.kt index e71ed64af210..ecdc6548a122 100644 --- a/app/src/main/java/mozilla/fenix/components/Components.kt +++ b/app/src/main/java/mozilla/fenix/components/Components.kt @@ -6,28 +6,24 @@ package mozilla.fenix.components import android.content.Context import mozilla.components.browser.engine.gecko.GeckoEngine -import mozilla.components.browser.session.SessionManager -import mozilla.components.browser.session.SessionProvider +import mozilla.components.browser.session.Session import mozilla.components.concept.engine.Engine -import mozilla.components.feature.session.SessionMapping +import mozilla.components.feature.session.SessionProvider import mozilla.components.feature.session.SessionUseCases -import mozilla.fenix.components.session.DefaultSessionProvider import org.mozilla.geckoview.GeckoRuntime -import org.mozilla.geckoview.GeckoRuntimeSettings /** * Helper class for lazily instantiating components needed by the application. */ class Components(private val applicationContext: Context) { private val geckoRuntime by lazy { - val settings = GeckoRuntimeSettings() - GeckoRuntime.create(applicationContext, settings) + GeckoRuntime.getDefault(applicationContext) } - val engine : Engine by lazy { GeckoEngine(geckoRuntime) } - private val sessionProvider: SessionProvider by lazy { DefaultSessionProvider() } - val sessionManager by lazy { SessionManager(sessionProvider) } - val sessionMapping by lazy { SessionMapping() } - val sessionUseCases by lazy { SessionUseCases(sessionManager, engine, sessionMapping) } + val sessionProvider : SessionProvider by lazy { + SessionProvider(applicationContext, Session("https://www.mozilla.org")) + } + + val sessionUseCases = SessionUseCases(sessionProvider, engine) } diff --git a/app/src/main/java/mozilla/fenix/components/session/DefaultSessionProvider.kt b/app/src/main/java/mozilla/fenix/components/session/DefaultSessionProvider.kt deleted file mode 100644 index 45635f7616f5..000000000000 --- a/app/src/main/java/mozilla/fenix/components/session/DefaultSessionProvider.kt +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -package mozilla.fenix.components.session - -import mozilla.components.browser.session.Session -import mozilla.components.browser.session.SessionProvider - -class DefaultSessionProvider: SessionProvider { - override fun getInitialSessions(): Pair, Int> { - // For now we start with a very simple session provider that will always start with a session - // that contains mozilla.org. - return Pair(listOf(Session("https://www.mozilla.org")), 0) - } -} diff --git a/build.gradle b/build.gradle index 9d4a07bc3328..0788f44d924b 100644 --- a/build.gradle +++ b/build.gradle @@ -11,14 +11,14 @@ buildscript { // Testing junit: '4.12', // Mozilla - mozillaComponents: '0.5.1' + mozillaComponents: '0.6' ] ext.gecko = [ // Discover nightly builds: https://tools.taskcluster.net/index/gecko.v2.mozilla-central.nightly - nightlyDate: '2018.04.10', - revision: 'a8061a09cd7064a8783ca9e67979d77fb52e001e', - version: '61.0.20180410100334' + nightlyDate: '2018.05.16', + revision: 'dedd25bfd2794eaba95225361f82c701e49c9339', + version: '62.0.20180516100458' ] ext.build = [