From db792e392081b233fe0a461b96ad9401a4074cc5 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Sat, 21 Dec 2024 11:46:10 +0900 Subject: [PATCH] chore(GmsCore support): Use more generic message --- .../shared/patches/GmsCoreSupport.java | 21 +++++++++++-------- .../music/settings/host/values/strings.xml | 4 +++- .../youtube/settings/host/values/strings.xml | 4 +++- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/extensions/shared/src/main/java/app/revanced/extension/shared/patches/GmsCoreSupport.java b/extensions/shared/src/main/java/app/revanced/extension/shared/patches/GmsCoreSupport.java index 96a049b87..faf1648ef 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/shared/patches/GmsCoreSupport.java +++ b/extensions/shared/src/main/java/app/revanced/extension/shared/patches/GmsCoreSupport.java @@ -59,18 +59,21 @@ public class GmsCoreSupport { private static void showBatteryOptimizationDialog(Activity context, String dialogMessageRef, - String positiveButtonStringRef, + String positiveButtonTextRef, DialogInterface.OnClickListener onPositiveClickListener) { // Use a delay to allow the activity to finish initializing. // Otherwise, if device is in dark mode the dialog is shown with wrong color scheme. - Utils.runOnMainThreadDelayed(() -> new AlertDialog.Builder(context) - .setIconAttribute(android.R.attr.alertDialogIcon) - .setTitle(str("gms_core_dialog_title")) - .setMessage(str(dialogMessageRef)) - .setPositiveButton(str(positiveButtonStringRef), onPositiveClickListener) - // Allow using back button to skip the action, just in case the check can never be satisfied. - .setCancelable(true) - .show(), 100); + Utils.runOnMainThreadDelayed(() -> + // Do not set cancelable to false, to allow using back button to skip the action, + // just in case the battery change can never be satisfied. + new AlertDialog.Builder(context) + .setIconAttribute(android.R.attr.alertDialogIcon) + .setTitle(str("gms_core_dialog_title")) + .setMessage(str(dialogMessageRef)) + .setPositiveButton(str(positiveButtonTextRef), onPositiveClickListener) + .show(), + 100 + ); } /** diff --git a/patches/src/main/resources/music/settings/host/values/strings.xml b/patches/src/main/resources/music/settings/host/values/strings.xml index f9a2a969e..797cd1aa1 100644 --- a/patches/src/main/resources/music/settings/host/values/strings.xml +++ b/patches/src/main/resources/music/settings/host/values/strings.xml @@ -443,7 +443,9 @@ This is required for the app to work." Open website "GmsCore battery optimizations must be disabled to prevent issues. -Tap on the continue button and disable battery optimizations." +Disabling battery optimizations for GmsCore will not negatively affect battery usage. + +Tap the continue button and allow optimization changes." Continue Spoof client diff --git a/patches/src/main/resources/youtube/settings/host/values/strings.xml b/patches/src/main/resources/youtube/settings/host/values/strings.xml index d40077f58..485e0c2e8 100644 --- a/patches/src/main/resources/youtube/settings/host/values/strings.xml +++ b/patches/src/main/resources/youtube/settings/host/values/strings.xml @@ -1852,7 +1852,9 @@ This is required for the app to work." Open website "GmsCore battery optimizations must be disabled to prevent issues. -Tap on the continue button and disable battery optimizations." +Disabling battery optimizations for GmsCore will not negatively affect battery usage. + +Tap the continue button and allow optimization changes." Continue Sanitize sharing links