Remove unused MessagingListener callbacks for pending commands
This commit is contained in:
parent
79259b678c
commit
56151e7b7e
4 changed files with 0 additions and 97 deletions
|
@ -31,7 +31,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
|
||||||
|
|
||||||
Memory syncStarted = null;
|
Memory syncStarted = null;
|
||||||
Memory sendStarted = null;
|
Memory sendStarted = null;
|
||||||
Memory processingStarted = null;
|
|
||||||
|
|
||||||
for (Memory memory : memories.values()) {
|
for (Memory memory : memories.values()) {
|
||||||
|
|
||||||
|
@ -76,17 +75,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
|
||||||
break;
|
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;
|
Memory somethingStarted = null;
|
||||||
if (syncStarted != null) {
|
if (syncStarted != null) {
|
||||||
|
@ -98,17 +86,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
|
||||||
other.sendPendingMessagesStarted(sendStarted.account);
|
other.sendPendingMessagesStarted(sendStarted.account);
|
||||||
somethingStarted = sendStarted;
|
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) {
|
if (somethingStarted != null && somethingStarted.folderTotal > 0) {
|
||||||
other.synchronizeMailboxProgress(somethingStarted.account, somethingStarted.folderServerId,
|
other.synchronizeMailboxProgress(somethingStarted.account, somethingStarted.folderServerId,
|
||||||
somethingStarted.folderCompleted, somethingStarted.folderTotal);
|
somethingStarted.folderCompleted, somethingStarted.folderTotal);
|
||||||
|
@ -180,33 +157,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
|
||||||
memory.folderTotal = total;
|
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) {
|
private Memory getMemory(Account account, String folderServerId) {
|
||||||
Memory memory = memories.get(getMemoryKey(account, folderServerId));
|
Memory memory = memories.get(getMemoryKey(account, folderServerId));
|
||||||
if (memory == null) {
|
if (memory == null) {
|
||||||
|
@ -229,7 +179,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
|
||||||
MemorizingState syncingState = null;
|
MemorizingState syncingState = null;
|
||||||
MemorizingState sendingState = null;
|
MemorizingState sendingState = null;
|
||||||
MemorizingState pushingState = null;
|
MemorizingState pushingState = null;
|
||||||
MemorizingState processingState = null;
|
|
||||||
String failureMessage = null;
|
String failureMessage = null;
|
||||||
|
|
||||||
int syncingTotalMessagesInMailbox;
|
int syncingTotalMessagesInMailbox;
|
||||||
|
@ -237,7 +186,6 @@ class MemorizingMessagingListener extends SimpleMessagingListener {
|
||||||
|
|
||||||
int folderCompleted = 0;
|
int folderCompleted = 0;
|
||||||
int folderTotal = 0;
|
int folderTotal = 0;
|
||||||
String processingCommandTitle = null;
|
|
||||||
|
|
||||||
Memory(Account account, String folderServerId) {
|
Memory(Account account, String folderServerId) {
|
||||||
this.account = account;
|
this.account = account;
|
||||||
|
|
|
@ -696,26 +696,12 @@ public class MessagingController {
|
||||||
LocalStore localStore = localStoreProvider.getInstance(account);
|
LocalStore localStore = localStoreProvider.getInstance(account);
|
||||||
List<PendingCommand> commands = localStore.getPendingCommands();
|
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;
|
PendingCommand processingCommand = null;
|
||||||
try {
|
try {
|
||||||
for (PendingCommand command : commands) {
|
for (PendingCommand command : commands) {
|
||||||
processingCommand = command;
|
processingCommand = command;
|
||||||
Timber.d("Processing pending command '%s'", 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
|
* 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
|
* most likely due to a server or IO error and it must be retried before any
|
||||||
|
@ -734,22 +720,12 @@ public class MessagingController {
|
||||||
} else {
|
} else {
|
||||||
throw me;
|
throw me;
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
progress++;
|
|
||||||
for (MessagingListener l : getListeners()) {
|
|
||||||
l.synchronizeMailboxProgress(account, null, progress, todo);
|
|
||||||
l.pendingCommandCompleted(account, command.getCommandName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (MessagingException me) {
|
} catch (MessagingException me) {
|
||||||
notifyUserIfCertificateProblem(account, me, true);
|
notifyUserIfCertificateProblem(account, me, true);
|
||||||
Timber.e(me, "Could not process command '%s'", processingCommand);
|
Timber.e(me, "Could not process command '%s'", processingCommand);
|
||||||
throw me;
|
throw me;
|
||||||
} finally {
|
|
||||||
for (MessagingListener l : getListeners()) {
|
|
||||||
l.pendingCommandsFinished(account);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,11 +52,6 @@ public interface MessagingListener {
|
||||||
void loadAttachmentFinished(Account account, Message message, Part part);
|
void loadAttachmentFinished(Account account, Message message, Part part);
|
||||||
void loadAttachmentFailed(Account account, Message message, Part part, String reason);
|
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 remoteSearchStarted(String folder);
|
||||||
void remoteSearchServerQueryComplete(String folderServerId, int numResults, int maxResults);
|
void remoteSearchServerQueryComplete(String folderServerId, int numResults, int maxResults);
|
||||||
void remoteSearchFinished(String folderServerId, int numResults, int maxResults, List<String> extraResults);
|
void remoteSearchFinished(String folderServerId, int numResults, int maxResults, List<String> extraResults);
|
||||||
|
|
|
@ -123,22 +123,6 @@ public abstract class SimpleMessagingListener implements MessagingListener {
|
||||||
public void loadAttachmentFailed(Account account, Message message, Part part, String reason) {
|
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
|
@Override
|
||||||
public void remoteSearchStarted(String folder) {
|
public void remoteSearchStarted(String folder) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue