Show release notes and changelog in MarkDownWindow
This commit is contained in:
parent
8224e038a3
commit
ad05a33e02
@ -58,8 +58,9 @@ public class MagiskManager extends Application implements Shell.Container {
|
||||
public int remoteManagerVersionCode = -1;
|
||||
|
||||
public String magiskLink;
|
||||
public String releaseNoteLink;
|
||||
public String magiskNoteLink;
|
||||
public String managerLink;
|
||||
public String managerNoteLink;
|
||||
public String uninstallerLink;
|
||||
|
||||
public boolean keepVerity = false;
|
||||
|
@ -42,11 +42,12 @@ public class CheckUpdates extends ParallelTask<Void, Void, Void> {
|
||||
mm.remoteMagiskVersionString = magisk.getString("version");
|
||||
mm.remoteMagiskVersionCode = magisk.getInt("versionCode");
|
||||
mm.magiskLink = magisk.getString("link");
|
||||
mm.releaseNoteLink = magisk.getString("note");
|
||||
mm.magiskNoteLink = magisk.getString("note");
|
||||
JSONObject manager = json.getJSONObject("app");
|
||||
mm.remoteManagerVersionString = manager.getString("version");
|
||||
mm.remoteManagerVersionCode = manager.getInt("versionCode");
|
||||
mm.managerLink = manager.getString("link");
|
||||
mm.managerNoteLink = manager.getString("note");
|
||||
JSONObject uninstaller = json.getJSONObject("uninstaller");
|
||||
mm.uninstallerLink = uninstaller.getString("link");
|
||||
} catch (JSONException ignored) {}
|
||||
|
@ -18,6 +18,7 @@ import com.topjohnwu.magisk.MagiskManager;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.SplashActivity;
|
||||
import com.topjohnwu.magisk.asyncs.InstallMagisk;
|
||||
import com.topjohnwu.magisk.asyncs.MarkDownWindow;
|
||||
import com.topjohnwu.magisk.asyncs.RestoreImages;
|
||||
import com.topjohnwu.magisk.components.AlertDialogBuilder;
|
||||
import com.topjohnwu.magisk.components.SnackbarMaker;
|
||||
@ -25,7 +26,6 @@ import com.topjohnwu.magisk.receivers.DownloadReceiver;
|
||||
import com.topjohnwu.magisk.receivers.ManagerUpdate;
|
||||
import com.topjohnwu.magisk.receivers.RebootReceiver;
|
||||
import com.topjohnwu.superuser.Shell;
|
||||
import com.topjohnwu.superuser.ShellUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -123,7 +123,7 @@ public class ShowUI {
|
||||
MagiskManager mm = Utils.getMagiskManager(activity);
|
||||
String filename = Utils.fmt("Magisk-v%s(%d).zip",
|
||||
mm.remoteMagiskVersionString, mm.remoteMagiskVersionCode);
|
||||
new AlertDialogBuilder(activity)
|
||||
AlertDialog.Builder b = 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))
|
||||
.setCancelable(true)
|
||||
@ -208,22 +208,27 @@ public class ShowUI {
|
||||
}
|
||||
).show();
|
||||
})
|
||||
.setNeutralButton(R.string.release_notes, (d, i) -> {
|
||||
if (mm.releaseNoteLink != null) {
|
||||
Intent openLink = new Intent(Intent.ACTION_VIEW, Uri.parse(mm.releaseNoteLink));
|
||||
.setNegativeButton(R.string.no_thanks, null);
|
||||
if (!TextUtils.isEmpty(mm.magiskNoteLink)) {
|
||||
b.setNeutralButton(R.string.release_notes, (d, i) -> {
|
||||
if (mm.magiskNoteLink.contains("forum.xda-developers")) {
|
||||
// Open forum links in browser
|
||||
Intent openLink = new Intent(Intent.ACTION_VIEW, Uri.parse(mm.magiskNoteLink));
|
||||
openLink.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
mm.startActivity(openLink);
|
||||
} else {
|
||||
new MarkDownWindow(activity, null, mm.magiskNoteLink).exec();
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.no_thanks, null)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
b.show();
|
||||
}
|
||||
|
||||
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)
|
||||
AlertDialog.Builder b = 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, filename))
|
||||
.setCancelable(true)
|
||||
@ -236,8 +241,12 @@ public class ShowUI {
|
||||
mm.sendBroadcast(intent);
|
||||
});
|
||||
})
|
||||
.setNegativeButton(R.string.no_thanks, null)
|
||||
.show();
|
||||
.setNegativeButton(R.string.no_thanks, null);
|
||||
if (!TextUtils.isEmpty(mm.managerNoteLink)) {
|
||||
b.setNeutralButton(R.string.app_changelog, (d, i) ->
|
||||
new MarkDownWindow(activity, null, mm.managerNoteLink).exec());
|
||||
}
|
||||
b.show();
|
||||
}
|
||||
|
||||
public static void uninstallDialog(Activity activity) {
|
||||
|
Loading…
Reference in New Issue
Block a user