summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java9
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java38
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/SessionDialog.java20
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/UserSessionStatus.java3
-rw-r--r--app/src/main/res/values/strings.xml3
-rw-r--r--app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java9
6 files changed, 46 insertions, 36 deletions
diff --git a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java
index 9ce0e99f..57c4d067 100644
--- a/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java
+++ b/app/src/debug/java/se/leap/bitmaskclient/ProviderAPI.java
@@ -143,6 +143,7 @@ public class ProviderAPI extends IntentService {
}
}
} else if (action.equalsIgnoreCase(SIGN_UP)) {
+ UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.SIGNING_UP);
Bundle result = tryToRegister(parameters);
if(result.getBoolean(RESULT_KEY)) {
receiver.send(SUCCESSFUL_SIGNUP, result);
@@ -198,11 +199,11 @@ public class ProviderAPI extends IntentService {
if(!wellFormedPassword(password)) {
result.putBoolean(RESULT_KEY, false);
result.putString(SessionDialog.USERNAME, username);
- result.putBoolean(SessionDialog.PASSWORD_INVALID_LENGTH, true);
+ result.putBoolean(SessionDialog.ERRORS.PASSWORD_INVALID_LENGTH.toString(), true);
}
if(!validUsername(username)) {
result.putBoolean(RESULT_KEY, false);
- result.putBoolean(SessionDialog.USERNAME_MISSING, true);
+ result.putBoolean(SessionDialog.ERRORS.USERNAME_MISSING.toString(), true);
}
}
@@ -247,11 +248,11 @@ public class ProviderAPI extends IntentService {
if(!wellFormedPassword(password)) {
result.putBoolean(RESULT_KEY, false);
result.putString(SessionDialog.USERNAME, username);
- result.putBoolean(SessionDialog.PASSWORD_INVALID_LENGTH, true);
+ result.putBoolean(SessionDialog.ERRORS.PASSWORD_INVALID_LENGTH.toString(), true);
}
if(!validUsername(username)) {
result.putBoolean(RESULT_KEY, false);
- result.putBoolean(SessionDialog.USERNAME_MISSING, true);
+ result.putBoolean(SessionDialog.ERRORS.USERNAME_MISSING.toString(), true);
}
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
index a8f6e110..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() {
@@ -291,20 +291,20 @@ public class Dashboard extends Activity implements SessionDialog.SessionDialogIn
public void signUp(String username, String password) {
User.setUserName(username);
Bundle parameters = bundlePassword(password);
- providerApiCommand(parameters, R.string.signingup_message, ProviderAPI.SIGN_UP);
+ providerApiCommand(parameters, 0, ProviderAPI.SIGN_UP);
}
@Override
public void logIn(String username, String password) {
User.setUserName(username);
Bundle parameters = bundlePassword(password);
- providerApiCommand(parameters, R.string.authenticating_message, ProviderAPI.LOG_IN);
+ providerApiCommand(parameters, 0, ProviderAPI.LOG_IN);
}
-
+
public void logOut() {
- providerApiCommand(Bundle.EMPTY, R.string.logout_message, ProviderAPI.LOG_OUT);
+ 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);
@@ -454,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 9025564b..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;
@@ -48,8 +46,11 @@ public class SessionDialog extends DialogFragment{
final public static String USERNAME = "username";
final public static String PASSWORD = "password";
- final public static String USERNAME_MISSING = "username missing";
- final public static String PASSWORD_INVALID_LENGTH = "password_invalid_length";
+ public static enum ERRORS {
+ USERNAME_MISSING,
+ PASSWORD_INVALID_LENGTH,
+ RISEUP_WARNING
+ }
@InjectView(R.id.user_message)
TextView user_message;
@@ -105,18 +106,21 @@ public class SessionDialog extends DialogFragment{
private void setUp(Bundle arguments) {
is_eip_pending = arguments.getBoolean(EipFragment.IS_PENDING, false);
- if (arguments.containsKey(PASSWORD_INVALID_LENGTH))
+ if (arguments.containsKey(ERRORS.PASSWORD_INVALID_LENGTH.toString()))
password_field.setError(getString(R.string.error_not_valid_password_user_message));
- 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);
}
- if (arguments.containsKey(USERNAME_MISSING)) {
+ if (arguments.containsKey(ERRORS.USERNAME_MISSING.toString())) {
username_field.setError(getString(R.string.username_ask));
}
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/java/se/leap/bitmaskclient/UserSessionStatus.java b/app/src/main/java/se/leap/bitmaskclient/UserSessionStatus.java
index f533819b..db432a82 100644
--- a/app/src/main/java/se/leap/bitmaskclient/UserSessionStatus.java
+++ b/app/src/main/java/se/leap/bitmaskclient/UserSessionStatus.java
@@ -30,7 +30,8 @@ public class UserSessionStatus extends Observable {
NOT_LOGGED_IN,
DIDNT_LOG_OUT,
LOGGING_IN,
- LOGGING_OUT
+ LOGGING_OUT,
+ SIGNING_UP
}
private static SessionStatus session_status = SessionStatus.NOT_LOGGED_IN;
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>
diff --git a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java
index 184173b2..c8fd0251 100644
--- a/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java
+++ b/app/src/release/java/se/leap/bitmaskclient/ProviderAPI.java
@@ -138,6 +138,7 @@ public class ProviderAPI extends IntentService {
}
}
} else if (action.equalsIgnoreCase(SIGN_UP)) {
+ UserSessionStatus.updateStatus(UserSessionStatus.SessionStatus.SIGNING_UP);
Bundle result = tryToRegister(parameters);
if(result.getBoolean(RESULT_KEY)) {
receiver.send(SUCCESSFUL_SIGNUP, result);
@@ -193,11 +194,11 @@ public class ProviderAPI extends IntentService {
if(!wellFormedPassword(password)) {
result.putBoolean(RESULT_KEY, false);
result.putString(SessionDialog.USERNAME, username);
- result.putBoolean(SessionDialog.PASSWORD_INVALID_LENGTH, true);
+ result.putBoolean(SessionDialog.ERRORS.PASSWORD_INVALID_LENGTH.toString(), true);
}
if(!validUsername(username)) {
result.putBoolean(RESULT_KEY, false);
- result.putBoolean(SessionDialog.USERNAME_MISSING, true);
+ result.putBoolean(SessionDialog.ERRORS.USERNAME_MISSING.toString(), true);
}
}
@@ -243,11 +244,11 @@ public class ProviderAPI extends IntentService {
if(!wellFormedPassword(password)) {
result.putBoolean(RESULT_KEY, false);
result.putString(SessionDialog.USERNAME, username);
- result.putBoolean(SessionDialog.PASSWORD_INVALID_LENGTH, true);
+ result.putBoolean(SessionDialog.ERRORS.PASSWORD_INVALID_LENGTH.toString(), true);
}
if(!validUsername(username)) {
result.putBoolean(RESULT_KEY, false);
- result.putBoolean(SessionDialog.USERNAME_MISSING, true);
+ result.putBoolean(SessionDialog.ERRORS.USERNAME_MISSING.toString(), true);
}
}