mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 12:27:39 +00:00
Don't show notification again if coming from notification
This commit is contained in:
parent
ac44f05811
commit
1d70d0fe94
@ -47,7 +47,6 @@ public class MagiskManager extends Application {
|
||||
public boolean isSuClient = false;
|
||||
public String suVersion = null;
|
||||
public boolean disabled = false;
|
||||
public boolean isNotified = false;
|
||||
|
||||
// Data
|
||||
public ValueSortedMap<String, Repo> repoMap;
|
||||
|
@ -39,14 +39,16 @@ public class SplashActivity extends Activity{
|
||||
boolean started = Utils.isValidShellResponse(ret) && Integer.parseInt(ret.get(0)) != 0;
|
||||
|
||||
// Initialize the update check service, notify every 3 hours
|
||||
ComponentName service = new ComponentName(magiskManager, UpdateCheckService.class);
|
||||
JobInfo jobInfo = new JobInfo.Builder(UPDATE_SERVICE_ID, service)
|
||||
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
|
||||
.setPersisted(true)
|
||||
.setPeriodic(3 * 60 * 60 * 1000)
|
||||
.build();
|
||||
JobScheduler scheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
|
||||
scheduler.schedule(jobInfo);
|
||||
if (!"install".equals(getIntent().getStringExtra(MainActivity.SECTION))) {
|
||||
ComponentName service = new ComponentName(magiskManager, UpdateCheckService.class);
|
||||
JobInfo jobInfo = new JobInfo.Builder(UPDATE_SERVICE_ID, service)
|
||||
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
|
||||
.setPersisted(true)
|
||||
.setPeriodic(3 * 60 * 60 * 1000)
|
||||
.build();
|
||||
JobScheduler scheduler = (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
|
||||
scheduler.schedule(jobInfo);
|
||||
}
|
||||
|
||||
// Now fire all async tasks
|
||||
new GetBootBlocks(this).exec();
|
||||
@ -62,7 +64,7 @@ public class SplashActivity extends Activity{
|
||||
}
|
||||
}.exec();
|
||||
new LoadApps(this).exec();
|
||||
new CheckUpdates(this, true){
|
||||
new CheckUpdates(this, !"install".equals(getIntent().getStringExtra(MainActivity.SECTION))){
|
||||
@Override
|
||||
protected void onPostExecute(Void v) {
|
||||
super.onPostExecute(v);
|
||||
|
@ -25,7 +25,7 @@ public class CheckUpdates extends ParallelTask<Void, Void, Void> {
|
||||
|
||||
public CheckUpdates(Context context, boolean b) {
|
||||
this(context);
|
||||
showNotification = b && !magiskManager.isNotified;
|
||||
showNotification = b;
|
||||
}
|
||||
|
||||
public CheckUpdates(Context context) {
|
||||
@ -49,7 +49,6 @@ public class CheckUpdates extends ParallelTask<Void, Void, Void> {
|
||||
@Override
|
||||
protected void onPostExecute(Void v) {
|
||||
if (magiskManager.magiskVersion < magiskManager.remoteMagiskVersion && showNotification) {
|
||||
magiskManager.isNotified = true;
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(magiskManager);
|
||||
builder.setSmallIcon(R.drawable.ic_magisk)
|
||||
.setContentTitle(magiskManager.getString(R.string.magisk_update_title))
|
||||
|
Loading…
x
Reference in New Issue
Block a user