diff --git a/src/main/java/com/topjohnwu/magisk/receivers/ManagerUpdate.java b/src/main/java/com/topjohnwu/magisk/receivers/ManagerUpdate.java index 2f478592f..cce1f1ca3 100644 --- a/src/main/java/com/topjohnwu/magisk/receivers/ManagerUpdate.java +++ b/src/main/java/com/topjohnwu/magisk/receivers/ManagerUpdate.java @@ -40,7 +40,7 @@ public class ManagerUpdate extends BroadcastReceiver { } }, intent.getStringExtra(Const.Key.INTENT_SET_LINK), - Utils.fmt("MagiskManager-v%s.apk", intent.getStringExtra(Const.Key.INTENT_SET_VERSION)) + intent.getStringExtra(Const.Key.INTENT_SET_FILENAME) ); } } diff --git a/src/main/java/com/topjohnwu/magisk/utils/Const.java b/src/main/java/com/topjohnwu/magisk/utils/Const.java index 71362c2f2..42eb6c4f8 100644 --- a/src/main/java/com/topjohnwu/magisk/utils/Const.java +++ b/src/main/java/com/topjohnwu/magisk/utils/Const.java @@ -113,7 +113,7 @@ public class Const { // intents public static final String OPEN_SECTION = "section"; - public static final String INTENT_SET_VERSION = "version"; + public static final String INTENT_SET_FILENAME = "filename"; public static final String INTENT_SET_LINK = "link"; public static final String INTENT_PERM = "perm_dialog"; public static final String FLASH_ACTION = "action"; diff --git a/src/main/java/com/topjohnwu/magisk/utils/ShowUI.java b/src/main/java/com/topjohnwu/magisk/utils/ShowUI.java index bb02d2a89..4836268e2 100644 --- a/src/main/java/com/topjohnwu/magisk/utils/ShowUI.java +++ b/src/main/java/com/topjohnwu/magisk/utils/ShowUI.java @@ -59,10 +59,12 @@ public class ShowUI { public static void managerUpdateNotification() { MagiskManager mm = MagiskManager.get(); + String filename = Utils.fmt("MagiskManager-v%s(%d).apk", + mm.remoteManagerVersionString, mm.remoteManagerVersionCode); Intent intent = new Intent(mm, ManagerUpdate.class); intent.putExtra(Const.Key.INTENT_SET_LINK, mm.managerLink); - intent.putExtra(Const.Key.INTENT_SET_VERSION, mm.remoteManagerVersionString); + intent.putExtra(Const.Key.INTENT_SET_FILENAME, filename); PendingIntent pendingIntent = PendingIntent.getBroadcast(mm, Const.ID.APK_UPDATE_NOTIFICATION_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT); @@ -100,7 +102,8 @@ public class ShowUI { public static void magiskInstallDialog(Activity activity) { MagiskManager mm = Utils.getMagiskManager(activity); - String filename = Utils.fmt("Magisk-v%s.zip", mm.remoteMagiskVersionString); + String filename = Utils.fmt("Magisk-v%s(%d).zip", + mm.remoteMagiskVersionString, mm.remoteMagiskVersionCode); new AlertDialogBuilder(activity) .setTitle(mm.getString(R.string.repo_install_title, mm.getString(R.string.magisk))) .setMessage(mm.getString(R.string.repo_install_msg, filename)) @@ -206,12 +209,7 @@ public class ShowUI { }; default: } - Utils.dlAndReceive( - activity, - receiver, - mm.magiskLink, - filename - ); + Utils.dlAndReceive(activity, receiver, mm.magiskLink, filename); } ).show(); }) @@ -228,16 +226,17 @@ public class ShowUI { public static void managerInstallDialog(Activity activity) { MagiskManager mm = Utils.getMagiskManager(activity); + String filename = Utils.fmt("MagiskManager-v%s(%d).apk", + mm.remoteManagerVersionString, mm.remoteManagerVersionCode); new AlertDialogBuilder(activity) .setTitle(mm.getString(R.string.repo_install_title, mm.getString(R.string.app_name))) - .setMessage(mm.getString(R.string.repo_install_msg, - Utils.fmt("MagiskManager-v%s.apk", mm.remoteManagerVersionString))) + .setMessage(mm.getString(R.string.repo_install_msg, filename)) .setCancelable(true) .setPositiveButton(R.string.install, (d, i) -> { Utils.runWithPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE, () -> { Intent intent = new Intent(mm, ManagerUpdate.class); intent.putExtra(Const.Key.INTENT_SET_LINK, mm.managerLink); - intent.putExtra(Const.Key.INTENT_SET_VERSION, mm.remoteManagerVersionString); + intent.putExtra(Const.Key.INTENT_SET_FILENAME, filename); mm.sendBroadcast(intent); }); }) diff --git a/src/main/java/com/topjohnwu/magisk/utils/Utils.java b/src/main/java/com/topjohnwu/magisk/utils/Utils.java index 9f6cb79c6..939869e81 100644 --- a/src/main/java/com/topjohnwu/magisk/utils/Utils.java +++ b/src/main/java/com/topjohnwu/magisk/utils/Utils.java @@ -82,9 +82,8 @@ public class Utils { public static String getLegalFilename(CharSequence filename) { return filename.toString().replace(" ", "_").replace("'", "").replace("\"", "") - .replace("$", "").replace("`", "").replace("(", "").replace(")", "") - .replace("#", "").replace("@", "").replace("*", "").replace("/", "_") - .replace("\\", "_"); + .replace("$", "").replace("`", "").replace("*", "").replace("/", "_") + .replace("#", "").replace("@", "").replace("\\", "_"); } public static int getPrefsInt(SharedPreferences prefs, String key, int def) {