diff options
author | cyBerta <cyberta@riseup.net> | 2020-12-28 00:47:19 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2020-12-28 00:47:19 +0100 |
commit | c008a935f92b79cb7b6f649fc876d398e20ebb22 (patch) | |
tree | 6aed01587d06016eaeaf023952580e37b6516e4f /app/src/main/java | |
parent | 8efd199a90e6d9388400b19e9fc6b68c81284f11 (diff) |
download apk, request permission and install app update
Diffstat (limited to 'app/src/main/java')
3 files changed, 19 insertions, 5 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/Constants.java index dfd94759..f62af638 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Constants.java +++ b/app/src/main/java/se/leap/bitmaskclient/Constants.java @@ -36,9 +36,7 @@ public interface Constants { String ALLOW_TETHERING_USB = "tethering_usb"; String SHOW_EXPERIMENTAL = "show_experimental"; String USE_IPv6_FIREWALL = "use_ipv6_firewall"; - String APK_DOWNLOAD_ID = "apk_download_id"; - String VERSION_FILE_DOWNLOAD_ID = "version_file_downlaod_id"; - String SIGNATURE_DOWNLOAD_ID = "signature_file_download_id"; + String RESTART_ON_UPDATE = "restart_on_update"; ////////////////////////////////////////////// @@ -50,6 +48,8 @@ public interface Constants { int REQUEST_CODE_SWITCH_PROVIDER = 1; int REQUEST_CODE_LOG_IN = 2; int REQUEST_CODE_ADD_PROVIDER = 3; + int REQUEST_CODE_INSTALL_UPDATE = 4; + int REQUEST_CODE_REQUEST_UPDATE = 5; ////////////////////////////////////////////// diff --git a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java index 9937eeeb..9d49d5da 100644 --- a/app/src/main/java/se/leap/bitmaskclient/StartActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/StartActivity.java @@ -183,9 +183,14 @@ public class StartActivity extends Activity{ if (getIntent() != null && getIntent().getBooleanExtra(EIP_RESTART_ON_BOOT, false)) { EipCommand.startVPN(this.getApplicationContext(), true); finish(); - return; + } else if (PreferenceHelper.getRestartOnUpdate(this.getApplicationContext())) { + PreferenceHelper.restartOnUpdate(this.getApplicationContext(), false); + EipCommand.startVPN(this.getApplicationContext(), false); + showMainActivity(); + finish(); + } else { + showMainActivity(); } - showMainActivity(); } } else { configureLeapProvider(); diff --git a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java b/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java index cb2aeb26..5ca2ec75 100644 --- a/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/utils/PreferenceHelper.java @@ -27,6 +27,7 @@ import static se.leap.bitmaskclient.Constants.PROVIDER_CONFIGURED; import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION; import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY; import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.Constants.RESTART_ON_UPDATE; import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; import static se.leap.bitmaskclient.Constants.SHOW_EXPERIMENTAL; import static se.leap.bitmaskclient.Constants.USE_IPv6_FIREWALL; @@ -121,6 +122,14 @@ public class PreferenceHelper { apply(); } + public static void restartOnUpdate(Context context, boolean isEnabled) { + putBoolean(context, RESTART_ON_UPDATE, isEnabled); + } + + public static boolean getRestartOnUpdate(Context context) { + return getBoolean(context, RESTART_ON_UPDATE, false); + } + public static boolean getUsePluggableTransports(Context context) { return getBoolean(context, USE_PLUGGABLE_TRANSPORTS, false); } |