Merge pull request #4467 from k9mail/MessagingListener_cleanup

More MessagingListener cleanup
This commit is contained in:
cketti 2020-01-23 16:25:30 +01:00 committed by GitHub
commit 4f6943336c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 44 additions and 333 deletions

View file

@ -30,8 +30,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
if (other != null) {
Memory syncStarted = null;
Memory sendStarted = null;
Memory processingStarted = null;
for (Memory memory : memories.values()) {
@ -41,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,
@ -50,43 +47,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
break;
}
}
if (memory.sendingState != null) {
switch (memory.sendingState) {
case STARTED:
sendStarted = memory;
break;
case FINISHED:
other.sendPendingMessagesCompleted(memory.account);
break;
case FAILED:
other.sendPendingMessagesFailed(memory.account);
break;
}
}
if (memory.pushingState != null) {
switch (memory.pushingState) {
case STARTED:
other.setPushActive(memory.account, memory.folderServerId, true);
break;
case FINISHED:
other.setPushActive(memory.account, memory.folderServerId, false);
break;
case FAILED:
break;
}
}
if (memory.processingState != null) {
switch (memory.processingState) {
case STARTED:
processingStarted = memory;
break;
case FINISHED:
case FAILED:
other.pendingCommandsFinished(memory.account);
break;
}
}
}
Memory somethingStarted = null;
if (syncStarted != null) {
@ -94,21 +54,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
syncStarted.folderName);
somethingStarted = syncStarted;
}
if (sendStarted != null) {
other.sendPendingMessagesStarted(sendStarted.account);
somethingStarted = sendStarted;
}
if (processingStarted != null) {
other.pendingCommandsProcessing(processingStarted.account);
if (processingStarted.processingCommandTitle != null) {
other.pendingCommandStarted(processingStarted.account,
processingStarted.processingCommandTitle);
} else {
other.pendingCommandCompleted(processingStarted.account, null);
}
somethingStarted = processingStarted;
}
if (somethingStarted != null && somethingStarted.folderTotal > 0) {
other.synchronizeMailboxProgress(somethingStarted.account, somethingStarted.folderServerId,
somethingStarted.folderCompleted, somethingStarted.folderTotal);
@ -128,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
@ -145,33 +87,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
memory.failureMessage = message;
}
@Override
public synchronized void setPushActive(Account account, String folderServerId, boolean active) {
Memory memory = getMemory(account, folderServerId);
memory.pushingState = (active ? MemorizingState.STARTED : MemorizingState.FINISHED);
}
@Override
public synchronized void sendPendingMessagesStarted(Account account) {
Memory memory = getMemory(account, null);
memory.sendingState = MemorizingState.STARTED;
memory.folderCompleted = 0;
memory.folderTotal = 0;
}
@Override
public synchronized void sendPendingMessagesCompleted(Account account) {
Memory memory = getMemory(account, null);
memory.sendingState = MemorizingState.FINISHED;
}
@Override
public synchronized void sendPendingMessagesFailed(Account account) {
Memory memory = getMemory(account, null);
memory.sendingState = MemorizingState.FAILED;
}
@Override
public synchronized void synchronizeMailboxProgress(Account account, String folderServerId, int completed,
int total) {
@ -180,33 +95,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
memory.folderTotal = total;
}
@Override
public synchronized void pendingCommandsProcessing(Account account) {
Memory memory = getMemory(account, null);
memory.processingState = MemorizingState.STARTED;
memory.folderCompleted = 0;
memory.folderTotal = 0;
}
@Override
public synchronized void pendingCommandsFinished(Account account) {
Memory memory = getMemory(account, null);
memory.processingState = MemorizingState.FINISHED;
}
@Override
public synchronized void pendingCommandStarted(Account account, String commandTitle) {
Memory memory = getMemory(account, null);
memory.processingCommandTitle = commandTitle;
}
@Override
public synchronized void pendingCommandCompleted(Account account, String commandTitle) {
Memory memory = getMemory(account, null);
memory.processingCommandTitle = null;
}
private Memory getMemory(Account account, String folderServerId) {
Memory memory = memories.get(getMemoryKey(account, folderServerId));
if (memory == null) {
@ -227,17 +115,10 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
String folderServerId;
String folderName;
MemorizingState syncingState = null;
MemorizingState sendingState = null;
MemorizingState pushingState = null;
MemorizingState processingState = null;
String failureMessage = null;
int syncingTotalMessagesInMailbox;
int syncingNumNewMessages;
int folderCompleted = 0;
int folderTotal = 0;
String processingCommandTitle = null;
Memory(Account account, String folderServerId) {
this.account = account;

View file

@ -696,26 +696,12 @@ public class MessagingController {
LocalStore localStore = localStoreProvider.getInstance(account);
List<PendingCommand> commands = localStore.getPendingCommands();
int progress = 0;
int todo = commands.size();
if (todo == 0) {
return;
}
for (MessagingListener l : getListeners()) {
l.pendingCommandsProcessing(account);
l.synchronizeMailboxProgress(account, null, progress, todo);
}
PendingCommand processingCommand = null;
try {
for (PendingCommand command : commands) {
processingCommand = command;
Timber.d("Processing pending command '%s'", command);
for (MessagingListener l : getListeners()) {
l.pendingCommandStarted(account, command.getCommandName());
}
/*
* We specifically do not catch any exceptions here. If a command fails it is
* most likely due to a server or IO error and it must be retried before any
@ -734,22 +720,12 @@ public class MessagingController {
} else {
throw me;
}
} finally {
progress++;
for (MessagingListener l : getListeners()) {
l.synchronizeMailboxProgress(account, null, progress, todo);
l.pendingCommandCompleted(account, command.getCommandName());
}
}
}
} catch (MessagingException me) {
notifyUserIfCertificateProblem(account, me, true);
Timber.e(me, "Could not process command '%s'", processingCommand);
throw me;
} finally {
for (MessagingListener l : getListeners()) {
l.pendingCommandsFinished(account);
}
}
}
@ -1024,7 +1000,7 @@ public class MessagingController {
}
for (MessagingListener l : getListeners()) {
l.folderStatusChanged(account, folder, 0);
l.folderStatusChanged(account, folder);
}
} finally {
closeFolder(localFolder);
@ -1109,14 +1085,8 @@ public class MessagingController {
String folderServerId = entry.getKey();
// Notify listeners of changed folder status
LocalFolder localFolder = localStore.getFolder(folderServerId);
try {
int unreadMessageCount = localFolder.getUnreadMessageCount();
for (MessagingListener l : getListeners()) {
l.folderStatusChanged(account, folderServerId, unreadMessageCount);
}
} catch (MessagingException e) {
Timber.w(e, "Couldn't get unread count for folder: %s", folderServerId);
for (MessagingListener l : getListeners()) {
l.folderStatusChanged(account, folderServerId);
}
// TODO: Skip the remote part for all local-only folders
@ -1158,9 +1128,8 @@ public class MessagingController {
// Update the messages in the local store
localFolder.setFlags(messages, Collections.singleton(flag), newState);
int unreadMessageCount = localFolder.getUnreadMessageCount();
for (MessagingListener l : getListeners()) {
l.folderStatusChanged(account, folderServerId, unreadMessageCount);
l.folderStatusChanged(account, folderServerId);
}
@ -1523,9 +1492,7 @@ public class MessagingController {
Timber.v("Outbox does not exist");
return;
}
for (MessagingListener l : getListeners()) {
l.sendPendingMessagesStarted(account);
}
localFolder.open();
List<LocalMessage> localMessages = localFolder.getMessages(null);
@ -1632,10 +1599,6 @@ public class MessagingController {
}
}
for (MessagingListener l : getListeners()) {
l.sendPendingMessagesCompleted(account);
}
if (lastFailure != null) {
if (wasPermanentFailure) {
notificationController.showSendFailedNotification(account, lastFailure);
@ -1648,10 +1611,6 @@ public class MessagingController {
throw new UnavailableAccountException(e);
} catch (Exception e) {
Timber.v(e, "Failed to send pending messages");
for (MessagingListener l : getListeners()) {
l.sendPendingMessagesFailed(account);
}
} finally {
if (lastFailure == null) {
notificationController.clearSendFailedNotification(account);
@ -1716,7 +1675,7 @@ public class MessagingController {
} catch (MessagingException me) {
Timber.e(me, "Count not get unread count for account %s", account.getDescription());
}
l.folderStatusChanged(account, folderServerId, unreadMessageCount);
l.folderStatusChanged(account, folderServerId);
}
};
@ -1916,9 +1875,8 @@ public class MessagingController {
if (unreadCountAffected) {
// If this copy operation changes the unread count in the destination
// folder, notify the listeners.
int unreadMessageCount = localDestFolder.getUnreadMessageCount();
for (MessagingListener l : getListeners()) {
l.folderStatusChanged(account, destFolder, unreadMessageCount);
l.folderStatusChanged(account, destFolder);
}
}
} else {
@ -1942,8 +1900,8 @@ public class MessagingController {
int unreadMessageCountSrc = localSrcFolder.getUnreadMessageCount();
int unreadMessageCountDest = localDestFolder.getUnreadMessageCount();
for (MessagingListener l : getListeners()) {
l.folderStatusChanged(account, srcFolder, unreadMessageCountSrc);
l.folderStatusChanged(account, destFolder, unreadMessageCountDest);
l.folderStatusChanged(account, srcFolder);
l.folderStatusChanged(account, destFolder);
}
}
}
@ -2094,15 +2052,6 @@ public class MessagingController {
LocalFolder localFolder = null;
LocalFolder localTrashFolder = null;
try {
//We need to make these callbacks before moving the messages to the trash
//as messages get a new UID after being moved
for (Message message : messages) {
String messageServerId = message.getUid();
for (MessagingListener l : getListeners(listener)) {
l.messageDeleted(account, folder, messageServerId);
}
}
List<Message> localOnlyMessages = new ArrayList<>();
List<Message> syncedMessages = new ArrayList<>();
List<String> syncedMessageUids = new ArrayList<>();
@ -2142,10 +2091,9 @@ public class MessagingController {
}
for (MessagingListener l : getListeners()) {
l.folderStatusChanged(account, folder, localFolder.getUnreadMessageCount());
l.folderStatusChanged(account, folder);
if (localTrashFolder != null) {
l.folderStatusChanged(account, account.getTrashFolder(),
localTrashFolder.getUnreadMessageCount());
l.folderStatusChanged(account, account.getTrashFolder());
}
}
@ -2231,7 +2179,8 @@ public class MessagingController {
LocalFolder localFolder = null;
try {
LocalStore localStore = localStoreProvider.getInstance(account);
localFolder = localStore.getFolder(account.getTrashFolder());
String trashFolderServerId = account.getTrashFolder();
localFolder = localStore.getFolder(trashFolderServerId);
localFolder.open();
boolean isTrashLocalOnly = isTrashLocalOnly(account);
@ -2242,7 +2191,7 @@ public class MessagingController {
}
for (MessagingListener l : getListeners()) {
l.emptyTrashCompleted(account);
l.folderStatusChanged(account, trashFolderServerId);
}
if (!isTrashLocalOnly) {
@ -2850,12 +2799,6 @@ public class MessagingController {
}
}
public void systemStatusChanged() {
for (MessagingListener l : getListeners()) {
l.systemStatusChanged();
}
}
public void cancelNotificationsForAccount(Account account) {
notificationController.clearNewMailNotifications(account);
}
@ -3046,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);
}
}
@ -3069,9 +3011,9 @@ public class MessagingController {
}
@Override
public void folderStatusChanged(@NotNull String folderServerId, int unreadMessageCount) {
public void folderStatusChanged(@NotNull String folderServerId) {
for (MessagingListener messagingListener : getListeners(listener)) {
messagingListener.folderStatusChanged(account, folderServerId, unreadMessageCount);
messagingListener.folderStatusChanged(account, folderServerId);
}
}

View file

@ -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();
}
@ -107,8 +106,6 @@ public class MessagingControllerPushReceiver implements PushReceiver {
}
public void setPushActive(String folderServerId, boolean enabled) {
for (MessagingListener l : controller.getListeners()) {
l.setPushActive(account, folderServerId, enabled);
}
// Nothing to do for now
}
}

View file

@ -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);
@ -35,28 +35,13 @@ public interface MessagingListener {
void checkMailStarted(Context context, Account account);
void checkMailFinished(Context context, Account account);
void sendPendingMessagesStarted(Account account);
void sendPendingMessagesCompleted(Account account);
void sendPendingMessagesFailed(Account account);
void folderStatusChanged(Account account, String folderServerId);
void emptyTrashCompleted(Account account);
void folderStatusChanged(Account account, String folderServerId, int unreadMessageCount);
void systemStatusChanged();
void messageDeleted(Account account, String folderServerId, String messageServerId);
void messageUidChanged(Account account, String folderServerId, String oldUid, String newUid);
void setPushActive(Account account, String folderServerId, boolean enabled);
void loadAttachmentFinished(Account account, Message message, Part part);
void loadAttachmentFailed(Account account, Message message, Part part, String reason);
void pendingCommandStarted(Account account, String commandTitle);
void pendingCommandsProcessing(Account account);
void pendingCommandCompleted(Account account, String commandTitle);
void pendingCommandsFinished(Account account);
void remoteSearchStarted(String folder);
void remoteSearchServerQueryComplete(String folderServerId, int numResults, int maxResults);
void remoteSearchFinished(String folderServerId, int numResults, int maxResults, List<String> extraResults);

View file

@ -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
@ -80,41 +79,13 @@ public abstract class SimpleMessagingListener implements MessagingListener {
}
@Override
public void sendPendingMessagesStarted(Account account) {
}
@Override
public void sendPendingMessagesCompleted(Account account) {
}
@Override
public void sendPendingMessagesFailed(Account account) {
}
@Override
public void emptyTrashCompleted(Account account) {
}
@Override
public void folderStatusChanged(Account account, String folderServerId, int unreadMessageCount) {
}
@Override
public void systemStatusChanged() {
}
@Override
public void messageDeleted(Account account, String folderServerId, String messageServerId) {
public void folderStatusChanged(Account account, String folderServerId) {
}
@Override
public void messageUidChanged(Account account, String folderServerId, String oldUid, String newUid) {
}
@Override
public void setPushActive(Account account, String folderServerId, boolean enabled) {
}
@Override
public void loadAttachmentFinished(Account account, Message message, Part part) {
}
@ -123,22 +94,6 @@ public abstract class SimpleMessagingListener implements MessagingListener {
public void loadAttachmentFailed(Account account, Message message, Part part, String reason) {
}
@Override
public void pendingCommandStarted(Account account, String commandTitle) {
}
@Override
public void pendingCommandsProcessing(Account account) {
}
@Override
public void pendingCommandCompleted(Account account, String commandTitle) {
}
@Override
public void pendingCommandsFinished(Account account) {
}
@Override
public void remoteSearchStarted(String folder) {
}

View file

@ -7,10 +7,7 @@ import android.content.Intent;
import android.os.IBinder;
import android.os.PowerManager;
import com.fsck.k9.DI;
import com.fsck.k9.K9;
import com.fsck.k9.controller.MessagingController;
import com.fsck.k9.helper.Utility;
import com.fsck.k9.power.TracingPowerManager;
import com.fsck.k9.power.TracingPowerManager.TracingWakeLock;
@ -298,20 +295,11 @@ public abstract class CoreService extends Service {
Runnable myRunner = new Runnable() {
public void run() {
try {
boolean oldIsSyncDisabled = CoreService.isMailSyncDisabled(context);
Timber.d("CoreService (%s) running Runnable %d with startId %d",
className, runner.hashCode(), startId);
// Run the supplied code
runner.run();
// If the sync status changed while runner was executing, notify
// MessagingController
if (CoreService.isMailSyncDisabled(context) != oldIsSyncDisabled) {
MessagingController messagingController = DI.get(MessagingController.class);
messagingController.systemStatusChanged();
}
} finally {
// Making absolutely sure stopSelf() will be called
try {
@ -410,11 +398,6 @@ public abstract class CoreService extends Service {
return null;
}
public static boolean isMailSyncDisabled(Context context) {
boolean hasConnectivity = Utility.hasConnectivity(context);
return !hasConnectivity || !isBackgroundSyncAllowed();
}
public static boolean isBackgroundSyncAllowed() {
K9.BACKGROUND_OPS backgroundSyncSetting = K9.getBackgroundOps();
switch (backgroundSyncSetting) {

View file

@ -370,15 +370,6 @@ public class MessagingControllerTest extends K9RobolectricTest {
verifyZeroInteractions(listener);
}
@Test
public void sendPendingMessagesSynchronous_shouldCallListenerOnStart() throws MessagingException {
setupAccountWithMessageToSend();
controller.sendPendingMessagesSynchronous(account);
verify(listener).sendPendingMessagesStarted(account);
}
@Test
public void sendPendingMessagesSynchronous_shouldSetProgress() throws MessagingException {
setupAccountWithMessageToSend();
@ -456,15 +447,6 @@ public class MessagingControllerTest extends K9RobolectricTest {
verify(notificationController).showCertificateErrorNotification(account, false);
}
@Test
public void sendPendingMessagesSynchronous_shouldCallListenerOnCompletion() throws MessagingException {
setupAccountWithMessageToSend();
controller.sendPendingMessagesSynchronous(account);
verify(listener).sendPendingMessagesCompleted(account);
}
private void setupAccountWithMessageToSend() throws MessagingException {
when(account.getOutboxFolder()).thenReturn(FOLDER_NAME);
account.setSentFolder(SENT_FOLDER_NAME, SpecialFolderSelection.AUTOMATIC);

View file

@ -101,7 +101,7 @@ public class MessageProvider extends ContentProvider {
MessagingController messagingController = DI.get(MessagingController.class);
messagingController.addListener(new SimpleMessagingListener() {
@Override
public void folderStatusChanged(Account account, String folderServerId, int unreadMessageCount) {
public void folderStatusChanged(Account account, String folderServerId) {
context.getContentResolver().notifyChange(CONTENT_URI, null);
}
});

View file

@ -25,15 +25,11 @@ class MessageListWidgetUpdateListener(private val context: Context) : SimpleMess
updateMailListWidget()
}
override fun messageDeleted(account: Account, folderServerId: String, messageServerId: String) {
updateMailListWidget()
}
override fun synchronizeMailboxNewMessage(account: Account, folderServerId: String, message: Message) {
updateMailListWidget()
}
override fun folderStatusChanged(account: Account, folderServerId: String, unreadMessageCount: Int) {
override fun folderStatusChanged(account: Account, folderServerId: String) {
updateMailListWidget()
}
}

View file

@ -19,15 +19,11 @@ class UnreadWidgetUpdateListener(private val unreadWidgetUpdater: UnreadWidgetUp
updateUnreadWidget()
}
override fun messageDeleted(account: Account, folderServerId: String, messageServerId: String) {
updateUnreadWidget()
}
override fun synchronizeMailboxNewMessage(account: Account, folderServerId: String, message: Message) {
updateUnreadWidget()
}
override fun folderStatusChanged(account: Account, folderServerId: String, unreadMessageCount: Int) {
override fun folderStatusChanged(account: Account, folderServerId: String) {
updateUnreadWidget()
}
}

View file

@ -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);

View file

@ -24,9 +24,8 @@ class FoldersLiveData(
private val messagingListener = object : SimpleMessagingListener() {
override fun folderStatusChanged(
account: Account?,
folderServerId: String?,
unreadMessageCount: Int
account: Account,
folderServerId: String
) {
if (account?.uuid == accountUuid) {
loadFoldersAsync()

View file

@ -14,8 +14,8 @@ 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, unreadMessageCount: Int)
fun folderStatusChanged(folderServerId: String)
}

View file

@ -201,8 +201,7 @@ class ImapSync {
int newMessages = downloadMessages(syncConfig, remoteFolder, backendFolder, remoteMessages, false,
lastUid, listener);
int unreadMessageCount = backendFolder.getUnreadMessageCount();
listener.folderStatusChanged(folder, unreadMessageCount);
listener.folderStatusChanged(folder);
/* Notify listeners that we're finally done. */
@ -215,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);

View file

@ -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, unreadMessageCount: Int) = Unit
override fun folderStatusChanged(folderServerId: String) = Unit
}

View file

@ -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

View file

@ -196,8 +196,7 @@ class Pop3Sync {
int newMessages = downloadMessages(syncConfig, remoteFolder, backendFolder, remoteMessages, false,
listener);
int unreadMessageCount = backendFolder.getUnreadMessageCount();
listener.folderStatusChanged(folder, unreadMessageCount);
listener.folderStatusChanged(folder);
/* Notify listeners that we're finally done. */
@ -210,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);

View file

@ -196,8 +196,7 @@ class WebDavSync {
int newMessages = downloadMessages(syncConfig, remoteFolder, backendFolder, remoteMessages, false,
listener);
int unreadMessageCount = backendFolder.getUnreadMessageCount();
listener.folderStatusChanged(folder, unreadMessageCount);
listener.folderStatusChanged(folder);
/* Notify listeners that we're finally done. */
@ -210,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);