From 34959a434facd5bd432d1ccfb80d726f6052d7b4 Mon Sep 17 00:00:00 2001 From: ValentinTimisica Date: Thu, 31 Oct 2019 16:16:33 +0200 Subject: [PATCH] Fixes #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. --- .../fenix/collections/CollectionCreationFragment.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/mozilla/fenix/collections/CollectionCreationFragment.kt b/app/src/main/java/org/mozilla/fenix/collections/CollectionCreationFragment.kt index 891262782..b510e4436 100644 --- a/app/src/main/java/org/mozilla/fenix/collections/CollectionCreationFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/collections/CollectionCreationFragment.kt @@ -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 } }