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 { defaultConfig {
applicationId 'com.topjohnwu.magisk' applicationId 'com.topjohnwu.magisk'
versionCode 1 versionCode 1
versionName "1.0" versionName props['appVersion']
buildConfigField 'String', 'DEV_CHANNEL', props['DEV_CHANNEL'] ?: 'null' 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 { public class DownloadActivity extends Activity {
private static final boolean CANARY = BuildConfig.VERSION_NAME.contains("-");
private static final String URL = private static final String URL =
BuildConfig.DEV_CHANNEL != null ? BuildConfig.DEV_CHANNEL : BuildConfig.DEV_CHANNEL != null ? BuildConfig.DEV_CHANNEL : RawData.urlBase() +
RawData.urlBase() + (BuildConfig.DEBUG ? RawData.canary() : RawData.stable()); (BuildConfig.DEBUG ? RawData.debug() : (CANARY ? RawData.canary() : RawData.stable()));
private String apkLink; private String apkLink;
private ErrorHandler err = (conn, e) -> { private ErrorHandler err = (conn, e) -> {
@ -71,7 +72,7 @@ public class DownloadActivity extends Activity {
new AlertDialog.Builder(this) new AlertDialog.Builder(this)
.setCancelable(false) .setCancelable(false)
.setTitle(RawData.appName()) .setTitle(RawData.appName())
.setMessage(RawData.no_internet_msg()) .setMessage(RawData.networkError())
.setNegativeButton(ok, (d, w) -> finish()) .setNegativeButton(ok, (d, w) -> finish())
.show(); .show();
} }
@ -87,7 +88,7 @@ public class DownloadActivity extends Activity {
new AlertDialog.Builder(DownloadActivity.this) new AlertDialog.Builder(DownloadActivity.this)
.setCancelable(false) .setCancelable(false)
.setTitle(RawData.appName()) .setTitle(RawData.appName())
.setMessage(RawData.upgrade_msg()) .setMessage(RawData.upgradeMsg())
.setPositiveButton(yes, (d, w) -> dlAPK()) .setPositiveButton(yes, (d, w) -> dlAPK())
.setNegativeButton(no, (d, w) -> finish()) .setNegativeButton(no, (d, w) -> finish())
.show(); .show();

View File

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