projects
/
pub
/
Android
/
ownCloud.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0fde008
)
Considered servers without sharing support
author
David A. Velasco
<dvelasco@solidgear.es>
Fri, 7 Feb 2014 07:59:11 +0000
(08:59 +0100)
committer
David A. Velasco
<dvelasco@solidgear.es>
Fri, 7 Feb 2014 07:59:11 +0000
(08:59 +0100)
src/com/owncloud/android/operations/SynchronizeFolderOperation.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
patch
|
blob
|
blame
|
history
diff --git
a/src/com/owncloud/android/operations/SynchronizeFolderOperation.java
b/src/com/owncloud/android/operations/SynchronizeFolderOperation.java
index
bf2a4e0
..
11ce41e
100644
(file)
--- a/
src/com/owncloud/android/operations/SynchronizeFolderOperation.java
+++ b/
src/com/owncloud/android/operations/SynchronizeFolderOperation.java
@@
-100,9
+100,12
@@
public class SynchronizeFolderOperation extends RemoteOperation {
/** 'True' means that this operation is part of a full account synchronization */
private boolean mSyncFullAccount;
/** 'True' means that this operation is part of a full account synchronization */
private boolean mSyncFullAccount;
+ /** 'True' means that Share resources bound to the files into the folder should be refreshed also */
+ private boolean mRefreshShares;
+
/** 'True' means that the remote folder changed from last synchronization and should be fetched */
private boolean mRemoteFolderChanged;
/** 'True' means that the remote folder changed from last synchronization and should be fetched */
private boolean mRemoteFolderChanged;
-
+
/**
* Creates a new instance of {@link SynchronizeFolderOperation}.
/**
* Creates a new instance of {@link SynchronizeFolderOperation}.
@@
-119,12
+122,14
@@
public class SynchronizeFolderOperation extends RemoteOperation {
public SynchronizeFolderOperation( OCFile folder,
long currentSyncTime,
boolean syncFullAccount,
public SynchronizeFolderOperation( OCFile folder,
long currentSyncTime,
boolean syncFullAccount,
+ boolean refreshShares,
FileDataStorageManager dataStorageManager,
Account account,
Context context ) {
mLocalFolder = folder;
mCurrentSyncTime = currentSyncTime;
mSyncFullAccount = syncFullAccount;
FileDataStorageManager dataStorageManager,
Account account,
Context context ) {
mLocalFolder = folder;
mCurrentSyncTime = currentSyncTime;
mSyncFullAccount = syncFullAccount;
+ mRefreshShares = refreshShares;
mStorageManager = dataStorageManager;
mAccount = account;
mContext = context;
mStorageManager = dataStorageManager;
mAccount = account;
mContext = context;
@@
-180,10
+185,13
@@
public class SynchronizeFolderOperation extends RemoteOperation {
sendLocalBroadcast(EVENT_SINGLE_FOLDER_CONTENTS_SYNCED, mLocalFolder.getRemotePath(), result);
}
sendLocalBroadcast(EVENT_SINGLE_FOLDER_CONTENTS_SYNCED, mLocalFolder.getRemotePath(), result);
}
- if (result.isSuccess()) {
- result = refreshSharesForFolder(client);
+ if (result.isSuccess() && mRefreshShares) {
+ RemoteOperationResult shareResult = refreshSharesForFolder(client);
+ if (shareResult.getCode() != ResultCode.FILE_NOT_FOUND) {
+ result = shareResult;
+ } // else , keep the previous result ; being conservative for servers where Sharing API is supported, but disabled
}
}
-
+
if (!mSyncFullAccount) {
sendLocalBroadcast(EVENT_SINGLE_FOLDER_SHARES_SYNCED, mLocalFolder.getRemotePath(), result);
}
if (!mSyncFullAccount) {
sendLocalBroadcast(EVENT_SINGLE_FOLDER_SHARES_SYNCED, mLocalFolder.getRemotePath(), result);
}
@@
-506,6
+514,7
@@
public class SynchronizeFolderOperation extends RemoteOperation {
* @param result
*/
private void sendLocalBroadcast(String event, String dirRemotePath, RemoteOperationResult result) {
* @param result
*/
private void sendLocalBroadcast(String event, String dirRemotePath, RemoteOperationResult result) {
+ Log_OC.d(TAG, "Send broadcast " + event);
Intent intent = new Intent(event);
intent.putExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME, mAccount.name);
if (dirRemotePath != null) {
Intent intent = new Intent(event);
intent.putExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME, mAccount.name);
if (dirRemotePath != null) {
diff --git
a/src/com/owncloud/android/syncadapter/FileSyncAdapter.java
b/src/com/owncloud/android/syncadapter/FileSyncAdapter.java
index
c550eaa
..
6b2ea73
100644
(file)
--- a/
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
+++ b/
src/com/owncloud/android/syncadapter/FileSyncAdapter.java
@@
-30,6
+30,7
@@
import com.owncloud.android.R;
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.lib.accounts.OwnCloudAccount;
import com.owncloud.android.lib.operations.common.RemoteOperationResult;
import com.owncloud.android.operations.SynchronizeFolderOperation;
import com.owncloud.android.operations.UpdateOCVersionOperation;
import com.owncloud.android.lib.operations.common.RemoteOperationResult;
import com.owncloud.android.operations.SynchronizeFolderOperation;
import com.owncloud.android.operations.UpdateOCVersionOperation;
@@
-40,6
+41,7
@@
import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
import android.accounts.Account;
+import android.accounts.AccountManager;
import android.accounts.AccountsException;
import android.app.Notification;
import android.app.NotificationManager;
import android.accounts.AccountsException;
import android.app.Notification;
import android.app.NotificationManager;
@@
-106,6
+108,9
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
/** {@link SyncResult} instance to return to the system when the synchronization finish */
private SyncResult mSyncResult;
/** {@link SyncResult} instance to return to the system when the synchronization finish */
private SyncResult mSyncResult;
+
+ /** 'True' means that the server supports the share API */
+ private boolean mIsSharedSupported;
/**
/**
@@
-150,6
+155,10
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
this.setAccount(account);
this.setContentProviderClient(providerClient);
this.setStorageManager(new FileDataStorageManager(account, providerClient));
this.setAccount(account);
this.setContentProviderClient(providerClient);
this.setStorageManager(new FileDataStorageManager(account, providerClient));
+
+ AccountManager accountManager = getAccountManager();
+ mIsSharedSupported = Boolean.parseBoolean(accountManager.getUserData(account, OwnCloudAccount.Constants.KEY_SUPPORTS_SHARE_API));
+
try {
this.initClientForCurrentAccount();
} catch (IOException e) {
try {
this.initClientForCurrentAccount();
} catch (IOException e) {
@@
-254,13
+263,13
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
DataStorageManager dataStorageManager,
Account account,
Context context ) {
DataStorageManager dataStorageManager,
Account account,
Context context ) {
-
}
*/
// folder synchronization
SynchronizeFolderOperation synchFolderOp = new SynchronizeFolderOperation( folder,
mCurrentSyncTime,
true,
}
*/
// folder synchronization
SynchronizeFolderOperation synchFolderOp = new SynchronizeFolderOperation( folder,
mCurrentSyncTime,
true,
+ mIsSharedSupported,
getStorageManager(),
getAccount(),
getContext()
getStorageManager(),
getAccount(),
getContext()
@@
-360,6
+369,7
@@
public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
* @param result Result of an individual {@ SynchronizeFolderOperation}, if completed; may be null.
*/
private void sendLocalBroadcast(String event, String dirRemotePath, RemoteOperationResult result) {
* @param result Result of an individual {@ SynchronizeFolderOperation}, if completed; may be null.
*/
private void sendLocalBroadcast(String event, String dirRemotePath, RemoteOperationResult result) {
+ Log_OC.d(TAG, "Send broadcast " + event);
Intent intent = new Intent(event);
intent.putExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME, getAccount().name);
if (dirRemotePath != null) {
Intent intent = new Intent(event);
intent.putExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME, getAccount().name);
if (dirRemotePath != null) {
diff --git
a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java
b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java
index
c6ce16c
..
d5c0d5a
100644
(file)
--- a/
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
+++ b/
src/com/owncloud/android/ui/activity/FileDisplayActivity.java
@@
-906,6
+906,7
@@
OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa
@Override
public void onReceive(Context context, Intent intent) {
String event = intent.getAction();
@Override
public void onReceive(Context context, Intent intent) {
String event = intent.getAction();
+ Log_OC.d(TAG, "Received broadcast " + event);
String accountName = intent.getStringExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME);
String synchFolderRemotePath = intent.getStringExtra(FileSyncAdapter.EXTRA_FOLDER_PATH);
RemoteOperationResult synchResult = (RemoteOperationResult)intent.getSerializableExtra(FileSyncAdapter.EXTRA_RESULT);
String accountName = intent.getStringExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME);
String synchFolderRemotePath = intent.getStringExtra(FileSyncAdapter.EXTRA_FOLDER_PATH);
RemoteOperationResult synchResult = (RemoteOperationResult)intent.getSerializableExtra(FileSyncAdapter.EXTRA_RESULT);
@@
-913,7
+914,10
@@
OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa
if (sameAccount) {
if (sameAccount) {
- if (!FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) {
+ if (FileSyncAdapter.EVENT_FULL_SYNC_START.equals(event)) {
+ mSyncInProgress = true;
+
+ } else {
OCFile currentFile = (getFile() == null) ? null : getStorageManager().getFileByPath(getFile().getRemotePath());
OCFile currentDir = (getCurrentDir() == null) ? null : getStorageManager().getFileByPath(getCurrentDir().getRemotePath());
OCFile currentFile = (getFile() == null) ? null : getStorageManager().getFileByPath(getFile().getRemotePath());
OCFile currentDir = (getCurrentDir() == null) ? null : getStorageManager().getFileByPath(getCurrentDir().getRemotePath());
@@
-958,6
+962,7
@@
OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa
}
removeStickyBroadcast(intent);
}
removeStickyBroadcast(intent);
+ Log_OC.d(TAG, "Setting progress visibility to " + mSyncInProgress);
setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/);
}
setSupportProgressBarIndeterminateVisibility(mSyncInProgress /*|| mRefreshSharesInProgress*/);
}
@@
-1536,6
+1541,7
@@
OCFileListFragment.ContainerActivity, FileDetailFragment.ContainerActivity, OnNa
RemoteOperation synchFolderOp = new SynchronizeFolderOperation( folder,
currentSyncTime,
false,
RemoteOperation synchFolderOp = new SynchronizeFolderOperation( folder,
currentSyncTime,
false,
+ getFileOperationsHelper().isSharedSupported(this),
getStorageManager(),
getAccount(),
getApplicationContext()
getStorageManager(),
getAccount(),
getApplicationContext()