Removed commented code and remaining forced exception

This commit is contained in:
David A. Velasco 2014-04-07 11:14:44 +02:00
parent a3798996e1
commit f24e56d19d
2 changed files with 14 additions and 28 deletions

View file

@ -307,7 +307,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
/// step 1 - load and process relevant inputs (resources, intent, savedInstanceState) /// step 1 - load and process relevant inputs (resources, intent, savedInstanceState)
boolean isUrlInputAllowed = getResources().getBoolean(R.bool.show_server_url_input); boolean isUrlInputAllowed = getResources().getBoolean(R.bool.show_server_url_input);
//boolean refreshButtonEnabled = false;
if (savedInstanceState == null) { if (savedInstanceState == null) {
if (mAccount != null) { if (mAccount != null) {
mServerInfo.mBaseUrl = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_BASE_URL); mServerInfo.mBaseUrl = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_BASE_URL);
@ -321,7 +320,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
mServerInfo.mIsSslConn = mServerInfo.mBaseUrl.startsWith("https://"); mServerInfo.mIsSslConn = mServerInfo.mBaseUrl.startsWith("https://");
} }
} else { } else {
//refreshButtonEnabled = savedInstanceState.getBoolean(KEY_REFRESH_BUTTON_ENABLED);
mServerStatusText = savedInstanceState.getInt(KEY_SERVER_STATUS_TEXT); mServerStatusText = savedInstanceState.getInt(KEY_SERVER_STATUS_TEXT);
mServerStatusIcon = savedInstanceState.getInt(KEY_SERVER_STATUS_ICON); mServerStatusIcon = savedInstanceState.getInt(KEY_SERVER_STATUS_ICON);
@ -761,10 +759,8 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
private void showViewPasswordButton() { private void showViewPasswordButton() {
//int drawable = android.R.drawable.ic_menu_view;
int drawable = R.drawable.ic_view; int drawable = R.drawable.ic_view;
if (isPasswordVisible()) { if (isPasswordVisible()) {
//drawable = android.R.drawable.ic_secure;
drawable = R.drawable.ic_hide; drawable = R.drawable.ic_hide;
} }
mPasswordInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, drawable, 0); mPasswordInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, drawable, 0);
@ -881,14 +877,12 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
showAuthStatus(); showAuthStatus();
// GET AUTHORIZATION request // GET AUTHORIZATION request
//Uri uri = Uri.parse(getString(R.string.oauth2_url_endpoint_auth));
Uri uri = Uri.parse(mOAuthAuthEndpointText.getText().toString().trim()); Uri uri = Uri.parse(mOAuthAuthEndpointText.getText().toString().trim());
Uri.Builder uriBuilder = uri.buildUpon(); Uri.Builder uriBuilder = uri.buildUpon();
uriBuilder.appendQueryParameter(OAuth2Constants.KEY_RESPONSE_TYPE, getString(R.string.oauth2_response_type)); uriBuilder.appendQueryParameter(OAuth2Constants.KEY_RESPONSE_TYPE, getString(R.string.oauth2_response_type));
uriBuilder.appendQueryParameter(OAuth2Constants.KEY_REDIRECT_URI, getString(R.string.oauth2_redirect_uri)); uriBuilder.appendQueryParameter(OAuth2Constants.KEY_REDIRECT_URI, getString(R.string.oauth2_redirect_uri));
uriBuilder.appendQueryParameter(OAuth2Constants.KEY_CLIENT_ID, getString(R.string.oauth2_client_id)); uriBuilder.appendQueryParameter(OAuth2Constants.KEY_CLIENT_ID, getString(R.string.oauth2_client_id));
uriBuilder.appendQueryParameter(OAuth2Constants.KEY_SCOPE, getString(R.string.oauth2_scope)); uriBuilder.appendQueryParameter(OAuth2Constants.KEY_SCOPE, getString(R.string.oauth2_scope));
//uriBuilder.appendQueryParameter(OAuth2Constants.KEY_STATE, whateverwewant);
uri = uriBuilder.build(); uri = uriBuilder.build();
Log_OC.d(TAG, "Starting browser to view " + uri.toString()); Log_OC.d(TAG, "Starting browser to view " + uri.toString());
Intent i = new Intent(Intent.ACTION_VIEW, uri); Intent i = new Intent(Intent.ACTION_VIEW, uri);
@ -988,7 +982,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
mWaitingForOpId = Long.MAX_VALUE; mWaitingForOpId = Long.MAX_VALUE;
dismissDialog(WAIT_DIALOG_TAG); dismissDialog(WAIT_DIALOG_TAG);
//if (result.isTemporalRedirection() && result.isIdPRedirection()) {
if (result.isIdPRedirection()) { if (result.isIdPRedirection()) {
String url = result.getRedirectedLocation(); String url = result.getRedirectedLocation();
String targetUrl = mServerInfo.mBaseUrl String targetUrl = mServerInfo.mBaseUrl
@ -1329,7 +1322,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
mWaitingForOpId = Long.MAX_VALUE; mWaitingForOpId = Long.MAX_VALUE;
dismissDialog(WAIT_DIALOG_TAG); dismissDialog(WAIT_DIALOG_TAG);
result = new RemoteOperationResult(new RuntimeException("FAKE"));
if (result.isSuccess()) { if (result.isSuccess()) {
Log_OC.d(TAG, "Successful access - time to save the account"); Log_OC.d(TAG, "Successful access - time to save the account");
@ -1351,12 +1343,6 @@ SsoWebViewClientListener, OnSslUntrustedCertListener {
/// the server /// the server
mServerIsChecked = true; mServerIsChecked = true;
mServerIsValid = false; mServerIsValid = false;
/*
mServerInfo.mIsSslConn = false;
mServerInfo.mVersion = null;
mServerInfo.mBaseUrl =
normalizeUrl(mHostUrlInput.getText().toString(), mServerInfo.mIsSslConn); // TODO remove?
*/
mServerInfo = new GetServerInfoOperation.ServerInfo(); mServerInfo = new GetServerInfoOperation.ServerInfo();
// update status icon and text // update status icon and text

View file

@ -100,12 +100,12 @@ public class OperationsService extends Service {
private static class Target { private static class Target {
public Uri mServerUrl = null; public Uri mServerUrl = null;
public Account mAccount = null; public Account mAccount = null;
public String mWebDavUrl = ""; public String mWebDavUrl = null;
public String mUsername = ""; public String mUsername = null;
public String mPassword = ""; public String mPassword = null;
public String mAuthToken = ""; public String mAuthToken = null;
public boolean mFollowRedirects = true; public boolean mFollowRedirects = true;
public String mCookie = ""; public String mCookie = null;
public Target(Account account, Uri serverUrl, String webdavUrl, String username, String password, String authToken, public Target(Account account, Uri serverUrl, String webdavUrl, String username, String password, String authToken,
boolean followRedirects, String cookie) { boolean followRedirects, String cookie) {
@ -284,12 +284,12 @@ public class OperationsService extends Service {
target = new Target( target = new Target(
account, account,
(serverUrl == null) ? null : Uri.parse(serverUrl), (serverUrl == null) ? null : Uri.parse(serverUrl),
((webDavPath == null) || (serverUrl == null)) ? "" : webDavUrl, ((webDavPath == null) || (serverUrl == null)) ? null : webDavUrl,
(username == null) ? "" : username, username,
(password == null) ? "" : password, password,
(authToken == null) ? "" : authToken, authToken,
followRedirects, followRedirects,
(cookie == null) ? "" : cookie cookie
); );
String action = operationIntent.getAction(); String action = operationIntent.getAction();
@ -420,14 +420,14 @@ public class OperationsService extends Service {
} else { } else {
mOwnCloudClient = OwnCloudClientFactory.createOwnCloudClient(mLastTarget.mServerUrl, getApplicationContext(), mOwnCloudClient = OwnCloudClientFactory.createOwnCloudClient(mLastTarget.mServerUrl, getApplicationContext(),
mLastTarget.mFollowRedirects); // this is not good enough mLastTarget.mFollowRedirects); // this is not good enough
if (mLastTarget.mWebDavUrl != "") { if (mLastTarget.mWebDavUrl != null) {
mOwnCloudClient.setWebdavUri(Uri.parse(mLastTarget.mWebDavUrl)); mOwnCloudClient.setWebdavUri(Uri.parse(mLastTarget.mWebDavUrl));
} }
if (mLastTarget.mUsername != "" && mLastTarget.mPassword != "") { if (mLastTarget.mUsername != null && mLastTarget.mPassword != null) {
mOwnCloudClient.setBasicCredentials(mLastTarget.mUsername, mLastTarget.mPassword); mOwnCloudClient.setBasicCredentials(mLastTarget.mUsername, mLastTarget.mPassword);
} else if (mLastTarget.mAuthToken != "") { } else if (mLastTarget.mAuthToken != null) {
mOwnCloudClient.setBearerCredentials(mLastTarget.mAuthToken); mOwnCloudClient.setBearerCredentials(mLastTarget.mAuthToken);
} else if (mLastTarget.mCookie != "") { } else if (mLastTarget.mCookie != null) {
mOwnCloudClient.setSsoSessionCookie(mLastTarget.mCookie); mOwnCloudClient.setSsoSessionCookie(mLastTarget.mCookie);
} }
mStorageManager = null; mStorageManager = null;