Fix and suppress lint issue. RestrictedApi is for the usage of ShortcutInfoCompat.Builder.

This commit is contained in:
Benoit Marty 2022-07-28 19:03:05 +02:00
parent eee418d1fd
commit a2e8506600
1 changed files with 3 additions and 0 deletions

View File

@ -16,6 +16,7 @@
package im.vector.app.features.home package im.vector.app.features.home
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.content.SharedPreferences import android.content.SharedPreferences
import android.content.pm.ShortcutManager import android.content.pm.ShortcutManager
@ -96,7 +97,9 @@ class ShortcutsHandler @Inject constructor(
.launchIn(coroutineScope) .launchIn(coroutineScope)
} }
@SuppressLint("RestrictedApi")
fun updateShortcutsWithPreviousIntent() { fun updateShortcutsWithPreviousIntent() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) return
// Check if it's been already done // Check if it's been already done
if (sharedPreferences.getBoolean(SHARED_PREF_KEY, false)) return if (sharedPreferences.getBoolean(SHARED_PREF_KEY, false)) return
ShortcutManagerCompat.getShortcuts(context, ShortcutManagerCompat.FLAG_MATCH_PINNED) ShortcutManagerCompat.getShortcuts(context, ShortcutManagerCompat.FLAG_MATCH_PINNED)