Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
472f1a949c |
@@ -1,6 +1,6 @@
|
||||
(ns legacy.status-im.data-store.activities-test
|
||||
(:require
|
||||
[cljs.test :refer [deftest is testing]]
|
||||
[cljs.test :refer [deftest is]]
|
||||
[legacy.status-im.data-store.activities :as store]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.shell.activity-center.notification-types :as notification-types]))
|
||||
@@ -18,89 +18,6 @@
|
||||
:name chat-name
|
||||
:replyMessage {}})
|
||||
|
||||
(deftest <-rpc-test
|
||||
(testing "renames keys"
|
||||
(is (= {:name chat-name
|
||||
:chat-id chat-id
|
||||
:contact-verification-status constants/contact-verification-status-pending}
|
||||
(-> raw-notification
|
||||
store/<-rpc
|
||||
(dissoc :last-message :message :reply-message)))))
|
||||
|
||||
(testing "transforms messages from RPC response"
|
||||
(is
|
||||
(= {:last-message {:quoted-message nil
|
||||
:outgoing-status nil
|
||||
:command-parameters nil
|
||||
:link-previews []
|
||||
:content {:sticker nil
|
||||
:rtl? nil
|
||||
:ens-name nil
|
||||
:parsed-text nil
|
||||
:response-to nil
|
||||
:chat-id nil
|
||||
:image nil
|
||||
:line-count nil
|
||||
:links nil
|
||||
:text nil}
|
||||
:outgoing false}
|
||||
:message nil
|
||||
:reply-message {:quoted-message nil
|
||||
:outgoing-status nil
|
||||
:command-parameters nil
|
||||
:link-previews []
|
||||
:content {:sticker nil
|
||||
:rtl? nil
|
||||
:ens-name nil
|
||||
:parsed-text nil
|
||||
:response-to nil
|
||||
:chat-id nil
|
||||
:image nil
|
||||
:line-count nil
|
||||
:links nil
|
||||
:text nil}
|
||||
:outgoing false}}
|
||||
(-> raw-notification
|
||||
store/<-rpc
|
||||
(select-keys [:last-message :message :reply-message])))))
|
||||
|
||||
(testing "augments notification based on its type"
|
||||
(is (= {:chat-name chat-name
|
||||
:chat-type constants/private-group-chat-type
|
||||
:name chat-name}
|
||||
(-> raw-notification
|
||||
(assoc :type notification-types/reply)
|
||||
store/<-rpc
|
||||
(select-keys [:name :chat-type :chat-name :public? :group-chat]))))
|
||||
|
||||
(is (= {:chat-name chat-name
|
||||
:chat-type constants/private-group-chat-type
|
||||
:name chat-name}
|
||||
(-> raw-notification
|
||||
(assoc :type notification-types/mention)
|
||||
store/<-rpc
|
||||
(select-keys [:name :chat-type :chat-name :public? :group-chat]))))
|
||||
|
||||
(is (= {:chat-name chat-name
|
||||
:chat-type constants/private-group-chat-type
|
||||
:group-chat true
|
||||
:name chat-name
|
||||
:public? false}
|
||||
(-> raw-notification
|
||||
(assoc :type notification-types/private-group-chat)
|
||||
store/<-rpc
|
||||
(select-keys [:name :chat-type :chat-name :public? :group-chat]))))
|
||||
|
||||
(is (= {:chat-name chat-name
|
||||
:chat-type constants/one-to-one-chat-type
|
||||
:group-chat false
|
||||
:name chat-name
|
||||
:public? false}
|
||||
(-> raw-notification
|
||||
(assoc :type notification-types/one-to-one-chat)
|
||||
store/<-rpc
|
||||
(select-keys [:name :chat-type :chat-name :public? :group-chat]))))))
|
||||
|
||||
(deftest remove-pending-contact-request-test
|
||||
(is (true? (store/pending-contact-request?
|
||||
"contact-id"
|
||||
|
||||
@@ -53,7 +53,14 @@
|
||||
:new :new?
|
||||
:albumImagesCount :album-images-count
|
||||
:displayName :display-name
|
||||
:linkPreviews :link-previews})
|
||||
:linkPreviews :link-previews
|
||||
:statusLinkPreviews :status-link-previews
|
||||
:bridgeMessage :bridge-message})
|
||||
(update :bridge-message
|
||||
set/rename-keys
|
||||
{:bridgeName :bridge-name
|
||||
:userName :user-name
|
||||
:userAvatar :user-avatar})
|
||||
(update :link-previews #(map <-link-preview-rpc %))
|
||||
(update :quoted-message
|
||||
set/rename-keys
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
:image nil
|
||||
:response-to "a"
|
||||
:links nil}
|
||||
:bridge-message nil
|
||||
:whisper-timestamp 1
|
||||
:contact-verification-state 1
|
||||
:contact-request-state 2
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
(def ^:const content-type-system-message-mutual-event-sent 15)
|
||||
(def ^:const content-type-system-message-mutual-event-accepted 16)
|
||||
(def ^:const content-type-system-message-mutual-event-removed 17)
|
||||
(def ^:const content-type-bridge-message 18)
|
||||
|
||||
;; Not implemented in status-go, only used for testing/ui work
|
||||
(def ^:const content-type-gif 100)
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
(ns status-im.contexts.chat.messenger.messages.content.view
|
||||
(:require
|
||||
[clojure.string :as string]
|
||||
[legacy.status-im.ui.screens.chat.message.legacy-view :as old-message]
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme :as quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[react-native.fast-image :as fast-image]
|
||||
[react-native.gesture :as gesture]
|
||||
[react-native.platform :as platform]
|
||||
[reagent.core :as reagent]
|
||||
@@ -113,6 +115,34 @@
|
||||
constants/content-type-system-message-mutual-event-sent
|
||||
[system-message-contact-request message-data :contact-request])))
|
||||
|
||||
(defn bridge-message-content
|
||||
[{:keys [bridge-message timestamp]}]
|
||||
(let [{:keys [user-avatar user-name
|
||||
bridge-name content]} bridge-message
|
||||
user-name (when (string? user-name)
|
||||
(-> user-name
|
||||
(string/replace "<b>" "")
|
||||
(string/replace "</b>" "")))]
|
||||
[rn/view
|
||||
{:style {:flex-direction :row
|
||||
:padding-horizontal 12
|
||||
:padding-top 4}}
|
||||
[fast-image/fast-image
|
||||
{:source {:uri user-avatar}
|
||||
:style {:width 32
|
||||
:margin-top 4
|
||||
:border-radius 16
|
||||
:height 32}}]
|
||||
[rn/view {:margin-left 8 :flex 1}
|
||||
[quo/author
|
||||
{:primary-name (str user-name)
|
||||
:short-chat-key (str "Bridged from " bridge-name)
|
||||
:time-str (datetime/timestamp->time timestamp)}]
|
||||
[quo/text
|
||||
{:size :paragraph-1
|
||||
:style {:line-height 22.75}}
|
||||
content]]]))
|
||||
|
||||
(declare on-long-press)
|
||||
|
||||
(defn- user-message-content-internal
|
||||
@@ -284,6 +314,9 @@
|
||||
keyboard-shown?))
|
||||
context]
|
||||
|
||||
(= content-type constants/content-type-bridge-message)
|
||||
[bridge-message-content message-data]
|
||||
|
||||
:else
|
||||
[user-message-content
|
||||
{:message-data message-data
|
||||
|
||||
Reference in New Issue
Block a user