From 0a3d6bc6d002c3daa20140cdbe4c285cda37fd98 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Fri, 23 Nov 2018 12:46:02 +0100 Subject: show synced contacts in choose contact activity --- src/main/java/de/pixart/messenger/Config.java | 2 -- src/main/java/de/pixart/messenger/entities/Contact.java | 7 ++----- src/main/java/de/pixart/messenger/entities/Conversation.java | 3 +-- src/main/java/de/pixart/messenger/entities/Message.java | 2 +- src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java | 2 +- .../java/de/pixart/messenger/ui/StartConversationActivity.java | 3 +-- 6 files changed, 6 insertions(+), 13 deletions(-) (limited to 'src/main/java/de/pixart') diff --git a/src/main/java/de/pixart/messenger/Config.java b/src/main/java/de/pixart/messenger/Config.java index 13c86e6a1..d79f8ca64 100644 --- a/src/main/java/de/pixart/messenger/Config.java +++ b/src/main/java/de/pixart/messenger/Config.java @@ -60,8 +60,6 @@ public final class Config { 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/Contact.java b/src/main/java/de/pixart/messenger/entities/Contact.java index 17a6b1099..1df6e120a 100644 --- a/src/main/java/de/pixart/messenger/entities/Contact.java +++ b/src/main/java/de/pixart/messenger/entities/Contact.java @@ -166,9 +166,6 @@ public class Contact implements ListItem, Blockable { if (isBlocked()) { tags.add(new Tag(context.getString(R.string.blocked), 0xff2e2f3b, 0)); } - if (showInPhoneBook()) { - tags.add(new Tag(context.getString(R.string.phone_book), 0xFF1E88E5, 0)); - } return tags; } @@ -387,8 +384,8 @@ public class Contact implements ListItem, Blockable { || (this.getOption(Contact.Options.DIRTY_PUSH)); } - public boolean showInPhoneBook() { - return systemAccount != null; + public boolean showInContactList() { + return showInRoster() || getOption(Options.SYNCED_VIA_OTHER); } public void parseSubscriptionFromElement(Element item) { diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java index db6006ca3..4dcd79e9d 100644 --- a/src/main/java/de/pixart/messenger/entities/Conversation.java +++ b/src/main/java/de/pixart/messenger/entities/Conversation.java @@ -1147,9 +1147,8 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl final Contact contact = getContact(); return mode == MODE_SINGLE && !contact.isOwnServer() - && !contact.showInRoster() + && !contact.showInContactList() && !contact.isSelf() - && !contact.showInPhoneBook() && sentMessagesCount() == 0; } diff --git a/src/main/java/de/pixart/messenger/entities/Message.java b/src/main/java/de/pixart/messenger/entities/Message.java index 14d235553..730e67170 100644 --- a/src/main/java/de/pixart/messenger/entities/Message.java +++ b/src/main/java/de/pixart/messenger/entities/Message.java @@ -673,7 +673,7 @@ public class Message extends AbstractEntity { public boolean trusted() { Contact contact = this.getContact(); - return status > STATUS_RECEIVED || (contact != null && (contact.showInRoster() || contact.isSelf())); + return status > STATUS_RECEIVED || (contact != null && (contact.showInContactList() || contact.isSelf())); } public boolean fixCounterpart() { diff --git a/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java b/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java index a760a563b..ac1866fec 100644 --- a/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ChooseContactActivity.java @@ -263,7 +263,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im for (final Account account : xmppConnectionService.getAccounts()) { if (account.getStatus() != Account.State.DISABLED) { for (final Contact contact : account.getRoster().getContacts()) { - if (contact.showInRoster() && + if (contact.showInContactList() && !filterContacts.contains(contact.getJid().asBareJid().toString()) && contact.match(this, needle)) { getListItems().add(contact); diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index 171db1bda..462fb4429 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -869,12 +869,11 @@ public class StartConversationActivity extends XmppActivity implements XmppConne protected void filterContacts(String needle) { this.contacts.clear(); final List accounts = xmppConnectionService.getAccounts(); - final boolean singleAccountActive = isSingleAccountActive(accounts); for (Account account : accounts) { if (account.getStatus() != Account.State.DISABLED) { for (Contact contact : account.getRoster().getContacts()) { Presence.Status s = contact.getShownStatus(); - if ((contact.showInRoster() || (singleAccountActive && contact.showInPhoneBook())) && contact.match(this, needle) + if (contact.showInContactList() && contact.match(this, needle) && (!this.mHideOfflineContacts || (needle != null && !needle.trim().isEmpty()) || s.compareTo(Presence.Status.OFFLINE) < 0)) { -- cgit v1.2.3