2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

[fenix] No issue: Fixes compilation errors with a-c 47.0

This commit is contained in:
Sawyer Blatz 2019-03-14 08:09:53 -07:00 committed by Jeff Boek
parent e6a4b4c227
commit 827a128b85
3 changed files with 7 additions and 6 deletions

View File

@ -25,6 +25,7 @@ import mozilla.components.feature.session.HistoryDelegate
import mozilla.components.feature.session.bundling.SessionBundleStorage import mozilla.components.feature.session.bundling.SessionBundleStorage
import mozilla.components.lib.crash.handler.CrashHandlerService import mozilla.components.lib.crash.handler.CrashHandlerService
import org.mozilla.fenix.AppRequestInterceptor import org.mozilla.fenix.AppRequestInterceptor
import org.mozilla.fenix.ext.components
import org.mozilla.geckoview.GeckoRuntime import org.mozilla.geckoview.GeckoRuntime
import org.mozilla.geckoview.GeckoRuntimeSettings import org.mozilla.geckoview.GeckoRuntimeSettings
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
@ -75,8 +76,9 @@ class Core(private val context: Context) {
GeckoViewFetchClient(context, runtime) GeckoViewFetchClient(context, runtime)
} }
val sessionStorage by lazy { val sessionStorage: SessionBundleStorage by lazy {
SessionBundleStorage(context, bundleLifetime = Pair(BUNDLE_LIFETIME_IN_MINUTES, TimeUnit.MINUTES)) SessionBundleStorage(context, bundleLifetime = Pair(BUNDLE_LIFETIME_IN_MINUTES, TimeUnit.MINUTES),
engine = engine)
} }
/** /**
@ -90,7 +92,7 @@ class Core(private val context: Context) {
// Restore a previous, still active bundle. // Restore a previous, still active bundle.
GlobalScope.launch(Dispatchers.Main) { GlobalScope.launch(Dispatchers.Main) {
val snapshot = async(Dispatchers.IO) { val snapshot = async(Dispatchers.IO) {
sessionStorage.restore()?.restoreSnapshot(engine) sessionStorage.restore()?.restoreSnapshot()
} }
// There's an active bundle with a snapshot: Feed it into the SessionManager. // There's an active bundle with a snapshot: Feed it into the SessionManager.

View File

@ -229,7 +229,7 @@ class HomeFragment : Fragment() {
when (it) { when (it) {
is SessionsAction.Select -> { is SessionsAction.Select -> {
requireComponents.core.sessionStorage.archive(requireComponents.core.sessionManager) requireComponents.core.sessionStorage.archive(requireComponents.core.sessionManager)
it.archivedSession.bundle.restoreSnapshot(requireComponents.core.engine)?.apply { it.archivedSession.bundle.restoreSnapshot()?.apply {
requireComponents.core.sessionManager.restore(this) requireComponents.core.sessionManager.restore(this)
homeScrollView.smoothScrollTo(0, 0) homeScrollView.smoothScrollTo(0, 0)
} }

View File

@ -12,7 +12,6 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import kotlinx.android.extensions.LayoutContainer import kotlinx.android.extensions.LayoutContainer
import kotlinx.android.synthetic.main.session_bottom_sheet.view.* import kotlinx.android.synthetic.main.session_bottom_sheet.view.*
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.home.sessions.ArchivedSession import org.mozilla.fenix.home.sessions.ArchivedSession
class SessionBottomSheetFragment : BottomSheetDialogFragment(), LayoutContainer { class SessionBottomSheetFragment : BottomSheetDialogFragment(), LayoutContainer {
@ -76,7 +75,7 @@ class SessionBottomSheetFragment : BottomSheetDialogFragment(), LayoutContainer
is SessionType.Current -> it.titles is SessionType.Current -> it.titles
is SessionType.Private -> it.titles is SessionType.Private -> it.titles
is SessionType.Archived -> is SessionType.Archived ->
it.archivedSession.bundle.restoreSnapshot(requireComponents.core.engine)?.let { snapshot -> it.archivedSession.bundle.restoreSnapshot()?.let { snapshot ->
snapshot.sessions.map { item -> item.session.title } snapshot.sessions.map { item -> item.session.title }
} }
} }