diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-11-23 12:32:34 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-11-23 12:32:34 +0100 |
commit | f7fea5a35adae306326de57da22420c52bfc4517 (patch) | |
tree | c0ec45e360dac387271023cea956a0c800aad4ed /src/main | |
parent | 7d584fbee00a5a74fbd14df6a9a98a47e112304e (diff) |
refresh contacts when opening StartConversationsActivity
Diffstat (limited to '')
5 files changed, 18 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/Config.java b/src/main/java/de/pixart/messenger/Config.java index 5181b24b1..13c86e6a1 100644 --- a/src/main/java/de/pixart/messenger/Config.java +++ b/src/main/java/de/pixart/messenger/Config.java @@ -59,6 +59,9 @@ public final class Config { public static final boolean ALLOW_NON_TLS_CONNECTIONS = false; //very dangerous. you should have a good reason to set this to true public static final boolean FORCE_ORBOT = false; // always use TOR + + public static final long CONTACT_SYNC_RETRY_INTERVAL = 1000L * 60 * 5; + public static final boolean HIDE_MESSAGE_TEXT_IN_NOTIFICATION = false; public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification diff --git a/src/main/java/de/pixart/messenger/entities/Account.java b/src/main/java/de/pixart/messenger/entities/Account.java index 9e3711535..412960e48 100644 --- a/src/main/java/de/pixart/messenger/entities/Account.java +++ b/src/main/java/de/pixart/messenger/entities/Account.java @@ -73,6 +73,7 @@ public class Account extends AbstractEntity { protected String password; protected int options = 0; protected State status = State.OFFLINE; + private State lastErrorStatus = State.OFFLINE; protected String resource; protected String avatar; protected String hostname = null; @@ -271,8 +272,15 @@ public class Account extends AbstractEntity { } } + public State getLastErrorStatus() { + return this.lastErrorStatus; + } + public void setStatus(final State status) { this.status = status; + if (status.isError) { + this.lastErrorStatus = status; + } } public State getTrueStatus() { diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java index 053685fc6..91501f623 100644 --- a/src/main/java/de/pixart/messenger/services/NotificationService.java +++ b/src/main/java/de/pixart/messenger/services/NotificationService.java @@ -929,9 +929,10 @@ public class NotificationService { cancel(ERROR_NOTIFICATION_ID); return; } + final boolean showAllErrors = QuickConversationsService.isConversations(); final List<Account> errors = new ArrayList<>(); for (final Account account : mXmppConnectionService.getAccounts()) { - if (account.hasErrorStatus() && account.showErrorNotification()) { + if (account.hasErrorStatus() && account.showErrorNotification() && (showAllErrors || account.getLastErrorStatus() == Account.State.UNAUTHORIZED)) { errors.add(account); } } diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index e9f77b33b..174785fb8 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -4041,6 +4041,10 @@ public class XmppConnectionService extends Service { return this.mMessageArchiveService; } + public QuickConversationsService getQuickConversationsService() { + return this.mQuickConversationsService; + } + public List<Contact> findContacts(Jid jid, String accountJid) { ArrayList<Contact> contacts = new ArrayList<>(); for (Account account : getAccounts()) { diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index 1edbafd67..171db1bda 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -735,6 +735,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne @Override protected void onBackendConnected() { + xmppConnectionService.getQuickConversationsService().considerSync(); if (mPostponedActivityResult != null) { onActivityResult(mPostponedActivityResult.first, RESULT_OK, mPostponedActivityResult.second); this.mPostponedActivityResult = null; |