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

Commit 28cce24c authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

Add request to remove unscannable media from SyncedFileState databaase. bump...

Add request to remove unscannable media from SyncedFileState databaase. bump version number to 1.2.4

Also, rewrite method name (add 's' at the end) for the method which remove hidden files from SyncedFileState database
parent 623bd0b1
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ plugins {

def versionMajor = 1
def versionMinor = 2
def versionPatch = 3
def versionPatch = 4



+3 −2
Original line number Diff line number Diff line
@@ -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.deleteUnscannableMediaFiles();
        dao.close();
    }
}
+11 −2
Original line number Diff line number Diff line
@@ -106,13 +106,22 @@ 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 removed
     * @return number of deleted input
     */
    public int deleteUnscannableMediaFiles() {
        return mDB.delete(TABLE_NAME, IS_MEDIA_TYPE + " =1 AND "+SCANNABLE+" =0", null);
    }

    /**
     * Delete each syncedFileState which is bound to syncedFOlder with specified ID
     * @param folderId syncedFolder's id used as foreign key
+0 −8
Original line number Diff line number Diff line
@@ -176,14 +176,6 @@ public class SyncedFileState implements Parcelable {
        return scannable;
    }

    /**
     * Define in which context the file can be scan
     * @param scannable 0: never. 1: on cloud only. 2: on device only. 3: in every context.
     */
    public void setScannable(int scannable) {
        this.scannable = scannable;
    }


    @Override
    public String toString(){
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ public class BootCompletedReceiver extends BroadcastReceiver {
                    && BuildConfig.VERSION_CODE > pref.getInt(PREF_VERSION_CODE, 1002000)) {
                pref.edit().putInt(PREF_VERSION_CODE, BuildConfig.VERSION_CODE).apply();
                try {
                    DbHelper.removeHiddenSyncedFileState(context);
                    DbHelper.cleanSyncedFileStateTableAfterUpdate(context);
                } catch (SQLiteException e) {
                    Log.e(TAG, "Can't remove entry for hidden file in Database", e);
                }