Remove not-implemented box from sticker/emoji messages (#19255)

* feat: replaced old emoji component with new one

* feat: replaced old sticker component with the new one

* ref: pass only url to sticker

* fix: renamed ns and passing only needed props

* fix: destructuring instead of select-keys & assoc

* fix: formatting
This commit is contained in:
Lungu Cristian 2024-03-26 11:53:33 +02:00 committed by GitHub
parent 6a88a34d34
commit 17b64ab3ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 70 additions and 53 deletions

View File

@ -2,7 +2,6 @@
(:require (:require
[legacy.status-im.react-native.resources :as resources] [legacy.status-im.react-native.resources :as resources]
[legacy.status-im.ui.components.colors :as quo.colors] [legacy.status-im.ui.components.colors :as quo.colors]
[legacy.status-im.ui.components.fast-image :as fast-image]
[legacy.status-im.ui.screens.chat.message.legacy-style :as style] [legacy.status-im.ui.screens.chat.message.legacy-style :as style]
[quo.core :as quo] [quo.core :as quo]
[quo.foundations.colors :as colors] [quo.foundations.colors :as colors]
@ -145,23 +144,6 @@
[rn/text {:style (style/status-text)}] [rn/text {:style (style/status-text)}]
(-> content :parsed-text peek :children))]]) (-> content :parsed-text peek :children))]])
;; EMOJI
(defn emoji
[]
(fn [{:keys [content] :as message}]
[rn/view (style/message-view message)
[rn/view {:style (style/message-view-content)}
[rn/view {:style (style/style-message-text)}
[rn/text {:style (style/emoji-message message)}
(:text content)]]]]))
;; STICKER
(defn sticker
[{:keys [content]}]
[fast-image/fast-image
{:style {:margin 10 :width 140 :height 140}
:source {:uri (str (-> content :sticker :url) "&download=true")}}])
(defn contact-request-status-pending (defn contact-request-status-pending
[] []
[rn/view {:style {:flex-direction :row}} [rn/view {:style {:flex-direction :row}}

View File

@ -0,0 +1,10 @@
(ns status-im.contexts.chat.messenger.messages.content.emoji-message.style)
(defn emoji-container
[margin-top]
{:flex-direction :row
:margin-top margin-top})
(def emoji-text
{:font-size 36
:line-height 42})

View File

@ -0,0 +1,10 @@
(ns status-im.contexts.chat.messenger.messages.content.emoji-message.view
(:require [react-native.core :as rn]
[status-im.contexts.chat.messenger.messages.content.emoji-message.style :as style]))
(defn view
[{:keys [content last-in-group? pinned in-pinned-view?]}]
(let [margin-top (if (or last-in-group? in-pinned-view? pinned) 8 0)]
[rn/view {:style (style/emoji-container margin-top)}
[rn/text {:style style/emoji-text}
(:text content)]]))

View File

@ -0,0 +1,10 @@
(ns status-im.contexts.chat.messenger.messages.content.sticker-message.view
(:require [react-native.core :as rn]
[react-native.fast-image :as fast-image]))
(defn view
[{:keys [url]}]
[rn/view {:style {:margin-top 6 :margin-bottom 4}}
[fast-image/fast-image
{:style {:width 120 :height 120}
:source {:uri (str url "&download=true")}}]])

View File

@ -17,10 +17,12 @@
[status-im.contexts.chat.messenger.messages.content.album.view :as album] [status-im.contexts.chat.messenger.messages.content.album.view :as album]
[status-im.contexts.chat.messenger.messages.content.audio.view :as audio] [status-im.contexts.chat.messenger.messages.content.audio.view :as audio]
[status-im.contexts.chat.messenger.messages.content.deleted.view :as content.deleted] [status-im.contexts.chat.messenger.messages.content.deleted.view :as content.deleted]
[status-im.contexts.chat.messenger.messages.content.emoji-message.view :as emoji-message]
[status-im.contexts.chat.messenger.messages.content.image.view :as image] [status-im.contexts.chat.messenger.messages.content.image.view :as image]
[status-im.contexts.chat.messenger.messages.content.pin.view :as pin] [status-im.contexts.chat.messenger.messages.content.pin.view :as pin]
[status-im.contexts.chat.messenger.messages.content.reactions.view :as reactions] [status-im.contexts.chat.messenger.messages.content.reactions.view :as reactions]
[status-im.contexts.chat.messenger.messages.content.status.view :as status] [status-im.contexts.chat.messenger.messages.content.status.view :as status]
[status-im.contexts.chat.messenger.messages.content.sticker-message.view :as sticker-message]
[status-im.contexts.chat.messenger.messages.content.style :as style] [status-im.contexts.chat.messenger.messages.content.style :as style]
[status-im.contexts.chat.messenger.messages.content.system.text.view :as system.text] [status-im.contexts.chat.messenger.messages.content.system.text.view :as system.text]
[status-im.contexts.chat.messenger.messages.content.text.view :as content.text] [status-im.contexts.chat.messenger.messages.content.text.view :as content.text]
@ -150,38 +152,37 @@
(let [show-delivery-state? (reagent/atom false)] (let [show-delivery-state? (reagent/atom false)]
(fn [{:keys [message-data context keyboard-shown? show-reactions? in-reaction-and-action-menu? (fn [{:keys [message-data context keyboard-shown? show-reactions? in-reaction-and-action-menu?
show-user-info? preview? theme]}] show-user-info? preview? theme]}]
(let [{:keys [content-type quoted-message content (let [{:keys [content-type quoted-message content outgoing outgoing-status pinned-by pinned
outgoing outgoing-status pinned-by last-in-group? message-id chat-id]} message-data
message-id chat-id]} message-data {:keys [disable-message-long-press?]} context
{:keys [disable-message-long-press?]} context first-image (first (:album message-data))
first-image (first (:album message-data)) outgoing-status (if (= content-type
outgoing-status (if (= content-type constants/content-type-album)
constants/content-type-album) (:outgoing-status first-image)
(:outgoing-status first-image) outgoing-status)
outgoing-status) outgoing (if (= content-type
outgoing (if (= content-type constants/content-type-album)
constants/content-type-album) (:outgoing first-image)
(:outgoing first-image) outgoing)
outgoing) context (assoc context
context (assoc context :on-long-press
:on-long-press #(on-long-press message-data
#(on-long-press message-data context
context keyboard-shown?))
keyboard-shown?)) response-to (:response-to content)
response-to (:response-to content) height (rf/sub [:dimensions/window-height])
height (rf/sub [:dimensions/window-height])
{window-width :width {window-width :width
window-scale :scale} (rn/get-window) window-scale :scale} (rn/get-window)
message-container-data {:window-width window-width message-container-data {:window-width window-width
:padding-right 20 :padding-right 20
:padding-left 20 :padding-left 20
:avatar-container-width 32 :avatar-container-width 32
:message-margin-left 8} :message-margin-left 8}
reactions (rf/sub [:chats/message-reactions message-id reactions (rf/sub [:chats/message-reactions message-id
chat-id]) chat-id])
six-reactions? (-> reactions six-reactions? (-> reactions
count count
(= 6))] (= 6))]
[rn/touchable-highlight [rn/touchable-highlight
{:accessibility-label (if (and outgoing (= outgoing-status :sending)) {:accessibility-label (if (and outgoing (= outgoing-status :sending))
:message-sending :message-sending
@ -231,10 +232,14 @@
[content.text/text-content message-data context] [content.text/text-content message-data context]
constants/content-type-emoji constants/content-type-emoji
[not-implemented/not-implemented [old-message/emoji message-data]] [emoji-message/view
{:content content
:last-in-group? last-in-group?
:pinned pinned
:in-pinned-view? (:in-pinned-view? context)}]
constants/content-type-sticker constants/content-type-sticker
[not-implemented/not-implemented [old-message/sticker message-data]] [sticker-message/view {:url (-> message-data :content :sticker :url)}]
constants/content-type-audio constants/content-type-audio
[audio/audio-message message-data context] [audio/audio-message message-data context]

View File

@ -1,11 +1,11 @@
(ns status-im.contexts.shell.activity-center.notification.reply.view (ns status-im.contexts.shell.activity-center.notification.reply.view
(:require (:require
[clojure.string :as string] [clojure.string :as string]
[legacy.status-im.ui.screens.chat.message.legacy-view :as old-message]
[quo.core :as quo] [quo.core :as quo]
[react-native.gesture :as gesture] [react-native.gesture :as gesture]
[status-im.common.not-implemented :as not-implemented] [status-im.common.not-implemented :as not-implemented]
[status-im.constants :as constants] [status-im.constants :as constants]
[status-im.contexts.chat.messenger.messages.content.sticker-message.view :as sticker-message]
[status-im.contexts.shell.activity-center.notification.common.view :as common] [status-im.contexts.shell.activity-center.notification.common.view :as common]
[status-im.contexts.shell.activity-center.notification.reply.style :as style] [status-im.contexts.shell.activity-center.notification.reply.style :as style]
[utils.datetime :as datetime] [utils.datetime :as datetime]
@ -34,7 +34,7 @@
:message-text (get-in message [:content :text])}]) :message-text (get-in message [:content :text])}])
constants/content-type-sticker constants/content-type-sticker
[old-message/sticker message] [sticker-message/view {:url (-> message :content :sticker :url)}]
constants/content-type-system-pinned-message constants/content-type-system-pinned-message
[not-implemented/not-implemented [not-implemented/not-implemented