From 0be9adefae2c36e2af96c10dcc5d2c6d77569970 Mon Sep 17 00:00:00 2001 From: Sawyer Blatz Date: Thu, 23 May 2019 10:46:54 -0700 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/2728 & https://github.com/mozilla-mobile/fenix/issues/2729: Uses view model selected tabs for collection creation (https://github.com/mozilla-mobile/fenix/pull/2748) --- app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt | 1 + .../org/mozilla/fenix/collections/CreateCollectionFragment.kt | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt index f0f8db6d55..0b35d4ea75 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt @@ -666,6 +666,7 @@ class BrowserFragment : Fragment(), BackHandler, CoroutineScope { val selectedSet = mutableSetOf(tabs) viewModel?.selectedTabs = selectedSet viewModel?.saveCollectionStep = SaveCollectionStep.SelectCollection + viewModel?.tabCollections = requireComponents.core.tabCollectionStorage.cachedTabCollections.reversed() view?.let { val directions = BrowserFragmentDirections.actionBrowserFragmentToCreateCollectionFragment() Navigation.findNavController(it).navigate(directions) diff --git a/app/src/main/java/org/mozilla/fenix/collections/CreateCollectionFragment.kt b/app/src/main/java/org/mozilla/fenix/collections/CreateCollectionFragment.kt index 9040c09bc6..1914e0706a 100644 --- a/app/src/main/java/org/mozilla/fenix/collections/CreateCollectionFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/collections/CreateCollectionFragment.kt @@ -121,8 +121,9 @@ class CreateCollectionFragment : DialogFragment(), CoroutineScope { is CollectionCreationAction.SaveCollectionName -> { showSavedSnackbar(it.tabs.size) dismiss() + context?.let { context -> - val sessionBundle = it.tabs.toSessionBundle(context) + val sessionBundle = viewModel.selectedTabs.toList().toSessionBundle(context) launch(Dispatchers.IO) { requireComponents.core.tabCollectionStorage.createCollection(it.name, sessionBundle) }