1
0
Fork 0

Cancel pending findBookmarkJob if another is started

master
ekager 2019-05-23 22:07:03 -07:00 committed by Emily Kager
parent 4b7c8a7db1
commit 2f46345954
1 changed files with 3 additions and 2 deletions

View File

@ -108,6 +108,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
private val fullScreenFeature = ViewBoundFeatureWrapper<FullScreenFeature>()
private val thumbnailsFeature = ViewBoundFeatureWrapper<ThumbnailsFeature>()
private val customTabsIntegration = ViewBoundFeatureWrapper<CustomTabsIntegration>()
private var findBookmarkJob: Job? = null
private lateinit var job: Job
var customTabSessionId: String? = null
@ -742,7 +743,6 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
override fun onUrlChanged(session: Session, url: String) {
super.onUrlChanged(session, url)
updateBookmarkState(session)
}
}
getSessionById()?.register(observer)
@ -769,7 +769,8 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope {
}
private fun updateBookmarkState(session: Session) {
launch {
if (findBookmarkJob?.isActive == true) findBookmarkJob?.cancel()
findBookmarkJob = launch {
val found = findBookmarkedURL(session)
launch(Main) {
getManagedEmitter<QuickActionChange>()