From b99d44573689fb1faf1f4b2c16bf51413708db60 Mon Sep 17 00:00:00 2001 From: cketti Date: Wed, 22 Jan 2020 17:16:06 +0100 Subject: [PATCH] Remove unused message counts from MessagingListener.synchronizeMailboxFinished() --- .../k9/controller/MemorizingMessagingListener.java | 11 ++--------- .../com/fsck/k9/controller/MessagingController.java | 5 ++--- .../controller/MessagingControllerPushReceiver.java | 3 +-- .../com/fsck/k9/controller/MessagingListener.java | 2 +- .../fsck/k9/controller/SimpleMessagingListener.java | 3 +-- .../com/fsck/k9/fragment/MessageListFragment.java | 4 +--- .../main/java/com/fsck/k9/backend/api/SyncListener.kt | 2 +- .../main/java/com/fsck/k9/backend/imap/ImapSync.java | 2 +- .../com/fsck/k9/backend/imap/SimpleSyncListener.kt | 2 +- .../java/com/fsck/k9/backend/imap/ImapSyncTest.java | 4 ++-- .../main/java/com/fsck/k9/backend/pop3/Pop3Sync.java | 2 +- .../java/com/fsck/k9/backend/webdav/WebDavSync.java | 2 +- 12 files changed, 15 insertions(+), 27 deletions(-) diff --git a/app/core/src/main/java/com/fsck/k9/controller/MemorizingMessagingListener.java b/app/core/src/main/java/com/fsck/k9/controller/MemorizingMessagingListener.java index ca7c2d977..ddba78390 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/MemorizingMessagingListener.java +++ b/app/core/src/main/java/com/fsck/k9/controller/MemorizingMessagingListener.java @@ -39,8 +39,7 @@ class MemorizingMessagingListener extends SimpleMessagingListener { syncStarted = memory; break; case FINISHED: - other.synchronizeMailboxFinished(memory.account, memory.folderServerId, - memory.syncingTotalMessagesInMailbox, memory.syncingNumNewMessages); + other.synchronizeMailboxFinished(memory.account, memory.folderServerId); break; case FAILED: other.synchronizeMailboxFailed(memory.account, memory.folderServerId, @@ -74,12 +73,9 @@ class MemorizingMessagingListener extends SimpleMessagingListener { } @Override - public synchronized void synchronizeMailboxFinished(Account account, String folderServerId, - int totalMessagesInMailbox, int numNewMessages) { + public synchronized void synchronizeMailboxFinished(Account account, String folderServerId) { Memory memory = getMemory(account, folderServerId); memory.syncingState = MemorizingState.FINISHED; - memory.syncingTotalMessagesInMailbox = totalMessagesInMailbox; - memory.syncingNumNewMessages = numNewMessages; } @Override @@ -121,9 +117,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener { MemorizingState syncingState = null; String failureMessage = null; - int syncingTotalMessagesInMailbox; - int syncingNumNewMessages; - int folderCompleted = 0; int folderTotal = 0; diff --git a/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java b/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java index 1063db388..61c20c74c 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java +++ b/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java @@ -2989,10 +2989,9 @@ public class MessagingController { } @Override - public void syncFinished(@NotNull String folderServerId, int totalMessagesInMailbox, int numNewMessages) { + public void syncFinished(@NotNull String folderServerId) { for (MessagingListener messagingListener : getListeners(listener)) { - messagingListener.synchronizeMailboxFinished(account, folderServerId, totalMessagesInMailbox, - numNewMessages); + messagingListener.synchronizeMailboxFinished(account, folderServerId); } } diff --git a/app/core/src/main/java/com/fsck/k9/controller/MessagingControllerPushReceiver.java b/app/core/src/main/java/com/fsck/k9/controller/MessagingControllerPushReceiver.java index fda0c77c7..215590c8d 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/MessagingControllerPushReceiver.java +++ b/app/core/src/main/java/com/fsck/k9/controller/MessagingControllerPushReceiver.java @@ -47,8 +47,7 @@ public class MessagingControllerPushReceiver implements PushReceiver { final CountDownLatch latch = new CountDownLatch(1); controller.synchronizeMailbox(account, folderServerId, new SimpleMessagingListener() { @Override - public void synchronizeMailboxFinished(Account account, String folderServerId, - int totalMessagesInMailbox, int numNewMessages) { + public void synchronizeMailboxFinished(Account account, String folderServerId) { latch.countDown(); } diff --git a/app/core/src/main/java/com/fsck/k9/controller/MessagingListener.java b/app/core/src/main/java/com/fsck/k9/controller/MessagingListener.java index 7744b708c..761f51728 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/MessagingListener.java +++ b/app/core/src/main/java/com/fsck/k9/controller/MessagingListener.java @@ -26,7 +26,7 @@ public interface MessagingListener { void synchronizeMailboxProgress(Account account, String folderServerId, int completed, int total); void synchronizeMailboxNewMessage(Account account, String folderServerId, Message message); void synchronizeMailboxRemovedMessage(Account account, String folderServerId, String messageServerId); - void synchronizeMailboxFinished(Account account, String folderServerId, int totalMessagesInMailbox, int numNewMessages); + void synchronizeMailboxFinished(Account account, String folderServerId); void synchronizeMailboxFailed(Account account, String folderServerId, String message); void loadMessageRemoteFinished(Account account, String folderServerId, String uid); diff --git a/app/core/src/main/java/com/fsck/k9/controller/SimpleMessagingListener.java b/app/core/src/main/java/com/fsck/k9/controller/SimpleMessagingListener.java index 1151452ba..c04ed2e93 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/SimpleMessagingListener.java +++ b/app/core/src/main/java/com/fsck/k9/controller/SimpleMessagingListener.java @@ -55,8 +55,7 @@ public abstract class SimpleMessagingListener implements MessagingListener { } @Override - public void synchronizeMailboxFinished(Account account, String folderServerId, int totalMessagesInMailbox, - int numNewMessages) { + public void synchronizeMailboxFinished(Account account, String folderServerId) { } @Override diff --git a/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java b/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java index f71ee5b98..105433e13 100644 --- a/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java +++ b/app/ui/src/main/java/com/fsck/k9/fragment/MessageListFragment.java @@ -1227,9 +1227,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener } @Override - public void synchronizeMailboxFinished(Account account, String folderServerId, int totalMessagesInMailbox, - int numNewMessages) { - + public void synchronizeMailboxFinished(Account account, String folderServerId) { if (updateForMe(account, folderServerId)) { handler.progress(false); handler.folderLoading(folderServerId, false); diff --git a/backend/api/src/main/java/com/fsck/k9/backend/api/SyncListener.kt b/backend/api/src/main/java/com/fsck/k9/backend/api/SyncListener.kt index dc3b9c0e4..19039d182 100644 --- a/backend/api/src/main/java/com/fsck/k9/backend/api/SyncListener.kt +++ b/backend/api/src/main/java/com/fsck/k9/backend/api/SyncListener.kt @@ -14,7 +14,7 @@ interface SyncListener { fun syncRemovedMessage(folderServerId: String, messageServerId: String) fun syncFlagChanged(folderServerId: String, messageServerId: String) - fun syncFinished(folderServerId: String, totalMessagesInMailbox: Int, numNewMessages: Int) + fun syncFinished(folderServerId: String) fun syncFailed(folderServerId: String, message: String, exception: Exception?) fun folderStatusChanged(folderServerId: String) diff --git a/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapSync.java b/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapSync.java index 02910e790..0261f4351 100644 --- a/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapSync.java +++ b/backend/imap/src/main/java/com/fsck/k9/backend/imap/ImapSync.java @@ -214,7 +214,7 @@ class ImapSync { System.currentTimeMillis(), newMessages); - listener.syncFinished(folder, remoteMessageCount, newMessages); + listener.syncFinished(folder); Timber.i("Done synchronizing folder %s:%s", accountName, folder); diff --git a/backend/imap/src/main/java/com/fsck/k9/backend/imap/SimpleSyncListener.kt b/backend/imap/src/main/java/com/fsck/k9/backend/imap/SimpleSyncListener.kt index 7309de017..11a11aa44 100644 --- a/backend/imap/src/main/java/com/fsck/k9/backend/imap/SimpleSyncListener.kt +++ b/backend/imap/src/main/java/com/fsck/k9/backend/imap/SimpleSyncListener.kt @@ -12,7 +12,7 @@ class SimpleSyncListener : SyncListener { override fun syncNewMessage(folderServerId: String, messageServerId: String, isOldMessage: Boolean) = Unit override fun syncRemovedMessage(folderServerId: String, messageServerId: String) = Unit override fun syncFlagChanged(folderServerId: String, messageServerId: String) = Unit - override fun syncFinished(folderServerId: String, totalMessagesInMailbox: Int, numNewMessages: Int) = Unit + override fun syncFinished(folderServerId: String) = Unit override fun syncFailed(folderServerId: String, message: String, exception: Exception?) = Unit override fun folderStatusChanged(folderServerId: String) = Unit } diff --git a/backend/imap/src/test/java/com/fsck/k9/backend/imap/ImapSyncTest.java b/backend/imap/src/test/java/com/fsck/k9/backend/imap/ImapSyncTest.java index f9bc95324..62b6d3fc2 100644 --- a/backend/imap/src/test/java/com/fsck/k9/backend/imap/ImapSyncTest.java +++ b/backend/imap/src/test/java/com/fsck/k9/backend/imap/ImapSyncTest.java @@ -90,7 +90,7 @@ public class ImapSyncTest { imapSync.sync(FOLDER_NAME, syncConfig, listener); - verify(listener).syncFinished(FOLDER_NAME, 1, 0); + verify(listener).syncFinished(FOLDER_NAME); } @Test @@ -99,7 +99,7 @@ public class ImapSyncTest { imapSync.sync(FOLDER_NAME, syncConfig, listener); - verify(listener).syncFinished(FOLDER_NAME, 0, 0); + verify(listener).syncFinished(FOLDER_NAME); } @Test diff --git a/backend/pop3/src/main/java/com/fsck/k9/backend/pop3/Pop3Sync.java b/backend/pop3/src/main/java/com/fsck/k9/backend/pop3/Pop3Sync.java index befbefabc..ab8d491ae 100644 --- a/backend/pop3/src/main/java/com/fsck/k9/backend/pop3/Pop3Sync.java +++ b/backend/pop3/src/main/java/com/fsck/k9/backend/pop3/Pop3Sync.java @@ -209,7 +209,7 @@ class Pop3Sync { System.currentTimeMillis(), newMessages); - listener.syncFinished(folder, remoteMessageCount, newMessages); + listener.syncFinished(folder); Timber.i("Done synchronizing folder %s:%s", accountName, folder); diff --git a/backend/webdav/src/main/java/com/fsck/k9/backend/webdav/WebDavSync.java b/backend/webdav/src/main/java/com/fsck/k9/backend/webdav/WebDavSync.java index 248a05793..11811d56a 100644 --- a/backend/webdav/src/main/java/com/fsck/k9/backend/webdav/WebDavSync.java +++ b/backend/webdav/src/main/java/com/fsck/k9/backend/webdav/WebDavSync.java @@ -209,7 +209,7 @@ class WebDavSync { System.currentTimeMillis(), newMessages); - listener.syncFinished(folder, remoteMessageCount, newMessages); + listener.syncFinished(folder); Timber.i("Done synchronizing folder %s:%s", accountName, folder);