From 427906f742e84a924132e77f1a67d32e87503e17 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Tue, 22 Aug 2017 21:55:29 +0200 Subject: [PATCH] get rid of uuid field in LocalStore --- .../com/fsck/k9/mailstore/LocalFolder.java | 2 +- .../java/com/fsck/k9/mailstore/LocalStore.java | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalFolder.java b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalFolder.java index 35ab09d95..49a3a7cd9 100644 --- a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalFolder.java +++ b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalFolder.java @@ -543,7 +543,7 @@ public class LocalFolder extends Folder { private String getPrefId(String name) { if (prefId == null) { - prefId = this.localStore.getUUid() + "." + name; + prefId = getAccount().getUuid() + "." + name; } return prefId; diff --git a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalStore.java b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalStore.java index 1e8763d36..0d9a6acdd 100644 --- a/k9mail/src/main/java/com/fsck/k9/mailstore/LocalStore.java +++ b/k9mail/src/main/java/com/fsck/k9/mailstore/LocalStore.java @@ -188,7 +188,6 @@ public class LocalStore extends Store { private final AttachmentInfoExtractor attachmentInfoExtractor; private final Account account; - private final String uUid; private final LockableDatabase database; /** @@ -207,7 +206,6 @@ public class LocalStore extends Store { attachmentInfoExtractor = AttachmentInfoExtractor.getInstance(); this.account = account; - this.uUid = account.getUuid(); database = new LockableDatabase(context, account.getUuid(), new StoreSchemaDefinition(this)); database.setStorageProviderId(account.getLocalStorageProviderId()); @@ -270,10 +268,6 @@ public class LocalStore extends Store { return account; } - String getUUid() { - return uUid; - } - protected Storage getStorage() { return Preferences.getPreferences(context).getStorage(); } @@ -282,7 +276,7 @@ public class LocalStore extends Store { final StorageManager storageManager = StorageManager.getInstance(context); - final File attachmentDirectory = storageManager.getAttachmentDirectory(uUid, + final File attachmentDirectory = storageManager.getAttachmentDirectory(account.getUuid(), database.getStorageProviderId()); return database.execute(false, new DbCallback() { @@ -298,7 +292,7 @@ public class LocalStore extends Store { } } - final File dbFile = storageManager.getDatabase(uUid, database.getStorageProviderId()); + final File dbFile = storageManager.getDatabase(account.getUuid(), database.getStorageProviderId()); return dbFile.length() + attachmentLength; } }); @@ -468,7 +462,8 @@ public class LocalStore extends Store { private void deleteAllMessagePartsDataFromDisk() { final StorageManager storageManager = StorageManager.getInstance(context); - File attachmentDirectory = storageManager.getAttachmentDirectory(uUid, database.getStorageProviderId()); + File attachmentDirectory = storageManager.getAttachmentDirectory( + account.getUuid(), database.getStorageProviderId()); File[] files = attachmentDirectory.listFiles(); if (files == null) { return; @@ -897,7 +892,8 @@ public class LocalStore extends Store { File getAttachmentFile(String attachmentId) { final StorageManager storageManager = StorageManager.getInstance(context); - final File attachmentDirectory = storageManager.getAttachmentDirectory(uUid, database.getStorageProviderId()); + final File attachmentDirectory = storageManager.getAttachmentDirectory( + account.getUuid(), database.getStorageProviderId()); return new File(attachmentDirectory, attachmentId); } @@ -999,7 +995,7 @@ public class LocalStore extends Store { } void notifyChange() { - Uri uri = Uri.withAppendedPath(EmailProvider.CONTENT_URI, "account/" + uUid + "/messages"); + Uri uri = Uri.withAppendedPath(EmailProvider.CONTENT_URI, "account/" + account.getUuid() + "/messages"); contentResolver.notifyChange(uri, null); }