You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Download Magisk Manager via new service
This commit is contained in:
@@ -18,7 +18,6 @@ import com.topjohnwu.magisk.Info;
|
||||
import com.topjohnwu.magisk.R;
|
||||
import com.topjohnwu.magisk.model.receiver.GeneralReceiver;
|
||||
import com.topjohnwu.magisk.ui.SplashActivity;
|
||||
import com.topjohnwu.magisk.utils.Utils;
|
||||
|
||||
public class Notifications {
|
||||
|
||||
@@ -61,13 +60,11 @@ public class Notifications {
|
||||
|
||||
public static void managerUpdate() {
|
||||
App app = App.self;
|
||||
String name = Utils.INSTANCE.fmt("MagiskManager v%s(%d)",
|
||||
Info.remote.getApp().getVersion(), Info.remote.getApp().getVersionCode());
|
||||
|
||||
Intent intent = new Intent(app, ClassMap.get(GeneralReceiver.class));
|
||||
intent.setAction(Const.Key.BROADCAST_MANAGER_UPDATE);
|
||||
intent.putExtra(Const.Key.INTENT_SET_LINK, Info.remote.getApp().getLink());
|
||||
intent.putExtra(Const.Key.INTENT_SET_NAME, name);
|
||||
intent.putExtra(Const.Key.INTENT_SET_APP, Info.remote.getApp());
|
||||
|
||||
PendingIntent pendingIntent = PendingIntent.getBroadcast(app,
|
||||
Const.ID.APK_UPDATE_NOTIFICATION_ID, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
|
||||
@@ -3,18 +3,21 @@ package com.topjohnwu.magisk.view.dialogs
|
||||
import android.app.Activity
|
||||
import com.topjohnwu.magisk.Info
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.utils.DownloadApp
|
||||
import com.topjohnwu.magisk.model.download.DownloadService
|
||||
import com.topjohnwu.magisk.model.entity.internal.Configuration
|
||||
import com.topjohnwu.magisk.model.entity.internal.DownloadSubject
|
||||
import com.topjohnwu.magisk.view.MarkDownWindow
|
||||
|
||||
class ManagerInstallDialog(a: Activity) : CustomAlertDialog(a) {
|
||||
|
||||
init {
|
||||
val name = "MagiskManager v${Info.remote.app.version}" +
|
||||
"(${Info.remote.app.versionCode})"
|
||||
val subject = DownloadSubject.Manager(Configuration.APK.Upgrade)
|
||||
setTitle(a.getString(R.string.repo_install_title, a.getString(R.string.app_name)))
|
||||
setMessage(a.getString(R.string.repo_install_msg, name))
|
||||
setMessage(a.getString(R.string.repo_install_msg, subject.title))
|
||||
setCancelable(true)
|
||||
setPositiveButton(R.string.install) { _, _ -> DownloadApp.upgrade(name) }
|
||||
setPositiveButton(R.string.install) { _, _ ->
|
||||
DownloadService(a) { this.subject = subject }
|
||||
}
|
||||
if (Info.remote.app.note.isNotEmpty()) {
|
||||
setNeutralButton(R.string.app_changelog) { _, _ ->
|
||||
MarkDownWindow.show(a, null, Info.remote.app.note) }
|
||||
|
||||
Reference in New Issue
Block a user