import com.owncloud.android.lib.network.OwnCloudClientFactory;\r
import com.owncloud.android.lib.network.OwnCloudClient;\r
import com.owncloud.android.operations.OAuth2GetAccessToken;\r
+
import com.owncloud.android.lib.operations.common.OnRemoteOperationListener;\r
-import com.owncloud.android.operations.OwnCloudServerCheckOperation;\r
+import com.owncloud.android.lib.operations.remote.OwnCloudServerCheckOperation;\r
import com.owncloud.android.lib.operations.common.RemoteOperation;\r
import com.owncloud.android.lib.operations.common.RemoteOperationResult;\r
import com.owncloud.android.lib.operations.common.RemoteOperationResult.ResultCode;\r
import com.owncloud.android.lib.operations.remote.ExistenceCheckRemoteOperation;\r
import com.owncloud.android.lib.operations.remote.GetUserNameRemoteOperation;\r
+
import com.owncloud.android.ui.dialog.SamlWebViewDialog;\r
import com.owncloud.android.ui.dialog.SslValidatorDialog;\r
import com.owncloud.android.ui.dialog.SslValidatorDialog.OnSslValidatorListener;\r
private static final String KEY_AUTH_MESSAGE_TEXT = "AUTH_MESSAGE_TEXT";\r
private static final String KEY_HOST_URL_TEXT = "HOST_URL_TEXT";\r
private static final String KEY_OC_VERSION = "OC_VERSION";\r
+ private static final String KEY_OC_VERSION_STRING = "OC_VERSION_STRING";\r
private static final String KEY_ACCOUNT = "ACCOUNT";\r
private static final String KEY_SERVER_VALID = "SERVER_VALID";\r
private static final String KEY_SERVER_CHECKED = "SERVER_CHECKED";\r
private static final String KEY_AUTH_STATUS_TEXT = "AUTH_STATUS_TEXT";\r
private static final String KEY_AUTH_STATUS_ICON = "AUTH_STATUS_ICON";\r
private static final String KEY_REFRESH_BUTTON_ENABLED = "KEY_REFRESH_BUTTON_ENABLED";\r
+ private static final String KEY_IS_SHARED_SUPPORTED = "KEY_IS_SHARE_SUPPORTED";\r
\r
private static final String AUTH_ON = "on";\r
private static final String AUTH_OFF = "off";\r
mAccount = getIntent().getExtras().getParcelable(EXTRA_ACCOUNT);\r
if (mAccount != null) {\r
String ocVersion = mAccountMgr.getUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_VERSION);\r
+ String ocVersionString = mAccountMgr.getUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_VERSION_STRING);\r
if (ocVersion != null) {\r
- mDiscoveredVersion = new OwnCloudVersion(ocVersion);\r
+ mDiscoveredVersion = new OwnCloudVersion(ocVersion, ocVersionString);\r
}\r
mHostBaseUrl = normalizeUrl(mAccountMgr.getUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_BASE_URL));\r
mHostUrlInput.setText(mHostBaseUrl);\r
String userName = mAccount.name.substring(0, mAccount.name.lastIndexOf('@'));\r
mUsernameInput.setText(userName);\r
+ \r
}\r
initAuthorizationMethod(); // checks intent and setup.xml to determine mCurrentAuthorizationMethod\r
mJustCreated = true;\r
\r
/// server data\r
String ocVersion = savedInstanceState.getString(KEY_OC_VERSION);\r
+ String ocVersionString = savedInstanceState.getString(KEY_OC_VERSION_STRING);\r
if (ocVersion != null) {\r
- mDiscoveredVersion = new OwnCloudVersion(ocVersion);\r
+ mDiscoveredVersion = new OwnCloudVersion(ocVersion, ocVersionString);\r
}\r
mHostBaseUrl = savedInstanceState.getString(KEY_HOST_URL_TEXT);\r
\r
\r
/// server data\r
if (mDiscoveredVersion != null) {\r
- outState.putString(KEY_OC_VERSION, mDiscoveredVersion.toString());\r
+ outState.putString(KEY_OC_VERSION, mDiscoveredVersion.getVersion());\r
+ outState.putString(KEY_OC_VERSION_STRING, mDiscoveredVersion.getVersionString());\r
}\r
outState.putString(KEY_HOST_URL_TEXT, mHostBaseUrl);\r
\r
\r
if (success)\r
finish();\r
+ } else {\r
+ updateAuthStatusIconAndText(result);\r
+ showAuthStatus();\r
+ Log_OC.e(TAG, "Access to user name failed: " + result.getLogMessage());\r
}\r
\r
}\r
\r
/// allow or not the user try to access the server\r
mOkButton.setEnabled(mServerIsValid);\r
-\r
+ \r
} // else nothing ; only the last check operation is considered; \r
// multiple can be triggered if the user amends a URL before a previous check can be triggered\r
}\r
mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken);\r
}\r
/// add user data to the new account; TODO probably can be done in the last parameter addAccountExplicitly, or in KEY_USERDATA\r
- mAccountMgr.setUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_VERSION, mDiscoveredVersion.toString());\r
+ mAccountMgr.setUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_VERSION, mDiscoveredVersion.getVersion());\r
+ mAccountMgr.setUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_VERSION_STRING, mDiscoveredVersion.getVersionString());\r
mAccountMgr.setUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_BASE_URL, mHostBaseUrl);\r
if (isSaml) {\r
mAccountMgr.setUserData(mAccount, OwnCloudAccount.Constants.KEY_SUPPORTS_SAML_WEB_SSO, "TRUE"); \r
}\r
\r
\r
- public void onSamlDialogSuccess(String sessionCookie){\r
+ public void onSamlDialogSuccess(String sessionCookie) {\r
mAuthToken = sessionCookie;\r
\r
if (sessionCookie != null && sessionCookie.length() > 0) {\r