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) {
if (shown) return;
if (!ConfigManager.isBinderAlive()) return;
if (App.getPreferences().getBoolean("never_show_welcome", false)) return;
if (!ConfigManager.isBinderAlive() ||
App.getPreferences().getBoolean("never_show_welcome", false) ||
(App.isParasitic && ShortcutUtil.isLaunchShortcutPinned())) {
shown = true;
return;
}
new WelcomeDialog().show(fm, "welcome");
shown = true;
}

View File

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