Skip to content

Commit

Permalink
making use of the view lifecycle scope for the view based fragment logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ouchadam committed May 5, 2022
1 parent 1a68211 commit b2e3dd1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class FtueAuthCombinedServerSelectionFragment @Inject constructor() : AbstractFt
views.chooseServerSubmit.debouncedClicks { updateServerUrl() }
views.chooseServerInput.editText().textChanges()
.onEach { views.chooseServerInput.error = null }
.launchIn(lifecycleScope)
.launchIn(viewLifecycleOwner.lifecycleScope)
}

private fun updateServerUrl() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class FtueAuthEmailEntryFragment @Inject constructor() : AbstractFtueAuthFragmen
views.emailEntryInput.error = null
views.emailEntrySubmit.isEnabled = it.isEmail()
}
.launchIn(lifecycleScope)
.launchIn(viewLifecycleOwner.lifecycleScope)
}

private fun updateEmail() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class FtueAuthSplashCarouselFragment @Inject constructor(

private fun ViewPager2.scheduleCarouselTransition(): Job {
val itemCount = adapter?.itemCount ?: throw IllegalStateException("An adapter must be set")
return lifecycleScope.launch {
return viewLifecycleOwner.lifecycleScope.launch {
delay(CAROUSEL_ROTATION_DELAY_MS)
setCurrentItem(currentItem.incrementByOneAndWrap(max = itemCount - 1), duration = CAROUSEL_TRANSITION_TIME_MS)
}
Expand Down

0 comments on commit b2e3dd1

Please sign in to comment.