mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-24 17:11:28 +00:00
61 lines
1.6 KiB
Java
61 lines
1.6 KiB
Java
package com.topjohnwu.magisk.module;
|
|
|
|
import android.content.Context;
|
|
import android.content.SharedPreferences;
|
|
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;
|
|
|
|
import org.json.JSONArray;
|
|
import org.json.JSONException;
|
|
import org.json.JSONObject;
|
|
|
|
import java.util.Date;
|
|
|
|
public class Repo extends BaseModule {
|
|
protected String repoName, mLogUrl, mManifestUrl, mZipUrl;
|
|
protected Date mLastUpdate;
|
|
|
|
public Repo(Context context, String name, Date lastUpdate) {
|
|
repoName = name;
|
|
mLastUpdate = lastUpdate;
|
|
mLogUrl = context.getString(R.string.file_url, repoName, "changelog.txt");
|
|
mManifestUrl = context.getString(R.string.file_url, repoName, "module.prop");
|
|
mZipUrl = context.getString(R.string.zip_url, repoName);
|
|
update();
|
|
}
|
|
|
|
public void update() {
|
|
String props = WebRequest.makeWebServiceCall(mManifestUrl, WebRequest.GET, true);
|
|
String lines[] = props.split("\\n");
|
|
parseProps(lines);
|
|
}
|
|
|
|
public void update(Date lastUpdate) {
|
|
if (lastUpdate.after(mLastUpdate)) {
|
|
mLastUpdate = lastUpdate;
|
|
update();
|
|
}
|
|
}
|
|
|
|
public String getZipUrl() {
|
|
return mZipUrl;
|
|
}
|
|
|
|
public String getLogUrl() {
|
|
return mLogUrl;
|
|
}
|
|
|
|
public String getManifestUrl() {
|
|
return mManifestUrl;
|
|
}
|
|
|
|
public Date getLastUpdate() {
|
|
return mLastUpdate;
|
|
}
|
|
}
|