pull/600/head
Colin Lee 5 years ago committed by GitHub
parent 0b4f8a1cc1
commit 9463029335

@ -449,7 +449,12 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
} }
} }
@SuppressWarnings("ComplexMethod")
override fun onResume() { override fun onResume() {
sessionObserver = subscribeToSession()
sessionManagerObserver = subscribeToSessions()
getSessionById()?.let { updateBookmarkState(it) }
if (getSessionById() == null) findNavController(this).popBackStack(R.id.homeFragment, false) if (getSessionById() == null) findNavController(this).popBackStack(R.id.homeFragment, false)
super.onResume() super.onResume()
context?.components?.core?.let { context?.components?.core?.let {
@ -461,14 +466,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
} }
getSessionById()?.let { (activity as HomeActivity).updateThemeForSession(it) } getSessionById()?.let { (activity as HomeActivity).updateThemeForSession(it) }
(activity as AppCompatActivity).supportActionBar?.hide() (activity as AppCompatActivity).supportActionBar?.hide()
}
@Suppress("ComplexMethod")
override fun onStart() {
super.onStart()
sessionObserver = subscribeToSession()
sessionManagerObserver = subscribeToSessions()
getSessionById()?.let { updateBookmarkState(it) }
getAutoDisposeObservable<SearchAction>() getAutoDisposeObservable<SearchAction>()
.subscribe { .subscribe {
when (it) { when (it) {
@ -551,6 +549,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
} }
} }
} }
assignSitePermissionsRules() assignSitePermissionsRules()
} }

@ -266,24 +266,15 @@ class HomeFragment : Fragment(), CoroutineScope, AccountObserver {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
(activity as AppCompatActivity).supportActionBar?.hide()
requireComponents.backgroundServices.accountManager.register(this, owner = this) getAutoDisposeObservable<SessionControlAction>()
} .subscribe {
when (it) {
@SuppressWarnings("ComplexMethod") is SessionControlAction.Tab -> handleTabAction(it.action)
override fun onStart() { is SessionControlAction.Collection -> handleCollectionAction(it.action)
super.onStart() is SessionControlAction.Onboarding -> handleOnboardingAction(it.action)
if (isAdded) {
getAutoDisposeObservable<SessionControlAction>()
.subscribe {
when (it) {
is SessionControlAction.Tab -> handleTabAction(it.action)
is SessionControlAction.Collection -> handleCollectionAction(it.action)
is SessionControlAction.Onboarding -> handleOnboardingAction(it.action)
}
} }
} }
getManagedEmitter<SessionControlChange>().onNext( getManagedEmitter<SessionControlChange>().onNext(
SessionControlChange.Change( SessionControlChange.Change(
@ -293,6 +284,14 @@ class HomeFragment : Fragment(), CoroutineScope, AccountObserver {
) )
) )
(activity as AppCompatActivity).supportActionBar?.hide()
requireComponents.backgroundServices.accountManager.register(this, owner = this)
}
@SuppressWarnings("ComplexMethod")
override fun onStart() {
super.onStart()
requireComponents.core.tabCollectionStorage.register(collectionStorageObserver, this) requireComponents.core.tabCollectionStorage.register(collectionStorageObserver, this)
sessionObserver.onStart() sessionObserver.onStart()
tabCollectionObserver = subscribeToTabCollections() tabCollectionObserver = subscribeToTabCollections()

@ -194,6 +194,9 @@ class SearchFragment : Fragment(), BackHandler {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
subscribeToSearchActions()
subscribeToAwesomeBarActions()
if (!permissionDidUpdate) { if (!permissionDidUpdate) {
getManagedEmitter<SearchChange>().onNext(SearchChange.ToolbarRequestedFocus) getManagedEmitter<SearchChange>().onNext(SearchChange.ToolbarRequestedFocus)
} }
@ -206,12 +209,6 @@ class SearchFragment : Fragment(), BackHandler {
getManagedEmitter<SearchChange>().onNext(SearchChange.ToolbarClearedFocus) getManagedEmitter<SearchChange>().onNext(SearchChange.ToolbarClearedFocus)
} }
override fun onStart() {
super.onStart()
subscribeToSearchActions()
subscribeToAwesomeBarActions()
}
override fun onBackPressed(): Boolean { override fun onBackPressed(): Boolean {
return when { return when {
qrFeature.onBackPressed() -> { qrFeature.onBackPressed() -> {

Loading…
Cancel
Save