Remove cache module exception
This commit is contained in:
parent
f6bcc84251
commit
ab7fd9799d
@ -25,10 +25,8 @@ public class LoadModules extends ParallelTask<Void, Void, Void> {
|
|||||||
|
|
||||||
for (String path : Utils.getModList(getShell(), MagiskManager.MAGISK_PATH)) {
|
for (String path : Utils.getModList(getShell(), MagiskManager.MAGISK_PATH)) {
|
||||||
Logger.dev("LoadModules: Adding modules from " + path);
|
Logger.dev("LoadModules: Adding modules from " + path);
|
||||||
try {
|
|
||||||
Module module = new Module(getShell(), path);
|
Module module = new Module(getShell(), path);
|
||||||
mm.moduleMap.put(module.getId(), module);
|
mm.moduleMap.put(module.getId(), module);
|
||||||
} catch (BaseModule.CacheModException ignored) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.dev("LoadModules: Data load done");
|
Logger.dev("LoadModules: Data load done");
|
||||||
|
@ -68,7 +68,6 @@ public class UpdateRepos extends ParallelTask<Void, Void, Void> {
|
|||||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
|
||||||
Date updatedDate = format.parse(lastUpdate);
|
Date updatedDate = format.parse(lastUpdate);
|
||||||
Repo repo = repoDB.getRepo(id);
|
Repo repo = repoDB.getRepo(id);
|
||||||
try {
|
|
||||||
Boolean updated;
|
Boolean updated;
|
||||||
if (repo == null) {
|
if (repo == null) {
|
||||||
repo = new Repo(name, updatedDate);
|
repo = new Repo(name, updatedDate);
|
||||||
@ -82,7 +81,6 @@ public class UpdateRepos extends ParallelTask<Void, Void, Void> {
|
|||||||
repoDB.addRepo(repo);
|
repoDB.addRepo(repo);
|
||||||
publishProgress();
|
publishProgress();
|
||||||
}
|
}
|
||||||
} catch (BaseModule.CacheModException ignored) {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,9 +38,9 @@ public abstract class BaseModule implements Comparable<BaseModule> {
|
|||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void parseProps(List<String> props) throws CacheModException { parseProps(props.toArray(new String[0])); }
|
protected void parseProps(List<String> props) { parseProps(props.toArray(new String[0])); }
|
||||||
|
|
||||||
protected void parseProps(String[] props) throws CacheModException {
|
protected void parseProps(String[] props) {
|
||||||
for (String line : props) {
|
for (String line : props) {
|
||||||
String[] prop = line.split("=", 2);
|
String[] prop = line.split("=", 2);
|
||||||
if (prop.length != 2)
|
if (prop.length != 2)
|
||||||
@ -75,9 +75,6 @@ public abstract class BaseModule implements Comparable<BaseModule> {
|
|||||||
try {
|
try {
|
||||||
templateVersion = Integer.parseInt(prop[1]);
|
templateVersion = Integer.parseInt(prop[1]);
|
||||||
} catch (NumberFormatException ignored) {}
|
} catch (NumberFormatException ignored) {}
|
||||||
case "cacheModule":
|
|
||||||
if (Boolean.parseBoolean(prop[1]))
|
|
||||||
throw new CacheModException(mId);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -121,12 +118,6 @@ public abstract class BaseModule implements Comparable<BaseModule> {
|
|||||||
return templateVersion;
|
return templateVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CacheModException extends Exception {
|
|
||||||
public CacheModException(String id) {
|
|
||||||
Logger.error("Cache mods are no longer supported! id: " + id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(@NonNull BaseModule module) {
|
public int compareTo(@NonNull BaseModule module) {
|
||||||
return this.getName().toLowerCase().compareTo(module.getName().toLowerCase());
|
return this.getName().toLowerCase().compareTo(module.getName().toLowerCase());
|
||||||
|
@ -9,7 +9,7 @@ public class Module extends BaseModule {
|
|||||||
private String mRemoveFile, mDisableFile, mUpdateFile;
|
private String mRemoveFile, mDisableFile, mUpdateFile;
|
||||||
private boolean mEnable, mRemove, mUpdated;
|
private boolean mEnable, mRemove, mUpdated;
|
||||||
|
|
||||||
public Module(Shell shell, String path) throws CacheModException {
|
public Module(Shell shell, String path) {
|
||||||
|
|
||||||
parseProps(Utils.readFile(shell, path + "/module.prop"));
|
parseProps(Utils.readFile(shell, path + "/module.prop"));
|
||||||
|
|
||||||
@ -26,8 +26,6 @@ public class Module extends BaseModule {
|
|||||||
setName(getId());
|
setName(getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.dev("Creating Module, id: " + getId());
|
|
||||||
|
|
||||||
mEnable = !Utils.itemExist(shell, mDisableFile);
|
mEnable = !Utils.itemExist(shell, mDisableFile);
|
||||||
mRemove = Utils.itemExist(shell, mRemoveFile);
|
mRemove = Utils.itemExist(shell, mRemoveFile);
|
||||||
mUpdated = Utils.itemExist(shell, mUpdateFile);
|
mUpdated = Utils.itemExist(shell, mUpdateFile);
|
||||||
|
@ -16,7 +16,7 @@ public class Repo extends BaseModule {
|
|||||||
private String repoName;
|
private String repoName;
|
||||||
private Date mLastUpdate;
|
private Date mLastUpdate;
|
||||||
|
|
||||||
public Repo(String name, Date lastUpdate) throws CacheModException {
|
public Repo(String name, Date lastUpdate) {
|
||||||
mLastUpdate = lastUpdate;
|
mLastUpdate = lastUpdate;
|
||||||
repoName = name;
|
repoName = name;
|
||||||
update();
|
update();
|
||||||
@ -28,14 +28,13 @@ public class Repo extends BaseModule {
|
|||||||
mLastUpdate = new Date(c.getLong(c.getColumnIndex("last_update")));
|
mLastUpdate = new Date(c.getLong(c.getColumnIndex("last_update")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update() throws CacheModException {
|
public void update() {
|
||||||
String props = WebService.getString(getManifestUrl());
|
String props = WebService.getString(getManifestUrl());
|
||||||
String lines[] = props.split("\\n");
|
String lines[] = props.split("\\n");
|
||||||
parseProps(lines);
|
parseProps(lines);
|
||||||
Logger.dev("Repo: Fetching prop: " + getId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean update(Date lastUpdate) throws CacheModException {
|
public boolean update(Date lastUpdate) {
|
||||||
if (lastUpdate.after(mLastUpdate)) {
|
if (lastUpdate.after(mLastUpdate)) {
|
||||||
mLastUpdate = lastUpdate;
|
mLastUpdate = lastUpdate;
|
||||||
update();
|
update();
|
||||||
|
Loading…
Reference in New Issue
Block a user