Skip to content

Commit dc6821a

Browse files
committed
add indicator to sync folder operation
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent 8d1ba44 commit dc6821a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

app/src/main/java/com/owncloud/android/operations/SynchronizeFolderOperation.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import android.text.TextUtils;
1616

1717
import com.nextcloud.client.account.User;
18+
import com.nextcloud.client.files.FileIndicator;
19+
import com.nextcloud.client.files.FileIndicatorManager;
1820
import com.nextcloud.client.jobs.download.FileDownloadHelper;
1921
import com.owncloud.android.datamodel.FileDataStorageManager;
2022
import com.owncloud.android.datamodel.OCFile;
@@ -132,6 +134,8 @@ protected RemoteOperationResult run(OwnCloudClient client) {
132134
return new RemoteOperationResult<>(ResultCode.FILE_NOT_FOUND);
133135
}
134136

137+
FileIndicatorManager.INSTANCE.update(mLocalFolder.getFileId(), FileIndicator.Syncing);
138+
135139
result = checkForChanges(client);
136140

137141
if (result.isSuccess()) {
@@ -143,15 +147,18 @@ protected RemoteOperationResult run(OwnCloudClient client) {
143147

144148
if (result.isSuccess()) {
145149
syncContents(client);
150+
FileIndicatorManager.INSTANCE.update(mLocalFolder.getFileId(), FileIndicator.Synced);
146151
}
147152
}
148153

149154
if (mCancellationRequested.get()) {
155+
FileIndicatorManager.INSTANCE.update(mLocalFolder.getFileId(), FileIndicator.Error);
150156
throw new OperationCancelledException();
151157
}
152158

153159
} catch (OperationCancelledException e) {
154-
result = new RemoteOperationResult(e);
160+
FileIndicatorManager.INSTANCE.update(mLocalFolder.getFileId(), FileIndicator.Error);
161+
result = new RemoteOperationResult<>(e);
155162
}
156163

157164
return result;

0 commit comments

Comments
 (0)