[fenix] Reformatting to use .any construct as suggested in review

pull/600/head
bswe 5 years ago
parent 35eabc4579
commit 92e2b65f5e

@ -26,19 +26,14 @@ 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) {
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) {
if (!ShortcutManagerCompat.isRequestPinShortcutSupported(context)) return

Loading…
Cancel
Save