Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dda9730b authored by narinder Rana's avatar narinder Rana
Browse files

remove file list item when upload done

parent cf3c3b4e
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -24,7 +24,9 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCo
import java.io.File;
import java.util.ArrayList;
import foundation.e.drive.database.DbHelper;
import foundation.e.drive.models.FileObserver;
import foundation.e.drive.models.SyncedFileState;
import foundation.e.drive.services.FileObserverService;
import foundation.e.drive.services.InitializerService;
import foundation.e.drive.utils.CommonUtils;

@@ -138,7 +140,7 @@ public class UploadFileOperation extends RemoteOperation implements ComparableOp
        //if upload is a success
        if( uploadResult.isSuccess() ){

          //  InitializerService.files.remove(file);
            FileObserverService.files.remove(file);

            Object data = uploadResult.getSingleData();
            if(data != null){
+161 −154
Original line number Diff line number Diff line
@@ -22,12 +22,14 @@ import android.os.Parcelable;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.util.Log;

import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.OnRemoteOperationListener;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.resources.files.FileUtils;
import com.owncloud.android.lib.resources.files.model.RemoteFile;

import java.io.File;
import java.io.FileFilter;
import java.io.FileOutputStream;
@@ -159,6 +161,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene
    }

    /* Common methods */

    /**
     * Start to bind this service to OperationManagerService or start scan if binding is already set.
     * Method to factorise code that is called from different place
@@ -196,6 +199,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene
    /**
     * Clear cached file unused:
     * remove each cached file which isn't in OperationManagerService.lockedSyncedFileState();
     *
     * @TODO rewrite this method!
     */
    private void clearCachedFile() {
@@ -219,6 +223,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene
    /**
     * Start scanning job
     * Load operation from DB
     *
     * @param remote if true looks for remote change. If false, look for local change.
     **/

@@ -254,7 +259,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene
                return;
            }
        } else {
            if(isFileObserverService){
            if (isFileObserverService && null != fileObserverObject) {

                Log.e("TAG", "ObserverService..isFileObserverService...." + isFileObserverService);

@@ -267,7 +272,6 @@ public class ObserverService extends Service implements OnRemoteOperationListene
                if (!syncedFileStates.isEmpty() || !fileObserverObject.getFiles().isEmpty()) {
                    handleLocalFiles(fileObserverObject.getFiles(), syncedFileStates);
                }

                // handleLocalFiles(fileObserverObject.getFiles(), fileObserverObject.getSyncedFileStatesList());

            } else {
@@ -280,6 +284,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene

    /**
     * Get list of synced folder depending of if media and setting sync are enabled.
     *
     * @return
     */
    private List<SyncedFolder> loadSyncedFolders() {
@@ -298,12 +303,9 @@ public class ObserverService extends Service implements OnRemoteOperationListene
    }






    /**
     * Handle end of remote Operation
     *
     * @param operation The RemoteOperation which ends and call this methods
     * @param result    The result of the remote Operation
     */
@@ -357,6 +359,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene

    /**
     * Method to get Id of SyncedFolder to scan
     *
     * @return List<Long> id of SyncedFolder to scan
     */
    private List<Long> getIdsFromFolderToScan() {
@@ -374,6 +377,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene

    /**
     * decide what to do with remote files and decide
     *
     * @param remoteFiles      Remote Files to inspect
     * @param syncedFileStates SyncedFileState to inspect
     */
@@ -479,6 +483,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene

    /**
     * Handle the list of syncedFileState which don't have remoteFile anymore.
     *
     * @param syncedFileStates SyncedFileState for which no remote equivalent has been found
     */
    private void handleRemoteRemainingSyncedFileState(List<SyncedFileState> syncedFileStates) {
@@ -668,6 +673,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene
     * If file has already be synced and modified since last synced then update (= upload)
     * if file has never been synced then upload
     * if file has already be on server once(=> SyncedFIleState.etag is valid) and not local file exist then remove syncedFile
     *
     * @param localFileList    list of local file to scan
     * @param syncedFileStates List of SyncedFileState to scan
     */
@@ -763,6 +769,7 @@ public class ObserverService extends Service implements OnRemoteOperationListene

    /**
     * manage rest of the list of syncedFilesState to look for remote file to delete
     *
     * @param syncedFileStates List of SyncedFileState for which no local equivalent has been found
     */
    private void handleLocalRemainingSyncedFileState(List<SyncedFileState> syncedFileStates) {