From 93d778a57799132d51a0c5aa8a72aacb33415c43 Mon Sep 17 00:00:00 2001 From: Angela Mazzurco Date: Mon, 31 Jul 2017 16:11:21 +0200 Subject: [PATCH 1/3] Show info from message sender when is in only one conversation --- retroshare-android-notify-service/src/main.qml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/retroshare-android-notify-service/src/main.qml b/retroshare-android-notify-service/src/main.qml index 63615f77e..9bababf3a 100644 --- a/retroshare-android-notify-service/src/main.qml +++ b/retroshare-android-notify-service/src/main.qml @@ -41,10 +41,12 @@ QtObject "unread conversations") notificationsBridge.notify( qsTr("New message!"), - qsTr("Unread messages in %1 %2").arg(convCnt).arg( - convCnt > 1 ? - qsTr("conversations") : qsTr("conversation") - ) + (convCnt > 1) ? + qsTr("Unread messages in %1 conversations").arg(convCnt): + qsTr("%1 Unread %2 from %3") + .arg(json.data[0].unread_count) + .arg(json.data[0].unread_count > 1 ? "messages" : "message") + .arg(json.data[0].remote_author_name) ) } } From c86b7c79aee0281997cdbb3fe169c825c0b90c32 Mon Sep 17 00:00:00 2001 From: Angela Mazzurco Date: Mon, 31 Jul 2017 16:52:03 +0200 Subject: [PATCH 2/3] Open contacts view on click unread notification --- retroshare-android-notify-service/src/main.qml | 3 ++- .../android/qml_app/RetroShareQmlActivity.java | 8 ++++++-- retroshare-qml-app/src/main-app.qml | 10 ++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/retroshare-android-notify-service/src/main.qml b/retroshare-android-notify-service/src/main.qml index 9bababf3a..dd25aa808 100644 --- a/retroshare-android-notify-service/src/main.qml +++ b/retroshare-android-notify-service/src/main.qml @@ -46,7 +46,8 @@ QtObject qsTr("%1 Unread %2 from %3") .arg(json.data[0].unread_count) .arg(json.data[0].unread_count > 1 ? "messages" : "message") - .arg(json.data[0].remote_author_name) + .arg(json.data[0].remote_author_name), + qsTr("/contacts") ) } } diff --git a/retroshare-qml-app/src/android/src/org/retroshare/android/qml_app/RetroShareQmlActivity.java b/retroshare-qml-app/src/android/src/org/retroshare/android/qml_app/RetroShareQmlActivity.java index 365778142..168d9286c 100644 --- a/retroshare-qml-app/src/android/src/org/retroshare/android/qml_app/RetroShareQmlActivity.java +++ b/retroshare-qml-app/src/android/src/org/retroshare/android/qml_app/RetroShareQmlActivity.java @@ -65,12 +65,16 @@ public class RetroShareQmlActivity extends QtActivity @Override public void onNewIntent(Intent intent) { - Log.i("RetroShareQmlActivity", "onNewIntent(Intent intent)"); + Log.i("RetroShareQmlActivity", "on NewIntent(Intent intent)"); super.onNewIntent(intent); String uri = intent.getDataString(); - if (uri != null) NativeCalls.notifyIntentUri(uri); + if (uri != null) + { + NativeCalls.notifyIntentUri(uri); + Log.i("RetroShareQmlActivity", "onNewIntent(Intent intent) Uri: " + uri); + } } @UsedByNativeCode @SuppressWarnings("unused") diff --git a/retroshare-qml-app/src/main-app.qml b/retroshare-qml-app/src/main-app.qml index f98f66fa7..fe09290bd 100644 --- a/retroshare-qml-app/src/main-app.qml +++ b/retroshare-qml-app/src/main-app.qml @@ -41,6 +41,7 @@ ApplicationWindow { addUriHandler("/certificate", certificateLinkHandler) addUriHandler("/identity", contactLinkHandler) + addUriHandler("/contacts", openContactsViewLinkHandler) var argc = mainArgs.length for(var i=0; i Date: Mon, 31 Jul 2017 17:42:45 +0200 Subject: [PATCH 3/3] Open chat when click notification of one chat new message --- .../src/main.qml | 6 +++++- retroshare-qml-app/src/main-app.qml | 19 ++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/retroshare-android-notify-service/src/main.qml b/retroshare-android-notify-service/src/main.qml index dd25aa808..99ef28ac2 100644 --- a/retroshare-android-notify-service/src/main.qml +++ b/retroshare-android-notify-service/src/main.qml @@ -47,7 +47,11 @@ QtObject .arg(json.data[0].unread_count) .arg(json.data[0].unread_count > 1 ? "messages" : "message") .arg(json.data[0].remote_author_name), - qsTr("/contacts") + qsTr("/contacts%1").arg( + convCnt == 1? + "?gxsId="+json.data[0].remote_author_id + + "&name="+json.data[0].remote_author_name + : "") ) } } diff --git a/retroshare-qml-app/src/main-app.qml b/retroshare-qml-app/src/main-app.qml index fe09290bd..22c03bf94 100644 --- a/retroshare-qml-app/src/main-app.qml +++ b/retroshare-qml-app/src/main-app.qml @@ -481,9 +481,26 @@ ApplicationWindow function openContactsViewLinkHandler (uriStr) { + console.log("openContactsViewLinkHandler(uriStr)" , uriStr) if(coreReady) { - stackView.push("qrc:/Contacts.qml" ) + var uri = new UriJs.URI(uriStr) + var query = UriJs.URI.parseQuery(uri.search()); + if (query.gxsId && query.name) + { + + ChatCache.chatHelper.startDistantChat(ChatCache.contactsCache.own.gxs_id, + query.gxsId, + query.name, + function (chatId) + { + stackView.push("qrc:/ChatView.qml", {'chatId': chatId}) + }) + } + else + { + stackView.push("qrc:/Contacts.qml" ) + } } }