summaryrefslogtreecommitdiff
path: root/app/src/main/java/se
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2022-07-25 17:27:28 +0200
committercyBerta <cyberta@riseup.net>2022-07-25 17:27:28 +0200
commitff83944dbfe81e88ee22a2d5f1618da4f97b2b50 (patch)
tree921d7d31c7edd182d269aea79c8fc76f51a2c0eb /app/src/main/java/se
parent23a8e4fbd3a52ead9cc8e9a32724e6c750ee29a6 (diff)
never update ProviderOberservable with a null provider, use a default provider object instead
Diffstat (limited to 'app/src/main/java/se')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java31
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/models/ProviderObservable.java4
2 files changed, 16 insertions, 19 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
index 80056925..2ccbe514 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
@@ -153,7 +153,7 @@ public class StartActivity extends Activity{
Provider provider = ProviderObservable.getInstance().getCurrentProvider();
if (provider != null && !provider.isDefault()) {
PreferenceHelper.deleteProviderDetailsFromPreferences(preferences, provider.getDomain());
- ProviderObservable.getInstance().updateProvider(null);
+ ProviderObservable.getInstance().updateProvider(new Provider());
}
}
@@ -192,24 +192,19 @@ public class StartActivity extends Activity{
}
private void prepareEIP() {
- boolean providerExists = ProviderObservable.getInstance().getCurrentProvider() != null;
- if (providerExists) {
- Provider provider = ProviderObservable.getInstance().getCurrentProvider();
- if(!provider.isConfigured()) {
- configureLeapProvider();
+ Provider provider = ProviderObservable.getInstance().getCurrentProvider();
+ if (provider.isConfigured()) {
+ Log.d(TAG, "vpn provider is configured");
+ if (getIntent() != null && getIntent().getBooleanExtra(EIP_RESTART_ON_BOOT, false)) {
+ EipCommand.startVPN(this, true);
+ finish();
+ } else if (PreferenceHelper.getRestartOnUpdate(this.getApplicationContext())) {
+ PreferenceHelper.restartOnUpdate(this.getApplicationContext(), false);
+ EipCommand.startVPN(this, false);
+ showMainActivity();
+ finish();
} else {
- Log.d(TAG, "vpn provider is configured");
- if (getIntent() != null && getIntent().getBooleanExtra(EIP_RESTART_ON_BOOT, false)) {
- EipCommand.startVPN(this, true);
- finish();
- } else if (PreferenceHelper.getRestartOnUpdate(this.getApplicationContext())) {
- PreferenceHelper.restartOnUpdate(this.getApplicationContext(), false);
- EipCommand.startVPN(this, false);
- showMainActivity();
- finish();
- } else {
- showMainActivity();
- }
+ showMainActivity();
}
} else {
configureLeapProvider();
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/models/ProviderObservable.java b/app/src/main/java/se/leap/bitmaskclient/base/models/ProviderObservable.java
index 19555504..3e1e1fcc 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/models/ProviderObservable.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/models/ProviderObservable.java
@@ -1,5 +1,7 @@
package se.leap.bitmaskclient.base.models;
+import androidx.annotation.NonNull;
+
import java.util.Observable;
/**
@@ -17,7 +19,7 @@ public class ProviderObservable extends Observable {
return instance;
}
- public synchronized void updateProvider(Provider provider) {
+ public synchronized void updateProvider(@NonNull Provider provider) {
instance.currentProvider = provider;
instance.providerForDns = null;
instance.setChanged();