Skip to content

Commit cdbd85f

Browse files
authored
[#13690] Fix visibility status color (#13747)
1 parent 647dfc7 commit cdbd85f

File tree

8 files changed

+105
-110
lines changed

8 files changed

+105
-110
lines changed

src/status_im/db.cljs

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
:sync-state :done
1414
:link-previews-whitelist []
1515
:app-state "active"
16-
:wallet wallet.db/default-wallet
16+
:wallet wallet.db/default-wallet
1717
:wallet/all-tokens {}
1818
:peers-count 0
1919
:node-info {}
@@ -34,9 +34,9 @@
3434
:registry {}
3535
:visibility-status-updates {}
3636
:stickers/packs-pending #{}
37-
:keycard {:nfc-enabled? false
38-
:pin {:original []
39-
:confirmation []
40-
:current []
41-
:puk []
42-
:enter-step :original}}})
37+
:keycard {:nfc-enabled? false
38+
:pin {:original []
39+
:confirmation []
40+
:current []
41+
:puk []
42+
:enter-step :original}}})

src/status_im/ui/components/chat_icon/screen.cljs

+6-35
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,6 @@
6363
[react/view {:style dot-styles
6464
:accessibility-label dot-accessibility-label}])]))
6565

66-
(defn profile-photo-plus-dot-view-old
67-
[{:keys [public-key photo-container photo-path community?]}]
68-
(let [photo-path (if (nil? photo-path)
69-
@(re-frame.core/subscribe [:chats/photo-path public-key])
70-
photo-path)
71-
photo-container (if (nil? photo-container)
72-
styles/container-chat-list photo-container)
73-
size (:width photo-container)
74-
identicon? (when photo-path (profile.db/base64-png? photo-path))
75-
dot-styles (visibility-status-utils/icon-visibility-status-dot-old
76-
public-key size identicon?)
77-
dot-accessibility-label (:accessibility-label dot-styles)]
78-
[react/view {:style photo-container
79-
:accessibility-label :profile-photo}
80-
[photos/photo photo-path {:size size}]
81-
(when-not community?
82-
[react/view {:style dot-styles
83-
:accessibility-label dot-accessibility-label}])]))
84-
8566
(defn emoji-chat-icon-view
8667
[chat-id group-chat name emoji styles]
8768
[react/view (:container styles)
@@ -92,16 +73,6 @@
9273
[profile-photo-plus-dot-view {:public-key chat-id
9374
:photo-container (:default-chat-icon styles)}])])
9475

