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

For #2899 - Scroll to Collections on change, animate new collections #3279

Merged
merged 2 commits into from
Jun 11, 2019

Conversation

ekager
Copy link
Contributor

@ekager ekager commented Jun 7, 2019

Pull Request checklist

  • [meh] Quality: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry or does not need one
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features

@ekager ekager requested a review from boek June 7, 2019 23:58
@ekager ekager requested a review from a team as a code owner June 7, 2019 23:58
@@ -732,18 +739,56 @@ class HomeFragment : Fragment(), CoroutineScope, AccountObserver {
emitAccountChanges()
}

private fun scrollToCollections(addedTabsSize: Int) {
launch(Dispatchers.Main) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Using Dispatchers.Main directly like this means there is no coroutineScope Job to handle cancellation. The fragment has a coroutineContext using Main already that will cancel and the delay() method will cooperatively cancel when it does so. Is there a reason not to use the current context and to create a new coroutineScope instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this change work @colintheshots ?

@@ -481,6 +484,10 @@ class HomeFragment : Fragment(), CoroutineScope, AccountObserver {
}
}
}
launch(Dispatchers.Main) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove this dispatcher override here. Once this is done, I think we're ready to merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops missed this one. Got it!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants