From: masensio Date: Wed, 29 Jan 2014 17:23:33 +0000 (+0100) Subject: Merge branch 'develop' into share_link_show_shared_files X-Git-Tag: oc-android-1.5.5~35^2~42 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/45c1e47e5fcc4ed0a55601725813810982746109?ds=inline;hp=-c Merge branch 'develop' into share_link_show_shared_files --- 45c1e47e5fcc4ed0a55601725813810982746109 diff --combined src/com/owncloud/android/authentication/AuthenticatorActivity.java index 4bd2bb8a,d132ea3f..3a817d67 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@@ -36,6 -36,7 +36,7 @@@ import android.support.v4.app.Fragment import android.text.Editable; import android.text.InputType; import android.text.TextWatcher; + import android.util.Log; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; @@@ -58,15 -59,13 +59,15 @@@ import com.owncloud.android.lib.account import com.owncloud.android.lib.network.OwnCloudClientFactory; import com.owncloud.android.lib.network.OwnCloudClient; import com.owncloud.android.operations.OAuth2GetAccessToken; + import com.owncloud.android.lib.operations.common.OnRemoteOperationListener; -import com.owncloud.android.operations.OwnCloudServerCheckOperation; +import com.owncloud.android.lib.operations.remote.OwnCloudServerCheckOperation; import com.owncloud.android.lib.operations.common.RemoteOperation; import com.owncloud.android.lib.operations.common.RemoteOperationResult; import com.owncloud.android.lib.operations.common.RemoteOperationResult.ResultCode; import com.owncloud.android.lib.operations.remote.ExistenceCheckRemoteOperation; import com.owncloud.android.lib.operations.remote.GetUserNameRemoteOperation; + import com.owncloud.android.ui.dialog.SamlWebViewDialog; import com.owncloud.android.ui.dialog.SslValidatorDialog; import com.owncloud.android.ui.dialog.SslValidatorDialog.OnSslValidatorListener; @@@ -105,7 -104,6 +106,7 @@@ implements OnRemoteOperationListener, private static final String KEY_AUTH_STATUS_TEXT = "AUTH_STATUS_TEXT"; private static final String KEY_AUTH_STATUS_ICON = "AUTH_STATUS_ICON"; private static final String KEY_REFRESH_BUTTON_ENABLED = "KEY_REFRESH_BUTTON_ENABLED"; + private static final String KEY_IS_SHARED_SUPPORTED = "KEY_IS_SHARE_SUPPORTED"; private static final String AUTH_ON = "on"; private static final String AUTH_OFF = "off"; @@@ -123,7 -121,6 +124,7 @@@ private String mHostBaseUrl; private OwnCloudVersion mDiscoveredVersion; + private boolean mIsSharedSupported; private String mAuthMessageText; private int mAuthMessageVisibility, mServerStatusText, mServerStatusIcon; @@@ -234,7 -231,6 +235,7 @@@ mServerIsChecked = false; mIsSslConn = false; mAuthStatusText = mAuthStatusIcon = 0; + mIsSharedSupported = false; /// retrieve extras from intent mAccount = getIntent().getExtras().getParcelable(EXTRA_ACCOUNT); @@@ -247,8 -243,6 +248,8 @@@ mHostUrlInput.setText(mHostBaseUrl); String userName = mAccount.name.substring(0, mAccount.name.lastIndexOf('@')); mUsernameInput.setText(userName); + mIsSharedSupported = Boolean.getBoolean(mAccountMgr.getUserData(mAccount, OwnCloudAccount.Constants.KEY_SUPPORTS_SHARE_API)); + } initAuthorizationMethod(); // checks intent and setup.xml to determine mCurrentAuthorizationMethod mJustCreated = true; @@@ -275,7 -269,6 +276,7 @@@ /// server data String ocVersion = savedInstanceState.getString(KEY_OC_VERSION); + mIsSharedSupported = savedInstanceState.getBoolean(KEY_IS_SHARED_SUPPORTED, false); if (ocVersion != null) { mDiscoveredVersion = new OwnCloudVersion(ocVersion); } @@@ -455,7 -448,6 +456,7 @@@ outState.putString(KEY_OC_VERSION, mDiscoveredVersion.toString()); } outState.putString(KEY_HOST_URL_TEXT, mHostBaseUrl); + outState.putBoolean(KEY_IS_SHARED_SUPPORTED, mIsSharedSupported); /// account data, if updating if (mAccount != null) { @@@ -590,7 -582,6 +591,7 @@@ mServerIsValid = false; mServerIsChecked = false; + mIsSharedSupported = false; mOkButton.setEnabled(false); mDiscoveredVersion = null; hideRefreshButton(); @@@ -832,6 -823,10 +833,10 @@@ if (success) finish(); + } else { + updateAuthStatusIconAndText(result); + showAuthStatus(); + Log_OC.e(TAG, "Access to user name failed: " + result.getLogMessage()); } } @@@ -900,9 -895,6 +905,9 @@@ /// allow or not the user try to access the server mOkButton.setEnabled(mServerIsValid); + + /// retrieve if is supported the Share API + mIsSharedSupported = operation.isSharedSupported(); } // else nothing ; only the last check operation is considered; // multiple can be triggered if the user amends a URL before a previous check can be triggered @@@ -1296,7 -1288,6 +1301,7 @@@ /// add user data to the new account; TODO probably can be done in the last parameter addAccountExplicitly, or in KEY_USERDATA mAccountMgr.setUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_VERSION, mDiscoveredVersion.toString()); mAccountMgr.setUserData(mAccount, OwnCloudAccount.Constants.KEY_OC_BASE_URL, mHostBaseUrl); + mAccountMgr.setUserData(mAccount, OwnCloudAccount.Constants.KEY_SUPPORTS_SHARE_API, Boolean.toString(mIsSharedSupported)); if (isSaml) { mAccountMgr.setUserData(mAccount, OwnCloudAccount.Constants.KEY_SUPPORTS_SAML_WEB_SSO, "TRUE"); } else if (isOAuth) { @@@ -1605,7 -1596,7 +1610,7 @@@ } - public void onSamlDialogSuccess(String sessionCookie){ + public void onSamlDialogSuccess(String sessionCookie) { mAuthToken = sessionCookie; if (sessionCookie != null && sessionCookie.length() > 0) { diff --combined src/com/owncloud/android/operations/SynchronizeFolderOperation.java index 0aae4a9c,82d4d8c6..852b2ca1 --- a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java +++ b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java @@@ -192,7 -192,7 +192,7 @@@ public class SynchronizeFolderOperatio ReadRemoteFileOperation operation = new ReadRemoteFileOperation(remotePath); result = operation.execute(client); if (result.isSuccess()){ - OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile)result.getData().get(0)); + OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0)); // check if remote and local folder are different mRemoteFolderChanged = !(remoteFolder.getEtag().equalsIgnoreCase(mLocalFolder.getEtag())); @@@ -223,11 -223,7 +223,7 @@@ Log_OC.d(TAG, "Synchronizing " + mAccount.name + remotePath); if (result.isSuccess()) { - ArrayList remotes = new ArrayList(); - for(Object obj: result.getData()) { - remotes.add((RemoteFile) obj); - } - synchronizeData(remotes, client); + synchronizeData(result.getData(), client); if (mConflictsFound > 0 || mFailsInFavouritesFound > 0) { result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT); // should be different result, but will do the job } @@@ -260,12 -256,12 +256,12 @@@ * retrieved. * @return 'True' when any change was made in the local data, 'false' otherwise. */ - private void synchronizeData(ArrayList folderAndFiles, OwnCloudClient client) { + private void synchronizeData(ArrayList folderAndFiles, OwnCloudClient client) { // get 'fresh data' from the database mLocalFolder = mStorageManager.getFileByPath(mLocalFolder.getRemotePath()); // parse data from remote folder - OCFile remoteFolder = fillOCFile(folderAndFiles.get(0)); + OCFile remoteFolder = fillOCFile((RemoteFile)folderAndFiles.get(0)); remoteFolder.setParentId(mLocalFolder.getParentId()); remoteFolder.setFileId(mLocalFolder.getFileId()); @@@ -285,7 -281,7 +281,7 @@@ OCFile remoteFile = null, localFile = null; for (int i=1; i