From 92e2b65f5e05e0afd747a5a30f88aaf09188ce92 Mon Sep 17 00:00:00 2001 From: bswe Date: Fri, 11 Oct 2019 15:40:16 -0700 Subject: [PATCH] [fenix] Reformatting to use .any construct as suggested in review --- .../components/PrivateShortcutCreateManager.kt | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/components/PrivateShortcutCreateManager.kt b/app/src/main/java/org/mozilla/fenix/components/PrivateShortcutCreateManager.kt index e09032c3c7..7ba6aeea54 100644 --- a/app/src/main/java/org/mozilla/fenix/components/PrivateShortcutCreateManager.kt +++ b/app/src/main/java/org/mozilla/fenix/components/PrivateShortcutCreateManager.kt @@ -26,18 +26,13 @@ object PrivateShortcutCreateManager { fun doesPrivateBrowsingPinnedShortcutExist(context: Context): Boolean { return if (SDK_INT >= Build.VERSION_CODES.N_MR1) { val pinnedShortcuts = context.getSystemService(ShortcutManager::class.java).pinnedShortcuts - if (pinnedShortcuts.any()) { - for (s in pinnedShortcuts) { - if (s.intent?.extras?.getString(HomeActivity.OPEN_TO_SEARCH) == - StartSearchIntentProcessor.PRIVATE_BROWSING_PINNED_SHORTCUT) { - return true - } - } - } + if (pinnedShortcuts.any { + it.intent?.extras?.getString(HomeActivity.OPEN_TO_SEARCH) == + StartSearchIntentProcessor.PRIVATE_BROWSING_PINNED_SHORTCUT }) + return true false - } else { + } else false - } } fun createPrivateShortcut(context: Context) {