Remove MessagingListener methods that are never used
This commit is contained in:
parent
93aaa85c14
commit
82f3c67ff0
6 changed files with 0 additions and 132 deletions
|
@ -223,10 +223,6 @@ public class MessagingController {
|
||||||
if (K9.DEBUG) {
|
if (K9.DEBUG) {
|
||||||
Log.i(K9.LOG_TAG, " Command '" + command.description + "' completed");
|
Log.i(K9.LOG_TAG, " Command '" + command.description + "' completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (MessagingListener l : getListeners(command.listener)) {
|
|
||||||
l.controllerCommandCompleted(!queuedCommands.isEmpty());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Error running command '" + commandDescription + "'", e);
|
Log.e(K9.LOG_TAG, "Error running command '" + commandDescription + "'", e);
|
||||||
|
@ -544,24 +540,12 @@ public class MessagingController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// alert everyone the search has started
|
|
||||||
if (listener != null) {
|
|
||||||
listener.listLocalMessagesStarted(account, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// build and do the query in the localstore
|
// build and do the query in the localstore
|
||||||
try {
|
try {
|
||||||
LocalStore localStore = account.getLocalStore();
|
LocalStore localStore = account.getLocalStore();
|
||||||
localStore.searchForMessages(retrievalListener, search);
|
localStore.searchForMessages(retrievalListener, search);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (listener != null) {
|
|
||||||
listener.listLocalMessagesFailed(account, null, e.getMessage());
|
|
||||||
}
|
|
||||||
addErrorMessage(account, null, e);
|
addErrorMessage(account, null, e);
|
||||||
} finally {
|
|
||||||
if (listener != null) {
|
|
||||||
listener.listLocalMessagesFinished(account, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,10 +697,6 @@ public class MessagingController {
|
||||||
localFolder.appendMessages(Collections.singletonList(message));
|
localFolder.appendMessages(Collections.singletonList(message));
|
||||||
localMsg = localFolder.getMessage(message.getUid());
|
localMsg = localFolder.getMessage(message.getUid());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listener != null) {
|
|
||||||
listener.remoteSearchAddMessage(remoteFolder.getName(), localMsg, i, messages.size());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1316,7 +1296,6 @@ public class MessagingController {
|
||||||
localMessage.setFlag(Flag.X_DOWNLOADED_PARTIAL, message.isSet(Flag.X_DOWNLOADED_PARTIAL));
|
localMessage.setFlag(Flag.X_DOWNLOADED_PARTIAL, message.isSet(Flag.X_DOWNLOADED_PARTIAL));
|
||||||
|
|
||||||
for (MessagingListener l : getListeners()) {
|
for (MessagingListener l : getListeners()) {
|
||||||
l.synchronizeMailboxAddOrUpdateMessage(account, folder, localMessage);
|
|
||||||
if (!localMessage.isSet(Flag.SEEN)) {
|
if (!localMessage.isSet(Flag.SEEN)) {
|
||||||
l.synchronizeMailboxNewMessage(account, folder, localMessage);
|
l.synchronizeMailboxNewMessage(account, folder, localMessage);
|
||||||
}
|
}
|
||||||
|
@ -1470,7 +1449,6 @@ public class MessagingController {
|
||||||
|
|
||||||
// Update the listener with what we've found
|
// Update the listener with what we've found
|
||||||
for (MessagingListener l : getListeners()) {
|
for (MessagingListener l : getListeners()) {
|
||||||
l.synchronizeMailboxAddOrUpdateMessage(account, folder, localMessage);
|
|
||||||
l.synchronizeMailboxProgress(account, folder, progress.get(), todo);
|
l.synchronizeMailboxProgress(account, folder, progress.get(), todo);
|
||||||
if (!localMessage.isSet(Flag.SEEN)) {
|
if (!localMessage.isSet(Flag.SEEN)) {
|
||||||
l.synchronizeMailboxNewMessage(account, folder, localMessage);
|
l.synchronizeMailboxNewMessage(account, folder, localMessage);
|
||||||
|
@ -1543,7 +1521,6 @@ public class MessagingController {
|
||||||
newMessages.incrementAndGet();
|
newMessages.incrementAndGet();
|
||||||
}
|
}
|
||||||
for (MessagingListener l : getListeners()) {
|
for (MessagingListener l : getListeners()) {
|
||||||
l.synchronizeMailboxAddOrUpdateMessage(account, folder, localMessage);
|
|
||||||
l.synchronizeMailboxProgress(account, folder, progress.get(), todo);
|
l.synchronizeMailboxProgress(account, folder, progress.get(), todo);
|
||||||
if (!localMessage.isSet(Flag.SEEN)) {
|
if (!localMessage.isSet(Flag.SEEN)) {
|
||||||
l.synchronizeMailboxNewMessage(account, folder, localMessage);
|
l.synchronizeMailboxNewMessage(account, folder, localMessage);
|
||||||
|
@ -1670,9 +1647,6 @@ public class MessagingController {
|
||||||
l.synchronizeMailboxRemovedMessage(account, folder, localMessage);
|
l.synchronizeMailboxRemovedMessage(account, folder, localMessage);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (MessagingListener l : getListeners()) {
|
|
||||||
l.synchronizeMailboxAddOrUpdateMessage(account, folder, localMessage);
|
|
||||||
}
|
|
||||||
if (shouldNotifyForMessage(account, localFolder, localMessage)) {
|
if (shouldNotifyForMessage(account, localFolder, localMessage)) {
|
||||||
shouldBeNotifiedOf = true;
|
shouldBeNotifiedOf = true;
|
||||||
}
|
}
|
||||||
|
@ -2194,9 +2168,6 @@ public class MessagingController {
|
||||||
for (Message message : messages) {
|
for (Message message : messages) {
|
||||||
if (!message.isSet(Flag.SEEN)) {
|
if (!message.isSet(Flag.SEEN)) {
|
||||||
message.setFlag(Flag.SEEN, true);
|
message.setFlag(Flag.SEEN, true);
|
||||||
for (MessagingListener l : getListeners()) {
|
|
||||||
l.listLocalMessagesUpdateMessage(account, folder, message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,7 @@ public interface MessagingListener {
|
||||||
void listFoldersFinished(Account account);
|
void listFoldersFinished(Account account);
|
||||||
void listFoldersFailed(Account account, String message);
|
void listFoldersFailed(Account account, String message);
|
||||||
|
|
||||||
void listLocalMessagesStarted(Account account, String folder);
|
|
||||||
void listLocalMessagesAddMessages(Account account, String folder, List<LocalMessage> messages);
|
void listLocalMessagesAddMessages(Account account, String folder, List<LocalMessage> messages);
|
||||||
void listLocalMessagesUpdateMessage(Account account, String folder, Message message);
|
|
||||||
void listLocalMessagesRemoveMessage(Account account, String folder, Message message);
|
|
||||||
void listLocalMessagesFinished(Account account, String folder);
|
|
||||||
void listLocalMessagesFailed(Account account, String folder, String message);
|
|
||||||
|
|
||||||
void synchronizeMailboxStarted(Account account, String folder);
|
void synchronizeMailboxStarted(Account account, String folder);
|
||||||
void synchronizeMailboxHeadersStarted(Account account, String folder);
|
void synchronizeMailboxHeadersStarted(Account account, String folder);
|
||||||
|
@ -40,7 +35,6 @@ public interface MessagingListener {
|
||||||
int numNewMessages);
|
int numNewMessages);
|
||||||
void synchronizeMailboxProgress(Account account, String folder, int completed, int total);
|
void synchronizeMailboxProgress(Account account, String folder, int completed, int total);
|
||||||
void synchronizeMailboxNewMessage(Account account, String folder, Message message);
|
void synchronizeMailboxNewMessage(Account account, String folder, Message message);
|
||||||
void synchronizeMailboxAddOrUpdateMessage(Account account, String folder, Message message);
|
|
||||||
void synchronizeMailboxRemovedMessage(Account account, String folder, Message message);
|
void synchronizeMailboxRemovedMessage(Account account, String folder, Message message);
|
||||||
void synchronizeMailboxFinished(Account account, String folder, int totalMessagesInMailbox, int numNewMessages);
|
void synchronizeMailboxFinished(Account account, String folder, int totalMessagesInMailbox, int numNewMessages);
|
||||||
void synchronizeMailboxFailed(Account account, String folder, String message);
|
void synchronizeMailboxFailed(Account account, String folder, String message);
|
||||||
|
@ -50,7 +44,6 @@ public interface MessagingListener {
|
||||||
|
|
||||||
void checkMailStarted(Context context, Account account);
|
void checkMailStarted(Context context, Account account);
|
||||||
void checkMailFinished(Context context, Account account);
|
void checkMailFinished(Context context, Account account);
|
||||||
void checkMailFailed(Context context, Account account, String reason);
|
|
||||||
|
|
||||||
void sendPendingMessagesStarted(Account account);
|
void sendPendingMessagesStarted(Account account);
|
||||||
void sendPendingMessagesCompleted(Account account);
|
void sendPendingMessagesCompleted(Account account);
|
||||||
|
@ -76,20 +69,8 @@ public interface MessagingListener {
|
||||||
|
|
||||||
void remoteSearchStarted(String folder);
|
void remoteSearchStarted(String folder);
|
||||||
void remoteSearchServerQueryComplete(String folderName, int numResults, int maxResults);
|
void remoteSearchServerQueryComplete(String folderName, int numResults, int maxResults);
|
||||||
void remoteSearchAddMessage(String folder, Message message, int numDone, int numTotal);
|
|
||||||
void remoteSearchFinished(String folder, int numResults, int maxResults, List<Message> extraResults);
|
void remoteSearchFinished(String folder, int numResults, int maxResults, List<Message> extraResults);
|
||||||
void remoteSearchFailed(String folder, String err);
|
void remoteSearchFailed(String folder, String err);
|
||||||
|
|
||||||
/**
|
|
||||||
* General notification messages subclasses can override to be notified that the controller
|
|
||||||
* has completed a command. This is useful for turning off progress indicators that may have
|
|
||||||
* been left over from previous commands.
|
|
||||||
*
|
|
||||||
* @param moreCommandsToRun
|
|
||||||
* {@code true} if the controller will continue on to another command immediately.
|
|
||||||
* {@code false} otherwise.
|
|
||||||
*/
|
|
||||||
void controllerCommandCompleted(boolean moreCommandsToRun);
|
|
||||||
|
|
||||||
void enableProgressIndicator(boolean enable);
|
void enableProgressIndicator(boolean enable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,30 +44,10 @@ public abstract class SimpleMessagingListener implements MessagingListener {
|
||||||
public void listFoldersFailed(Account account, String message) {
|
public void listFoldersFailed(Account account, String message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void listLocalMessagesStarted(Account account, String folder) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void listLocalMessagesAddMessages(Account account, String folder, List<LocalMessage> messages) {
|
public void listLocalMessagesAddMessages(Account account, String folder, List<LocalMessage> messages) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void listLocalMessagesUpdateMessage(Account account, String folder, Message message) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void listLocalMessagesRemoveMessage(Account account, String folder, Message message) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void listLocalMessagesFinished(Account account, String folder) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void listLocalMessagesFailed(Account account, String folder, String message) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void synchronizeMailboxStarted(Account account, String folder) {
|
public void synchronizeMailboxStarted(Account account, String folder) {
|
||||||
}
|
}
|
||||||
|
@ -93,10 +73,6 @@ public abstract class SimpleMessagingListener implements MessagingListener {
|
||||||
public void synchronizeMailboxNewMessage(Account account, String folder, Message message) {
|
public void synchronizeMailboxNewMessage(Account account, String folder, Message message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void synchronizeMailboxAddOrUpdateMessage(Account account, String folder, Message message) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void synchronizeMailboxRemovedMessage(Account account, String folder, Message message) {
|
public void synchronizeMailboxRemovedMessage(Account account, String folder, Message message) {
|
||||||
}
|
}
|
||||||
|
@ -126,10 +102,6 @@ public abstract class SimpleMessagingListener implements MessagingListener {
|
||||||
public void checkMailFinished(Context context, Account account) {
|
public void checkMailFinished(Context context, Account account) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void checkMailFailed(Context context, Account account, String reason) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendPendingMessagesStarted(Account account) {
|
public void sendPendingMessagesStarted(Account account) {
|
||||||
}
|
}
|
||||||
|
@ -198,10 +170,6 @@ public abstract class SimpleMessagingListener implements MessagingListener {
|
||||||
public void remoteSearchServerQueryComplete(String folderName, int numResults, int maxResults) {
|
public void remoteSearchServerQueryComplete(String folderName, int numResults, int maxResults) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void remoteSearchAddMessage(String folder, Message message, int numDone, int numTotal) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remoteSearchFinished(String folder, int numResults, int maxResults, List<Message> extraResults) {
|
public void remoteSearchFinished(String folder, int numResults, int maxResults, List<Message> extraResults) {
|
||||||
}
|
}
|
||||||
|
@ -210,10 +178,6 @@ public abstract class SimpleMessagingListener implements MessagingListener {
|
||||||
public void remoteSearchFailed(String folder, String err) {
|
public void remoteSearchFailed(String folder, String err) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void controllerCommandCompleted(boolean moreCommandsToRun) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enableProgressIndicator(boolean enable) {
|
public void enableProgressIndicator(boolean enable) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,11 +108,6 @@ public class PollService extends CoreService {
|
||||||
accountsChecked.clear();
|
accountsChecked.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void checkMailFailed(Context context, Account account, String reason) {
|
|
||||||
release();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void synchronizeMailboxFinished(
|
public void synchronizeMailboxFinished(
|
||||||
Account account,
|
Account account,
|
||||||
|
|
|
@ -140,16 +140,6 @@ public class ActivityListenerTest {
|
||||||
assertEquals("", operation);
|
assertEquals("", operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getOperation__whenSynchronizeMailboxAddOrUpdateMessage() {
|
|
||||||
activityListener.synchronizeMailboxStarted(account, FOLDER);
|
|
||||||
activityListener.synchronizeMailboxAddOrUpdateMessage(account, FOLDER, message);
|
|
||||||
|
|
||||||
String operation = activityListener.getOperation(context);
|
|
||||||
|
|
||||||
assertEquals("Poll account:folder", operation);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getOperation__whenSynchronizeMailboxNewMessage() {
|
public void getOperation__whenSynchronizeMailboxNewMessage() {
|
||||||
activityListener.synchronizeMailboxStarted(account, FOLDER);
|
activityListener.synchronizeMailboxStarted(account, FOLDER);
|
||||||
|
|
|
@ -360,17 +360,6 @@ public class MessagingControllerTest {
|
||||||
verify(listener, never()).listFoldersFinished(account);
|
verify(listener, never()).listFoldersFinished(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void searchLocalMessagesSynchronous_shouldNotifyStartedListingLocalMessages()
|
|
||||||
throws Exception {
|
|
||||||
setAccountsInPreferences(Collections.singletonMap("1", account));
|
|
||||||
when(search.getAccountUuids()).thenReturn(new String[]{"allAccounts"});
|
|
||||||
|
|
||||||
controller.searchLocalMessagesSynchronous(search, listener);
|
|
||||||
|
|
||||||
verify(listener).listLocalMessagesStarted(account, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void searchLocalMessagesSynchronous_shouldCallSearchForMessagesOnLocalStore()
|
public void searchLocalMessagesSynchronous_shouldCallSearchForMessagesOnLocalStore()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
@ -382,18 +371,6 @@ public class MessagingControllerTest {
|
||||||
verify(localStore).searchForMessages(any(MessageRetrievalListener.class), eq(search));
|
verify(localStore).searchForMessages(any(MessageRetrievalListener.class), eq(search));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void searchLocalMessagesSynchronous_shouldNotifyFailureIfStoreThrowsException() throws Exception {
|
|
||||||
setAccountsInPreferences(Collections.singletonMap("1", account));
|
|
||||||
when(search.getAccountUuids()).thenReturn(new String[]{"allAccounts"});
|
|
||||||
when(localStore.searchForMessages(any(MessageRetrievalListener.class), eq(search)))
|
|
||||||
.thenThrow(new MessagingException("Test"));
|
|
||||||
|
|
||||||
controller.searchLocalMessagesSynchronous(search, listener);
|
|
||||||
|
|
||||||
verify(listener).listLocalMessagesFailed(account, null, "Test");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void searchLocalMessagesSynchronous_shouldNotifyWhenStoreFinishesRetrievingAMessage()
|
public void searchLocalMessagesSynchronous_shouldNotifyWhenStoreFinishesRetrievingAMessage()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
@ -522,16 +499,6 @@ public class MessagingControllerTest {
|
||||||
fetchProfileCaptor.capture(), Matchers.<MessageRetrievalListener>eq(null));
|
fetchProfileCaptor.capture(), Matchers.<MessageRetrievalListener>eq(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void searchRemoteMessagesSynchronous_shouldNotifyListenerOfNewMessages() throws Exception {
|
|
||||||
setupRemoteSearch();
|
|
||||||
|
|
||||||
controller.searchRemoteMessagesSynchronous("1", FOLDER_NAME, "query", reqFlags, forbiddenFlags, listener);
|
|
||||||
|
|
||||||
verify(listener).remoteSearchAddMessage(FOLDER_NAME, localNewMessage1, 1, 2);
|
|
||||||
verify(listener).remoteSearchAddMessage(FOLDER_NAME, localNewMessage2, 2, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void searchRemoteMessagesSynchronous_shouldNotifyOnFailure() throws Exception {
|
public void searchRemoteMessagesSynchronous_shouldNotifyOnFailure() throws Exception {
|
||||||
setupRemoteSearch();
|
setupRemoteSearch();
|
||||||
|
|
Loading…
Reference in a new issue