Don't show prompt when shortcut created on Android 14 (#2627)

This commit is contained in:
LoveSy 2023-07-15 01:35:06 +08:00 committed by GitHub
parent b178215f2f
commit aa9875eed3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -86,8 +86,12 @@ public class WelcomeDialog extends DialogFragment {
public static void showIfNeed(FragmentManager fm) { public static void showIfNeed(FragmentManager fm) {
if (shown) return; if (shown) return;
if (!ConfigManager.isBinderAlive()) return; if (!ConfigManager.isBinderAlive() ||
if (App.getPreferences().getBoolean("never_show_welcome", false)) return; App.getPreferences().getBoolean("never_show_welcome", false) ||
(App.isParasitic && ShortcutUtil.isLaunchShortcutPinned())) {
shown = true;
return;
}
new WelcomeDialog().show(fm, "welcome"); new WelcomeDialog().show(fm, "welcome");
shown = true; shown = true;
} }

View File

@ -168,14 +168,12 @@ public class ShortcutUtil {
public static boolean isLaunchShortcutPinned() { public static boolean isLaunchShortcutPinned() {
var context = App.getInstance(); var context = App.getInstance();
var sm = context.getSystemService(ShortcutManager.class); var sm = context.getSystemService(ShortcutManager.class);
boolean pinned = false;
for (var info : sm.getPinnedShortcuts()) { for (var info : sm.getPinnedShortcuts()) {
if (SHORTCUT_ID.equals(info.getId())) { if (SHORTCUT_ID.equals(info.getId())) {
pinned = true; return true;
break;
} }
} }
return pinned; return false;
} }
public static boolean shouldAllowPinShortcut(Context context) { public static boolean shouldAllowPinShortcut(Context context) {