Loading app/core/build.gradle +1 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ dependencies { testImplementation project(':mail:testing') testImplementation project(":backend:imap") testImplementation project(":mail:protocols:smtp") testImplementation project(":app:storage") testImplementation "org.robolectric:robolectric:${versions.robolectric}" testImplementation "junit:junit:${versions.junit}" testImplementation "com.google.truth:truth:${versions.truth}" Loading app/core/src/main/java/com/fsck/k9/K9.java +3 −3 Original line number Diff line number Diff line Loading @@ -354,7 +354,7 @@ public class K9 { * {@code SharedPreference}. * * <p> * If the stored version matches {@link LocalStore#DB_VERSION} we know that the databases are * If the stored version matches {@link LocalStore#getDbVersion()} we know that the databases are * up to date.<br> * Using {@code SharedPreferences} should be a lot faster than opening all SQLite databases to * get the current database version. Loading @@ -369,7 +369,7 @@ public class K9 { int cachedVersion = databaseVersionCache.getInt(KEY_LAST_ACCOUNT_DATABASE_VERSION, 0); if (cachedVersion >= LocalStore.DB_VERSION) { if (cachedVersion >= LocalStore.getDbVersion()) { K9.setDatabasesUpToDate(false); } if (cachedVersion < VERSION_MIGRATE_OPENPGP_TO_ACCOUNTS) { Loading Loading @@ -1073,7 +1073,7 @@ public class K9 { if (save) { Editor editor = databaseVersionCache.edit(); editor.putInt(KEY_LAST_ACCOUNT_DATABASE_VERSION, LocalStore.DB_VERSION); editor.putInt(KEY_LAST_ACCOUNT_DATABASE_VERSION, LocalStore.getDbVersion()); editor.apply(); } } Loading app/core/src/main/java/com/fsck/k9/mailstore/LocalMessage.java +1 −1 Original line number Diff line number Diff line Loading @@ -188,7 +188,7 @@ public class LocalMessage extends MimeMessage { return (attachmentCount > 0); } int getAttachmentCount() { public int getAttachmentCount() { return attachmentCount; } Loading app/core/src/main/java/com/fsck/k9/mailstore/LocalStore.java +38 −3 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import com.fsck.k9.mail.Part; import com.fsck.k9.mailstore.LocalFolder.DataLocation; import com.fsck.k9.mailstore.LocalFolder.MoreMessages; import com.fsck.k9.mailstore.LockableDatabase.DbCallback; import com.fsck.k9.mailstore.LockableDatabase.SchemaDefinition; import com.fsck.k9.mailstore.LockableDatabase.WrappedException; import com.fsck.k9.mailstore.StorageManager.StorageProvider; import com.fsck.k9.message.extractors.AttachmentCounter; Loading Loading @@ -181,8 +182,6 @@ public class LocalStore { */ private static final int THREAD_FLAG_UPDATE_BATCH_SIZE = 500; public static final int DB_VERSION = 65; private final Context context; private final ContentResolver contentResolver; private final MessagePreviewCreator messagePreviewCreator; Loading Loading @@ -211,7 +210,11 @@ public class LocalStore { this.account = account; database = new LockableDatabase(context, account.getUuid(), new StoreSchemaDefinition(this)); SchemaDefinitionFactory schemaDefinitionFactory = DI.get(SchemaDefinitionFactory.class); RealMigrationsHelper migrationsHelper = new RealMigrationsHelper(); SchemaDefinition schemaDefinition = schemaDefinitionFactory.createSchemaDefinition(migrationsHelper); database = new LockableDatabase(context, account.getUuid(), schemaDefinition); database.setStorageProviderId(account.getLocalStorageProviderId()); database.open(); } Loading Loading @@ -247,6 +250,11 @@ public class LocalStore { } } public static int getDbVersion() { SchemaDefinitionFactory schemaDefinitionFactory = DI.get(SchemaDefinitionFactory.class); return schemaDefinitionFactory.getDatabaseVersion(); } public static void removeAccount(Account account) { try { removeInstance(account); Loading Loading @@ -1354,4 +1362,31 @@ public class LocalStore { } } } class RealMigrationsHelper implements MigrationsHelper { @Override public LocalStore getLocalStore() { return LocalStore.this; } @Override public Storage getStorage() { return LocalStore.this.getStorage(); } @Override public Account getAccount() { return LocalStore.this.getAccount(); } @Override public Context getContext() { return LocalStore.this.getContext(); } @Override public String serializeFlags(List<Flag> flags) { return LocalStore.serializeFlags(flags); } } } app/core/src/main/java/com/fsck/k9/mailstore/migrations/MigrationsHelper.java→app/core/src/main/java/com/fsck/k9/mailstore/MigrationsHelper.java +1 −1 Original line number Diff line number Diff line package com.fsck.k9.mailstore.migrations; package com.fsck.k9.mailstore; import java.util.List; Loading Loading
app/core/build.gradle +1 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ dependencies { testImplementation project(':mail:testing') testImplementation project(":backend:imap") testImplementation project(":mail:protocols:smtp") testImplementation project(":app:storage") testImplementation "org.robolectric:robolectric:${versions.robolectric}" testImplementation "junit:junit:${versions.junit}" testImplementation "com.google.truth:truth:${versions.truth}" Loading
app/core/src/main/java/com/fsck/k9/K9.java +3 −3 Original line number Diff line number Diff line Loading @@ -354,7 +354,7 @@ public class K9 { * {@code SharedPreference}. * * <p> * If the stored version matches {@link LocalStore#DB_VERSION} we know that the databases are * If the stored version matches {@link LocalStore#getDbVersion()} we know that the databases are * up to date.<br> * Using {@code SharedPreferences} should be a lot faster than opening all SQLite databases to * get the current database version. Loading @@ -369,7 +369,7 @@ public class K9 { int cachedVersion = databaseVersionCache.getInt(KEY_LAST_ACCOUNT_DATABASE_VERSION, 0); if (cachedVersion >= LocalStore.DB_VERSION) { if (cachedVersion >= LocalStore.getDbVersion()) { K9.setDatabasesUpToDate(false); } if (cachedVersion < VERSION_MIGRATE_OPENPGP_TO_ACCOUNTS) { Loading Loading @@ -1073,7 +1073,7 @@ public class K9 { if (save) { Editor editor = databaseVersionCache.edit(); editor.putInt(KEY_LAST_ACCOUNT_DATABASE_VERSION, LocalStore.DB_VERSION); editor.putInt(KEY_LAST_ACCOUNT_DATABASE_VERSION, LocalStore.getDbVersion()); editor.apply(); } } Loading
app/core/src/main/java/com/fsck/k9/mailstore/LocalMessage.java +1 −1 Original line number Diff line number Diff line Loading @@ -188,7 +188,7 @@ public class LocalMessage extends MimeMessage { return (attachmentCount > 0); } int getAttachmentCount() { public int getAttachmentCount() { return attachmentCount; } Loading
app/core/src/main/java/com/fsck/k9/mailstore/LocalStore.java +38 −3 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import com.fsck.k9.mail.Part; import com.fsck.k9.mailstore.LocalFolder.DataLocation; import com.fsck.k9.mailstore.LocalFolder.MoreMessages; import com.fsck.k9.mailstore.LockableDatabase.DbCallback; import com.fsck.k9.mailstore.LockableDatabase.SchemaDefinition; import com.fsck.k9.mailstore.LockableDatabase.WrappedException; import com.fsck.k9.mailstore.StorageManager.StorageProvider; import com.fsck.k9.message.extractors.AttachmentCounter; Loading Loading @@ -181,8 +182,6 @@ public class LocalStore { */ private static final int THREAD_FLAG_UPDATE_BATCH_SIZE = 500; public static final int DB_VERSION = 65; private final Context context; private final ContentResolver contentResolver; private final MessagePreviewCreator messagePreviewCreator; Loading Loading @@ -211,7 +210,11 @@ public class LocalStore { this.account = account; database = new LockableDatabase(context, account.getUuid(), new StoreSchemaDefinition(this)); SchemaDefinitionFactory schemaDefinitionFactory = DI.get(SchemaDefinitionFactory.class); RealMigrationsHelper migrationsHelper = new RealMigrationsHelper(); SchemaDefinition schemaDefinition = schemaDefinitionFactory.createSchemaDefinition(migrationsHelper); database = new LockableDatabase(context, account.getUuid(), schemaDefinition); database.setStorageProviderId(account.getLocalStorageProviderId()); database.open(); } Loading Loading @@ -247,6 +250,11 @@ public class LocalStore { } } public static int getDbVersion() { SchemaDefinitionFactory schemaDefinitionFactory = DI.get(SchemaDefinitionFactory.class); return schemaDefinitionFactory.getDatabaseVersion(); } public static void removeAccount(Account account) { try { removeInstance(account); Loading Loading @@ -1354,4 +1362,31 @@ public class LocalStore { } } } class RealMigrationsHelper implements MigrationsHelper { @Override public LocalStore getLocalStore() { return LocalStore.this; } @Override public Storage getStorage() { return LocalStore.this.getStorage(); } @Override public Account getAccount() { return LocalStore.this.getAccount(); } @Override public Context getContext() { return LocalStore.this.getContext(); } @Override public String serializeFlags(List<Flag> flags) { return LocalStore.serializeFlags(flags); } } }
app/core/src/main/java/com/fsck/k9/mailstore/migrations/MigrationsHelper.java→app/core/src/main/java/com/fsck/k9/mailstore/MigrationsHelper.java +1 −1 Original line number Diff line number Diff line package com.fsck.k9.mailstore.migrations; package com.fsck.k9.mailstore; import java.util.List; Loading