\r
/// step 1 - load and process relevant inputs (resources, intent, savedInstanceState)\r
boolean isUrlInputAllowed = getResources().getBoolean(R.bool.show_server_url_input); \r
- //boolean refreshButtonEnabled = false;\r
if (savedInstanceState == null) {\r
if (mAccount != null) {\r
mServerInfo.mBaseUrl = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_BASE_URL);\r
mServerInfo.mIsSslConn = mServerInfo.mBaseUrl.startsWith("https://");\r
}\r
} else {\r
- //refreshButtonEnabled = savedInstanceState.getBoolean(KEY_REFRESH_BUTTON_ENABLED);\r
mServerStatusText = savedInstanceState.getInt(KEY_SERVER_STATUS_TEXT);\r
mServerStatusIcon = savedInstanceState.getInt(KEY_SERVER_STATUS_ICON);\r
\r
\r
\r
private void showViewPasswordButton() {\r
- //int drawable = android.R.drawable.ic_menu_view;\r
int drawable = R.drawable.ic_view;\r
if (isPasswordVisible()) {\r
- //drawable = android.R.drawable.ic_secure;\r
drawable = R.drawable.ic_hide;\r
}\r
mPasswordInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, drawable, 0);\r
showAuthStatus();\r
\r
// GET AUTHORIZATION request\r
- //Uri uri = Uri.parse(getString(R.string.oauth2_url_endpoint_auth));\r
Uri uri = Uri.parse(mOAuthAuthEndpointText.getText().toString().trim());\r
Uri.Builder uriBuilder = uri.buildUpon();\r
uriBuilder.appendQueryParameter(OAuth2Constants.KEY_RESPONSE_TYPE, getString(R.string.oauth2_response_type));\r
uriBuilder.appendQueryParameter(OAuth2Constants.KEY_REDIRECT_URI, getString(R.string.oauth2_redirect_uri)); \r
uriBuilder.appendQueryParameter(OAuth2Constants.KEY_CLIENT_ID, getString(R.string.oauth2_client_id));\r
uriBuilder.appendQueryParameter(OAuth2Constants.KEY_SCOPE, getString(R.string.oauth2_scope));\r
- //uriBuilder.appendQueryParameter(OAuth2Constants.KEY_STATE, whateverwewant);\r
uri = uriBuilder.build();\r
Log_OC.d(TAG, "Starting browser to view " + uri.toString());\r
Intent i = new Intent(Intent.ACTION_VIEW, uri);\r
mWaitingForOpId = Long.MAX_VALUE;\r
dismissDialog(WAIT_DIALOG_TAG);\r
- //if (result.isTemporalRedirection() && result.isIdPRedirection()) {\r
if (result.isIdPRedirection()) {
String url = result.getRedirectedLocation();\r
String targetUrl = mServerInfo.mBaseUrl \r
mWaitingForOpId = Long.MAX_VALUE;\r
dismissDialog(WAIT_DIALOG_TAG);\r
\r
- result = new RemoteOperationResult(new RuntimeException("FAKE"));\r
if (result.isSuccess()) {\r
Log_OC.d(TAG, "Successful access - time to save the account");\r
\r
/// the server\r
mServerIsChecked = true;\r
mServerIsValid = false;\r
- /*\r
- mServerInfo.mIsSslConn = false;\r
- mServerInfo.mVersion = null;\r
- mServerInfo.mBaseUrl = \r
- normalizeUrl(mHostUrlInput.getText().toString(), mServerInfo.mIsSslConn); // TODO remove?\r
- */\r
mServerInfo = new GetServerInfoOperation.ServerInfo(); \r
\r
// update status icon and text\r
private static class Target {
public Uri mServerUrl = null;
public Account mAccount = null;
- public String mWebDavUrl = "";
- public String mUsername = "";
- public String mPassword = "";
- public String mAuthToken = "";
+ public String mWebDavUrl = null;
+ public String mUsername = null;
+ public String mPassword = null;
+ public String mAuthToken = null;
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,
boolean followRedirects, String cookie) {
target = new Target(
account,
(serverUrl == null) ? null : Uri.parse(serverUrl),
- ((webDavPath == null) || (serverUrl == null)) ? "" : webDavUrl,
- (username == null) ? "" : username,
- (password == null) ? "" : password,
- (authToken == null) ? "" : authToken,
+ ((webDavPath == null) || (serverUrl == null)) ? null : webDavUrl,
+ username,
+ password,
+ authToken,
followRedirects,
- (cookie == null) ? "" : cookie
+ cookie
);
String action = operationIntent.getAction();
} else {
mOwnCloudClient = OwnCloudClientFactory.createOwnCloudClient(mLastTarget.mServerUrl, getApplicationContext(),
mLastTarget.mFollowRedirects); // this is not good enough
- if (mLastTarget.mWebDavUrl != "") {
+ if (mLastTarget.mWebDavUrl != null) {
mOwnCloudClient.setWebdavUri(Uri.parse(mLastTarget.mWebDavUrl));
}
- if (mLastTarget.mUsername != "" && mLastTarget.mPassword != "") {
+ if (mLastTarget.mUsername != null && mLastTarget.mPassword != null) {
mOwnCloudClient.setBasicCredentials(mLastTarget.mUsername, mLastTarget.mPassword);
- } else if (mLastTarget.mAuthToken != "") {
+ } else if (mLastTarget.mAuthToken != null) {
mOwnCloudClient.setBearerCredentials(mLastTarget.mAuthToken);
- } else if (mLastTarget.mCookie != "") {
+ } else if (mLastTarget.mCookie != null) {
mOwnCloudClient.setSsoSessionCookie(mLastTarget.mCookie);
}
mStorageManager = null;