Remove module helper

This commit is contained in:
topjohnwu
2017-02-12 20:53:41 +08:00
parent b51978f51c
commit 1418ec2416
9 changed files with 155 additions and 171 deletions

View File

@@ -1,6 +1,7 @@
package com.topjohnwu.magisk.utils;
import android.Manifest;
import android.app.Activity;
import android.app.DownloadManager;
import android.content.Context;
import android.content.IntentFilter;
@@ -15,6 +16,7 @@ import android.widget.Toast;
import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.asyncs.LoadRepos;
import com.topjohnwu.magisk.receivers.DownloadReceiver;
import java.io.File;
@@ -152,4 +154,16 @@ public class Utils {
}
}.requestTest();
}
public static void clearRepoCache(Activity activity) {
MagiskManager magiskManager = getMagiskManager(activity);
SharedPreferences repoMap = activity.getSharedPreferences(LoadRepos.FILE_KEY, Context.MODE_PRIVATE);
repoMap.edit()
.remove(LoadRepos.ETAG_KEY)
.remove(LoadRepos.VERSION_KEY)
.apply();
magiskManager.repoLoadDone.isTriggered = false;
new LoadRepos(activity).exec();
Toast.makeText(activity, R.string.repo_cache_cleared, Toast.LENGTH_SHORT).show();
}
}