Reformatting to use .any construct as suggested in review
parent
052695ffa1
commit
6bc5d96f92
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue