Loading app/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ plugins { def versionMajor = 1 def versionMinor = 2 def versionPatch = 3 def versionPatch = 4 Loading app/src/main/java/foundation/e/drive/FileObservers/FileEventListener.java +3 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } } Loading app/src/main/java/foundation/e/drive/database/DbHelper.java +3 −2 Original line number Diff line number Diff line Loading @@ -366,9 +366,10 @@ public final class DbHelper extends SQLiteOpenHelper { * @param context * @throws SQLiteException if database can't be open */ public static void removeHiddenSyncedFileState(Context context) throws SQLiteException { public static void cleanSyncedFileStateTableAfterUpdate(Context context) throws SQLiteException { SyncedFileStateDAO dao = openSyncedFileStateDAO(context, true); dao.deleteHiddenFileState(); dao.deleteHiddenFileStates(); dao.updateUnscannableMediaFiles(); dao.close(); } } app/src/main/java/foundation/e/drive/database/SyncedFileStateDAO.java +16 −2 Original line number Diff line number Diff line Loading @@ -106,13 +106,27 @@ class SyncedFileStateDAO { /** * Remove SyncedFileState for hidden file (starting with '.') * Remove SyncedFileState for hidden files (starting with '.') * @return number of deleted input */ public int deleteHiddenFileState() { public int deleteHiddenFileStates() { return mDB.delete(TABLE_NAME, FILE_NAME + " LIKE ?", new String[]{".%"}); } /** * In previous version, when a synchronized file was removed, the DB value for scannable column * was set to "0"; Now we consider those entries has to be scannable set to "2" in order to let synchronization algo * to remove them * @return number of deleted input */ public int updateUnscannableMediaFiles() { final ContentValues value = new ContentValues(); value.put(SCANNABLE, SyncedFileState.DEVICE_SCANNABLE); final String whereClause = IS_MEDIA_TYPE + " =1 AND " + SCANNABLE + " ="+SyncedFileState.NOT_SCANNABLE; return mDB.update(TABLE_NAME, value, whereClause, null); } /** * Delete each syncedFileState which is bound to syncedFOlder with specified ID * @param folderId syncedFolder's id used as foreign key Loading app/src/main/java/foundation/e/drive/models/SyncWrapper.java +4 −1 Original line number Diff line number Diff line Loading @@ -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; /** Loading Loading @@ -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); Loading @@ -78,6 +79,8 @@ public class SyncWrapper { context); break; case REMOTE_DELETE: operation = new RemoveFileOperation(request.getSyncedFileState()); break; default: operation = null; break; Loading Loading
app/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ plugins { def versionMajor = 1 def versionMinor = 2 def versionPatch = 3 def versionPatch = 4 Loading
app/src/main/java/foundation/e/drive/FileObservers/FileEventListener.java +3 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } } Loading
app/src/main/java/foundation/e/drive/database/DbHelper.java +3 −2 Original line number Diff line number Diff line Loading @@ -366,9 +366,10 @@ public final class DbHelper extends SQLiteOpenHelper { * @param context * @throws SQLiteException if database can't be open */ public static void removeHiddenSyncedFileState(Context context) throws SQLiteException { public static void cleanSyncedFileStateTableAfterUpdate(Context context) throws SQLiteException { SyncedFileStateDAO dao = openSyncedFileStateDAO(context, true); dao.deleteHiddenFileState(); dao.deleteHiddenFileStates(); dao.updateUnscannableMediaFiles(); dao.close(); } }
app/src/main/java/foundation/e/drive/database/SyncedFileStateDAO.java +16 −2 Original line number Diff line number Diff line Loading @@ -106,13 +106,27 @@ class SyncedFileStateDAO { /** * Remove SyncedFileState for hidden file (starting with '.') * Remove SyncedFileState for hidden files (starting with '.') * @return number of deleted input */ public int deleteHiddenFileState() { public int deleteHiddenFileStates() { return mDB.delete(TABLE_NAME, FILE_NAME + " LIKE ?", new String[]{".%"}); } /** * In previous version, when a synchronized file was removed, the DB value for scannable column * was set to "0"; Now we consider those entries has to be scannable set to "2" in order to let synchronization algo * to remove them * @return number of deleted input */ public int updateUnscannableMediaFiles() { final ContentValues value = new ContentValues(); value.put(SCANNABLE, SyncedFileState.DEVICE_SCANNABLE); final String whereClause = IS_MEDIA_TYPE + " =1 AND " + SCANNABLE + " ="+SyncedFileState.NOT_SCANNABLE; return mDB.update(TABLE_NAME, value, whereClause, null); } /** * Delete each syncedFileState which is bound to syncedFOlder with specified ID * @param folderId syncedFolder's id used as foreign key Loading
app/src/main/java/foundation/e/drive/models/SyncWrapper.java +4 −1 Original line number Diff line number Diff line Loading @@ -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; /** Loading Loading @@ -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); Loading @@ -78,6 +79,8 @@ public class SyncWrapper { context); break; case REMOTE_DELETE: operation = new RemoveFileOperation(request.getSyncedFileState()); break; default: operation = null; break; Loading