95-
(defn emoji-chat-icon-view-old
96-
[chat-id group-chat name emoji styles]
97-
[react/view (:container styles)
98-
(if group-chat
99-
(if (string/blank? emoji)
100-
[default-chat-icon name styles]
101-
[emoji-chat-icon emoji styles])
102-
[profile-photo-plus-dot-view-old {:public-key chat-id
103-
:photo-container (:default-chat-icon styles)}])])
104-
10576
(defn chat-icon-view-toolbar
10677
[chat-id group-chat name color emoji]
10778
[emoji-chat-icon-view chat-id group-chat name emoji
@@ -169,7 +140,7 @@
169140
(if group-chat
170141
[default-chat-icon icon-text styles]
171142
(let [photo-path @(re-frame.core/subscribe [:chats/photo-path chat-id])]
172-
(if-not (string/blank? photo-path)
143+
(when-not (string/blank? photo-path)
173144
[photos/photo photo-path styles]))))
174145

175146
(defn emoji-chat-intro-icon-view [icon-text chat-id group-chat emoji styles]
@@ -178,7 +149,7 @@
178149
[default-chat-icon icon-text styles]
179150
[emoji-chat-icon emoji styles])
180151
(let [photo-path @(re-frame.core/subscribe [:chats/photo-path chat-id])]
181-
(if-not (string/blank? photo-path)
152+
(when-not (string/blank? photo-path)
182153
[photos/photo photo-path styles]))))
183154

184155
(defn profile-icon-view
@@ -192,10 +163,10 @@
192163
(styles/emoji-chat-icon-text size))} override-styles)]
193164
[react/view (:container styles)
194165
(if (and photo-path (seq photo-path))
195-
[profile-photo-plus-dot-view-old {:photo-path photo-path
196-
:public-key public-key
197-
:photo-container (:container styles)
198-
:community? community?}]
166+
[profile-photo-plus-dot-view {:photo-path photo-path
167+
:public-key public-key
168+
:photo-container (:container styles)
169+
:community? community?}]
199170
(if (string/blank? emoji)
200171
[default-chat-icon name styles]
201172
[emoji-chat-icon emoji styles]))

src/status_im/ui/screens/communities/members.cljs

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@
4545
my-public-key
4646
can-manage-users?
4747
can-kick-users?]}]
48-
(let [member (<sub [:contacts/contact-by-identity public-key])
48+
(let [member (<sub [:contacts/contact-by-identity public-key])
4949
[first-name second-name] (<sub [:contacts/contact-two-names-by-identity public-key])]
5050
[quo/list-item
5151
{:title first-name
5252
:subtitle second-name
5353
:accessibility-label :member-item
54-
:icon [chat-icon/profile-photo-plus-dot-view-old
55-
{:public-key public-key
56-
:photo-path (multiaccounts/displayed-photo member)}]
54+
:icon [chat-icon/profile-photo-plus-dot-view
55+
{:public-key public-key
56+
:photo-path (multiaccounts/displayed-photo member)}]
5757
:accessory (when (not= public-key my-public-key)
5858
[quo/button {:on-press
5959
#(>evt [:bottom-sheet/show-sheet

src/status_im/ui/screens/contacts_list/views.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
[quo/list-item
1616
{:title first-name
1717
:subtitle second-name
18-
:icon [chat-icon.screen/profile-photo-plus-dot-view-old
18+
:icon [chat-icon.screen/profile-photo-plus-dot-view
1919
{:public-key public-key
2020
:photo-path (multiaccounts/displayed-photo contact)}]
2121
:chevron true

src/status_im/ui/screens/home/views/inner_item.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@
259259
[react/touchable-opacity (merge {:style {:height 64 :background-color background-color}} opts)
260260
[:<>
261261
[chat-item-icon muted (and group-chat (not public?)) (and group-chat public?)]
262-
[chat-icon.screen/emoji-chat-icon-view-old chat-id group-chat chat-name emoji
262+
[chat-icon.screen/emoji-chat-icon-view chat-id group-chat chat-name emoji
263263
{:container (assoc chat-icon.styles/container-chat-list
264264
:top 12 :left 16 :position :absolute)
265265
:size 40
@@ -279,4 +279,4 @@
279279
(:whisper-timestamp last-message)
280280
timestamp))]
281281
[unviewed-indicator-old home-item]])
282-
[message-content-text (select-keys last-message [:content :content-type :community-id]) true]]]))
282+
[message-content-text (select-keys last-message [:content :content-type :community-id]) true]]]))

src/status_im/ui/screens/profile/visibility_status/styles.cljs

+20-17
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,27 @@
1414
:padding 6
1515
:padding-right 12})
1616

17-
(defn visibility-status-dot [dot-color size]
18-
{:background-color dot-color
19-
:width size
20-
:height size
21-
:border-radius (/ size 2)
22-
:border-width 3.5
23-
:border-color (quo2.colors/theme-colors quo2.colors/white quo2.colors/neutral-90)})
17+
(defn visibility-status-dot
18+
[{:keys [color size new-ui?]}]
19+
(if new-ui?
20+
{:background-color color
21+
:width size
22+
:height size
23+
:border-radius (/ size 2)
24+
:border-width 3.5
25+
:border-color (quo2.colors/theme-colors quo2.colors/white quo2.colors/neutral-90)}
26+
{:background-color color
27+
:width size
28+
:height size
29+
:border-radius (/ size 2)
30+
:border-width 1
31+
:border-color colors/white}))
2432

25-
(defn visibility-status-dot-old [dot-color size]
26-
{:background-color dot-color
27-
:width size
28-
:height size
29-
:border-radius (/ size 2)
30-
:border-width 1
31-
:border-color colors/white})
32-
33-
(defn visibility-status-profile-dot-old [color size border-width margin-left]
34-
(merge (visibility-status-dot-old color size)
33+
(defn visibility-status-profile-dot
34+
[{:keys [color size border-width margin-left new-ui?]}]
35+
(merge (visibility-status-dot {:color color
36+
:size size
37+
:new-ui? new-ui?})
3538
{:margin-right 6
3639
:margin-left margin-left
3740
:border-width border-width}))

src/status_im/ui/screens/profile/visibility_status/utils.cljs

+46-35
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
(ns status-im.ui.screens.profile.visibility-status.utils
2-
(:require [status-im.constants :as constants]
2+
(:require [clojure.string :as string]
3+
[quo.design-system.colors :as colors]
4+
[quo2.foundations.colors :as quo2.colors]
5+
[status-im.constants :as constants]
36
[status-im.i18n.i18n :as i18n]
47
[status-im.ui.screens.profile.visibility-status.styles :as styles]
5-
[status-im.utils.handlers :refer [<sub]]
8+
[status-im.utils.config :as config]
69
[status-im.utils.datetime :as datetime]
7-
[quo.design-system.colors :as colors]
8-
[clojure.string :as string]
9-
[quo2.foundations.colors :as quo2.colors]))
10+
[status-im.utils.handlers :refer [<sub]]))
1011

1112
;; Specs:
1213
;; :visibility-status-automatic
@@ -73,53 +74,63 @@
7374
constants/visibility-status-inactive
7475
status-type)))
7576

