From fe2129849d646b6fcbaab0a8d55a8fd9e117a435 Mon Sep 17 00:00:00 2001 From: jp-modernisation-gouv-fr Date: Sun, 17 Jun 2018 21:14:55 +0000 Subject: [PATCH 1/2] correct double open tchat --- vector/src/main/java/fr/gouv/tchap/util/DinsicUtils.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vector/src/main/java/fr/gouv/tchap/util/DinsicUtils.java b/vector/src/main/java/fr/gouv/tchap/util/DinsicUtils.java index ac6b697f22b..f907680e7c4 100644 --- a/vector/src/main/java/fr/gouv/tchap/util/DinsicUtils.java +++ b/vector/src/main/java/fr/gouv/tchap/util/DinsicUtils.java @@ -446,10 +446,11 @@ public static void startDirectChat(final RiotAppCompatActivity activity, final M // Tell if contact is tchap user if (MXSession.isUserId(selectedContact.mUserId)) { // || DinsicUtils.isFromFrenchGov(item.mContact.getEmails())) // The contact is a Tchap user - if (DinsicUtils.openDirectChat(activity, selectedContact.mUserId, session, false)) { - // If a direct chat already exist with him, open it - DinsicUtils.openDirectChat(activity, selectedContact.mUserId, session, true); - } else { + if (!DinsicUtils.openDirectChat(activity, selectedContact.mUserId, session, false)) { + //to be consciensously reviewed! + // // If a direct chat already exist with him, open it + // DinsicUtils.openDirectChat(activity, selectedContact.mUserId, session, true); + // } else { // If it's a Tchap user without a direct chat with him // Display a popup to confirm the creation of a new direct chat with him String msg = activity.getResources().getString(R.string.start_new_chat_prompt_msg, selectedContact.mDisplayName); From 77661f3b1c5b940807622e878ba7b8706a574ece Mon Sep 17 00:00:00 2001 From: giomfo Date: Wed, 20 Jun 2018 09:41:15 +0200 Subject: [PATCH 2/2] Code cleaning --- vector/src/main/java/fr/gouv/tchap/util/DinsicUtils.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/vector/src/main/java/fr/gouv/tchap/util/DinsicUtils.java b/vector/src/main/java/fr/gouv/tchap/util/DinsicUtils.java index f907680e7c4..077bd10fdda 100644 --- a/vector/src/main/java/fr/gouv/tchap/util/DinsicUtils.java +++ b/vector/src/main/java/fr/gouv/tchap/util/DinsicUtils.java @@ -445,12 +445,8 @@ public static void startDirectChat(final RiotAppCompatActivity activity, final M // Tell if contact is tchap user if (MXSession.isUserId(selectedContact.mUserId)) { // || DinsicUtils.isFromFrenchGov(item.mContact.getEmails())) - // The contact is a Tchap user + // The contact is a Tchap user, try to open an existing direct chat if (!DinsicUtils.openDirectChat(activity, selectedContact.mUserId, session, false)) { - //to be consciensously reviewed! - // // If a direct chat already exist with him, open it - // DinsicUtils.openDirectChat(activity, selectedContact.mUserId, session, true); - // } else { // If it's a Tchap user without a direct chat with him // Display a popup to confirm the creation of a new direct chat with him String msg = activity.getResources().getString(R.string.start_new_chat_prompt_msg, selectedContact.mDisplayName);