projects
/
pub
/
Android
/
ownCloud.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
OC-2332: rewrite getAvailableRemotePath from UpdateFileOperation, using ExistenceCehe...
[pub/Android/ownCloud.git]
/
src
/
com
/
owncloud
/
android
/
syncadapter
/
FileSyncAdapter.java
diff --git
a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java
b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java
index
2aab922
..
f0bc870
100644
(file)
--- a/
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
+++ b/
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
@@
-26,17
+26,18
@@
import java.util.Map;
import org.apache.jackrabbit.webdav.DavException;
import org.apache.jackrabbit.webdav.DavException;
-import com.owncloud.android.
Log_OC
;
+import com.owncloud.android.
MainApp
;
import com.owncloud.android.R;
import com.owncloud.android.R;
-import com.owncloud.android.authentication.AccountAuthenticator;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
-import com.owncloud.android.operations.RemoteOperationResult;
+import com.owncloud.android.o
c_framework.o
perations.RemoteOperationResult;
import com.owncloud.android.operations.SynchronizeFolderOperation;
import com.owncloud.android.operations.UpdateOCVersionOperation;
import com.owncloud.android.operations.SynchronizeFolderOperation;
import com.owncloud.android.operations.UpdateOCVersionOperation;
-import com.owncloud.android.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.o
c_framework.o
perations.RemoteOperationResult.ResultCode;
import com.owncloud.android.ui.activity.ErrorsWhileCopyingHandlerActivity;
import com.owncloud.android.ui.activity.ErrorsWhileCopyingHandlerActivity;
+import com.owncloud.android.utils.Log_OC;
+
import android.accounts.Account;
import android.accounts.AccountsException;
import android.accounts.Account;
import android.accounts.AccountsException;
@@
-97,7
+98,7
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
/**
/**
- * Creates a
n
{@link FileSyncAdapter}
+ * Creates a {@link FileSyncAdapter}
*
* {@inheritDoc}
*/
*
* {@inheritDoc}
*/
@@
-107,11
+108,21
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
/**
/**
+ * Creates a {@link FileSyncAdapter}
+ *
+ * {@inheritDoc}
+ */
+ public FileSyncAdapter(Context context, boolean autoInitialize, boolean allowParallelSyncs) {
+ super(context, autoInitialize, allowParallelSyncs);
+ }
+
+
+ /**
* {@inheritDoc}
*/
@Override
public synchronized void onPerformSync(Account account, Bundle extras,
* {@inheritDoc}
*/
@Override
public synchronized void onPerformSync(Account account, Bundle extras,
- String authority, ContentProviderClient provider,
+ String authority, ContentProviderClient provider
Client
,
SyncResult syncResult) {
mCancellation = false;
SyncResult syncResult) {
mCancellation = false;
@@
-126,8
+137,8
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
mSyncResult.delayUntil = 60*60*24; // avoid too many automatic synchronizations
this.setAccount(account);
mSyncResult.delayUntil = 60*60*24; // avoid too many automatic synchronizations
this.setAccount(account);
- this.setContentProvider
(provider
);
- this.setStorageManager(new FileDataStorageManager(account, provider));
+ this.setContentProvider
Client(providerClient
);
+ this.setStorageManager(new FileDataStorageManager(account, provider
Client
));
try {
this.initClientForCurrentAccount();
} catch (IOException e) {
try {
this.initClientForCurrentAccount();
} catch (IOException e) {
@@
-268,8
+279,9
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
} else {
// in failures, the statistics for the global result are updated
if (result.getCode() == RemoteOperationResult.ResultCode.UNAUTHORIZED ||
} else {
// in failures, the statistics for the global result are updated
if (result.getCode() == RemoteOperationResult.ResultCode.UNAUTHORIZED ||
- ( result.isIdPRedirection() &&
- AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(getClient().getAuthTokenType()))) {
+ ( result.isIdPRedirection() &&
+ getClient().getCredentials() == null )) {
+ //MainApp.getAuthTokenTypeSamlSessionCookie().equals(getClient().getAuthTokenType()))) {
mSyncResult.stats.numAuthExceptions++;
} else if (result.getException() instanceof DavException) {
mSyncResult.stats.numAuthExceptions++;
} else if (result.getException() instanceof DavException) {
@@
-315,14
+327,15
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
for (i=0; i < files.size() && !mCancellation; i++) {
newFile = files.get(i);
if (newFile.isFolder()) {
for (i=0; i < files.size() && !mCancellation; i++) {
newFile = files.get(i);
if (newFile.isFolder()) {
+ /*
etag = newFile.getEtag();
syncDown = (parentEtagChanged || etag == null || etag.length() == 0);
etag = newFile.getEtag();
syncDown = (parentEtagChanged || etag == null || etag.length() == 0);
- if(syncDown) {
+ if(syncDown) {
*/
synchronizeFolder(newFile);
// update the size of the parent folder again after recursive synchronization
synchronizeFolder(newFile);
// update the size of the parent folder again after recursive synchronization
- getStorageManager().updateFolderSize(parent.getFileId());
+
//
getStorageManager().updateFolderSize(parent.getFileId());
sendStickyBroadcast(true, parent.getRemotePath(), null); // notify again to refresh size in UI
sendStickyBroadcast(true, parent.getRemotePath(), null); // notify again to refresh size in UI
- }
+
//
}
}
}
}
}
@@
-337,7
+350,7
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
* @param dirRemotePath Remote path of a folder that was just synchronized (with or without success)
*/
private void sendStickyBroadcast(boolean inProgress, String dirRemotePath, RemoteOperationResult result) {
* @param dirRemotePath Remote path of a folder that was just synchronized (with or without success)
*/
private void sendStickyBroadcast(boolean inProgress, String dirRemotePath, RemoteOperationResult result) {
- Intent i = new Intent(FileSyncService.
SYNC_MESSAGE
);
+ Intent i = new Intent(FileSyncService.
getSyncMessage()
);
i.putExtra(FileSyncService.IN_PROGRESS, inProgress);
i.putExtra(FileSyncService.ACCOUNT_NAME, getAccount().name);
if (dirRemotePath != null) {
i.putExtra(FileSyncService.IN_PROGRESS, inProgress);
i.putExtra(FileSyncService.ACCOUNT_NAME, getAccount().name);
if (dirRemotePath != null) {
@@
-359,9
+372,9
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
notification.flags |= Notification.FLAG_AUTO_CANCEL;
boolean needsToUpdateCredentials = (mLastFailedResult != null &&
( mLastFailedResult.getCode() == ResultCode.UNAUTHORIZED ||
notification.flags |= Notification.FLAG_AUTO_CANCEL;
boolean needsToUpdateCredentials = (mLastFailedResult != null &&
( mLastFailedResult.getCode() == ResultCode.UNAUTHORIZED ||
- // (mLastFailedResult.isTemporalRedirection() && mLastFailedResult.isIdPRedirection() &&
( mLastFailedResult.isIdPRedirection() &&
( mLastFailedResult.isIdPRedirection() &&
- AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(getClient().getAuthTokenType()))
+ getClient().getCredentials() == null )
+ //MainApp.getAuthTokenTypeSamlSessionCookie().equals(getClient().getAuthTokenType()))
)
);
// TODO put something smart in the contentIntent below for all the possible errors
)
);
// TODO put something smart in the contentIntent below for all the possible errors