summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-03-19 16:56:32 +0100
committerParménides GV <parmegv@sdf.org>2015-03-19 16:56:32 +0100
commitd18be7ed1dfc645bd378c2eb0c152f7e0eda42e9 (patch)
tree5887a0e8d3b091ae27293870a70b7ccc67128c61
parent2c44ba2678c6b3367a119d1e857dd5d5723f7681 (diff)
Show gus message just for riseup login.
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java34
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/SessionDialog.java13
-rw-r--r--app/src/main/res/values/strings.xml3
3 files changed, 25 insertions, 25 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
index 14d79bc0..7c5e5421 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
@@ -1,6 +1,6 @@
/**
* Copyright (c) 2013 LEAP Encryption Access Project and contributers
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -37,7 +37,7 @@ import se.leap.bitmaskclient.eip.*;
/**
* The main user facing Activity of Bitmask Android, consisting of status, controls,
* and access to preferences.
- *
+ *
* @author Sean Leonard <meanderingcode@aetherislands.net>
* @author parmegv
*/
@@ -202,7 +202,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
})
.show();
}
-
+
/**
* Inflates permanent UI elements of the View and contains logic for what
* service dependent UI elements to include.
@@ -248,7 +248,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
getMenuInflater().inflate(R.menu.client_dashboard, menu);
return true;
}
-
+
@Override
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()){
@@ -279,7 +279,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
public void showAbout() {
Intent intent = new Intent(this, AboutActivity.class);
- startActivity(intent);
+ startActivity(intent);
}
public void showLog() {
@@ -300,11 +300,11 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
Bundle parameters = bundlePassword(password);
providerApiCommand(parameters, 0, ProviderAPI.LOG_IN);
}
-
+
public void logOut() {
providerApiCommand(Bundle.EMPTY, 0, ProviderAPI.LOG_OUT);
}
-
+
@Override
public void update (Observable observable, Object data) {
if(observable instanceof UserSessionStatus) {
@@ -374,7 +374,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
eip_fragment.progress_bar.setVisibility(ProgressBar.VISIBLE);
setStatusMessage(progressbar_message_resId);
}
-
+
Intent command = prepareProviderAPICommand(parameters, providerApi_action);
startService(command);
}
@@ -382,9 +382,9 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
private Intent prepareProviderAPICommand(Bundle parameters, String action) {
providerAPI_result_receiver = new ProviderAPIResultReceiver(new Handler());
providerAPI_result_receiver.setReceiver(this);
-
+
Intent command = new Intent(this, ProviderAPI.class);
-
+
command.putExtra(ProviderAPI.PARAMETERS, parameters);
command.putExtra(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver);
command.setAction(action);
@@ -394,12 +394,16 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
public void cancelLoginOrSignup() {
EipStatus.getInstance().setConnectedOrDisconnected();
}
-
+
public void sessionDialog(Bundle resultData) {
-
+
FragmentTransaction transaction = fragment_manager.removePreviousFragment(SessionDialog.TAG);
DialogFragment newFragment = new SessionDialog();
+ if(provider.getName().equalsIgnoreCase("riseup")) {
+ resultData = resultData == Bundle.EMPTY ? new Bundle() : resultData;
+ resultData.putBoolean(SessionDialog.ERRORS.RISEUP_WARNING.toString(), true);
+ }
if(resultData != null && !resultData.isEmpty()) {
newFragment.setArguments(resultData);
}
@@ -408,7 +412,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
private void switchProvider() {
if (provider.hasEIP()) eip_fragment.stopEipIfPossible();
-
+
preferences.edit().clear().apply();
switching_provider = false;
startActivityForResult(new Intent(this, ConfigurationWizard.class), SWITCH_PROVIDER);
@@ -426,8 +430,6 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
} else if(resultCode == ProviderAPI.SUCCESSFUL_LOGIN) {
downloadVpnCertificate();
} else if(resultCode == ProviderAPI.FAILED_LOGIN) {
- if(provider.getName().equalsIgnoreCase("riseup"))
- resultData.putBoolean(SessionDialog.ERRORS.CONFUSING_CREDENTIALS.toString(), true);
sessionDialog(resultData);
} else if(resultCode == ProviderAPI.SUCCESSFUL_LOGOUT) {
if(switching_provider) switchProvider();
@@ -456,7 +458,7 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
public static Context getContext() {
return app;
}
-
+
@Override
public void startActivityForResult(Intent intent, int requestCode) {
intent.putExtra(Dashboard.REQUEST_CODE, requestCode);
diff --git a/app/src/main/java/se/leap/bitmaskclient/SessionDialog.java b/app/src/main/java/se/leap/bitmaskclient/SessionDialog.java
index e32bca8e..91e56330 100644
--- a/app/src/main/java/se/leap/bitmaskclient/SessionDialog.java
+++ b/app/src/main/java/se/leap/bitmaskclient/SessionDialog.java
@@ -26,8 +26,6 @@ import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
-import org.jetbrains.annotations.NotNull;
-
import butterknife.ButterKnife;
import butterknife.InjectView;
@@ -51,7 +49,7 @@ public class SessionDialog extends DialogFragment{
public static enum ERRORS {
USERNAME_MISSING,
PASSWORD_INVALID_LENGTH,
- CONFUSING_CREDENTIALS
+ RISEUP_WARNING
}
@InjectView(R.id.user_message)
@@ -110,9 +108,10 @@ public class SessionDialog extends DialogFragment{
is_eip_pending = arguments.getBoolean(EipFragment.IS_PENDING, false);
if (arguments.containsKey(ERRORS.PASSWORD_INVALID_LENGTH.toString()))
password_field.setError(getString(R.string.error_not_valid_password_user_message));
- else if(arguments.containsKey(ERRORS.CONFUSING_CREDENTIALS.toString()))
- username_field.setError("Perhaps you used your non LEAP credentials");
- if (arguments.containsKey(USERNAME)) {
+ else if(arguments.containsKey(ERRORS.RISEUP_WARNING.toString())) {
+ user_message.setVisibility(TextView.VISIBLE);
+ user_message.setText(R.string.login_riseup_warning);
+ } if (arguments.containsKey(USERNAME)) {
String username = arguments.getString(USERNAME);
username_field.setText(username);
}
@@ -121,7 +120,7 @@ public class SessionDialog extends DialogFragment{
}
if(arguments.containsKey(getString(R.string.user_message)))
user_message.setText(arguments.getString(getString(R.string.user_message)));
- else
+ else if(user_message.getVisibility() != TextView.VISIBLE)
user_message.setVisibility(View.GONE);
if(!username_field.getText().toString().isEmpty() && password_field.isFocusable())
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 632bc1f8..d1e33928 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -59,11 +59,10 @@
<string name="logout_message">Logging out from this session.</string>
<string name="logged_out_message">Logged out.</string>
<string name="log_out_failed_message">Didn\'t log out. Try later, it may be a problem in the network or in the provider. If the problem persists, then wipe Bitmask data from the Android settings</string>
+ <string name="login.riseup.warning">"Riseup users: You need to create a separate account to use the VPN service"</string>
<string name="succesful_authentication_message">Authentication succeeded.</string>
<string name="authentication_failed_message">Authentication failed.</string>
<string name="registration_failed_message">Registration failed.</string>
- <string name="successful_authed_cert_downloaded_message">Your own cert has been correctly downloaded.</string>
- <string name="authed_cert_download_failed_message">Your own cert has incorrectly been downloaded.</string>
<string name="eip_status_start_pending">Initiating connection</string>
<string name="eip_cancel_connect_title">Cancel connection?</string>
<string name="eip_cancel_connect_text">There is a connection attempt in progress. Do you wish to cancel it?</string>