Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Upgrade to android-components 0.6 #40

Merged
merged 1 commit into from
May 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions app/src/main/java/mozilla/fenix/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
20 changes: 8 additions & 12 deletions app/src/main/java/mozilla/fenix/components/Components.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is 0.6, so we still need to provide the context. That will go away next week ;)

}

val sessionUseCases = SessionUseCases(sessionProvider, engine)
}

This file was deleted.

8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down