Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b4818db6d | ||
|
|
2dc0925a3b | ||
|
|
cf643e028f | ||
|
|
003afc99b6 | ||
|
|
981079e249 | ||
|
|
2d3427718a | ||
|
|
4e7dc60f6c | ||
|
|
5869ebc884 |
@@ -74,15 +74,15 @@
|
||||
:photo-container (:default-chat-icon styles)}])])
|
||||
|
||||
(defn chat-icon-view-toolbar
|
||||
[chat-id group-chat name color emoji]
|
||||
[chat-id group-chat name color emoji size]
|
||||
[emoji-chat-icon-view chat-id group-chat name emoji
|
||||
{:container styles/container-chat-toolbar
|
||||
:size 36
|
||||
:chat-icon styles/chat-icon-chat-toolbar
|
||||
:default-chat-icon (styles/default-chat-icon-chat-toolbar color)
|
||||
{:container (styles/container-chat-toolbar size)
|
||||
:size size
|
||||
:chat-icon (styles/chat-icon-chat-toolbar size)
|
||||
:default-chat-icon (styles/default-chat-icon-chat-toolbar color size)
|
||||
:default-chat-icon-text (if (string/blank? emoji)
|
||||
(styles/default-chat-icon-text 36)
|
||||
(styles/emoji-chat-icon-text 36))}])
|
||||
(styles/default-chat-icon-text size)
|
||||
(styles/emoji-chat-icon-text size))}])
|
||||
|
||||
(defn chat-icon-view-chat-list
|
||||
[chat-id group-chat name color]
|
||||
|
||||
@@ -44,11 +44,11 @@
|
||||
:height 20
|
||||
:border-radius 20}))
|
||||
|
||||
(defn default-chat-icon-chat-toolbar [color]
|
||||
(defn default-chat-icon-chat-toolbar [color size]
|
||||
(merge (default-chat-icon color)
|
||||
{:width 36
|
||||
:height 36
|
||||
:border-radius 18}))
|
||||
{:width size
|
||||
:height size
|
||||
:border-radius size}))
|
||||
|
||||
(defn default-chat-icon-profile [color size]
|
||||
(merge (default-chat-icon color)
|
||||
@@ -115,10 +115,10 @@
|
||||
:height 20
|
||||
:margin 0}))
|
||||
|
||||
(def chat-icon-chat-toolbar
|
||||
(defn chat-icon-chat-toolbar [size]
|
||||
(merge chat-icon
|
||||
{:width 36
|
||||
:height 36
|
||||
{:width size
|
||||
:height size
|
||||
:margin 0}))
|
||||
|
||||
(defn custom-size-icon [size]
|
||||
@@ -149,9 +149,9 @@
|
||||
{:width size
|
||||
:height size})
|
||||
|
||||
(def container-chat-toolbar
|
||||
{:width 36
|
||||
:height 36})
|
||||
(defn container-chat-toolbar [size]
|
||||
{:width size
|
||||
:height size})
|
||||
|
||||
(defn chat-icon-profile-edit []
|
||||
{:width 24
|
||||
|
||||
@@ -29,12 +29,13 @@
|
||||
[status-im.ui.screens.chat.utils :as chat.utils]
|
||||
[status-im.ui.screens.chat.styles.photos :as photos.style]
|
||||
[status-im.ui.screens.communities.icon :as communities.icon]
|
||||
[status-im.utils.handlers :refer [>evt]]
|
||||
[status-im.utils.handlers :refer [<sub >evt]]
|
||||
[status-im.utils.config :as config]
|
||||
[status-im.utils.security :as security]
|
||||
[quo2.foundations.typography :as typography]
|
||||
[quo2.foundations.colors :as quo2.colors])
|
||||
|
||||
[quo2.foundations.colors :as quo2.colors]
|
||||
[status-im.ui.components.list.views :as list]
|
||||
[status-im.ui.components.chat-icon.screen :as chat-icon.screen])
|
||||
(:require-macros [status-im.utils.views :refer [defview letsubs]]))
|
||||
|
||||
(defn message-timestamp-anim
|
||||
@@ -231,19 +232,15 @@
|
||||
;; We append empty spaces to the name as a workaround to make one-line and multi-line label components show correctly
|
||||
(str " " (if (= pinned-by (user-contact :public-key)) (i18n/label :t/You) (first contact-names)))))
|
||||
|
||||
(def pin-icon-width 10)
|
||||
|
||||
(def pin-icon-height 15)
|
||||
|
||||
(defn pin-icon []
|
||||
[icons/icon :main-icons/pin16 {:color (:text-04 @colors/theme)
|
||||
:height pin-icon-height
|
||||
:width pin-icon-width}])
|
||||
(defn pin-icon [color size]
|
||||
[icons/icon :main-icons/pin16 {:color color
|
||||
:height size
|
||||
:width size}])
|
||||
|
||||
(defn pinned-by-indicator [pinned-by]
|
||||
[react/view {:style (style/pin-indicator)
|
||||
:accessibility-label :pinned-by}
|
||||
[pin-icon]
|
||||
[pin-icon quo2.colors/primary-50 16]
|
||||
[quo/text {:size :small
|
||||
:color :main
|
||||
:style (style/pin-author-text)}
|
||||
@@ -418,7 +415,7 @@
|
||||
:prevent-closing? true}]))
|
||||
(re-frame/dispatch [::models.pin-message/send-pin-message (assoc message :pinned (not pinned))]))))
|
||||
|
||||
(defn on-long-press-fn [on-long-press {:keys [pinned message-pin-enabled outgoing edit-enabled show-input?] :as message} content]
|
||||
(defn on-long-press-fn [on-long-press {:keys [pinned message-pin-enabled outgoing edit-enabled show-input? community?] :as message} content]
|
||||
(on-long-press
|
||||
(concat
|
||||
(when (and outgoing edit-enabled)
|
||||
@@ -443,7 +440,7 @@
|
||||
(when message-pin-enabled
|
||||
[{:type :main
|
||||
:on-press #(pin-message message)
|
||||
:label (i18n/label (if pinned :t/unpin-from-chat :t/pin-to-chat))
|
||||
:label (i18n/label (if pinned (if community? :t/unpin-from-channel :t/unpin-from-chat) (if community? :t/pin-to-channel :t/pin-to-chat)))
|
||||
:icon :main-icons/pin-context20
|
||||
:id (if pinned :unpin :pin)}])
|
||||
[{:type :danger
|
||||
@@ -472,10 +469,7 @@
|
||||
(reset! ref on-long-press)
|
||||
[react/touchable-highlight
|
||||
(when-not modal
|
||||
{:on-press (fn [_]
|
||||
(react/dismiss-keyboard!)
|
||||
(reset! show-timestamp? true))
|
||||
:delay-long-press 100
|
||||
{:delay-long-press 100
|
||||
:on-long-press on-long-press
|
||||
:disabled in-popover?})
|
||||
[react/view style/message-view-wrapper
|
||||
@@ -497,11 +491,11 @@
|
||||
[react/view {:style {:width photos.style/default-size
|
||||
:height photos.style/default-size
|
||||
:margin-horizontal 8
|
||||
:border-radius photos.style/default-size
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:background-color quo2.colors/primary-50-opa-10}}
|
||||
[pin-icon]]
|
||||
:border-radius photos.style/default-size
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:background-color quo2.colors/primary-50-opa-10}}
|
||||
[pin-icon quo2.colors/primary-50 16]]
|
||||
[react/view
|
||||
[react/view {:style {:flex-direction :row :align-items :center}}
|
||||
[react/touchable-opacity {:style style/message-author-touchable
|
||||
@@ -737,7 +731,7 @@
|
||||
[message-content-wrapper message
|
||||
[unknown-content-type message]])
|
||||
|
||||
(defn chat-message [{:keys [pinned pinned-by mentioned] :as message}]
|
||||
(defn chat-message [{:keys [pinned pinned-by mentioned in-pinned-view? last-in-group?] :as message}]
|
||||
(let [reactions @(re-frame/subscribe [:chats/message-reactions (:message-id message) (:chat-id message)])
|
||||
own-reactions (reduce (fn [acc {:keys [emoji-id own]}]
|
||||
(if own (conj acc emoji-id) acc))
|
||||
@@ -764,7 +758,8 @@
|
||||
(into #{} (js->clj own-reactions))
|
||||
#(on-emoji-press %))}]))
|
||||
on-long-press (atom nil)]
|
||||
[react/view {:style (merge (when (or mentioned pinned) {:background-color quo2.colors/primary-50-opa-5 :border-radius 16 :margin-bottom 4}) {:margin-horizontal 8})}
|
||||
[react/view
|
||||
{:style (merge (when (and (not in-pinned-view?) (or mentioned pinned)) {:background-color quo2.colors/primary-50-opa-5 :border-radius 16 :margin-bottom 4}) (when (or mentioned pinned last-in-group?) {:margin-top 8}) {:margin-horizontal 8})}
|
||||
(when pinned
|
||||
[react/view {:style (style/pin-indicator-container)}
|
||||
[pinned-by-indicator pinned-by]])
|
||||
@@ -773,3 +768,111 @@
|
||||
:on-long-press on-open-drawer}]
|
||||
[reaction-row/message-reactions message reactions nil on-emoji-press on-long-press] ;; TODO: pass on-open-drawer function
|
||||
]))
|
||||
|
||||
(defn message-render-fn
|
||||
[{:keys [outgoing] :as message}
|
||||
_
|
||||
{:keys [group-chat public? community? current-public-key show-input? message-pin-enabled edit-enabled]}]
|
||||
[chat-message
|
||||
(assoc message
|
||||
:incoming-group (and group-chat (not outgoing))
|
||||
:group-chat group-chat
|
||||
:public? public?
|
||||
:community? community?
|
||||
:current-public-key current-public-key
|
||||
:show-input? show-input?
|
||||
:message-pin-enabled message-pin-enabled
|
||||
:in-pinned-view? true
|
||||
:edit-enabled edit-enabled)])
|
||||
|
||||
(def list-key-fn #(or (:message-id %) (:value %)))
|
||||
|
||||
(defn pinned-messages-list [chat-id]
|
||||
(let [pinned-messages (vec (vals (<sub [:chats/pinned chat-id])))
|
||||
current-chat (<sub [:chats/current-chat])
|
||||
community (<sub [:communities/community (:community-id current-chat)])]
|
||||
[react/view
|
||||
[react/text-class {:style (merge typography/heading-1 typography/font-semi-bold {:margin-horizontal 20 :color (quo2.colors/theme-colors quo2.colors/neutral-100 quo2.colors/white)})} (i18n/label :t/pinned-messages)]
|
||||
(when community
|
||||
[react/view {:style {:flex-direction :row
|
||||
:background-color (quo2.colors/theme-colors quo2.colors/neutral-10 quo2.colors/neutral-80)
|
||||
:border-radius 20
|
||||
:align-items :center
|
||||
:align-self :flex-start
|
||||
:margin-horizontal 20
|
||||
:padding 4
|
||||
:margin-top 8}}
|
||||
[chat-icon.screen/chat-icon-view-toolbar chat-id (:group-chat current-chat) (:chat-name current-chat) (:color current-chat) (:emoji current-chat) 22]
|
||||
[react/text-class {:style {:margin-left 6 :margin-right 4 :color (quo2.colors/theme-colors quo2.colors/neutral-100 quo2.colors/white)}} (:name community)]
|
||||
[icons/icon
|
||||
:main-icons/chevron-right
|
||||
{:color (quo2.colors/theme-colors quo2.colors/neutral-50 quo2.colors/neutral-40)
|
||||
:width 12
|
||||
:height 12}]
|
||||
[react/text-class {:style {:margin-left 4 :margin-right 8 :color (quo2.colors/theme-colors quo2.colors/neutral-100 quo2.colors/white)}} (str "# " (:chat-name current-chat))]])
|
||||
[list/flat-list
|
||||
{:data pinned-messages
|
||||
:render-fn message-render-fn
|
||||
:key-fn list-key-fn
|
||||
:separator [react/view {:background-color (quo2.colors/theme-colors quo2.colors/neutral-10 quo2.colors/neutral-80) :height 1 :margin-top 8}]}]]))
|
||||
|
||||
(defmethod ->message constants/content-type-pin [{:keys [from in-popover? timestamp-str chat-id] :as message} {:keys [modal close-modal]}]
|
||||
(let [response-to (:response-to (:content message))]
|
||||
[react/touchable-opacity-class {:on-press (fn []
|
||||
(re-frame/dispatch [:bottom-sheet/show-sheet
|
||||
{:content #(pinned-messages-list chat-id)}]))
|
||||
:active-opacity 1
|
||||
:style (merge {:flex-direction :row :margin-vertical 8} (style/message-wrapper message))}
|
||||
[react/view {:style {:width photos.style/default-size
|
||||
:height photos.style/default-size
|
||||
:margin-horizontal 8
|
||||
:border-radius photos.style/default-size
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:background-color quo2.colors/primary-50-opa-10}}
|
||||
[pin-icon quo2.colors/primary-50 16]]
|
||||
[react/view
|
||||
[react/view {:style {:flex-direction :row :align-items :center}}
|
||||
[react/touchable-opacity {:style style/message-author-touchable
|
||||
:disabled in-popover?
|
||||
:on-press #(do (when modal (close-modal))
|
||||
(re-frame/dispatch [:chat.ui/show-profile from]))}
|
||||
[message-author-name from {:modal modal}]]
|
||||
[react/text {:style {:font-size 13}} (str " " (i18n/label :pinned-a-message))]
|
||||
[react/text
|
||||
{:style (merge
|
||||
{:padding-left 5
|
||||
:margin-top 2}
|
||||
(style/message-timestamp-text))
|
||||
:accessibility-label :message-timestamp}
|
||||
timestamp-str]]
|
||||
[quoted-message response-to (:quoted-message message) true]]]))
|
||||
|
||||
(defn pinned-banner [chat-id]
|
||||
(let [pinned-messages (<sub [:chats/pinned chat-id])
|
||||
latest-pin-text (get-in (last (vals pinned-messages)) [:content :text])
|
||||
pins-count (count (seq pinned-messages))]
|
||||
(when (> pins-count 0)
|
||||
[react/touchable-opacity-class
|
||||
{:style {:height 50
|
||||
:background-color quo2.colors/primary-50-opa-20
|
||||
:flex-direction :row
|
||||
:align-items :center
|
||||
:padding-horizontal 20
|
||||
:padding-vertical 10}
|
||||
:active-opacity 1
|
||||
:on-press (fn []
|
||||
(re-frame/dispatch [:bottom-sheet/show-sheet
|
||||
{:content #(pinned-messages-list chat-id)}]))}
|
||||
[pin-icon (quo2.colors/theme-colors quo2.colors/neutral-100 quo2.colors/white) 20]
|
||||
[react/text-class {:number-of-lines 1
|
||||
:style (merge typography/paragraph-2 {:margin-left 10 :margin-right 50 :color (quo2.colors/theme-colors quo2.colors/neutral-100 quo2.colors/white)})} latest-pin-text]
|
||||
[react/view {:style {:position :absolute
|
||||
:right 22
|
||||
:height 20
|
||||
:width 20
|
||||
:border-radius 8
|
||||
:justify-content :center
|
||||
:align-items :center
|
||||
:background-color quo2.colors/neutral-80-opa-5}}
|
||||
[react/text-class {:style (merge typography/label typography/font-medium {:color (quo2.colors/theme-colors quo2.colors/neutral-100 quo2.colors/white)})} pins-count]]])))
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
[status-im.chat.models.pin-message :as models.pin-message]
|
||||
[status-im.ui.components.list.views :as list]
|
||||
[status-im.utils.handlers :refer [<sub]]
|
||||
[status-im.ui.screens.chat.message.message-old :as message]))
|
||||
[status-im.ui.screens.chat.message.message-old :as message-old]))
|
||||
|
||||
(def selected-unpin (reagent/atom nil))
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
:justify-content :space-between
|
||||
:flex 1
|
||||
:padding-right 20}}
|
||||
[message/chat-message
|
||||
[message-old/chat-message
|
||||
(assoc message
|
||||
:group-chat group-chat
|
||||
:public? public?
|
||||
|
||||
@@ -76,8 +76,9 @@
|
||||
(merge {:flex-direction :row}))
|
||||
|
||||
(defn pin-indicator-container []
|
||||
{:margin-top 8
|
||||
{:margin-top 4
|
||||
:margin-left 68
|
||||
:top 4
|
||||
:justify-content :center
|
||||
:align-self :flex-start
|
||||
:align-items :flex-start})
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
chat-info]
|
||||
[react/view {:style st/toolbar-container}
|
||||
[react/view {:margin-right 10}
|
||||
[chat-icon.screen/chat-icon-view-toolbar chat-id group-chat chat-name color emoji]]
|
||||
[chat-icon.screen/chat-icon-view-toolbar chat-id group-chat chat-name color emoji 36]]
|
||||
[react/view {:style st/chat-name-view}
|
||||
(if group-chat
|
||||
[react/text {:style st/chat-name-text
|
||||
|
||||
@@ -317,11 +317,11 @@
|
||||
:edit-enabled edit-enabled)
|
||||
space-keeper]))])
|
||||
|
||||
(defn render-fn [{:keys [outgoing type] :as message}
|
||||
idx
|
||||
_
|
||||
{:keys [group-chat public? community? current-public-key
|
||||
chat-id show-input? message-pin-enabled edit-enabled in-pinned-view?]}]
|
||||
(defn message-render-fn [{:keys [outgoing type] :as message}
|
||||
idx
|
||||
_
|
||||
{:keys [group-chat public? community? current-public-key
|
||||
chat-id show-input? message-pin-enabled edit-enabled in-pinned-view?]}]
|
||||
[react/view {:style (when (and platform/android? (not in-pinned-view?)) {:scaleY -1})}
|
||||
(if (= type :datemark)
|
||||
[message-datemark/chat-datemark (:value message)]
|
||||
@@ -489,7 +489,7 @@
|
||||
:show-input? show-input?
|
||||
:edit-enabled true
|
||||
:in-pinned-view? false})
|
||||
:render-fn render-fn
|
||||
:render-fn message-render-fn
|
||||
:on-viewable-items-changed on-viewable-items-changed
|
||||
:on-end-reached list-on-end-reached
|
||||
:on-scroll-to-index-failed identity ;;don't remove this
|
||||
@@ -645,6 +645,7 @@
|
||||
(if group-chat
|
||||
[invitation-requests chat-id admins]
|
||||
(when-not mutual-contact-requests-enabled? [add-contact-bar chat-id])))
|
||||
[message/pinned-banner chat-id]
|
||||
;;MESSAGES LIST
|
||||
[messages-view {:chat chat
|
||||
:mutual-contact-requests-enabled? mutual-contact-requests-enabled?
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
id
|
||||
true
|
||||
display-name
|
||||
(or color (rand-nth colors/chat-colors))])]
|
||||
(or color (rand-nth colors/chat-colors)) nil 36])]
|
||||
[rn/view {:style {:flex 1 :justify-content :center}}
|
||||
[quo/text {:number-of-lines 1
|
||||
:accessibility-label :community-name-text}
|
||||
|
||||
@@ -1798,7 +1798,9 @@
|
||||
"kicked": "Kicked",
|
||||
"delete-for-everyone": "Delete for everyone",
|
||||
"pin-to-chat": "Pin to the chat",
|
||||
"pin-to-channel": "Pin to the channel",
|
||||
"unpin-from-chat": "Unpin from the chat",
|
||||
"unpin-from-channel": "Unpin from the channel",
|
||||
"copy-text": "Copy text",
|
||||
"edit-message": "Edit message",
|
||||
"save-image-library": "Save image to library",
|
||||
|
||||
Reference in New Issue
Block a user