mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Cache immutable value
This commit is contained in:
parent
6f577d8232
commit
3a48e33c81
1 changed files with 3 additions and 2 deletions
|
@ -39,6 +39,7 @@ class ShortcutsHandler @Inject constructor(
|
|||
private val activeSessionHolder: ActiveSessionHolder,
|
||||
private val pinCodeStore: PinCodeStore
|
||||
) {
|
||||
private val isRequestPinShortcutSupported = ShortcutManagerCompat.isRequestPinShortcutSupported(context)
|
||||
|
||||
fun observeRoomsAndBuildShortcuts(): Disposable {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) {
|
||||
|
@ -71,7 +72,7 @@ class ShortcutsHandler @Inject constructor(
|
|||
if (deadShortcutIds.isNotEmpty()) {
|
||||
Timber.d("Removing shortcut(s) $deadShortcutIds")
|
||||
ShortcutManagerCompat.removeLongLivedShortcuts(context, deadShortcutIds)
|
||||
if (ShortcutManagerCompat.isRequestPinShortcutSupported(context)) {
|
||||
if (isRequestPinShortcutSupported) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
||||
context.getSystemService<ShortcutManager>()?.disableShortcuts(deadShortcutIds)
|
||||
}
|
||||
|
@ -107,7 +108,7 @@ class ShortcutsHandler @Inject constructor(
|
|||
ShortcutManagerCompat.removeLongLivedShortcuts(context, shortcuts)
|
||||
|
||||
// We can only disabled pinned shortcuts with the API, but at least it will prevent the crash
|
||||
if (ShortcutManagerCompat.isRequestPinShortcutSupported(context)) {
|
||||
if (isRequestPinShortcutSupported) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
||||
context.getSystemService<ShortcutManager>()
|
||||
?.let {
|
||||
|
|
Loading…
Reference in a new issue