[#11438] Add "sent" message confirmations

This commit is contained in:
andrey 2020-11-23 15:54:19 +01:00
parent f9095a492e
commit e2717ade98
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272
12 changed files with 27 additions and 19 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 B

After

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 B

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 B

View File

@ -69,7 +69,7 @@
(if (or (= command-state constants/command-state-request-address-for-transaction-declined) (if (or (= command-state constants/command-state-request-address-for-transaction-declined)
(= command-state constants/command-state-request-transaction-declined) (= command-state constants/command-state-request-transaction-declined)
(= :failed transaction-type)) (= :failed transaction-type))
[vector-icons/icon :tiny-icons/tiny-warning [vector-icons/icon :tiny-icons/tiny-warning-background
{:width 16 {:width 16
:height 16 :height 16
:container-style {:margin-right 6}}] :container-style {:margin-right 6}}]

View File

@ -29,11 +29,25 @@
(defn message-timestamp (defn message-timestamp
([message] ([message]
[message-timestamp message false]) [message-timestamp message false])
([{:keys [timestamp-str outgoing content]} justify-timestamp?] ([{:keys [timestamp-str outgoing content outgoing-status]} justify-timestamp?]
[react/text {:style (style/message-timestamp-text [react/view (when justify-timestamp?
justify-timestamp? {:align-self :flex-end
outgoing :position :absolute
(:rtl? content))} timestamp-str])) :bottom 9 ; 6 Bubble bottom, 3 message baseline
(if (:rtl? content) :left :right) 12
:flex-direction :row
:align-items :flex-end})
(when (and outgoing justify-timestamp?)
[vector-icons/icon (case outgoing-status
:sending :tiny-icons/tiny-pending
:sent :tiny-icons/tiny-sent
:not-sent :tiny-icons/tiny-warning
:tiny-icons/tiny-pending)
{:width 16
:height 12
:color colors/white}])
[react/text {:style (style/message-timestamp-text outgoing)}
timestamp-str]]))
(defview quoted-message (defview quoted-message
[_ {:keys [from parsed-text image]} outgoing current-public-key public?] [_ {:keys [from parsed-text image]} outgoing current-public-key public?]
@ -142,10 +156,10 @@
(defn render-parsed-text [message tree] (defn render-parsed-text [message tree]
(reduce (fn [acc e] (render-block message acc e)) [:<>] tree)) (reduce (fn [acc e] (render-block message acc e)) [:<>] tree))
(defn render-parsed-text-with-timestamp [{:keys [timestamp-str] :as message} tree] (defn render-parsed-text-with-timestamp [{:keys [timestamp-str outgoing] :as message} tree]
(let [elements (render-parsed-text message tree) (let [elements (render-parsed-text message tree)
timestamp [react/text {:style (style/message-timestamp-placeholder)} timestamp [react/text {:style (style/message-timestamp-placeholder)}
(str " " timestamp-str)] (str (if outgoing " " " ") timestamp-str)]
last-element (peek elements)] last-element (peek elements)]
;; Using `nth` here as slightly faster than `first`, roughly 30% ;; Using `nth` here as slightly faster than `first`, roughly 30%
;; It's worth considering pure js structures for this code path as ;; It's worth considering pure js structures for this code path as

View File

@ -43,7 +43,5 @@
:justify-content :space-between}) :justify-content :space-between})
(defn timestamp [outgoing] (defn timestamp [outgoing]
(merge (message.style/message-timestamp-text (merge (message.style/message-timestamp-text outgoing)
false {:margin-left 40}))
outgoing
false) {:margin-left 40}))

View File

@ -28,23 +28,19 @@
:align-items align})) :align-items align}))
(def message-timestamp (def message-timestamp
{:font-size 10 {:font-size 10})
:align-self :flex-end})
(defn message-timestamp-placeholder (defn message-timestamp-placeholder
[] []
(merge message-timestamp {:opacity 0 :color "rgba(0,0,0,0)"})) (merge message-timestamp {:opacity 0 :color "rgba(0,0,0,0)"}))
(defn message-timestamp-text (defn message-timestamp-text
[justify-timestamp? outgoing rtl?] [outgoing]
(merge message-timestamp (merge message-timestamp
{:line-height 10 {:line-height 10
:color (if outgoing :color (if outgoing
colors/white-transparent-70-persist colors/white-transparent-70-persist
colors/gray)} colors/gray)}))
(when justify-timestamp? {:position :absolute
:bottom 9 ; 6 Bubble bottom, 3 message baseline
(if rtl? :left :right) 12})))
(defn message-wrapper [{:keys [outgoing]}] (defn message-wrapper [{:keys [outgoing]}]
(merge {:flex-direction :column} (merge {:flex-direction :column}