Decouple AuthType / ConnectionSecurity from main app

This commit is contained in:
Jan Berkel 2014-12-17 19:37:18 +01:00
parent 9c7776d289
commit 51bc464449
8 changed files with 241 additions and 142 deletions

View file

@ -79,7 +79,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
private CheckBox mCompressionWifi;
private CheckBox mCompressionOther;
private CheckBox mSubscribedFoldersOnly;
private ArrayAdapter<AuthType> mAuthTypeAdapter;
private AuthTypeAdapter mAuthTypeAdapter;
private String mDefaultPort = "";
private String mDefaultSslPort = "";
private ConnectionSecurity[] mConnectionSecurityChoices = ConnectionSecurity.values();
@ -142,7 +142,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
}
});
mAuthTypeAdapter = AuthType.getArrayAdapter(this);
mAuthTypeAdapter = AuthTypeAdapter.get(this);
mAuthTypeView.setAdapter(mAuthTypeAdapter);
/*
@ -168,7 +168,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
if (savedInstanceState == null) {
// The first item is selected if settings.authenticationType is null or is not in mAuthTypeAdapter
mCurrentAuthTypeViewPosition = mAuthTypeAdapter.getPosition(settings.authenticationType);
mCurrentAuthTypeViewPosition = mAuthTypeAdapter.getAuthPosition(settings.authenticationType);
} else {
mCurrentAuthTypeViewPosition = savedInstanceState.getInt(STATE_AUTH_TYPE_POSITION);
}
@ -257,13 +257,13 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
}
// Note that mConnectionSecurityChoices is configured above based on server type
ArrayAdapter<ConnectionSecurity> securityTypesAdapter =
ConnectionSecurity.getArrayAdapter(this, mConnectionSecurityChoices);
ConnectionSecurityAdapter securityTypesAdapter =
ConnectionSecurityAdapter.get(this, mConnectionSecurityChoices);
mSecurityTypeView.setAdapter(securityTypesAdapter);
// Select currently configured security type
if (savedInstanceState == null) {
mCurrentSecurityTypeViewPosition = securityTypesAdapter.getPosition(settings.connectionSecurity);
mCurrentSecurityTypeViewPosition = securityTypesAdapter.getConnectionSecurityPosition(settings.connectionSecurity);
} else {
/*
@ -347,7 +347,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
updateViewFromAuthType();
validateFields();
AuthType selection = (AuthType) mAuthTypeView.getSelectedItem();
AuthType selection = getSelectedAuthType();
// Have the user select (or confirm) the client certificate
if (AuthType.EXTERNAL == selection) {
@ -395,7 +395,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
* Shows/hides password field and client certificate spinner
*/
private void updateViewFromAuthType() {
AuthType authType = (AuthType) mAuthTypeView.getSelectedItem();
AuthType authType = getSelectedAuthType();
boolean isAuthTypeExternal = (AuthType.EXTERNAL == authType);
if (isAuthTypeExternal) {
@ -421,10 +421,10 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
* that this is the last thing called after an input change.)
*/
private void validateFields() {
AuthType authType = (AuthType) mAuthTypeView.getSelectedItem();
AuthType authType = getSelectedAuthType();
boolean isAuthTypeExternal = (AuthType.EXTERNAL == authType);
ConnectionSecurity connectionSecurity = (ConnectionSecurity) mSecurityTypeView.getSelectedItem();
ConnectionSecurity connectionSecurity = getSelectedSecurity();
boolean hasConnectionSecurity = (connectionSecurity != ConnectionSecurity.NONE);
if (isAuthTypeExternal && !hasConnectionSecurity) {
@ -448,16 +448,16 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
mSecurityTypeView.setOnItemSelectedListener(null);
mSecurityTypeView.setSelection(mCurrentSecurityTypeViewPosition, false);
mSecurityTypeView.setOnItemSelectedListener(onItemSelectedListener);
updateAuthPlainTextFromSecurityType((ConnectionSecurity) mSecurityTypeView.getSelectedItem());
updateAuthPlainTextFromSecurityType(getSelectedSecurity());
mPortView.removeTextChangedListener(validationTextWatcher);
mPortView.setText(mCurrentPortViewSetting);
mPortView.addTextChangedListener(validationTextWatcher);
authType = (AuthType) mAuthTypeView.getSelectedItem();
authType = getSelectedAuthType();
isAuthTypeExternal = (AuthType.EXTERNAL == authType);
connectionSecurity = (ConnectionSecurity) mSecurityTypeView.getSelectedItem();
connectionSecurity = getSelectedSecurity();
hasConnectionSecurity = (connectionSecurity != ConnectionSecurity.NONE);
} else {
mCurrentAuthTypeViewPosition = mAuthTypeView.getSelectedItemPosition();
@ -484,7 +484,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
}
private void updatePortFromSecurityType() {
ConnectionSecurity securityType = (ConnectionSecurity) mSecurityTypeView.getSelectedItem();
ConnectionSecurity securityType = getSelectedSecurity();
updateAuthPlainTextFromSecurityType(securityType);
// Remove listener so as not to trigger validateFields() which is called
@ -512,13 +512,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
}
private void updateAuthPlainTextFromSecurityType(ConnectionSecurity securityType) {
switch (securityType) {
case NONE:
AuthType.PLAIN.useInsecureText(true, mAuthTypeAdapter);
break;
default:
AuthType.PLAIN.useInsecureText(false, mAuthTypeAdapter);
}
mAuthTypeAdapter.useInsecureText(securityType == ConnectionSecurity.NONE);
}
@Override
@ -547,7 +541,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
String password = null;
String clientCertificateAlias = null;
AuthType authType = (AuthType) mAuthTypeView.getSelectedItem();
AuthType authType = getSelectedAuthType();
if (AuthType.EXTERNAL == authType) {
clientCertificateAlias = mClientCertificateSpinner.getAlias();
} else {
@ -575,13 +569,13 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
protected void onNext() {
try {
ConnectionSecurity connectionSecurity = (ConnectionSecurity) mSecurityTypeView.getSelectedItem();
ConnectionSecurity connectionSecurity = getSelectedSecurity();
String username = mUsernameView.getText().toString();
String password = null;
String clientCertificateAlias = null;
AuthType authType = (AuthType) mAuthTypeView.getSelectedItem();
AuthType authType = getSelectedAuthType();
if (authType == AuthType.EXTERNAL) {
clientCertificateAlias = mClientCertificateSpinner.getAlias();
} else {
@ -645,6 +639,7 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
toast.show();
}
/*
* Calls validateFields() which enables or disables the Next button
* based on the fields' validity.
@ -669,4 +664,14 @@ public class AccountSetupIncoming extends K9Activity implements OnClickListener
validateFields();
}
};
private AuthType getSelectedAuthType() {
AuthTypeHolder holder = (AuthTypeHolder) mAuthTypeView.getSelectedItem();
return holder.authType;
}
private ConnectionSecurity getSelectedSecurity() {
ConnectionSecurityHolder holder = (ConnectionSecurityHolder) mSecurityTypeView.getSelectedItem();
return holder.connectionSecurity;
}
}

View file

@ -55,7 +55,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
private int mCurrentSecurityTypeViewPosition;
private Spinner mAuthTypeView;
private int mCurrentAuthTypeViewPosition;
private ArrayAdapter<AuthType> mAuthTypeAdapter;
private AuthTypeAdapter mAuthTypeAdapter;
private Button mNextButton;
private Account mAccount;
private boolean mMakeDefault;
@ -112,9 +112,9 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
mNextButton.setOnClickListener(this);
mSecurityTypeView.setAdapter(ConnectionSecurity.getArrayAdapter(this));
mSecurityTypeView.setAdapter(ConnectionSecurityAdapter.get(this));
mAuthTypeAdapter = AuthType.getArrayAdapter(this);
mAuthTypeAdapter = AuthTypeAdapter.get(this);
mAuthTypeView.setAdapter(mAuthTypeAdapter);
/*
@ -143,7 +143,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
if (savedInstanceState == null) {
// The first item is selected if settings.authenticationType is null or is not in mAuthTypeAdapter
mCurrentAuthTypeViewPosition = mAuthTypeAdapter.getPosition(settings.authenticationType);
mCurrentAuthTypeViewPosition = mAuthTypeAdapter.getAuthPosition(settings.authenticationType);
} else {
mCurrentAuthTypeViewPosition = savedInstanceState.getInt(STATE_AUTH_TYPE_POSITION);
}
@ -229,8 +229,8 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
if (mCurrentSecurityTypeViewPosition != position) {
updatePortFromSecurityType();
boolean isInsecure = (ConnectionSecurity.NONE == mSecurityTypeView.getSelectedItem());
boolean isAuthExternal = (AuthType.EXTERNAL == mAuthTypeView.getSelectedItem());
boolean isInsecure = (ConnectionSecurity.NONE == getSelectedSecurity());
boolean isAuthExternal = (AuthType.EXTERNAL == getSelectedAuthType());
boolean loginNotRequired = !mRequireLoginView.isChecked();
/*
@ -246,7 +246,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
if (isInsecure && isAuthExternal && loginNotRequired) {
OnItemSelectedListener onItemSelectedListener = mAuthTypeView.getOnItemSelectedListener();
mAuthTypeView.setOnItemSelectedListener(null);
mCurrentAuthTypeViewPosition = mAuthTypeAdapter.getPosition(AuthType.PLAIN);
mCurrentAuthTypeViewPosition = mAuthTypeAdapter.getAuthPosition(AuthType.PLAIN);
mAuthTypeView.setSelection(mCurrentAuthTypeViewPosition, false);
mAuthTypeView.setOnItemSelectedListener(onItemSelectedListener);
updateViewFromAuthType();
@ -270,7 +270,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
updateViewFromAuthType();
validateFields();
AuthType selection = (AuthType) mAuthTypeView.getSelectedItem();
AuthType selection = getSelectedAuthType();
// Have the user select (or confirm) the client certificate
if (AuthType.EXTERNAL == selection) {
@ -330,7 +330,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
* Shows/hides password field and client certificate spinner
*/
private void updateViewFromAuthType() {
AuthType authType = (AuthType) mAuthTypeView.getSelectedItem();
AuthType authType = getSelectedAuthType();
boolean isAuthTypeExternal = (AuthType.EXTERNAL == authType);
if (isAuthTypeExternal) {
@ -356,10 +356,10 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
* that this is the last thing called after an input change.)
*/
private void validateFields() {
AuthType authType = (AuthType) mAuthTypeView.getSelectedItem();
AuthType authType = getSelectedAuthType();
boolean isAuthTypeExternal = (AuthType.EXTERNAL == authType);
ConnectionSecurity connectionSecurity = (ConnectionSecurity) mSecurityTypeView.getSelectedItem();
ConnectionSecurity connectionSecurity = getSelectedSecurity();
boolean hasConnectionSecurity = (connectionSecurity != ConnectionSecurity.NONE);
if (isAuthTypeExternal && !hasConnectionSecurity) {
@ -383,16 +383,16 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
mSecurityTypeView.setOnItemSelectedListener(null);
mSecurityTypeView.setSelection(mCurrentSecurityTypeViewPosition, false);
mSecurityTypeView.setOnItemSelectedListener(onItemSelectedListener);
updateAuthPlainTextFromSecurityType((ConnectionSecurity) mSecurityTypeView.getSelectedItem());
updateAuthPlainTextFromSecurityType(getSelectedSecurity());
mPortView.removeTextChangedListener(validationTextWatcher);
mPortView.setText(mCurrentPortViewSetting);
mPortView.addTextChangedListener(validationTextWatcher);
authType = (AuthType) mAuthTypeView.getSelectedItem();
authType = getSelectedAuthType();
isAuthTypeExternal = (AuthType.EXTERNAL == authType);
connectionSecurity = (ConnectionSecurity) mSecurityTypeView.getSelectedItem();
connectionSecurity = getSelectedSecurity();
hasConnectionSecurity = (connectionSecurity != ConnectionSecurity.NONE);
} else {
mCurrentAuthTypeViewPosition = mAuthTypeView.getSelectedItemPosition();
@ -421,7 +421,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
}
private void updatePortFromSecurityType() {
ConnectionSecurity securityType = (ConnectionSecurity) mSecurityTypeView.getSelectedItem();
ConnectionSecurity securityType = getSelectedSecurity();
updateAuthPlainTextFromSecurityType(securityType);
// Remove listener so as not to trigger validateFields() which is called
@ -449,13 +449,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
}
private void updateAuthPlainTextFromSecurityType(ConnectionSecurity securityType) {
switch (securityType) {
case NONE:
AuthType.PLAIN.useInsecureText(true, mAuthTypeAdapter);
break;
default:
AuthType.PLAIN.useInsecureText(false, mAuthTypeAdapter);
}
mAuthTypeAdapter.useInsecureText(securityType == ConnectionSecurity.NONE);
}
@Override
@ -472,7 +466,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
}
protected void onNext() {
ConnectionSecurity securityType = (ConnectionSecurity) mSecurityTypeView.getSelectedItem();
ConnectionSecurity securityType = getSelectedSecurity();
String uri;
String username = null;
String password = null;
@ -481,7 +475,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
if (mRequireLoginView.isChecked()) {
username = mUsernameView.getText().toString();
authType = (AuthType) mAuthTypeView.getSelectedItem();
authType = getSelectedAuthType();
if (AuthType.EXTERNAL == authType) {
clientCertificateAlias = mClientCertificateSpinner.getAlias();
} else {
@ -511,6 +505,7 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
mRequireLoginSettingsView.setVisibility(isChecked ? View.VISIBLE : View.GONE);
validateFields();
}
private void failure(Exception use) {
Log.e(K9.LOG_TAG, "Failure", use);
String toastText = getString(R.string.account_setup_bad_uri, use.getMessage());
@ -541,4 +536,14 @@ public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
validateFields();
}
};
private AuthType getSelectedAuthType() {
AuthTypeHolder holder = (AuthTypeHolder) mAuthTypeView.getSelectedItem();
return holder.authType;
}
private ConnectionSecurity getSelectedSecurity() {
ConnectionSecurityHolder holder = (ConnectionSecurityHolder) mSecurityTypeView.getSelectedItem();
return holder.connectionSecurity;
}
}

View file

@ -0,0 +1,52 @@
package com.fsck.k9.activity.setup;
import android.content.Context;
import android.widget.ArrayAdapter;
import com.fsck.k9.mail.AuthType;
class AuthTypeAdapter extends ArrayAdapter<AuthTypeHolder> {
public AuthTypeAdapter(Context context, int simple_spinner_item, AuthTypeHolder[] holders) {
super(context, simple_spinner_item, holders);
}
public static AuthTypeAdapter get(Context context) {
AuthType[] authTypes = new AuthType[]{AuthType.PLAIN, AuthType.CRAM_MD5, AuthType.EXTERNAL};
AuthTypeHolder[] holders = new AuthTypeHolder[authTypes.length];
for (int i = 0; i < authTypes.length; i++) {
holders[i] = new AuthTypeHolder(authTypes[i], context.getResources());
}
AuthTypeAdapter authTypesAdapter = new AuthTypeAdapter(context,
android.R.layout.simple_spinner_item, holders);
authTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
return authTypesAdapter;
}
/**
* Used to select an appropriate localized text label for the
* {@code AuthType.PLAIN} option presented to users.
*
* @param insecure
* <p>
* A value of {@code true} will use "Normal password".
* <p>
* A value of {@code false} will use
* "Password, transmitted insecurely"
*/
public void useInsecureText(boolean insecure) {
for (int i=0; i<getCount(); i++) {
getItem(i).setInsecure(insecure);
}
notifyDataSetChanged();
}
public int getAuthPosition(AuthType authenticationType) {
for (int i=0; i<getCount(); i++) {
if (getItem(i).authType == authenticationType) {
return i;
}
}
return -1;
}
}

View file

@ -0,0 +1,51 @@
package com.fsck.k9.activity.setup;
import android.content.res.Resources;
import com.fsck.k9.R;
import com.fsck.k9.mail.AuthType;
class AuthTypeHolder {
final AuthType authType;
private final Resources resources;
private boolean insecure;
public AuthTypeHolder(AuthType authType, Resources resources) {
this.authType = authType;
this.resources = resources;
}
public void setInsecure(boolean insecure) {
this.insecure = insecure;
}
@Override
public String toString() {
final int resourceId = resourceId();
if (resourceId == 0) {
return authType.name();
} else {
return resources.getString(resourceId);
}
}
private int resourceId() {
switch (authType) {
case PLAIN:
if (insecure) {
return R.string.account_setup_auth_type_insecure_password;
} else {
return R.string.account_setup_auth_type_normal_password;
}
case CRAM_MD5:
return R.string.account_setup_auth_type_encrypted_password;
case EXTERNAL:
return R.string.account_setup_auth_type_tls_client_certificate;
case AUTOMATIC:
case LOGIN:
default:
return 0;
}
}
}

View file

@ -0,0 +1,38 @@
package com.fsck.k9.activity.setup;
import android.content.Context;
import android.widget.ArrayAdapter;
import com.fsck.k9.mail.ConnectionSecurity;
class ConnectionSecurityAdapter extends ArrayAdapter<ConnectionSecurityHolder> {
public ConnectionSecurityAdapter(Context context, int resource, ConnectionSecurityHolder[] securityTypes) {
super(context, resource, securityTypes);
}
public static ConnectionSecurityAdapter get(Context context) {
return get(context, ConnectionSecurity.values());
}
public static ConnectionSecurityAdapter get(Context context,
ConnectionSecurity[] items) {
ConnectionSecurityHolder[] holders = new ConnectionSecurityHolder[items.length];
for (int i = 0; i < items.length; i++) {
holders[i] = new ConnectionSecurityHolder(items[i], context.getResources());
}
ConnectionSecurityAdapter securityTypesAdapter = new ConnectionSecurityAdapter(context,
android.R.layout.simple_spinner_item, holders);
securityTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
return securityTypesAdapter;
}
public int getConnectionSecurityPosition(ConnectionSecurity connectionSecurity) {
for (int i=0; i<getCount(); i++) {
if (getItem(i).connectionSecurity == connectionSecurity) {
return i;
}
}
return -1;
}
}

View file

@ -0,0 +1,34 @@
package com.fsck.k9.activity.setup;
import android.content.res.Resources;
import com.fsck.k9.R;
import com.fsck.k9.mail.ConnectionSecurity;
class ConnectionSecurityHolder {
final ConnectionSecurity connectionSecurity;
private final Resources resources;
public ConnectionSecurityHolder(ConnectionSecurity connectionSecurity, Resources resources) {
this.connectionSecurity = connectionSecurity;
this.resources = resources;
}
public String toString() {
final int resourceId = resourceId();
if (resourceId == 0) {
return connectionSecurity.name();
} else {
return resources.getString(resourceId);
}
}
private int resourceId() {
switch (connectionSecurity) {
case NONE: return R.string.account_setup_incoming_security_none_label;
case STARTTLS_REQUIRED: return R.string.account_setup_incoming_security_tls_label;
case SSL_TLS_REQUIRED: return R.string.account_setup_incoming_security_ssl_label;
default: return 0;
}
}
}

View file

@ -1,10 +1,5 @@
package com.fsck.k9.mail;
import android.content.Context;
import android.widget.ArrayAdapter;
import com.fsck.k9.K9;
import com.fsck.k9.R;
public enum AuthType {
/*
* The names of these authentication types are saved as strings when
@ -17,23 +12,9 @@ public enum AuthType {
* their original names have been retained for backward compatibility with
* user settings.
*/
PLAIN(R.string.account_setup_auth_type_normal_password){
@Override
public void useInsecureText(boolean insecure, ArrayAdapter<AuthType> authTypesAdapter) {
if (insecure) {
mResourceId = R.string.account_setup_auth_type_insecure_password;
} else {
mResourceId = R.string.account_setup_auth_type_normal_password;
}
authTypesAdapter.notifyDataSetChanged();
}
},
CRAM_MD5(R.string.account_setup_auth_type_encrypted_password),
EXTERNAL(R.string.account_setup_auth_type_tls_client_certificate),
PLAIN,
CRAM_MD5,
EXTERNAL,
/*
* The following are obsolete authentication settings that were used with
@ -41,45 +22,6 @@ public enum AuthType {
* still exist in a user's settings from a previous version or may be found
* when importing settings.
*/
AUTOMATIC(0),
LOGIN(0);
static public ArrayAdapter<AuthType> getArrayAdapter(Context context) {
AuthType[] authTypes = new AuthType[]{PLAIN, CRAM_MD5, EXTERNAL};
ArrayAdapter<AuthType> authTypesAdapter = new ArrayAdapter<AuthType>(context,
android.R.layout.simple_spinner_item, authTypes);
authTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
return authTypesAdapter;
}
int mResourceId;
private AuthType(int id) {
mResourceId = id;
}
/**
* Used to select an appropriate localized text label for the
* {@code AuthType.PLAIN} option presented to users.
*
* @param insecure
* <p>
* A value of {@code true} will use "Normal password".
* <p>
* A value of {@code false} will use
* "Password, transmitted insecurely"
*/
public void useInsecureText(boolean insecure, ArrayAdapter<AuthType> authTypesAdapter) {
// Do nothing. Overridden in AuthType.PLAIN
}
@Override
public String toString() {
if (mResourceId == 0) {
return name();
} else {
return K9.app.getString(mResourceId);
}
}
AUTOMATIC,
LOGIN
}

View file

@ -1,35 +1,7 @@
package com.fsck.k9.mail;
import android.content.Context;
import android.widget.ArrayAdapter;
import com.fsck.k9.K9;
import com.fsck.k9.R;
public enum ConnectionSecurity {
NONE(R.string.account_setup_incoming_security_none_label),
STARTTLS_REQUIRED(R.string.account_setup_incoming_security_tls_label),
SSL_TLS_REQUIRED(R.string.account_setup_incoming_security_ssl_label);
static public ArrayAdapter<ConnectionSecurity> getArrayAdapter(Context context) {
return getArrayAdapter(context, ConnectionSecurity.values());
}
static public ArrayAdapter<ConnectionSecurity> getArrayAdapter(Context context, ConnectionSecurity[] securityTypes) {
ArrayAdapter<ConnectionSecurity> securityTypesAdapter = new ArrayAdapter<ConnectionSecurity>(context,
android.R.layout.simple_spinner_item, securityTypes);
securityTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
return securityTypesAdapter;
}
private final int mResourceId;
private ConnectionSecurity(int id) {
mResourceId = id;
}
@Override
public String toString() {
return K9.app.getString(mResourceId);
}
NONE,
STARTTLS_REQUIRED,
SSL_TLS_REQUIRED
}