summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/base
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2021-12-11 16:30:36 +0000
committercyberta <cyberta@riseup.net>2021-12-11 16:30:36 +0000
commit42a3735356881633004dfb6ed3c60fe8b7d26689 (patch)
tree9f54e737b24f9877938e79dd5726cb084be02d7e /app/src/main/java/se/leap/bitmaskclient/base
parent5aaa3bb1c83d486e300eb98876eab26ad4325b82 (diff)
parente7c09efba8a06bc7a000d525aff5ac027339023e (diff)
Merge branch 'bugfixes' into 'master'
bug fixes See merge request leap/bitmask_android!153
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/base')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/BitmaskTileService.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java12
5 files changed, 19 insertions, 15 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/BitmaskTileService.java b/app/src/main/java/se/leap/bitmaskclient/base/BitmaskTileService.java
index 4a8b1236..65355a67 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/BitmaskTileService.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/BitmaskTileService.java
@@ -43,9 +43,9 @@ public class BitmaskTileService extends TileService implements Observer {
private void onTileTap() {
EipStatus eipStatus = EipStatus.getInstance();
if (eipStatus.isConnecting() || eipStatus.isBlocking() || eipStatus.isConnected() || eipStatus.isReconnecting()) {
- EipCommand.stopVPN(getApplicationContext());
+ EipCommand.stopVPN(this);
} else {
- EipCommand.startVPN(getApplicationContext(), false);
+ EipCommand.startVPN(this, false);
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java
index 77743eac..aea397fb 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/MainActivity.java
@@ -217,14 +217,14 @@ public class MainActivity extends AppCompatActivity implements EipSetupListener,
switch (requestCode) {
case REQUEST_CODE_SWITCH_PROVIDER:
- EipCommand.stopVPN(this.getApplicationContext());
- EipCommand.startVPN(this.getApplicationContext(), false);
+ EipCommand.stopVPN(this);
+ EipCommand.startVPN(this, false);
break;
case REQUEST_CODE_CONFIGURE_LEAP:
Log.d(TAG, "REQUEST_CODE_CONFIGURE_LEAP - onActivityResult - MainActivity");
break;
case REQUEST_CODE_LOG_IN:
- EipCommand.startVPN(this.getApplicationContext(), true);
+ EipCommand.startVPN(this, true);
break;
}
}
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 9d689e5d..1ea574ff 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
@@ -189,11 +189,11 @@ public class StartActivity extends Activity{
} else {
Log.d(TAG, "vpn provider is configured");
if (getIntent() != null && getIntent().getBooleanExtra(EIP_RESTART_ON_BOOT, false)) {
- EipCommand.startVPN(this.getApplicationContext(), true);
+ EipCommand.startVPN(this, true);
finish();
} else if (PreferenceHelper.getRestartOnUpdate(this.getApplicationContext())) {
PreferenceHelper.restartOnUpdate(this.getApplicationContext(), false);
- EipCommand.startVPN(this.getApplicationContext(), false);
+ EipCommand.startVPN(this, false);
showMainActivity();
finish();
} else {
@@ -224,7 +224,7 @@ public class StartActivity extends Activity{
Provider provider = data.getParcelableExtra(Provider.KEY);
storeProviderInPreferences(preferences, provider);
ProviderObservable.getInstance().updateProvider(provider);
- EipCommand.startVPN(this.getApplicationContext(), false);
+ EipCommand.startVPN(this, false);
showMainActivity();
} else if (resultCode == RESULT_CANCELED) {
finish();
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java
index 14673874..07057d6e 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java
@@ -336,9 +336,9 @@ public class EipFragment extends Fragment implements Observer {
Bundle bundle = new Bundle();
bundle.putBoolean(EIP_ACTION_START, true);
bundle.putBoolean(EIP_EARLY_ROUTES, false);
- ProviderAPICommand.execute(getContext().getApplicationContext(), DOWNLOAD_GEOIP_JSON, bundle, provider);
+ ProviderAPICommand.execute(context, DOWNLOAD_GEOIP_JSON, bundle, provider);
} else {
- EipCommand.startVPN(context.getApplicationContext(), false);
+ EipCommand.startVPN(context, false);
}
EipStatus.getInstance().updateState("UI_CONNECTING", "", 0, ConnectionStatus.LEVEL_START);
}
@@ -349,7 +349,7 @@ public class EipFragment extends Fragment implements Observer {
Log.e(TAG, "context is null when trying to stop EIP");
return;
}
- EipCommand.stopVPN(context.getApplicationContext());
+ EipCommand.stopVPN(context);
}
private void askPendingStartCancellation() {
diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java
index 4e7bb6ab..f2c3b2d6 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java
@@ -176,10 +176,14 @@ public class GatewaySelectionFragment extends Fragment implements Observer, Loca
}
PreferenceHelper.setPreferredCity(context, preferredCity);
EipCommand.startVPN(context, false);
- Intent intent = new Intent(getContext(), MainActivity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
- intent.setAction(ACTION_SHOW_VPN_FRAGMENT);
- startActivity(intent);
+ try {
+ Intent intent = new Intent(context, MainActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ intent.setAction(ACTION_SHOW_VPN_FRAGMENT);
+ context.startActivity(intent);
+ } catch (NullPointerException npe) {
+ npe.printStackTrace();
+ }
}).start();
}