From ffaa85f133696bd686e9a88eb924ff87adedeb97 Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Fri, 20 Jul 2018 13:16:49 +0300 Subject: [PATCH 01/16] Add system warnings, delivery notifications, general unread messages badge --- .../ui/components/connectivity/styles.cljs | 20 ++++++---- .../ui/components/connectivity/view.cljs | 1 + src/status_im/ui/components/desktop/tabs.cljs | 38 +++++++++++++------ .../ui/screens/desktop/main/chat/views.cljs | 14 +++++-- .../ui/screens/main_tabs/styles.cljs | 21 +++++++++- 5 files changed, 69 insertions(+), 25 deletions(-) diff --git a/src/status_im/ui/components/connectivity/styles.cljs b/src/status_im/ui/components/connectivity/styles.cljs index 2bab1359ca..a447877940 100644 --- a/src/status_im/ui/components/connectivity/styles.cljs +++ b/src/status_im/ui/components/connectivity/styles.cljs @@ -1,15 +1,19 @@ (ns status-im.ui.components.connectivity.styles (:require-macros [status-im.utils.styles :refer [defnstyle]]) - (:require [status-im.ui.components.colors :as colors])) + (:require [status-im.ui.components.colors :as colors] + [status-im.utils.platform :as platform])) (defnstyle text-wrapper [top opacity window-width pending?] - {:ios {:z-index 0} - :opacity opacity - :width window-width - :top (+ (+ 56 top) (if pending? 35 0)) - :position :absolute - :background-color colors/gray-notifications - :height 35}) + (cond-> + {:opacity opacity + :background-color colors/gray-notifications + :height 35} + (not platform/desktop?) + (assoc + :ios {:z-index 0} + :width window-width + :top (+ (+ 56 top) (if pending? 35 0)) + :position :absolute))) (def text {:text-align :center diff --git a/src/status_im/ui/components/connectivity/view.cljs b/src/status_im/ui/components/connectivity/view.cljs index 079c8fcf45..01694018ea 100644 --- a/src/status_im/ui/components/connectivity/view.cljs +++ b/src/status_im/ui/components/connectivity/view.cljs @@ -3,6 +3,7 @@ (:require [re-frame.core :as re-frame] [reagent.core :as reagent] [status-im.ui.components.react :as react] + [taoensso.timbre :as log] [status-im.ui.components.connectivity.styles :as styles] [status-im.i18n :as i18n])) diff --git a/src/status_im/ui/components/desktop/tabs.cljs b/src/status_im/ui/components/desktop/tabs.cljs index 4c5020f5c7..475d4acce7 100644 --- a/src/status_im/ui/components/desktop/tabs.cljs +++ b/src/status_im/ui/components/desktop/tabs.cljs @@ -14,7 +14,8 @@ [{:view-id :home :content {:title "Home" :icon-inactive :icons/home - :icon-active :icons/home-active}} + :icon-active :icons/home-active} + :count-subscription :get-chats-unread-messages-number} #_{:view-id :wallet :content {:title "Wallet" :icon-inactive :icons/wallet @@ -22,30 +23,43 @@ {:view-id :profile :content {:title "Profile" :icon-inactive :icons/profile - :icon-active :icons/profile-active}}]) + :icon-active :icons/profile-active} + :count-subscription :get-profile-unread-messages-number}]) + +(defn- counter [cnt] + (let [[unviewed-messages-label large?] (if (< 9 cnt) + ["9+" true] + [cnt false])] + [react/view {:style tabs.styles/unread-messages-icon} + [react/text {:style (tabs.styles/unread-messages-text large?)} unviewed-messages-label]])) (defn- tab-content [{:keys [title icon-active icon-inactive]}] - (fn [active?] + (fn [active? cnt] [react/view {:style tabs.styles/tab-container} (let [icon (if active? icon-active icon-inactive)] [react/view [icons/icon icon {:style {:tint-color (if active? colors/blue colors/gray-icon)}}]]) [react/view [react/text {:style (tabs.styles/tab-title active?)} - title]]])) + title]] + (when (pos? cnt) + [counter cnt])])) (def tabs-list-indexed (map-indexed vector (map #(update % :content tab-content) tabs-list-data))) -(defn tab [index content view-id active?] - [react/touchable-highlight {:style (merge tabs.styles/tab-container {:flex 1}) - :disabled active? - :on-press #(re-frame/dispatch [:show-desktop-tab view-id])} - [react/view - [content active?]]]) +(views/defview tab [index content view-id active? count-subscription] + (views/letsubs [cnt [count-subscription]] + [react/touchable-highlight {:style (merge tabs.styles/tab-container {:flex 1}) + :disabled active? + :on-press #(do + (re-frame/dispatch [:navigate-to :home]) + (re-frame/dispatch [:show-desktop-tab view-id]))} + [react/view + [content active? (if (= view-id :home) cnt nil)]]])) (views/defview main-tabs [] (views/letsubs [current-tab [:get-in [:desktop/desktop :tab-view-id]]] [react/view [react/view {:style tabs.styles/tabs-container} - (for [[index {:keys [content view-id]}] tabs-list-indexed] - ^{:key index} [tab index content view-id (= current-tab view-id)])]])) + (for [[index {:keys [content view-id count-subscription]}] tabs-list-indexed] + ^{:key index} [tab index content view-id (= current-tab view-id) count-subscription])]])) diff --git a/src/status_im/ui/screens/desktop/main/chat/views.cljs b/src/status_im/ui/screens/desktop/main/chat/views.cljs index 4734eef175..1f18082205 100644 --- a/src/status_im/ui/screens/desktop/main/chat/views.cljs +++ b/src/status_im/ui/screens/desktop/main/chat/views.cljs @@ -4,6 +4,7 @@ [status-im.ui.components.icons.vector-icons :as icons] [clojure.string :as string] [status-im.chat.styles.message.message :as message.style] + [status-im.chat.views.message.message :as message] [status-im.utils.gfycat.core :as gfycat.core] [taoensso.timbre :as log] [status-im.utils.gfycat.core :as gfycat] @@ -12,6 +13,7 @@ [status-im.utils.datetime :as time] [status-im.utils.utils :as utils] [status-im.ui.components.react :as react] + [status-im.ui.components.connectivity.view :as connectivity] [status-im.ui.components.colors :as colors] [status-im.chat.views.message.datemark :as message.datemark] [status-im.ui.screens.desktop.main.tabs.profile.views :as profile.views] @@ -56,7 +58,8 @@ (i18n/label :t/clear-history)] [react/text {:style (styles/profile-actions-text colors/black) :on-press #(re-frame/dispatch [:chat.ui/delete-chat-pressed chat-id])} - (i18n/label :t/delete-chat)]]])) + (i18n/label :t/delete-chat)]]] + [connectivity/error-view {:top 2}])) (views/defview message-author-name [{:keys [outgoing from] :as message}] (views/letsubs [current-account [:get-current-account] @@ -133,9 +136,12 @@ :reagent-render (fn [] ^{:key (str "message" message-id)} - (if (and group-chat (not outgoing)) - [message-with-name-and-avatar text message] - [text-only-message text message]))})))) + [react/view + (if (and group-chat (not outgoing)) + [message-with-name-and-avatar text message] + [text-only-message text message]) + [react/view (message.style/delivery-status outgoing) + [message/message-delivery-status message]]])})))) (views/defview messages-view [{:keys [chat-id group-chat]}] (views/letsubs [chat-id* (atom nil) diff --git a/src/status_im/ui/screens/main_tabs/styles.cljs b/src/status_im/ui/screens/main_tabs/styles.cljs index ac76855d93..6fc53d75e8 100644 --- a/src/status_im/ui/screens/main_tabs/styles.cljs +++ b/src/status_im/ui/screens/main_tabs/styles.cljs @@ -1,5 +1,6 @@ (ns status-im.ui.screens.main-tabs.styles (:require [status-im.ui.components.styles :as styles] + [status-im.ui.components.colors :as colors] [status-im.utils.platform :as platform]) (:require-macros [status-im.utils.styles :refer [defnstyle]])) @@ -26,6 +27,8 @@ (defnstyle tab-title [active?] {:ios {:font-size 11} :android {:font-size 12} + :desktop {:font-size 12 + :font-weight (if active? "600" :normal)} :text-align :center :color (if active? styles/color-blue4 @@ -39,4 +42,20 @@ :top 4}) (def counter - {:margin-left 18}) \ No newline at end of file + {:margin-left 18}) + +(def unread-messages-icon + {:position :absolute + :width 20 + :height 20 + :border-radius 20 + :left 18 + :top 10 + :justify-content :center + :align-items :center + :background-color colors/blue}) + +(defn unread-messages-text [large?] + {:color colors/white + :font-size (if large? 10 10.9)}) + From a08a98c4912f287182b6f048115b54c689293526 Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Wed, 1 Aug 2018 14:35:14 -0600 Subject: [PATCH 02/16] Fix status display by providing public key in message data --- .../ui/components/connectivity/view.cljs | 1 - .../ui/screens/desktop/main/chat/views.cljs | 24 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/status_im/ui/components/connectivity/view.cljs b/src/status_im/ui/components/connectivity/view.cljs index 01694018ea..079c8fcf45 100644 --- a/src/status_im/ui/components/connectivity/view.cljs +++ b/src/status_im/ui/components/connectivity/view.cljs @@ -3,7 +3,6 @@ (:require [re-frame.core :as re-frame] [reagent.core :as reagent] [status-im.ui.components.react :as react] - [taoensso.timbre :as log] [status-im.ui.components.connectivity.styles :as styles] [status-im.i18n :as i18n])) diff --git a/src/status_im/ui/screens/desktop/main/chat/views.cljs b/src/status_im/ui/screens/desktop/main/chat/views.cljs index 1f18082205..7892ffcbe9 100644 --- a/src/status_im/ui/screens/desktop/main/chat/views.cljs +++ b/src/status_im/ui/screens/desktop/main/chat/views.cljs @@ -140,19 +140,19 @@ (if (and group-chat (not outgoing)) [message-with-name-and-avatar text message] [text-only-message text message]) - [react/view (message.style/delivery-status outgoing) + [react/view {:style (message.style/delivery-status outgoing)} [message/message-delivery-status message]]])})))) (views/defview messages-view [{:keys [chat-id group-chat]}] - (views/letsubs [chat-id* (atom nil) - scroll-ref (atom nil) - scroll-timer (atom nil) - scroll-height (atom nil)] - (let [_ (when (or (not @chat-id*) (not= @chat-id* chat-id)) + (views/letsubs [messages [:get-current-chat-messages-stream] + current-public-key [:get-current-public-key]] + (let [chat-id* (atom nil) + scroll-ref (atom nil) + scroll-timer (atom nil) + scroll-height (atom nil) + _ (when (or (not @chat-id*) (not= @chat-id* chat-id)) (reset! chat-id* chat-id) - (js/setTimeout #(when scroll-ref (.scrollToEnd @scroll-ref)) 400)) - messages (re-frame/subscribe [:get-current-chat-messages-stream]) - current-public-key (re-frame/subscribe [:get-current-public-key])] + (js/setTimeout #(when @scroll-ref (.scrollToEnd @scroll-ref)) 400))] [react/view {:style styles/messages-view} [react/scroll-view {:scrollEventThrottle 16 :headerHeight styles/messages-list-vertical-padding @@ -169,9 +169,11 @@ :ref #(reset! scroll-ref %)} [react/view (doall - (for [[index {:keys [from content message-id type value] :as message-obj}] (map-indexed vector (reverse @messages))] + (for [[index {:keys [from content message-id type value] :as message-obj}] (map-indexed vector (reverse messages))] ^{:key (or message-id (str type value))} - [message content (= from @current-public-key) (assoc message-obj :group-chat group-chat)]))]]]))) + [message content (= from current-public-key) + (assoc message-obj :group-chat group-chat + :current-public-key current-public-key)]))]]]))) (views/defview chat-text-input [] (views/letsubs [inp-ref (atom nil)] From 9136dd0d3f17f54b65509e6a9f12cbe46876797a Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Mon, 27 Aug 2018 16:13:56 +0300 Subject: [PATCH 03/16] Fix :show-desktop-tab usage --- src/status_im/ui/components/desktop/tabs.cljs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/status_im/ui/components/desktop/tabs.cljs b/src/status_im/ui/components/desktop/tabs.cljs index 475d4acce7..056800bba0 100644 --- a/src/status_im/ui/components/desktop/tabs.cljs +++ b/src/status_im/ui/components/desktop/tabs.cljs @@ -51,9 +51,7 @@ (views/letsubs [cnt [count-subscription]] [react/touchable-highlight {:style (merge tabs.styles/tab-container {:flex 1}) :disabled active? - :on-press #(do - (re-frame/dispatch [:navigate-to :home]) - (re-frame/dispatch [:show-desktop-tab view-id]))} + :on-press #(re-frame/dispatch [:show-desktop-tab view-id])} [react/view [content active? (if (= view-id :home) cnt nil)]]])) From 400e8b6d99cf6ed6f6559568fac219c9663a36dd Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Mon, 27 Aug 2018 17:06:00 +0300 Subject: [PATCH 04/16] Fix message key so that message status updates work --- .../ui/screens/desktop/main/chat/views.cljs | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/status_im/ui/screens/desktop/main/chat/views.cljs b/src/status_im/ui/screens/desktop/main/chat/views.cljs index 7892ffcbe9..0d40715579 100644 --- a/src/status_im/ui/screens/desktop/main/chat/views.cljs +++ b/src/status_im/ui/screens/desktop/main/chat/views.cljs @@ -27,31 +27,32 @@ :as current-chat}] (views/letsubs [chat-name [:get-current-chat-name] {:keys [pending? whisper-identity photo-path]} [:get-current-chat-contact]] - [react/view {:style styles/toolbar-chat-view} - [react/view {:style {:flex-direction :row - :flex 1}} - (if public? - [react/view {:style (styles/topic-image color)} - [react/text {:style styles/topic-text} - (string/capitalize (second chat-name))]] - [react/image {:style styles/chat-icon - :source {:uri photo-path}}]) - [react/view {:style (styles/chat-title-and-type pending?)} - [react/text {:style styles/chat-title - :font :medium} - chat-name] - (cond pending? - [react/text {:style styles/add-contact-text - :on-press #(re-frame/dispatch [:add-contact whisper-identity])} - (i18n/label :t/add-to-contacts)] - public? - [react/text {:style styles/public-chat-text} - (i18n/label :t/public-chat)])]] - [react/view - (when (and (not group-chat) (not public?)) - [react/text {:style (styles/profile-actions-text colors/black) - :on-press #(re-frame/dispatch [:show-profile-desktop whisper-identity])} - (i18n/label :t/view-profile)]) + [react/view + [react/view {:style styles/toolbar-chat-view} + [react/view {:style {:flex-direction :row + :flex 1}} + (if public? + [react/view {:style (styles/topic-image color)} + [react/text {:style styles/topic-text} + (string/capitalize (second chat-name))]] + [react/image {:style styles/chat-icon + :source {:uri photo-path}}]) + [react/view {:style (styles/chat-title-and-type pending?)} + [react/text {:style styles/chat-title + :font :medium} + chat-name] + (cond pending? + [react/text {:style styles/add-contact-text + :on-press #(re-frame/dispatch [:add-contact whisper-identity])} + (i18n/label :t/add-to-contacts)] + public? + [react/text {:style styles/public-chat-text} + (i18n/label :t/public-chat)])]] + [react/view + (when (and (not group-chat) (not public?)) + [react/text {:style (styles/profile-actions-text colors/black) + :on-press #(re-frame/dispatch [:show-profile-desktop whisper-identity])} + (i18n/label :t/view-profile)]) [react/text {:style (styles/profile-actions-text colors/black) :on-press #(re-frame/dispatch [:chat.ui/clear-history-pressed])} @@ -59,7 +60,7 @@ [react/text {:style (styles/profile-actions-text colors/black) :on-press #(re-frame/dispatch [:chat.ui/delete-chat-pressed chat-id])} (i18n/label :t/delete-chat)]]] - [connectivity/error-view {:top 2}])) + [connectivity/error-view {:top 2}]])) (views/defview message-author-name [{:keys [outgoing from] :as message}] (views/letsubs [current-account [:get-current-account] @@ -170,7 +171,7 @@ [react/view (doall (for [[index {:keys [from content message-id type value] :as message-obj}] (map-indexed vector (reverse messages))] - ^{:key (or message-id (str type value))} + ^{:key message-obj} [message content (= from current-public-key) (assoc message-obj :group-chat group-chat :current-public-key current-public-key)]))]]]))) From 3e43d85215dc567ed622855d05cca8780e912ccf Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Tue, 28 Aug 2018 15:54:49 +0300 Subject: [PATCH 05/16] Fix message delivery status alignment on desktop --- src/status_im/chat/styles/message/message.cljs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/status_im/chat/styles/message/message.cljs b/src/status_im/chat/styles/message/message.cljs index e66d32de37..22cc211b5b 100644 --- a/src/status_im/chat/styles/message/message.cljs +++ b/src/status_im/chat/styles/message/message.cljs @@ -3,6 +3,7 @@ (:require [status-im.ui.components.styles :as styles] [status-im.chat.styles.photos :as photos] [status-im.ui.components.colors :as colors] + [status-im.utils.platform :as platform] [status-im.constants :as constants])) (defstyle style-message-text @@ -95,9 +96,9 @@ (defn delivery-status [outgoing] (if outgoing {:align-self :flex-end - :padding-right 8} + :padding-right (if platform/desktop? 24 8)} {:align-self :flex-start - :padding-left 8})) + :padding-left (if platform/desktop? 24 8)})) (def message-author {:width photos/default-size From fc12e22535b4e93d8b39eeeecf2f488f5ac3d45c Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Tue, 28 Aug 2018 18:47:35 +0300 Subject: [PATCH 06/16] Fix error view jumps --- .../ui/components/connectivity/styles.cljs | 10 +++- .../ui/screens/desktop/main/chat/views.cljs | 55 +++++++++---------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/src/status_im/ui/components/connectivity/styles.cljs b/src/status_im/ui/components/connectivity/styles.cljs index a447877940..8d0563fe38 100644 --- a/src/status_im/ui/components/connectivity/styles.cljs +++ b/src/status_im/ui/components/connectivity/styles.cljs @@ -7,13 +7,17 @@ (cond-> {:opacity opacity :background-color colors/gray-notifications - :height 35} + :height 35 + :position :absolute} + platform/desktop? + (assoc + :left 0 + :right 0) (not platform/desktop?) (assoc :ios {:z-index 0} :width window-width - :top (+ (+ 56 top) (if pending? 35 0)) - :position :absolute))) + :top (+ (+ 56 top) (if pending? 35 0))))) (def text {:text-align :center diff --git a/src/status_im/ui/screens/desktop/main/chat/views.cljs b/src/status_im/ui/screens/desktop/main/chat/views.cljs index 0d40715579..4b5607abe4 100644 --- a/src/status_im/ui/screens/desktop/main/chat/views.cljs +++ b/src/status_im/ui/screens/desktop/main/chat/views.cljs @@ -27,40 +27,38 @@ :as current-chat}] (views/letsubs [chat-name [:get-current-chat-name] {:keys [pending? whisper-identity photo-path]} [:get-current-chat-contact]] - [react/view - [react/view {:style styles/toolbar-chat-view} - [react/view {:style {:flex-direction :row - :flex 1}} - (if public? - [react/view {:style (styles/topic-image color)} - [react/text {:style styles/topic-text} - (string/capitalize (second chat-name))]] - [react/image {:style styles/chat-icon - :source {:uri photo-path}}]) - [react/view {:style (styles/chat-title-and-type pending?)} - [react/text {:style styles/chat-title - :font :medium} - chat-name] - (cond pending? - [react/text {:style styles/add-contact-text - :on-press #(re-frame/dispatch [:add-contact whisper-identity])} - (i18n/label :t/add-to-contacts)] - public? - [react/text {:style styles/public-chat-text} - (i18n/label :t/public-chat)])]] - [react/view - (when (and (not group-chat) (not public?)) - [react/text {:style (styles/profile-actions-text colors/black) - :on-press #(re-frame/dispatch [:show-profile-desktop whisper-identity])} - (i18n/label :t/view-profile)]) + [react/view {:style styles/toolbar-chat-view} + [react/view {:style {:flex-direction :row + :flex 1}} + (if public? + [react/view {:style (styles/topic-image color)} + [react/text {:style styles/topic-text} + (string/capitalize (second chat-name))]] + [react/image {:style styles/chat-icon + :source {:uri photo-path}}]) + [react/view {:style (styles/chat-title-and-type pending?)} + [react/text {:style styles/chat-title + :font :medium} + chat-name] + (cond pending? + [react/text {:style styles/add-contact-text + :on-press #(re-frame/dispatch [:add-contact whisper-identity])} + (i18n/label :t/add-to-contacts)] + public? + [react/text {:style styles/public-chat-text} + (i18n/label :t/public-chat)])]] + [react/view + (when (and (not group-chat) (not public?)) + [react/text {:style (styles/profile-actions-text colors/black) + :on-press #(re-frame/dispatch [:show-profile-desktop whisper-identity])} + (i18n/label :t/view-profile)]) [react/text {:style (styles/profile-actions-text colors/black) :on-press #(re-frame/dispatch [:chat.ui/clear-history-pressed])} (i18n/label :t/clear-history)] [react/text {:style (styles/profile-actions-text colors/black) :on-press #(re-frame/dispatch [:chat.ui/delete-chat-pressed chat-id])} - (i18n/label :t/delete-chat)]]] - [connectivity/error-view {:top 2}]])) + (i18n/label :t/delete-chat)]]])) (views/defview message-author-name [{:keys [outgoing from] :as message}] (views/letsubs [current-account [:get-current-account] @@ -155,6 +153,7 @@ (reset! chat-id* chat-id) (js/setTimeout #(when @scroll-ref (.scrollToEnd @scroll-ref)) 400))] [react/view {:style styles/messages-view} + [connectivity/error-view] [react/scroll-view {:scrollEventThrottle 16 :headerHeight styles/messages-list-vertical-padding :footerWidth styles/messages-list-vertical-padding From 7bde1ef1f9028bd7939c6369af5d9739ca7543a7 Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Wed, 29 Aug 2018 14:03:22 +0300 Subject: [PATCH 07/16] Disable 'Tap for options' on Desktop --- src/status_im/chat/views/message/message.cljs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/status_im/chat/views/message/message.cljs b/src/status_im/chat/views/message/message.cljs index f722a3b482..9f97879299 100644 --- a/src/status_im/chat/views/message/message.cljs +++ b/src/status_im/chat/views/message/message.cljs @@ -281,9 +281,12 @@ :message-id message-id}])))} [react/view style/not-sent-view [react/text {:style style/not-sent-text} - (i18n/message-status-label :not-sent)] - [react/view style/not-sent-icon - [vector-icons/icon :icons/warning {:color colors/red}]]]]) + (i18n/message-status-label (if platform/desktop? + :not-sent-without-tap + :not-sent))] + (when-not platform/desktop? + [react/view style/not-sent-icon + [vector-icons/icon :icons/warning {:color colors/red}]])]]) (defview command-status [{{:keys [network]} :params}] (letsubs [current-network [:network-name]] From 08e092c824ab0465adb173f5b3386cd532ac59bf Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Wed, 29 Aug 2018 17:13:27 +0300 Subject: [PATCH 08/16] Fix connectivity error view overlay --- src/status_im/ui/screens/desktop/main/chat/views.cljs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/status_im/ui/screens/desktop/main/chat/views.cljs b/src/status_im/ui/screens/desktop/main/chat/views.cljs index 4b5607abe4..6f78e17769 100644 --- a/src/status_im/ui/screens/desktop/main/chat/views.cljs +++ b/src/status_im/ui/screens/desktop/main/chat/views.cljs @@ -47,6 +47,12 @@ public? [react/text {:style styles/public-chat-text} (i18n/label :t/public-chat)])]] + #_[react/view + [react/popup-menu + [react/popup-menu-trigger {:text "Popup"}] + [react/popup-menu-options + [react/popup-menu-option {:text "First"}] + [react/popup-menu-option {:text "Second"}]]]] [react/view (when (and (not group-chat) (not public?)) [react/text {:style (styles/profile-actions-text colors/black) @@ -153,7 +159,6 @@ (reset! chat-id* chat-id) (js/setTimeout #(when @scroll-ref (.scrollToEnd @scroll-ref)) 400))] [react/view {:style styles/messages-view} - [connectivity/error-view] [react/scroll-view {:scrollEventThrottle 16 :headerHeight styles/messages-list-vertical-padding :footerWidth styles/messages-list-vertical-padding @@ -173,7 +178,8 @@ ^{:key message-obj} [message content (= from current-public-key) (assoc message-obj :group-chat group-chat - :current-public-key current-public-key)]))]]]))) + :current-public-key current-public-key)]))]] + [connectivity/error-view]]))) (views/defview chat-text-input [] (views/letsubs [inp-ref (atom nil)] From 2d3952f2522c7fb62bcc5fd295ff7f369f1b3f81 Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Tue, 4 Sep 2018 18:45:46 +0300 Subject: [PATCH 09/16] Test commit to trigger Jenkins build --- src/status_im/ui/screens/desktop/main/chat/views.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/status_im/ui/screens/desktop/main/chat/views.cljs b/src/status_im/ui/screens/desktop/main/chat/views.cljs index 6f78e17769..ac6ace4218 100644 --- a/src/status_im/ui/screens/desktop/main/chat/views.cljs +++ b/src/status_im/ui/screens/desktop/main/chat/views.cljs @@ -49,7 +49,7 @@ (i18n/label :t/public-chat)])]] #_[react/view [react/popup-menu - [react/popup-menu-trigger {:text "Popup"}] + [react/popup-menu-trigger {:text "Popup test"}] [react/popup-menu-options [react/popup-menu-option {:text "First"}] [react/popup-menu-option {:text "Second"}]]]] From d0e5ecd48b53e82666c2534a1dbfc5bb35b8ba85 Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Fri, 20 Jul 2018 13:16:49 +0300 Subject: [PATCH 10/16] Add system warnings, delivery notifications, general unread messages badge --- .../ui/components/connectivity/view.cljs | 1 + .../ui/screens/desktop/main/chat/views.cljs | 104 +++++++++--------- 2 files changed, 53 insertions(+), 52 deletions(-) diff --git a/src/status_im/ui/components/connectivity/view.cljs b/src/status_im/ui/components/connectivity/view.cljs index 079c8fcf45..01694018ea 100644 --- a/src/status_im/ui/components/connectivity/view.cljs +++ b/src/status_im/ui/components/connectivity/view.cljs @@ -3,6 +3,7 @@ (:require [re-frame.core :as re-frame] [reagent.core :as reagent] [status-im.ui.components.react :as react] + [taoensso.timbre :as log] [status-im.ui.components.connectivity.styles :as styles] [status-im.i18n :as i18n])) diff --git a/src/status_im/ui/screens/desktop/main/chat/views.cljs b/src/status_im/ui/screens/desktop/main/chat/views.cljs index ac6ace4218..91f3166bc0 100644 --- a/src/status_im/ui/screens/desktop/main/chat/views.cljs +++ b/src/status_im/ui/screens/desktop/main/chat/views.cljs @@ -1,58 +1,58 @@ (ns status-im.ui.screens.desktop.main.chat.views - (:require-macros [status-im.utils.views :as views]) - (:require [re-frame.core :as re-frame] - [status-im.ui.components.icons.vector-icons :as icons] - [clojure.string :as string] - [status-im.chat.styles.message.message :as message.style] - [status-im.chat.views.message.message :as message] - [status-im.utils.gfycat.core :as gfycat.core] - [taoensso.timbre :as log] - [status-im.utils.gfycat.core :as gfycat] - [status-im.constants :as constants] - [status-im.utils.identicon :as identicon] - [status-im.utils.datetime :as time] - [status-im.utils.utils :as utils] - [status-im.ui.components.react :as react] - [status-im.ui.components.connectivity.view :as connectivity] - [status-im.ui.components.colors :as colors] - [status-im.chat.views.message.datemark :as message.datemark] - [status-im.ui.screens.desktop.main.tabs.profile.views :as profile.views] - [status-im.ui.components.icons.vector-icons :as vector-icons] - [status-im.ui.screens.desktop.main.chat.styles :as styles] - [status-im.utils.contacts :as utils.contacts] - [status-im.i18n :as i18n] - [status-im.ui.screens.desktop.main.chat.events :as chat.events])) +(:require-macros [status-im.utils.views :as views]) +(:require [re-frame.core :as re-frame] + [status-im.ui.components.icons.vector-icons :as icons] + [clojure.string :as string] + [status-im.chat.styles.message.message :as message.style] + [status-im.chat.views.message.message :as message] + [status-im.utils.gfycat.core :as gfycat.core] + [taoensso.timbre :as log] + [status-im.utils.gfycat.core :as gfycat] + [status-im.constants :as constants] + [status-im.utils.identicon :as identicon] + [status-im.utils.datetime :as time] + [status-im.utils.utils :as utils] + [status-im.ui.components.react :as react] + [status-im.ui.components.connectivity.view :as connectivity] + [status-im.ui.components.colors :as colors] + [status-im.chat.views.message.datemark :as message.datemark] + [status-im.ui.screens.desktop.main.tabs.profile.views :as profile.views] + [status-im.ui.components.icons.vector-icons :as vector-icons] + [status-im.ui.screens.desktop.main.chat.styles :as styles] + [status-im.utils.contacts :as utils.contacts] + [status-im.i18n :as i18n] + [status-im.ui.screens.desktop.main.chat.events :as chat.events])) (views/defview toolbar-chat-view [{:keys [chat-id color public-key public? group-chat] - :as current-chat}] - (views/letsubs [chat-name [:get-current-chat-name] - {:keys [pending? whisper-identity photo-path]} [:get-current-chat-contact]] - [react/view {:style styles/toolbar-chat-view} - [react/view {:style {:flex-direction :row - :flex 1}} - (if public? - [react/view {:style (styles/topic-image color)} - [react/text {:style styles/topic-text} - (string/capitalize (second chat-name))]] - [react/image {:style styles/chat-icon - :source {:uri photo-path}}]) - [react/view {:style (styles/chat-title-and-type pending?)} - [react/text {:style styles/chat-title - :font :medium} - chat-name] - (cond pending? - [react/text {:style styles/add-contact-text - :on-press #(re-frame/dispatch [:add-contact whisper-identity])} - (i18n/label :t/add-to-contacts)] - public? - [react/text {:style styles/public-chat-text} - (i18n/label :t/public-chat)])]] - #_[react/view - [react/popup-menu - [react/popup-menu-trigger {:text "Popup test"}] - [react/popup-menu-options - [react/popup-menu-option {:text "First"}] - [react/popup-menu-option {:text "Second"}]]]] + :as current-chat}] +(views/letsubs [chat-name [:get-current-chat-name] + {:keys [pending? whisper-identity photo-path]} [:get-current-chat-contact]] + [react/view {:style styles/toolbar-chat-view} + [react/view {:style {:flex-direction :row + :flex 1}} + (if public? + [react/view {:style (styles/topic-image color)} + [react/text {:style styles/topic-text} + (string/capitalize (second chat-name))]] + [react/image {:style styles/chat-icon + :source {:uri photo-path}}]) + [react/view {:style (styles/chat-title-and-type pending?)} + [react/text {:style styles/chat-title + :font :medium} + chat-name] + (cond pending? + [react/text {:style styles/add-contact-text + :on-press #(re-frame/dispatch [:add-contact whisper-identity])} + (i18n/label :t/add-to-contacts)] + public? + [react/text {:style styles/public-chat-text} + (i18n/label :t/public-chat)])]] + #_[react/view + [react/popup-menu + [react/popup-menu-trigger {:text "Popup test"}] + [react/popup-menu-options + [react/popup-menu-option {:text "First"}] + [react/popup-menu-option {:text "Second"}]]]] [react/view (when (and (not group-chat) (not public?)) [react/text {:style (styles/profile-actions-text colors/black) From 0562015fa86394c96715db387dce5f066f80a47a Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Wed, 1 Aug 2018 14:35:14 -0600 Subject: [PATCH 11/16] Fix status display by providing public key in message data --- src/status_im/ui/components/connectivity/view.cljs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/status_im/ui/components/connectivity/view.cljs b/src/status_im/ui/components/connectivity/view.cljs index 01694018ea..079c8fcf45 100644 --- a/src/status_im/ui/components/connectivity/view.cljs +++ b/src/status_im/ui/components/connectivity/view.cljs @@ -3,7 +3,6 @@ (:require [re-frame.core :as re-frame] [reagent.core :as reagent] [status-im.ui.components.react :as react] - [taoensso.timbre :as log] [status-im.ui.components.connectivity.styles :as styles] [status-im.i18n :as i18n])) From 70aae89d057af99b9b2985becc2189b36d4328e7 Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Tue, 28 Aug 2018 18:47:35 +0300 Subject: [PATCH 12/16] Fix error view jumps --- src/status_im/ui/screens/desktop/main/chat/views.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/status_im/ui/screens/desktop/main/chat/views.cljs b/src/status_im/ui/screens/desktop/main/chat/views.cljs index 91f3166bc0..4534584510 100644 --- a/src/status_im/ui/screens/desktop/main/chat/views.cljs +++ b/src/status_im/ui/screens/desktop/main/chat/views.cljs @@ -58,7 +58,6 @@ [react/text {:style (styles/profile-actions-text colors/black) :on-press #(re-frame/dispatch [:show-profile-desktop whisper-identity])} (i18n/label :t/view-profile)]) - [react/text {:style (styles/profile-actions-text colors/black) :on-press #(re-frame/dispatch [:chat.ui/clear-history-pressed])} (i18n/label :t/clear-history)] @@ -159,6 +158,7 @@ (reset! chat-id* chat-id) (js/setTimeout #(when @scroll-ref (.scrollToEnd @scroll-ref)) 400))] [react/view {:style styles/messages-view} + [connectivity/error-view] [react/scroll-view {:scrollEventThrottle 16 :headerHeight styles/messages-list-vertical-padding :footerWidth styles/messages-list-vertical-padding From 59c1eb1f5fc65abc783b67fe84e10e7e7f43bb92 Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Wed, 29 Aug 2018 17:13:27 +0300 Subject: [PATCH 13/16] Fix connectivity error view overlay --- src/status_im/ui/screens/desktop/main/chat/views.cljs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/status_im/ui/screens/desktop/main/chat/views.cljs b/src/status_im/ui/screens/desktop/main/chat/views.cljs index 4534584510..9da31475a1 100644 --- a/src/status_im/ui/screens/desktop/main/chat/views.cljs +++ b/src/status_im/ui/screens/desktop/main/chat/views.cljs @@ -158,7 +158,6 @@ (reset! chat-id* chat-id) (js/setTimeout #(when @scroll-ref (.scrollToEnd @scroll-ref)) 400))] [react/view {:style styles/messages-view} - [connectivity/error-view] [react/scroll-view {:scrollEventThrottle 16 :headerHeight styles/messages-list-vertical-padding :footerWidth styles/messages-list-vertical-padding From 33da59f8591bec76e5ec28d9f00a39a20618b0d8 Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Wed, 12 Sep 2018 18:09:47 +0300 Subject: [PATCH 14/16] Fix formatting --- .../ui/screens/desktop/main/chat/views.cljs | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/src/status_im/ui/screens/desktop/main/chat/views.cljs b/src/status_im/ui/screens/desktop/main/chat/views.cljs index 9da31475a1..6e942ca3f0 100644 --- a/src/status_im/ui/screens/desktop/main/chat/views.cljs +++ b/src/status_im/ui/screens/desktop/main/chat/views.cljs @@ -1,58 +1,58 @@ (ns status-im.ui.screens.desktop.main.chat.views -(:require-macros [status-im.utils.views :as views]) -(:require [re-frame.core :as re-frame] - [status-im.ui.components.icons.vector-icons :as icons] - [clojure.string :as string] - [status-im.chat.styles.message.message :as message.style] - [status-im.chat.views.message.message :as message] - [status-im.utils.gfycat.core :as gfycat.core] - [taoensso.timbre :as log] - [status-im.utils.gfycat.core :as gfycat] - [status-im.constants :as constants] - [status-im.utils.identicon :as identicon] - [status-im.utils.datetime :as time] - [status-im.utils.utils :as utils] - [status-im.ui.components.react :as react] - [status-im.ui.components.connectivity.view :as connectivity] - [status-im.ui.components.colors :as colors] - [status-im.chat.views.message.datemark :as message.datemark] - [status-im.ui.screens.desktop.main.tabs.profile.views :as profile.views] - [status-im.ui.components.icons.vector-icons :as vector-icons] - [status-im.ui.screens.desktop.main.chat.styles :as styles] - [status-im.utils.contacts :as utils.contacts] - [status-im.i18n :as i18n] - [status-im.ui.screens.desktop.main.chat.events :as chat.events])) + (:require-macros [status-im.utils.views :as views]) + (:require [re-frame.core :as re-frame] + [status-im.ui.components.icons.vector-icons :as icons] + [clojure.string :as string] + [status-im.chat.styles.message.message :as message.style] + [status-im.chat.views.message.message :as message] + [status-im.utils.gfycat.core :as gfycat.core] + [taoensso.timbre :as log] + [status-im.utils.gfycat.core :as gfycat] + [status-im.constants :as constants] + [status-im.utils.identicon :as identicon] + [status-im.utils.datetime :as time] + [status-im.utils.utils :as utils] + [status-im.ui.components.react :as react] + [status-im.ui.components.connectivity.view :as connectivity] + [status-im.ui.components.colors :as colors] + [status-im.chat.views.message.datemark :as message.datemark] + [status-im.ui.screens.desktop.main.tabs.profile.views :as profile.views] + [status-im.ui.components.icons.vector-icons :as vector-icons] + [status-im.ui.screens.desktop.main.chat.styles :as styles] + [status-im.utils.contacts :as utils.contacts] + [status-im.i18n :as i18n] + [status-im.ui.screens.desktop.main.chat.events :as chat.events])) (views/defview toolbar-chat-view [{:keys [chat-id color public-key public? group-chat] - :as current-chat}] -(views/letsubs [chat-name [:get-current-chat-name] - {:keys [pending? whisper-identity photo-path]} [:get-current-chat-contact]] - [react/view {:style styles/toolbar-chat-view} - [react/view {:style {:flex-direction :row - :flex 1}} - (if public? - [react/view {:style (styles/topic-image color)} - [react/text {:style styles/topic-text} - (string/capitalize (second chat-name))]] - [react/image {:style styles/chat-icon - :source {:uri photo-path}}]) - [react/view {:style (styles/chat-title-and-type pending?)} - [react/text {:style styles/chat-title - :font :medium} - chat-name] - (cond pending? - [react/text {:style styles/add-contact-text - :on-press #(re-frame/dispatch [:add-contact whisper-identity])} - (i18n/label :t/add-to-contacts)] - public? - [react/text {:style styles/public-chat-text} - (i18n/label :t/public-chat)])]] - #_[react/view - [react/popup-menu - [react/popup-menu-trigger {:text "Popup test"}] - [react/popup-menu-options - [react/popup-menu-option {:text "First"}] - [react/popup-menu-option {:text "Second"}]]]] + :as current-chat}] + (views/letsubs [chat-name [:get-current-chat-name] + {:keys [pending? whisper-identity photo-path]} [:get-current-chat-contact]] + [react/view {:style styles/toolbar-chat-view} + [react/view {:style {:flex-direction :row + :flex 1}} + (if public? + [react/view {:style (styles/topic-image color)} + [react/text {:style styles/topic-text} + (string/capitalize (second chat-name))]] + [react/image {:style styles/chat-icon + :source {:uri photo-path}}]) + [react/view {:style (styles/chat-title-and-type pending?)} + [react/text {:style styles/chat-title + :font :medium} + chat-name] + (cond pending? + [react/text {:style styles/add-contact-text + :on-press #(re-frame/dispatch [:add-contact whisper-identity])} + (i18n/label :t/add-to-contacts)] + public? + [react/text {:style styles/public-chat-text} + (i18n/label :t/public-chat)])]] + #_[react/view + [react/popup-menu + [react/popup-menu-trigger {:text "Popup test"}] + [react/popup-menu-options + [react/popup-menu-option {:text "First"}] + [react/popup-menu-option {:text "Second"}]]]] [react/view (when (and (not group-chat) (not public?)) [react/text {:style (styles/profile-actions-text colors/black) From d9e7d7c88789640231a9735b1ab4b924c40b5088 Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Thu, 13 Sep 2018 12:19:56 +0300 Subject: [PATCH 15/16] Test commit for inverted feature --- src/status_im/ui/screens/desktop/main/chat/views.cljs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/status_im/ui/screens/desktop/main/chat/views.cljs b/src/status_im/ui/screens/desktop/main/chat/views.cljs index 6e942ca3f0..310cbcf50f 100644 --- a/src/status_im/ui/screens/desktop/main/chat/views.cljs +++ b/src/status_im/ui/screens/desktop/main/chat/views.cljs @@ -156,12 +156,13 @@ scroll-height (atom nil) _ (when (or (not @chat-id*) (not= @chat-id* chat-id)) (reset! chat-id* chat-id) - (js/setTimeout #(when @scroll-ref (.scrollToEnd @scroll-ref)) 400))] + #_(js/setTimeout #(when @scroll-ref (.scrollToEnd @scroll-ref)) 400))] [react/view {:style styles/messages-view} [react/scroll-view {:scrollEventThrottle 16 :headerHeight styles/messages-list-vertical-padding :footerWidth styles/messages-list-vertical-padding :enableArrayScrollingOptimization true + :inverted true :on-scroll (fn [e] (let [ne (.-nativeEvent e) y (.-y (.-contentOffset ne))] @@ -173,7 +174,7 @@ :ref #(reset! scroll-ref %)} [react/view (doall - (for [[index {:keys [from content message-id type value] :as message-obj}] (map-indexed vector (reverse messages))] + (for [[index {:keys [from content message-id type value] :as message-obj}] (map-indexed vector messages)] ^{:key message-obj} [message content (= from current-public-key) (assoc message-obj :group-chat group-chat From 62ba35972b98ab09bdc17f5cdccc8b341ebc45c5 Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Thu, 13 Sep 2018 12:48:47 +0300 Subject: [PATCH 16/16] Remove on-content-size-change handler --- src/status_im/ui/screens/desktop/main/chat/views.cljs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/status_im/ui/screens/desktop/main/chat/views.cljs b/src/status_im/ui/screens/desktop/main/chat/views.cljs index 310cbcf50f..a558d6520f 100644 --- a/src/status_im/ui/screens/desktop/main/chat/views.cljs +++ b/src/status_im/ui/screens/desktop/main/chat/views.cljs @@ -170,7 +170,6 @@ (when @scroll-timer (js/clearTimeout @scroll-timer)) (reset! scroll-timer (js/setTimeout #(re-frame/dispatch [:load-more-messages]) 300))) (reset! scroll-height (+ y (.-height (.-layoutMeasurement ne)))))) - :on-content-size-change #(.scrollToEnd @scroll-ref) :ref #(reset! scroll-ref %)} [react/view (doall