You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
I think it won't break anything?
This commit is contained in:
@@ -45,90 +45,98 @@ public class Module {
|
||||
this.mVersionCode = Integer.valueOf(props[1]);
|
||||
break;
|
||||
case "name":
|
||||
this.mName = props[1];
|
||||
this.mName = value;
|
||||
break;
|
||||
case "author":
|
||||
this.mAuthor = props[1];
|
||||
this.mAuthor = value;
|
||||
break;
|
||||
case "id":
|
||||
this.mId = props[1];
|
||||
this.mId = value;
|
||||
break;
|
||||
case "version":
|
||||
this.mVersion = props[1];
|
||||
this.mVersion = value;
|
||||
break;
|
||||
case "description":
|
||||
this.mDescription = props[1];
|
||||
this.mDescription = value;
|
||||
break;
|
||||
case "donate":
|
||||
this.mDonateUrl = props[1];
|
||||
this.mDonateUrl = value;
|
||||
break;
|
||||
case "support":
|
||||
this.mSupportUrl = props[1];
|
||||
this.mSupportUrl = value;
|
||||
break;
|
||||
case "donateUrl":
|
||||
this.mDonateUrl = props[1];
|
||||
this.mDonateUrl = value;
|
||||
break;
|
||||
case "zipUrl":
|
||||
this.mZipUrl = props[1];
|
||||
this.mZipUrl = value;
|
||||
break;
|
||||
case "baseUrl":
|
||||
this.mBaseUrl = props[1];
|
||||
this.mBaseUrl = value;
|
||||
break;
|
||||
case "manifestUrl":
|
||||
this.mManifestUrl = props[1];
|
||||
this.mManifestUrl = value;
|
||||
break;
|
||||
default:
|
||||
Log.d("Magisk", "Manifest string not recognized: " + props[0]);
|
||||
Log.d("Magisk", "Module: Manifest string not recognized: " + props[0]);
|
||||
break;
|
||||
}
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if (mId != null) {
|
||||
Log.d("Magisk", "Module: Checking for preference named repo_" + mId);
|
||||
if (prefs.contains("repo_" + mId)) {
|
||||
String entryString = prefs.getString("repo_" + mId, "");
|
||||
|
||||
}
|
||||
|
||||
String entryName = "repo" + mId;
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
String[] subStrings = entryString.split("\n");
|
||||
for (String subKeys : subStrings) {
|
||||
String[] idEntry = subKeys.split("=", 2);
|
||||
Log.d("Magisk", "Module: Checking entry strings. Key is " + idEntry[0] + " and value is " + idEntry[1]);
|
||||
if (idEntry[0].equals("id")) {
|
||||
if (idEntry.length != 2) {
|
||||
continue;
|
||||
}
|
||||
if (this.mId != null && !this.mId.isEmpty()) {
|
||||
String preferenceString = "repo_" + this.mId;
|
||||
String preferenceKey = prefs.getString(preferenceString,"nope");
|
||||
Log.d("Magisk", "Module: Checking for preference named " + preferenceString);
|
||||
if (!preferenceKey.equals("nope")) {
|
||||
Log.d("Magisk", "Module: repo_" + mId + " found.");
|
||||
String entryString = prefs.getString("repo_" + mId, "");
|
||||
|
||||
if (idEntry[1].equals(mId)) {
|
||||
Log.d("Magisk", "Module: Hey, I know I'm online...");
|
||||
mIsOnline = true;
|
||||
} else mIsOnline = false;
|
||||
String[] subStrings = entryString.split("\n");
|
||||
for (String subKeys : subStrings) {
|
||||
String[] idEntry = subKeys.split("=", 2);
|
||||
if (idEntry[0].equals("id")) {
|
||||
if (idEntry.length != 2) {
|
||||
continue;
|
||||
}
|
||||
if (idEntry[0].equals("versionCode")) {
|
||||
if (idEntry.length != 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Integer.valueOf(idEntry[1]) > mVersionCode) {
|
||||
mUpdateAvailable = true;
|
||||
Log.d("Magisk", "Module: Hey, I have an update...");
|
||||
} else mUpdateAvailable = false;
|
||||
}
|
||||
if (idEntry[1].equals(mId)) {
|
||||
Log.d("Magisk", "Module: Hey, I know I'm online...");
|
||||
mIsOnline = true;
|
||||
} else mIsOnline = false;
|
||||
}
|
||||
if (idEntry[0].equals("versionCode")) {
|
||||
if (idEntry.length != 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (Integer.valueOf(idEntry[1]) > mVersionCode) {
|
||||
mUpdateAvailable = true;
|
||||
Log.d("Magisk", "Module: Hey, I have an update...");
|
||||
} else mUpdateAvailable = false;
|
||||
}
|
||||
}
|
||||
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
if (mIsOnline) {
|
||||
editor.putBoolean("repo_isInstalled_" + mId, true);
|
||||
|
||||
} else {
|
||||
editor.putBoolean("repo_isInstalled_" + mId, false);
|
||||
}
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
if (mIsOnline) {
|
||||
editor.putBoolean("repo-isInstalled_" + mId, true);
|
||||
|
||||
} else {
|
||||
editor.putBoolean("repo-isInstalled_" + mId, false);
|
||||
}
|
||||
|
||||
if (mUpdateAvailable) {
|
||||
editor.putBoolean("repo-canUpdate_" + mId, true);
|
||||
} else {
|
||||
editor.putBoolean("repo-canUpdate_" + mId, false);
|
||||
}
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
if (mName == null) {
|
||||
@@ -147,8 +155,8 @@ public class Module {
|
||||
mName = repo.getName();
|
||||
mVersion = repo.getmVersion();
|
||||
mDescription = repo.getDescription();
|
||||
mId = "foo";
|
||||
mVersionCode = 111;
|
||||
mId = repo.getId();
|
||||
mVersionCode = repo.getmVersionCode();
|
||||
mUrl = repo.getmZipUrl();
|
||||
mEnable = true;
|
||||
mRemove = false;
|
||||
|
||||
@@ -28,21 +28,23 @@ public class Repo {
|
||||
private String mVersionCode;
|
||||
private String mSupportUrl;
|
||||
private String mDonateUrl;
|
||||
private Date lastUpdate;
|
||||
private String lastUpdate;
|
||||
private Context appContext;
|
||||
private boolean mIsInstalled;
|
||||
private boolean mIsInstalled,mCanUpdate;
|
||||
|
||||
public Repo(String manifestString, Context context) {
|
||||
ParseProps(manifestString);
|
||||
appContext = context;
|
||||
ParseProps(manifestString);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Repo(String name, String url, Date updated, Context context) {
|
||||
appContext = context;
|
||||
this.mName = name;
|
||||
this.mBaseUrl = url;
|
||||
this.lastUpdate = updated;
|
||||
this.lastUpdate = updated.toString();
|
||||
this.fetch();
|
||||
|
||||
}
|
||||
@@ -52,28 +54,16 @@ public class Repo {
|
||||
this.mZipUrl = zipUrl;
|
||||
this.mDescription = moduleDescription;
|
||||
this.mName = moduleName;
|
||||
this.lastUpdate = lastUpdated;
|
||||
this.lastUpdate = lastUpdated.toString();
|
||||
this.fetch();
|
||||
|
||||
}
|
||||
|
||||
private void fetch() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(appContext);
|
||||
if (prefs.contains("repo_" + this.mId)) {
|
||||
String repoString = prefs.getString("repo_" + this.mId,"");
|
||||
if (!repoString.equals("")) {
|
||||
ParseProps(repoString);
|
||||
}
|
||||
}
|
||||
if (prefs.contains("repo_isInstalled_" + this.mId)) {
|
||||
mIsInstalled = prefs.getBoolean("repo_isInstalled_" + this.mId,false);
|
||||
|
||||
}
|
||||
|
||||
public void fetch() {
|
||||
WebRequest webreq = new WebRequest();
|
||||
// Construct initial url for contents
|
||||
Log.d("Magisk", "Manifest string is: " + mBaseUrl + "/contents/");
|
||||
String repoString = webreq.makeWebServiceCall(mBaseUrl + "/contents/", WebRequest.GET);
|
||||
Log.d("Magisk", "Repo: Fetch called, Manifest string is: " + mBaseUrl + "/contents?access_token=5c9f47a299d48a6a649af3587bc97200bafcac65");
|
||||
String repoString = webreq.makeWebServiceCall(mBaseUrl + "/contents?access_token=5c9f47a299d48a6a649af3587bc97200bafcac65", WebRequest.GET);
|
||||
try {
|
||||
JSONArray repoArray = new JSONArray(repoString);
|
||||
for (int f = 0; f < repoArray.length(); f++) {
|
||||
@@ -91,9 +81,11 @@ public class Repo {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Log.d("Magisk", "Inner fetch: " + repoString);
|
||||
Log.d("Magisk", "Repo: Inner fetch: " + mManifestUrl + "?access_token=5c9f47a299d48a6a649af3587bc97200bafcac65");
|
||||
WebRequest propReq = new WebRequest();
|
||||
String manifestString = propReq.makeWebServiceCall(this.mManifestUrl,WebRequest.GET,true);
|
||||
String manifestString = propReq.makeWebServiceCall(mManifestUrl,WebRequest.GET,true);
|
||||
Log.d("Magisk","Repo: parseprops called from fetch for string " + manifestString);
|
||||
|
||||
if (ParseProps(manifestString)) {
|
||||
PutProps(manifestString);
|
||||
}
|
||||
@@ -111,7 +103,7 @@ public class Repo {
|
||||
editor.apply();
|
||||
}
|
||||
private boolean ParseProps(String string) {
|
||||
Log.d("Magisk","Repo: parseprops called for string " + string);
|
||||
|
||||
if ((string.length() <= 1) | (!string.contains("id"))) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -119,7 +111,6 @@ public class Repo {
|
||||
for (String line : lines) {
|
||||
if (line != "") {
|
||||
String props[] = line.split("=");
|
||||
Log.d("Magisk", "Repo: Split values are " + props[0] + " and " + props[1]);
|
||||
switch (props[0]) {
|
||||
case "versionCode":
|
||||
this.mVersionCode = props[1];
|
||||
@@ -157,6 +148,9 @@ public class Repo {
|
||||
case "manifestUrl":
|
||||
this.mManifestUrl = props[1];
|
||||
break;
|
||||
case "logUrl":
|
||||
this.mLogUrl = props[1];
|
||||
break;
|
||||
default:
|
||||
Log.d("Magisk", "Manifest string not recognized: " + props[0]);
|
||||
break;
|
||||
@@ -164,7 +158,20 @@ public class Repo {
|
||||
}
|
||||
|
||||
}
|
||||
return this.mName != null;
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(appContext);
|
||||
if (prefs.contains("repo-isInstalled_" + this.mId)) {
|
||||
mIsInstalled = prefs.getBoolean("repo-isInstalled_" + this.mId,false);
|
||||
}
|
||||
if (prefs.contains("repo-canUpdate_" + this.mId)) {
|
||||
mCanUpdate = prefs.getBoolean("repo-canUpdate_" + this.mId,false);
|
||||
}
|
||||
if (prefs.contains("updated_" + this.mId)) {
|
||||
lastUpdate = prefs.getString("updated_" + this.mId,"");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return this.mId != null;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -241,10 +248,11 @@ public class Repo {
|
||||
return mSupportUrl;
|
||||
}
|
||||
|
||||
public Date getLastUpdate() {
|
||||
public String getLastUpdate() {
|
||||
return lastUpdate;
|
||||
}
|
||||
|
||||
public boolean isInstalled() { return mIsInstalled; }
|
||||
public boolean canUpdate() { return mCanUpdate; }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
package com.topjohnwu.magisk.module;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
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.io.File;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class RepoAdapter {
|
||||
private String[] result;
|
||||
private static String url = "https://api.github.com/orgs/Magisk-Modules-Repo/repos";
|
||||
private static List<Repo> repos = new ArrayList<Repo>() {
|
||||
|
||||
};
|
||||
private static final String TAG_ID = "id";
|
||||
private static final String TAG_NAME = "name";
|
||||
private static String TAG = "Magisk";
|
||||
private Context activityContext;
|
||||
private Date updatedDate, currentDate;
|
||||
|
||||
public List<Repo> listRepos(Context context, boolean refresh) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
if (!prefs.contains("hasCachedRepos") | refresh) {
|
||||
activityContext = context;
|
||||
new MyAsyncTask().execute();
|
||||
List<String> out = null;
|
||||
} else {
|
||||
Log.d(TAG, "Building from cache");
|
||||
Map<String, ?> map = prefs.getAll();
|
||||
repos.clear();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
map.entrySet().stream().filter(entry -> entry.getKey().contains("repo_")).forEach(entry -> {
|
||||
String repoString = entry.getValue().toString();
|
||||
if (repoString.length() >= 0) {
|
||||
repos.add(new Repo(repoString,context));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return repos;
|
||||
}
|
||||
|
||||
|
||||
class MyAsyncTask extends AsyncTask<String, String, Void> {
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onProgressUpdate(String... values) {
|
||||
super.onProgressUpdate(values);
|
||||
Toast.makeText(activityContext, "Refreshing online modules", Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(String... params) {
|
||||
publishProgress();
|
||||
// Creating service handler class instance
|
||||
WebRequest webreq = new WebRequest();
|
||||
|
||||
// Making a request to url and getting response
|
||||
String jsonStr = webreq.makeWebServiceCall(url, WebRequest.GET);
|
||||
Log.d("Magisk", "doInBackground Running, String: " + jsonStr + " Url: " + url);
|
||||
|
||||
|
||||
try {
|
||||
repos.clear();
|
||||
JSONArray jsonArray = new JSONArray(jsonStr);
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject jsonobject = jsonArray.getJSONObject(i);
|
||||
String name = jsonobject.getString("name");
|
||||
String url = jsonobject.getString("url");
|
||||
String lastUpdate = jsonobject.getString("updated_at");
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||
try {
|
||||
updatedDate = format.parse(lastUpdate);
|
||||
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ((!name.contains("Repo.github.io"))) {
|
||||
//if (!name.contains("Repo.github.io") && name.contains("template")) {
|
||||
repos.add(new Repo(name, url, updatedDate, activityContext));
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void onPostExecute(Void v) {
|
||||
|
||||
|
||||
} // protected void onPostExecute(Void v)
|
||||
} //class MyAsyncTask extends AsyncTask<String, String, Void>
|
||||
|
||||
protected void onPreExecute() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.topjohnwu.magisk.module;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.topjohnwu.magisk.utils.WebRequest;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class RepoHelper {
|
||||
private String[] result;
|
||||
private static String url = "https://api.github.com/orgs/Magisk-Modules-Repo/repos?access_token=5c9f47a299d48a6a649af3587bc97200bafcac65";
|
||||
private static List<Repo> repos = new ArrayList<Repo>();
|
||||
private static final String TAG_ID = "id";
|
||||
private static final String TAG_NAME = "name";
|
||||
private static String TAG = "Magisk";
|
||||
private String mName,mId,mUrl;
|
||||
private Context activityContext;
|
||||
private Date updatedDate, currentDate;
|
||||
private SharedPreferences prefs;
|
||||
private boolean apiFail;
|
||||
|
||||
public List<Repo> listRepos(Context context, boolean refresh) {
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
activityContext = context;
|
||||
if (!prefs.contains("hasCachedRepos") | refresh) {
|
||||
Log.d(TAG, "RepoHelper: Building from web");
|
||||
new MyAsyncTask().execute();
|
||||
List<String> out = null;
|
||||
} else {
|
||||
Log.d(TAG, "RepoHelper: Building from cache");
|
||||
repos.clear();
|
||||
Map<String, ?> map = prefs.getAll();
|
||||
for(Map.Entry<String,?> entry : map.entrySet()){
|
||||
if (entry.getKey().contains("repo_")) {
|
||||
Log.d("Magisk","RepoHelper: found entry for repo " + entry.getKey());
|
||||
String repoString = entry.getValue().toString().replace(""", "\"");
|
||||
String[] repoStrings = repoString.split("\n");
|
||||
for(String string : repoStrings) {
|
||||
String[] splitStrings = string.split("=");
|
||||
switch(splitStrings[0]) {
|
||||
case ("id"):
|
||||
mId = splitStrings[1];
|
||||
break;
|
||||
case ("baseUrl"):
|
||||
mUrl = splitStrings[1];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
Log.d("Magisk","RepoHelper: adding repo with id of " + mId);
|
||||
repos.add(new Repo(repoString,activityContext));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return repos;
|
||||
}
|
||||
|
||||
|
||||
class MyAsyncTask extends AsyncTask<String, String, Void> {
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
super.onPreExecute();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onProgressUpdate(String... values) {
|
||||
super.onProgressUpdate(values);
|
||||
Toast.makeText(activityContext, "Refreshing online modules", Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(String... params) {
|
||||
publishProgress();
|
||||
// Creating service handler class instance
|
||||
WebRequest webreq = new WebRequest();
|
||||
|
||||
// Making a request to url and getting response
|
||||
String jsonStr = webreq.makeWebServiceCall(url, WebRequest.GET);
|
||||
Log.d("Magisk", "doInBackground Running, String: " + jsonStr + " Url: " + url);
|
||||
if(jsonStr != null && !jsonStr.isEmpty()) {
|
||||
|
||||
try {
|
||||
repos.clear();
|
||||
JSONArray jsonArray = new JSONArray(jsonStr);
|
||||
for (int i = 0; i < jsonArray.length(); i++) {
|
||||
JSONObject jsonobject = jsonArray.getJSONObject(i);
|
||||
String name = jsonobject.getString("name");
|
||||
String url = jsonobject.getString("url");
|
||||
String lastUpdate = jsonobject.getString("updated_at");
|
||||
String mId = "";
|
||||
String cacheUpdate = "";
|
||||
String manifestString = "";
|
||||
boolean doUpdate = true;
|
||||
boolean hasCachedDate = false;
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||
Map<String, ?> map = prefs.getAll();
|
||||
for (Map.Entry<String, ?> entry : map.entrySet()) {
|
||||
if (entry.getValue().toString().contains(url)) {
|
||||
Log.d("Magisk", "RepoHelper: found matching URL");
|
||||
manifestString = entry.getValue().toString();
|
||||
String[] entryStrings = entry.getValue().toString().split("\n");
|
||||
for (String valueString : entryStrings) {
|
||||
String[] valueSub = valueString.split("=");
|
||||
if (valueSub[0].equals("id")) {
|
||||
mId = valueSub[1];
|
||||
Log.d("Magisk", "RepoHelper: Got id for package of " + mId);
|
||||
if (prefs.contains("updated_" + mId)) {
|
||||
cacheUpdate = prefs.getString("updated_" + mId, "");
|
||||
hasCachedDate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
try {
|
||||
updatedDate = format.parse(lastUpdate);
|
||||
Log.d("Magisk", "RepoHelper: Dates found, online is " + updatedDate + " and cached is " + cacheUpdate);
|
||||
|
||||
if (hasCachedDate) {
|
||||
|
||||
doUpdate = !cacheUpdate.equals(updatedDate.toString());
|
||||
Log.d("Magisk", "RepoHelper: DoUpdate is " + doUpdate);
|
||||
}
|
||||
|
||||
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (!name.contains("Repo.github.io")) {
|
||||
if (doUpdate) {
|
||||
repos.add(new Repo(name, url, updatedDate, activityContext));
|
||||
Log.d(TAG, "RepoHelper: Trying to add new repo for online refresh - " + name);
|
||||
} else {
|
||||
repos.add(new Repo(manifestString, activityContext));
|
||||
Log.d(TAG, "RepoHelper: Trying to add new repo using manifestString of " + mId);
|
||||
}
|
||||
}
|
||||
for (int f = 0; f < repos.size(); f++) {
|
||||
repos.get(f).fetch();
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
apiFail = false;
|
||||
} else {
|
||||
apiFail = true;
|
||||
}
|
||||
return null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void onPostExecute(Void v) {
|
||||
if (apiFail) {
|
||||
Toast.makeText(activityContext,"GitHub API Limit reached, please try refreshing again in an hour.",Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
} // protected void onPostExecute(Void v)
|
||||
} //class MyAsyncTask extends AsyncTask<String, String, Void>
|
||||
|
||||
protected void onPreExecute() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user