From 2420f3f2cd1b1e97b7a32c0a9b1da6673a3c79a3 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Mon, 17 Feb 2020 20:07:42 +0100 Subject: do not warn user if bookmark already exists --- src/main/java/de/pixart/messenger/entities/Account.java | 8 +------- .../java/de/pixart/messenger/ui/StartConversationActivity.java | 9 ++++++--- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'src/main/java/de/pixart') diff --git a/src/main/java/de/pixart/messenger/entities/Account.java b/src/main/java/de/pixart/messenger/entities/Account.java index c270f5b43..154f98af9 100644 --- a/src/main/java/de/pixart/messenger/entities/Account.java +++ b/src/main/java/de/pixart/messenger/entities/Account.java @@ -541,13 +541,7 @@ public class Account extends AbstractEntity implements AvatarService.Avatarable } } - public boolean hasBookmarkFor(final Jid jid) { - synchronized (this.bookmarks) { - return this.bookmarks.containsKey(jid.asBareJid()); - } - } - - Bookmark getBookmark(final Jid jid) { + public Bookmark getBookmark(final Jid jid) { synchronized (this.bookmarks) { return this.bookmarks.get(jid.asBareJid()); } diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java index 8f4e468c7..82379facd 100644 --- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java @@ -1003,10 +1003,12 @@ public class StartConversationActivity extends XmppActivity implements XmppConne } if (isBookmarkChecked) { - if (account.hasBookmarkFor(conferenceJid)) { - layout.setError(getString(R.string.bookmark_already_exists)); + Bookmark bookmark = account.getBookmark(conferenceJid); + if (bookmark != null) { + dialog.dismiss(); + openConversationsForBookmark(bookmark); } else { - final Bookmark bookmark = new Bookmark(account, conferenceJid.asBareJid()); + bookmark = new Bookmark(account, conferenceJid.asBareJid()); bookmark.setAutojoin(getBooleanPreference("autojoin", R.bool.autojoin)); final String nick = conferenceJid.getResource(); if (nick != null && !nick.isEmpty() && !nick.equals(MucOptions.defaultNick(account))) { @@ -1100,6 +1102,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne final AdapterView.AdapterContextMenuInfo acmi = (AdapterContextMenuInfo) menuInfo; if (mResContextMenu == R.menu.conference_context) { activity.conference_context_id = acmi.position; + //TODO hide share if known to be private } else if (mResContextMenu == R.menu.contact_context) { activity.contact_context_id = acmi.position; final Contact contact = (Contact) activity.contacts.get(acmi.position); -- cgit v1.2.3