Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 11 commits into from
Mar 26, 2024
18 changes: 0 additions & 18 deletions src/legacy/status_im/ui/screens/chat/message/legacy_view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
(:require
[legacy.status-im.react-native.resources :as resources]
[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]
[quo.core :as quo]
[quo.foundations.colors :as colors]
Expand Down Expand Up @@ -145,23 +144,6 @@
[rn/text {:style (style/status-text)}]
(-> 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
[]
[rn/view {:style {:flex-direction :row}}
Expand Down
Original file line number Diff line number Diff line change
@@ -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})
Original file line number Diff line number Diff line change
@@ -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)]]))
Original file line number Diff line number Diff line change
@@ -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")}}]])
71 changes: 38 additions & 33 deletions src/status_im/contexts/chat/messenger/messages/content/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
[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.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.pin.view :as pin]
[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.sticker-message.view :as sticker-message]
[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.text.view :as content.text]
Expand Down Expand Up @@ -150,38 +152,37 @@
(let [show-delivery-state? (reagent/atom false)]
(fn [{:keys [message-data context keyboard-shown? show-reactions? in-reaction-and-action-menu?
show-user-info? preview? theme]}]
(let [{:keys [content-type quoted-message content
outgoing outgoing-status pinned-by
message-id chat-id]} message-data
{:keys [disable-message-long-press?]} context
first-image (first (:album message-data))
outgoing-status (if (= content-type
constants/content-type-album)
(:outgoing-status first-image)
outgoing-status)
outgoing (if (= content-type
constants/content-type-album)
(:outgoing first-image)
outgoing)
context (assoc context
:on-long-press
#(on-long-press message-data
context
keyboard-shown?))
response-to (:response-to content)
height (rf/sub [:dimensions/window-height])
(let [{:keys [content-type quoted-message content outgoing outgoing-status pinned-by pinned
last-in-group? message-id chat-id]} message-data
{:keys [disable-message-long-press?]} context
first-image (first (:album message-data))
outgoing-status (if (= content-type
constants/content-type-album)
(:outgoing-status first-image)
outgoing-status)
outgoing (if (= content-type
constants/content-type-album)
(:outgoing first-image)
outgoing)
context (assoc context
:on-long-press
#(on-long-press message-data
context
keyboard-shown?))
response-to (:response-to content)
height (rf/sub [:dimensions/window-height])
{window-width :width
window-scale :scale} (rn/get-window)
message-container-data {:window-width window-width
:padding-right 20
:padding-left 20
:avatar-container-width 32
:message-margin-left 8}
reactions (rf/sub [:chats/message-reactions message-id
chat-id])
six-reactions? (-> reactions
count
(= 6))]
window-scale :scale} (rn/get-window)
message-container-data {:window-width window-width
:padding-right 20
:padding-left 20
:avatar-container-width 32
:message-margin-left 8}
reactions (rf/sub [:chats/message-reactions message-id
chat-id])
six-reactions? (-> reactions
count
(= 6))]
[rn/touchable-highlight
{:accessibility-label (if (and outgoing (= outgoing-status :sending))
:message-sending
Expand Down Expand Up @@ -231,10 +232,14 @@
[content.text/text-content message-data context]

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
[not-implemented/not-implemented [old-message/sticker message-data]]
[sticker-message/view {:url (-> message-data :content :sticker :url)}]

constants/content-type-audio
[audio/audio-message message-data context]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
(ns status-im.contexts.shell.activity-center.notification.reply.view
(:require
[clojure.string :as string]
[legacy.status-im.ui.screens.chat.message.legacy-view :as old-message]
[quo.core :as quo]
[react-native.gesture :as gesture]
[status-im.common.not-implemented :as not-implemented]
[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.reply.style :as style]
[utils.datetime :as datetime]
Expand Down Expand Up @@ -34,7 +34,7 @@
:message-text (get-in message [:content :text])}])

constants/content-type-sticker
[old-message/sticker message]
[sticker-message/view {:url (-> message :content :sticker :url)}]

constants/content-type-system-pinned-message
[not-implemented/not-implemented
Expand Down