Skip to content

Commit 17b64ab

Browse files
authored
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
1 parent 6a88a34 commit 17b64ab

File tree

6 files changed

+70
-53
lines changed

6 files changed

+70
-53
lines changed

src/legacy/status_im/ui/screens/chat/message/legacy_view.cljs

-18
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
(:require
33
[legacy.status-im.react-native.resources :as resources]
44
[legacy.status-im.ui.components.colors :as quo.colors]
5-
[legacy.status-im.ui.components.fast-image :as fast-image]
65
[legacy.status-im.ui.screens.chat.message.legacy-style :as style]
76
[quo.core :as quo]
87
[quo.foundations.colors :as colors]
@@ -145,23 +144,6 @@
145144
[rn/text {:style (style/status-text)}]
146145
(-> content :parsed-text peek :children))]])
147146

148-
;; EMOJI
149-
(defn emoji
150-
[]
151-
(fn [{:keys [content] :as message}]
152-
[rn/view (style/message-view message)
153-
[rn/view {:style (style/message-view-content)}
154-
[rn/view {:style (style/style-message-text)}
155-
[rn/text {:style (style/emoji-message message)}
156-
(:text content)]]]]))
157-
158-
;; STICKER
159-
(defn sticker
160-
[{:keys [content]}]
161-
[fast-image/fast-image
162-
{:style {:margin 10 :width 140 :height 140}
163-
:source {:uri (str (-> content :sticker :url) "&download=true")}}])
164-
165147
(defn contact-request-status-pending
166148
[]
167149
[rn/view {:style {:flex-direction :row}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(ns status-im.contexts.chat.messenger.messages.content.emoji-message.style)
2+
3+
(defn emoji-container
4+
[margin-top]
5+
{:flex-direction :row
6+
:margin-top margin-top})
7+
8+
(def emoji-text
9+
{:font-size 36
10+
:line-height 42})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(ns status-im.contexts.chat.messenger.messages.content.emoji-message.view
2+
(:require [react-native.core :as rn]
3+
[status-im.contexts.chat.messenger.messages.content.emoji-message.style :as style]))
4+
5+
(defn view
6+
[{:keys [content last-in-group? pinned in-pinned-view?]}]
7+
(let [margin-top (if (or last-in-group? in-pinned-view? pinned) 8 0)]
8+
[rn/view {:style (style/emoji-container margin-top)}
9+
[rn/text {:style style/emoji-text}
10+
(:text content)]]))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
(ns status-im.contexts.chat.messenger.messages.content.sticker-message.view
2+
(:require [react-native.core :as rn]
3+
[react-native.fast-image :as fast-image]))
4+
5+
(defn view
6+
[{:keys [url]}]
7+
[rn/view {:style {:margin-top 6 :margin-bottom 4}}
8+
[fast-image/fast-image
9+
{:style {:width 120 :height 120}
10+
:source {:uri (str url "&download=true")}}]])

src/status_im/contexts/chat/messenger/messages/content/view.cljs

+38-33
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@
1717
[status-im.contexts.chat.messenger.messages.content.album.view :as album]
1818
[status-im.contexts.chat.messenger.messages.content.audio.view :as audio]
1919
[status-im.contexts.chat.messenger.messages.content.deleted.view :as content.deleted]
20+
[status-im.contexts.chat.messenger.messages.content.emoji-message.view :as emoji-message]
2021
[status-im.contexts.chat.messenger.messages.content.image.view :as image]
2122
[status-im.contexts.chat.messenger.messages.content.pin.view :as pin]
2223
[status-im.contexts.chat.messenger.messages.content.reactions.view :as reactions]
2324
[status-im.contexts.chat.messenger.messages.content.status.view :as status]
25+
[status-im.contexts.chat.messenger.messages.content.sticker-message.view :as sticker-message]
2426
[status-im.contexts.chat.messenger.messages.content.style :as style]
2527
[status-im.contexts.chat.messenger.messages.content.system.text.view :as system.text]
2628
[status-im.contexts.chat.messenger.messages.content.text.view :as content.text]
@@ -150,38 +152,37 @@
150152
(let [show-delivery-state? (reagent/atom false)]
151153
(fn [{:keys [message-data context keyboard-shown? show-reactions? in-reaction-and-action-menu?
152154
show-user-info? preview? theme]}]
153-
(let [{:keys [content-type quoted-message content
154-
outgoing outgoing-status pinned-by
155-
message-id chat-id]} message-data
156-
{:keys [disable-message-long-press?]} context
157-
first-image (first (:album message-data))
158-
outgoing-status (if (= content-type
159-
constants/content-type-album)
160-
(:outgoing-status first-image)
161-
outgoing-status)
162-
outgoing (if (= content-type
163-
constants/content-type-album)
164-
(:outgoing first-image)
165-
outgoing)
166-
context (assoc context
167-
:on-long-press
168-
#(on-long-press message-data
169-
context
170-
keyboard-shown?))
171-
response-to (:response-to content)
172-
height (rf/sub [:dimensions/window-height])
155+
(let [{:keys [content-type quoted-message content outgoing outgoing-status pinned-by pinned
156+
last-in-group? message-id chat-id]} message-data
157+
{:keys [disable-message-long-press?]} context
158+
first-image (first (:album message-data))
159+
outgoing-status (if (= content-type
160+
constants/content-type-album)
161+
(:outgoing-status first-image)
162+
outgoing-status)
163+
outgoing (if (= content-type
164+
constants/content-type-album)
165+
(:outgoing first-image)
166+
outgoing)
167+
context (assoc context
168+
:on-long-press
169+
#(on-long-press message-data
170+
context
171+
keyboard-shown?))
172+
response-to (:response-to content)
173+
height (rf/sub [:dimensions/window-height])
173174
{window-width :width
174-
window-scale :scale} (rn/get-window)
175-
message-container-data {:window-width window-width
176-
:padding-right 20
177-
:padding-left 20
178-
:avatar-container-width 32
179-
:message-margin-left 8}
180-
reactions (rf/sub [:chats/message-reactions message-id
181-
chat-id])
182-
six-reactions? (-> reactions
183-
count
184-
(= 6))]
175+
window-scale :scale} (rn/get-window)
176+
message-container-data {:window-width window-width
177+
:padding-right 20
178+
:padding-left 20
179+
:avatar-container-width 32
180+
:message-margin-left 8}
181+
reactions (rf/sub [:chats/message-reactions message-id
182+
chat-id])
183+
six-reactions? (-> reactions
184+
count
185+
(= 6))]
185186
[rn/touchable-highlight
186187
{:accessibility-label (if (and outgoing (= outgoing-status :sending))
187188
:message-sending
@@ -231,10 +232,14 @@
231232
[content.text/text-content message-data context]
232233

233234
constants/content-type-emoji
234-
[not-implemented/not-implemented [old-message/emoji message-data]]
235+
[emoji-message/view
236+
{:content content
237+
:last-in-group? last-in-group?
238+
:pinned pinned
239+
:in-pinned-view? (:in-pinned-view? context)}]
235240

236241
constants/content-type-sticker
237-
[not-implemented/not-implemented [old-message/sticker message-data]]
242+
[sticker-message/view {:url (-> message-data :content :sticker :url)}]
238243

239244
constants/content-type-audio
240245
[audio/audio-message message-data context]

src/status_im/contexts/shell/activity_center/notification/reply/view.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
(ns status-im.contexts.shell.activity-center.notification.reply.view
22
(:require
33
[clojure.string :as string]
4-
[legacy.status-im.ui.screens.chat.message.legacy-view :as old-message]
54
[quo.core :as quo]
65
[react-native.gesture :as gesture]
76
[status-im.common.not-implemented :as not-implemented]
87
[status-im.constants :as constants]
8+
[status-im.contexts.chat.messenger.messages.content.sticker-message.view :as sticker-message]
99
[status-im.contexts.shell.activity-center.notification.common.view :as common]
1010
[status-im.contexts.shell.activity-center.notification.reply.style :as style]
1111
[utils.datetime :as datetime]
@@ -34,7 +34,7 @@
3434
:message-text (get-in message [:content :text])}])
3535

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

3939
constants/content-type-system-pinned-message
4040
[not-implemented/not-implemented

0 commit comments

Comments
 (0)