Dont push notification if chat is not in cofx

Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
Andrea Maria Piana 2021-03-05 10:46:19 +01:00 committed by andrey
parent aee782d468
commit 49b78c0cea
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272

View File

@ -42,6 +42,7 @@
[{:keys [title message icon user-info channel-id type] [{:keys [title message icon user-info channel-id type]
:as notification :as notification
:or {channel-id "status-im-notifications"}}] :or {channel-id "status-im-notifications"}}]
(when notification
(pn-android/present-local-notification (pn-android/present-local-notification
(merge {:channelId channel-id (merge {:channelId channel-id
:title title :title title
@ -52,7 +53,7 @@
(when icon (when icon
{:largeIconUrl (:uri (react/resolve-asset-source icon))}) {:largeIconUrl (:uri (react/resolve-asset-source icon))})
(when (= type "message") (when (= type "message")
notification)))) notification)))))
(defn handle-notification-press [{{deep-link :deepLink} :userInfo (defn handle-notification-press [{{deep-link :deepLink} :userInfo
interaction :userInteraction}] interaction :userInteraction}]
@ -136,6 +137,7 @@
{:keys [chat-type chat-id] :as chat} :chat {:keys [chat-type chat-id] :as chat} :chat
{:keys [identicon]} :contact {:keys [identicon]} :contact
contact-id :contact-id}] contact-id :contact-id}]
(when (and chat-type chat-id)
(let [contact-name @(re-frame/subscribe (let [contact-name @(re-frame/subscribe
[:contacts/contact-name-by-identity contact-id]) [:contacts/contact-name-by-identity contact-id])
group-chat? (not= chat-type constants/one-to-one-chat-type) group-chat? (not= chat-type constants/one-to-one-chat-type)
@ -161,7 +163,7 @@
:alias title :alias title
:identicon (or identicon (identicon/identicon contact-id)) :identicon (or identicon (identicon/identicon contact-id))
:whisperTimestamp (get message :whisperTimestamp) :whisperTimestamp (get message :whisperTimestamp)
:text (reply/get-quoted-text-with-mentions (:parsedText message))}))) :text (reply/get-quoted-text-with-mentions (:parsedText message))}))))
(defn create-notification (defn create-notification
([notification] ([notification]