76-
(defn dot-color [{:keys [status-type] :or {status-type constants/visibility-status-inactive}}]
77-
(:color (get visibility-status-type-data status-type)))
78-
79-
(defn dot-color-old [{:keys [status-type] :or {status-type constants/visibility-status-inactive}}]
80-
(:color (get visibility-status-type-data-old status-type)))
77+
(defn icon-dot-color [{:keys [status-type] :or {status-type constants/visibility-status-inactive}}]
78+
(if @config/new-ui-enabled?
79+
(:color (get visibility-status-type-data status-type))
80+
(:color (get visibility-status-type-data-old status-type))))
8181

8282
(defn my-icon? [public-key]
8383
(or (string/blank? public-key)
8484
(= public-key (<sub [:multiaccount/public-key]))))
8585

86-
(defn visibility-status-update [public-key my-icon?]
86+
(defn visibility-status-update
87+
[public-key my-icon?]
8788
(if my-icon?
8889
(<sub [:multiaccount/current-user-visibility-status])
8990
(<sub [:visibility-status-updates/visibility-status-update public-key])))
9091

91-
(defn icon-visibility-status-dot [public-key container-size _]
92-
(let [my-icon? (my-icon? public-key)
93-
visibility-status-update (visibility-status-update public-key my-icon?)
94-
size (/ container-size 2.4)
95-
margin -2
96-
dot-color (dot-color visibility-status-update)
97-
accessibility-label (if (= dot-color quo2.colors/color-online)
98-
:online-profile-photo-dot
99-
:offline-profile-photo-dot)]
100-
(merge (styles/visibility-status-dot dot-color size)
101-
{:bottom margin
102-
:right margin
103-
:position :absolute
104-
:accessibility-label accessibility-label})))
92+
(defn icon-dot-accessibility-label
93+
[dot-color]
94+
(if @config/new-ui-enabled?
95+
(if (= dot-color quo2.colors/color-online)
96+
:online-profile-photo-dot
97+
:offline-profile-photo-dot)
98+
(if (= dot-color colors/color-online)
99+
:online-profile-photo-dot
100+
:offline-profile-photo-dot)))
101+
102+
(defn icon-dot-margin
103+
[size identicon?]
104+
(if @config/new-ui-enabled?
105+
-2
106+
(if identicon?
107+
(/ size 6)
108+
(/ size 7))))
109+
110+
(defn icon-dot-size
111+
[container-size]
112+
(if @config/new-ui-enabled?
113+
(/ container-size 2.4)
114+
(/ container-size 4)))
105115

106-
(defn icon-visibility-status-dot-old [public-key container-size identicon?]
116+
(defn icon-visibility-status-dot
117+
[public-key container-size identicon?]
107118
(let [my-icon? (my-icon? public-key)
108119
visibility-status-update (visibility-status-update public-key my-icon?)
109-
size (/ container-size 4)
110-
margin (if identicon? (/ size 6) (/ size 7))
111-
dot-color (dot-color-old visibility-status-update)
112-
accessibility-label (if (= dot-color colors/color-online)
113-
:online-profile-photo-dot
114-
:offline-profile-photo-dot)]
115-
(merge (styles/visibility-status-dot-old dot-color size)
120+
size (icon-dot-size container-size)
121+
margin (icon-dot-margin size identicon?)
122+
dot-color (icon-dot-color visibility-status-update)
123+
new-ui? @config/new-ui-enabled?]
124+
(merge (styles/visibility-status-dot {:color dot-color
125+
:size size
126+
:new-ui? new-ui?})
116127
{:bottom margin
117128
:right margin
118129
:position :absolute
119-
:accessibility-label accessibility-label})))
130+
:accessibility-label (icon-dot-accessibility-label dot-color)})))
120131

