summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java10
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/SetupViewPagerAdapter.java5
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/activities/SetupActivity.java14
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/CircumventionSetupFragment.java43
-rw-r--r--app/src/main/res/values/strings.xml4
5 files changed, 59 insertions, 17 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 8372b6ad..19f03dee 100644
--- a/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/base/StartActivity.java
@@ -247,13 +247,9 @@ public class StartActivity extends Activity{
if (getIntent().hasExtra(APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE)) {
getIntent().removeExtra(APP_ACTION_CONFIGURE_ALWAYS_ON_PROFILE);
}
- if (isDefaultBitmask()) {
- Intent intent = new Intent(this, SetupActivity.class);
- intent.putExtra(SetupActivity.EXTRA_SWITCH_PROVIDER, false);
- startActivityForResult(intent, REQUEST_CODE_CONFIGURE_LEAP);
- } else { // custom branded app
- startActivityForResult(new Intent(this, CustomProviderSetupActivity.class), REQUEST_CODE_CONFIGURE_LEAP);
- }
+ Intent intent = new Intent(this, SetupActivity.class);
+ intent.putExtra(SetupActivity.EXTRA_SWITCH_PROVIDER, false);
+ startActivityForResult(intent, REQUEST_CODE_CONFIGURE_LEAP);
}
@Override
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/SetupViewPagerAdapter.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/SetupViewPagerAdapter.java
index a4a8fabd..00630f39 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/SetupViewPagerAdapter.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/SetupViewPagerAdapter.java
@@ -1,5 +1,6 @@
package se.leap.bitmaskclient.providersetup;
+import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask;
import static se.leap.bitmaskclient.providersetup.fragments.SetupFragmentFactory.CIRCUMVENTION_SETUP_FRAGMENT;
import static se.leap.bitmaskclient.providersetup.fragments.SetupFragmentFactory.CONFIGURE_PROVIDER_FRAGMENT;
import static se.leap.bitmaskclient.providersetup.fragments.SetupFragmentFactory.NOTIFICATION_PERMISSON_EDUCATIONAL_FRAGMENT;
@@ -33,7 +34,9 @@ public class SetupViewPagerAdapter extends FragmentStateAdapter {
this(fragmentManager, lifecycle);
ArrayList<Integer> fragments = new ArrayList<>();
if (providerSetup) {
- fragments.add(PROVIDER_SELECTION_FRAGMENT);
+ if (isDefaultBitmask()) {
+ fragments.add(PROVIDER_SELECTION_FRAGMENT);
+ }
fragments.add(CIRCUMVENTION_SETUP_FRAGMENT);
fragments.add(CONFIGURE_PROVIDER_FRAGMENT);
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/SetupActivity.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/SetupActivity.java
index a6e50769..724543e4 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/SetupActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/activities/SetupActivity.java
@@ -3,6 +3,7 @@ package se.leap.bitmaskclient.providersetup.activities;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static androidx.appcompat.app.ActionBar.DISPLAY_SHOW_CUSTOM;
+import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask;
import static se.leap.bitmaskclient.base.utils.PreferenceHelper.deleteProviderDetailsFromPreferences;
import static se.leap.bitmaskclient.providersetup.fragments.SetupFragmentFactory.CONFIGURE_PROVIDER_FRAGMENT;
import static se.leap.bitmaskclient.tor.TorStatusObservable.TorStatus.OFF;
@@ -84,14 +85,19 @@ public class SetupActivity extends AppCompatActivity implements SetupActivityCal
fragmentManager = new FragmentManagerEnhanced(getSupportFragmentManager());
ArrayList<View> indicatorViews = new ArrayList<>();
- // indicator views for provider selection and config setup
+ if (isDefaultBitmask()) {
+ // indicator view for provider selection
+ addIndicatorView(indicatorViews);
+ }
+
+ // indicator views for config setup
boolean basicProviderSetup = !ProviderObservable.getInstance().getCurrentProvider().isConfigured() || switchProvider;
if (basicProviderSetup) {
- for (int i = 0; i < 3; i++) {
- addIndicatorView(indicatorViews);
- }
+ addIndicatorView(indicatorViews);
+ addIndicatorView(indicatorViews);
}
+
// indicator views for VPN permission
Intent requestVpnPermission = VpnService.prepare(this);
if (requestVpnPermission != null) {
diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/CircumventionSetupFragment.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/CircumventionSetupFragment.java
index 11fa582b..34a93319 100644
--- a/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/CircumventionSetupFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/fragments/CircumventionSetupFragment.java
@@ -1,5 +1,8 @@
package se.leap.bitmaskclient.providersetup.fragments;
+import static se.leap.bitmaskclient.base.utils.ConfigHelper.isDefaultBitmask;
+
+import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -9,10 +12,14 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.base.utils.PreferenceHelper;
import se.leap.bitmaskclient.databinding.FCircumventionSetupBinding;
+import se.leap.bitmaskclient.providersetup.ProviderManager;
+import se.leap.bitmaskclient.providersetup.activities.CancelCallback;
+import se.leap.bitmaskclient.providersetup.activities.SetupActivityCallback;
-public class CircumventionSetupFragment extends BaseSetupFragment {
+public class CircumventionSetupFragment extends BaseSetupFragment implements CancelCallback {
public static CircumventionSetupFragment newInstance(int position) {
CircumventionSetupFragment fragment = new CircumventionSetupFragment();
@@ -24,7 +31,8 @@ public class CircumventionSetupFragment extends BaseSetupFragment {
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
FCircumventionSetupBinding binding = FCircumventionSetupBinding.inflate(inflater, container, false);
-
+ binding.rbPlainVpn.setText(getString(R.string.use_standard_vpn, getString(R.string.app_name)));
+ binding.tvCircumventionDetailDescription.setText(getString(R.string.circumvention_setup_hint, getString(R.string.app_name)));
binding.circumventionRadioGroup.setOnCheckedChangeListener((group, checkedId) -> {
if (binding.rbCircumvention.getId() == checkedId) {
PreferenceHelper.useBridges(true);
@@ -50,9 +58,38 @@ public class CircumventionSetupFragment extends BaseSetupFragment {
}
@Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ setupActivityCallback.registerCancelCallback(this);
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ setupActivityCallback.removeCancelCallback(this);
+ }
+
+ @Override
public void onFragmentSelected() {
super.onFragmentSelected();
- setupActivityCallback.setCancelButtonHidden(false);
+ setupActivityCallback.setCancelButtonHidden(!isDefaultBitmask());
setupActivityCallback.setNavigationButtonHidden(false);
+ if (!isDefaultBitmask()) {
+ loadProviderFromAssets();
+ }
+ }
+
+ private void loadProviderFromAssets() {
+ ProviderManager providerManager = ProviderManager.getInstance(getContext().getApplicationContext().getAssets(),
+ getContext().getExternalFilesDir(null));
+ providerManager.setAddDummyEntry(false);
+ setupActivityCallback.onProviderSelected(providerManager.providers().get(0));
+ }
+
+ @Override
+ public void onCanceled() {
+ if (!isDefaultBitmask()) {
+ loadProviderFromAssets();
+ }
}
} \ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 90d06333..baefac16 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -215,8 +215,8 @@
<string name="provider_description_calyx">Calyx is a non-profit education and research organization devoted to studying, testing, developing and implementing privacy technology and tools to promote free speech, free expression, civic engagement and privacy rights on the internet and in the mobile communications industry.</string>
<string name="title_circumvention_setup">Do You Require Censorship Circumvention?</string>
<string name="circumvention_setup_description">If you live where the internet is censored you can use our censorship circumvention options to access all internet services. These options will slow down your connection!</string>
- <string name="circumvention_setup_hint">Bitmask will automatically try to connect you to the internet using a variety of circumvention technologies. You can fine tune this in the advanced settings.</string>
- <string name="use_standard_vpn">Use standard Bitmask VPN</string>
+ <string name="circumvention_setup_hint">%s will automatically try to connect you to the internet using a variety of circumvention technologies. You can fine tune this in the advanced settings.</string>
+ <string name="use_standard_vpn">Use standard %s</string>
<string name="use_circumvention_tech">Use circumvention tech (slower)</string>
<string name="description_configure_provider">To connect to your provider Bitmask is fetching all the required configuration information. This only happens during first setup.</string>
<string name="description_configure_provider_circumvention">Bitmask is attempting to collect all required configuration data from the provider. This only happens during first setup. You selected to use circumvention technology, so this might take some time.</string>