|
|
|
|
@ -25,8 +25,6 @@ import java.lang.ref.WeakReference; |
|
|
|
|
|
|
|
|
|
public class Updater implements View.OnClickListener { |
|
|
|
|
|
|
|
|
|
private static final String PROXY = "https://ghproxy.com/"; |
|
|
|
|
|
|
|
|
|
private WeakReference<Activity> activity; |
|
|
|
|
private AlertDialog dialog; |
|
|
|
|
private String branch; |
|
|
|
|
@ -41,6 +39,22 @@ public class Updater implements View.OnClickListener { |
|
|
|
|
return Loader.INSTANCE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private File getFile() { |
|
|
|
|
return FileUtil.getCacheFile(branch + ".apk"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String getPath() { |
|
|
|
|
return "https://raw.githubusercontent.com/FongMi/TV/" + branch + "/release/"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String getJson() { |
|
|
|
|
return "https://ghproxy.com/" + getPath() + BuildConfig.FLAVOR_mode + "-" + branch + ".json"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String getApk() { |
|
|
|
|
return "https://ghproxy.com/" + getPath() + BuildConfig.FLAVOR_mode + "-" + BuildConfig.FLAVOR_api + ".apk"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Updater() { |
|
|
|
|
this.branch = "release"; |
|
|
|
|
} |
|
|
|
|
@ -71,22 +85,6 @@ public class Updater implements View.OnClickListener { |
|
|
|
|
connect(getJson()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private File getFile() { |
|
|
|
|
return FileUtil.getCacheFile(branch + ".apk"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String getPath() { |
|
|
|
|
return "https://raw.githubusercontent.com/FongMi/TV/" + branch + "/release/"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String getJson() { |
|
|
|
|
return PROXY + getPath() + BuildConfig.FLAVOR_mode + "-" + branch + ".json"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private String getApk() { |
|
|
|
|
return PROXY + getPath() + BuildConfig.FLAVOR_mode + "-" + BuildConfig.FLAVOR_api + ".apk"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void connect(String target) { |
|
|
|
|
try { |
|
|
|
|
JSONObject object = new JSONObject(OKHttp.newCall(target).execute().body().string()); |
|
|
|
|
|