Massive repo refactor

This commit is contained in:
topjohnwu
2016-09-29 01:42:25 +08:00
parent 0acc5e33b3
commit bb7ff27d04
17 changed files with 445 additions and 429 deletions
@@ -8,7 +8,7 @@ import java.util.List;
public abstract class BaseModule {
protected String mId, mName, mVersion, mAuthor, mDescription, mSupportUrl, mDonateUrl;
protected boolean mIsCacheModule = false, mCanUpdate = false;
protected boolean mIsCacheModule = false;
protected int mVersionCode = 0;
protected void parseProps(List<String> props) { parseProps(props.toArray(new String[props.size()])); }
@@ -54,7 +54,6 @@ public abstract class BaseModule {
this.mIsCacheModule = Boolean.parseBoolean(prop[1]);
break;
default:
Log.d("Magisk", "Module: Manifest string not recognized: " + prop[0]);
break;
}
}
@@ -97,12 +96,4 @@ public abstract class BaseModule {
public String getSupportUrl() {
return mSupportUrl;
}
public void setUpdate() {
mCanUpdate = true;
}
public boolean canUpdate() {
return mCanUpdate;
}
}
@@ -1,7 +1,7 @@
package com.topjohnwu.magisk.module;
import com.topjohnwu.magisk.utils.Logger;
import com.topjohnwu.magisk.utils.RepoHelper;
import com.topjohnwu.magisk.utils.ModuleHelper;
import com.topjohnwu.magisk.utils.Utils;
public class Module extends BaseModule {
@@ -32,17 +32,6 @@ public class Module extends BaseModule {
}
public void checkUpdate() {
Repo repo = RepoHelper.repoMap.get(mId);
if (repo != null) {
repo.setInstalled();
if (repo.getVersionCode() > mVersionCode) {
repo.setUpdate();
mCanUpdate = true;
}
}
}
public void createDisableFile() {
mEnable = !Utils.createFile(mDisableFile);
}
@@ -6,6 +6,7 @@ import android.preference.PreferenceManager;
import android.util.Log;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.utils.ModuleHelper;
import com.topjohnwu.magisk.utils.Utils;
import com.topjohnwu.magisk.utils.WebRequest;
@@ -18,7 +19,6 @@ import java.util.Date;
public class Repo extends BaseModule {
protected String repoName, mLogUrl, mManifestUrl, mZipUrl;
protected Date mLastUpdate;
protected boolean mIsInstalled = false;
public Repo(Context context, String name, Date lastUpdate) {
repoName = name;
@@ -42,10 +42,6 @@ public class Repo extends BaseModule {
}
}
public void setInstalled() {
mIsInstalled = true;
}
public String getZipUrl() {
return mZipUrl;
}
@@ -61,6 +57,4 @@ public class Repo extends BaseModule {
public Date getLastUpdate() {
return mLastUpdate;
}
public boolean isInstalled() { return mIsInstalled; }
}