Target the proper channel in stub

This commit is contained in:
topjohnwu 2019-10-30 05:00:52 -04:00
parent dc9f69bab0
commit 490e4d3180
3 changed files with 13 additions and 8 deletions

View File

@ -4,7 +4,7 @@ android {
defaultConfig {
applicationId 'com.topjohnwu.magisk'
versionCode 1
versionName "1.0"
versionName props['appVersion']
buildConfigField 'String', 'DEV_CHANNEL', props['DEV_CHANNEL'] ?: 'null'
}

View File

@ -24,9 +24,10 @@ import static com.topjohnwu.magisk.DelegateApplication.MANAGER_APK;
public class DownloadActivity extends Activity {
private static final boolean CANARY = BuildConfig.VERSION_NAME.contains("-");
private static final String URL =
BuildConfig.DEV_CHANNEL != null ? BuildConfig.DEV_CHANNEL :
RawData.urlBase() + (BuildConfig.DEBUG ? RawData.canary() : RawData.stable());
BuildConfig.DEV_CHANNEL != null ? BuildConfig.DEV_CHANNEL : RawData.urlBase() +
(BuildConfig.DEBUG ? RawData.debug() : (CANARY ? RawData.canary() : RawData.stable()));
private String apkLink;
private ErrorHandler err = (conn, e) -> {
@ -71,7 +72,7 @@ public class DownloadActivity extends Activity {
new AlertDialog.Builder(this)
.setCancelable(false)
.setTitle(RawData.appName())
.setMessage(RawData.no_internet_msg())
.setMessage(RawData.networkError())
.setNegativeButton(ok, (d, w) -> finish())
.show();
}
@ -87,7 +88,7 @@ public class DownloadActivity extends Activity {
new AlertDialog.Builder(DownloadActivity.this)
.setCancelable(false)
.setTitle(RawData.appName())
.setMessage(RawData.upgrade_msg())
.setMessage(RawData.upgradeMsg())
.setPositiveButton(yes, (d, w) -> dlAPK())
.setNegativeButton(no, (d, w) -> finish())
.show();

View File

@ -16,19 +16,23 @@ public class RawData {
return "https://raw.githubusercontent.com/topjohnwu/magisk_files/";
}
public static String canary() {
public static String debug() {
return "canary/debug.json";
}
public static String canary() {
return "canary/release.json";
}
public static String stable() {
return "master/stable.json";
}
public static String no_internet_msg() {
public static String networkError() {
return res.getString(R.string.no_internet_msg);
}
public static String upgrade_msg() {
public static String upgradeMsg() {
return res.getString(R.string.upgrade_msg);
}