Display discord bridged posts #19233 (#19248)

This commit is contained in:
flexsurfer 2024-03-14 13:46:00 +01:00 committed by GitHub
parent 58606dc87c
commit 69294b196f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 44 additions and 1 deletions

View File

@ -44,6 +44,7 @@
:line-count nil :line-count nil
:links nil :links nil
:text nil} :text nil}
:bridge-message nil
:outgoing false} :outgoing false}
:message nil :message nil
:reply-message {:quoted-message nil :reply-message {:quoted-message nil
@ -61,6 +62,7 @@
:line-count nil :line-count nil
:links nil :links nil
:text nil} :text nil}
:bridge-message nil
:outgoing false}} :outgoing false}}
(-> raw-notification (-> raw-notification
store/<-rpc store/<-rpc

View File

@ -82,7 +82,13 @@
:albumImagesCount :album-images-count :albumImagesCount :album-images-count
:displayName :display-name :displayName :display-name
:linkPreviews :link-previews :linkPreviews :link-previews
:statusLinkPreviews :status-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 :link-previews #(map <-link-preview-rpc %))
(update :status-link-previews #(map <-status-link-previews-rpc %)) (update :status-link-previews #(map <-status-link-previews-rpc %))
(update :quoted-message (update :quoted-message

View File

@ -21,6 +21,7 @@
:image nil :image nil
:response-to "a" :response-to "a"
:links nil} :links nil}
:bridge-message nil
:whisper-timestamp 1 :whisper-timestamp 1
:contact-verification-state 1 :contact-verification-state 1
:contact-request-state 2 :contact-request-state 2

View File

@ -19,6 +19,7 @@
(def ^:const content-type-system-message-mutual-event-sent 15) (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-accepted 16)
(def ^:const content-type-system-message-mutual-event-removed 17) (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 ;; Not implemented in status-go, only used for testing/ui work
(def ^:const content-type-gif 100) (def ^:const content-type-gif 100)

View File

@ -1,10 +1,12 @@
(ns status-im.contexts.chat.messenger.messages.content.view (ns status-im.contexts.chat.messenger.messages.content.view
(:require (:require
[clojure.string :as string]
[legacy.status-im.ui.screens.chat.message.legacy-view :as old-message] [legacy.status-im.ui.screens.chat.message.legacy-view :as old-message]
[quo.core :as quo] [quo.core :as quo]
[quo.foundations.colors :as colors] [quo.foundations.colors :as colors]
[quo.theme :as quo.theme] [quo.theme :as quo.theme]
[react-native.core :as rn] [react-native.core :as rn]
[react-native.fast-image :as fast-image]
[react-native.gesture :as gesture] [react-native.gesture :as gesture]
[react-native.platform :as platform] [react-native.platform :as platform]
[reagent.core :as reagent] [reagent.core :as reagent]
@ -113,6 +115,34 @@
constants/content-type-system-message-mutual-event-sent constants/content-type-system-message-mutual-event-sent
[system-message-contact-request message-data :contact-request]))) [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) (declare on-long-press)
(defn- user-message-content-internal (defn- user-message-content-internal
@ -284,6 +314,9 @@
keyboard-shown?)) keyboard-shown?))
context] context]
(= content-type constants/content-type-bridge-message)
[bridge-message-content message-data]
:else :else
[user-message-content [user-message-content
{:message-data message-data {:message-data message-data