121132
(defn visibility-status-order [public-key]
122133
(let [my-icon? (my-icon? public-key)
123134
visibility-status-update (visibility-status-update public-key my-icon?)
124-
dot-color (dot-color visibility-status-update)]
135+
dot-color (icon-dot-color visibility-status-update)]
125136
(if (= dot-color colors/color-online) 0 1)))

src/status_im/ui/screens/profile/visibility_status/views.cljs

+19-9
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
[quo.react-native :as rn]
77
[re-frame.core :as re-frame]
88
[reagent.core :as reagent]
9+
[status-im.constants :as constants]
910
[status-im.ui.components.animation :as anim]
1011
[status-im.ui.components.react :as react]
11-
[status-im.utils.platform :as platform]
12-
[status-im.utils.handlers :refer [<sub]]
13-
[status-im.constants :as constants]
1412
[status-im.ui.screens.profile.visibility-status.styles :as styles]
15-
[status-im.ui.screens.profile.visibility-status.utils :as utils]))
13+
[status-im.ui.screens.profile.visibility-status.utils :as utils]
14+
[status-im.utils.config :as config]
15+
[status-im.utils.handlers :refer [<sub]]
16+
[status-im.utils.platform :as platform]))
1617

1718
;; === Code Related to visibility-status-button ===
1819

@@ -33,13 +34,22 @@
3334
(defn profile-visibility-status-dot [status-type color]
3435
(let [automatic? (= status-type
3536
constants/visibility-status-automatic)
36-
[border-width margin-left size] (if automatic? [1 -10 12] [0 6 10])]
37+
[border-width margin-left size] (if automatic? [1 -10 12] [0 6 10])
38+
new-ui? @config/new-ui-enabled?]
3739
[:<>
3840
(when automatic?
39-
[rn/view {:style (styles/visibility-status-profile-dot-old
40-
colors/color-inactive size border-width 6)}])
41-
[rn/view {:style (styles/visibility-status-profile-dot-old
42-
color size border-width margin-left)}]]))
41+
[rn/view {:style (styles/visibility-status-profile-dot
42+
{:color colors/color-inactive
43+
:size size
44+
:border-width border-width
45+
:margin-left 6
46+
:new-ui? new-ui?})}])
47+
[rn/view {:style (styles/visibility-status-profile-dot
48+
{:color color
49+
:size size
50+
:border-width border-width
51+
:margin-left margin-left
52+
:new-ui? new-ui?})}]]))
4353

4454
(defn visibility-status-button [on-press props]
4555
(let [logged-in? (<sub [:multiaccount/logged-in?])

0 commit comments

Comments
 (0)