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

Commit 623bd0b1 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

When a file is removed from the phone. Put the remote one in the remote trash

parent 95d75f1b
Loading
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@

package foundation.e.drive.FileObservers;

import static foundation.e.drive.models.SyncRequest.Type.REMOTE_DELETE;
import static foundation.e.drive.models.SyncRequest.Type.UPLOAD;

import android.content.Context;
@@ -222,8 +223,8 @@ public class FileEventListener {

        //If already in DB
        if (fileState.getScannable() > 0) {
            fileState.setScannable(0);
            DbHelper.manageSyncedFileStateDB(fileState, "UPDATE", appContext);
            SyncRequest deleteRequest = new SyncRequest(fileState, REMOTE_DELETE);
            this.sendSyncRequestToSynchronizationService(deleteRequest);
        }
    }

+4 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ import com.owncloud.android.lib.common.operations.RemoteOperation;
import java.io.File;

import foundation.e.drive.operations.DownloadFileOperation;
import foundation.e.drive.operations.RemoveFileOperation;
import foundation.e.drive.operations.UploadFileOperation;

/**
@@ -66,7 +67,7 @@ public class SyncWrapper {
                final File file = new File(sfs.getLocalPath());
                if (!file.exists()) {
                    operation = null;
                    Log.w(TAG, "createRemoteOperation: local file doesn't exist for upload");
                    Log.w(TAG, "createRemoteOperation: local file doesn't. Can't upload");
                    break;
                }
                operation = new UploadFileOperation(sfs, account, context);
@@ -78,6 +79,8 @@ public class SyncWrapper {
                        context);
                break;
            case REMOTE_DELETE:
                operation = new RemoveFileOperation(request.getSyncedFileState());
                break;
            default:
                operation = null;
                break;