[fenix] Fixes https://github.com/mozilla-mobile/fenix/issues/6341: Initialize 'selectedTabs' based on opened/selected tabs.

The problem was that the parameter 'selectedTabIds' was not taken into account
when initializing the variable 'selectedTabs'. So I made the initialization
based on both the selected tab and the number of open tabs.
pull/600/head
ValentinTimisica 5 years ago committed by Emily Kager
parent 5048bbad85
commit 6ec011b789

@ -47,7 +47,12 @@ class CollectionCreationFragment : DialogFragment() {
val sessionManager = requireComponents.core.sessionManager
val publicSuffixList = requireComponents.publicSuffixList
val tabs = sessionManager.getTabs(args.tabIds, publicSuffixList)
val selectedTabs = if (tabs.size == 1) setOf(tabs.first()) else emptySet()
val selectedTabs = if (args.selectedTabIds != null) {
sessionManager.getTabs(args.selectedTabIds, publicSuffixList).toSet()
} else {
if (tabs.size == 1) setOf(tabs.first()) else emptySet()
}
val tabCollections = requireComponents.core.tabCollectionStorage.cachedTabCollections
val selectedTabCollection = args.selectedTabCollectionId
.let { id -> tabCollections.firstOrNull { it.id == id } }

Loading…
Cancel
Save