Skip to content

Commit 06b5e98

Browse files
committed
self reivew changes
1 parent cc75de0 commit 06b5e98

File tree

8 files changed

+43
-38
lines changed

8 files changed

+43
-38
lines changed

src/status_im/common/confirmation_drawer/style.cljs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44
{:flex-direction :row
55
:justify-content :space-between
66
:margin-top 25})
7+
8+
(def context-tag
9+
{:margin-bottom 12
10+
:margin-top 4})

src/status_im/common/confirmation_drawer/view.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
:full-name display-name
5050
:group-name display-name
5151
:customization-color color
52-
:container-style {:margin-bottom 12 :margin-top 4}
52+
:container-style style/context-tag
5353
:size 24}]
5454
[quo/text description]
5555
[extra-action-view extra-action extra-text extra-action-selected?]

src/status_im/common/contact_list_item/view.cljs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
(ns status-im.common.contact-list-item.view
22
(:require
33
[quo.core :as quo]
4+
[react-native.core :as rn]
45
[status-im.constants :as constants]
56
[utils.address :as address]
67
[utils.re-frame :as rf]))
@@ -12,7 +13,10 @@
1213
theme]
1314
(let [photo-path (rf/sub [:chats/photo-path public-key])
1415
online? (rf/sub [:visibility-status-updates/online? public-key])
15-
untrustworthy? (= constants/contact-trust-status-untrustworthy trust-status)
16+
untrustworthy? (rn/use-memo
17+
(fn []
18+
(= constants/contact-trust-status-untrustworthy trust-status))
19+
[trust-status])
1620
customization-color (rf/sub [:profile/customization-color])]
1721
[quo/user
1822
{:customization-color customization-color

src/status_im/common/home/actions/view.cljs

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,13 @@
130130
:on-press #(hide-sheet-and-dispatch [:contact/block-contact
131131
public-key])}])}]))
132132

133-
(defn mark-as-untrusted-action
134-
[item]
133+
(defn handle-trust-mark-action
134+
[{:keys [public-key primary-name trust-status] :as item}]
135135
(hide-sheet-and-dispatch
136-
[:contact/mark-as-untrusted-sheet item]))
137-
138-
(defn remove-untrusted-mark-action
139-
[{:keys [public-key primary-name]}]
140-
(hide-sheet-and-dispatch [:contact/remove-trust-status public-key primary-name]))
136+
(if (= trust-status
137+
constants/contact-trust-status-untrustworthy)
138+
[:contact/remove-trust-status public-key primary-name]
139+
[:contact/mark-as-untrusted-sheet item])))
141140

142141
(defn mute-chat-entry
143142
[chat-id chat-type muted-till]
@@ -311,21 +310,17 @@
311310

312311
(defn change-trust-status-entry
313312
[{:keys [trust-status] :as item}]
314-
(let [handle-press (if (= trust-status
315-
constants/contact-trust-status-untrustworthy)
316-
remove-untrusted-mark-action
317-
mark-as-untrusted-action)]
318-
(entry {:icon :i/untrustworthy
319-
:label (i18n/label (if (= trust-status
320-
constants/contact-trust-status-untrustworthy)
321-
:t/remove-untrusted-mark
322-
:t/mark-as-untrusted))
323-
:on-press #(handle-press item)
324-
:danger? true
325-
:add-divider? true
326-
:accessibility-label :mark-as-untrusted
327-
:sub-label nil
328-
:chevron? false})))
313+
(entry {:icon :i/untrustworthy
314+
:label (i18n/label (if (= trust-status
315+
constants/contact-trust-status-untrustworthy)
316+
:t/remove-untrusted-mark
317+
:t/mark-as-untrusted))
318+
:on-press #(handle-trust-mark-action item)
319+
:danger? true
320+
:add-divider? true
321+
:accessibility-label :mark-as-untrusted
322+
:sub-label nil
323+
:chevron? false}))
329324

330325
(defn block-user-entry
331326
[item]

src/status_im/contexts/chat/home/chat_list_item/view.cljs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,10 @@
251251
(rf/sub [:contacts/contact-by-address chat-id]))
252252
unread-messages? (pos? unviewed-messages-count)
253253
trust-status (rf/sub [:contacts/contact-trust-status chat-id])
254-
untrustworthy? (= constants/contact-trust-status-untrustworthy trust-status)]
254+
untrustworthy? (rn/use-memo
255+
(fn []
256+
(= constants/contact-trust-status-untrustworthy trust-status))
257+
[trust-status])]
255258
[rn/view {:style {:flex-direction :row}}
256259
[avatar-view
257260
{:contact contact

src/status_im/contexts/contact/trust/events.cljs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
{:dispatch
5050
[:show-bottom-sheet
5151
{:content (fn []
52-
(tap> item)
5352
[confirmation-drawer/confirmation-drawer
5453
{:title (i18n/label :t/mark-as-untrusted)
5554
:description (i18n/label :t/mark-as-untrusted-description
@@ -64,7 +63,7 @@
6463
(rf/dispatch [:contact.ui/remove-contact-pressed item]))
6564
:extra-text (i18n/label :t/remove-contact)
6665
:context item
67-
:accessibility-label :block-user
66+
:accessibility-label :mark-as-untrustworthy
6867
:button-text (i18n/label :t/mark-as-untrusted-button)
6968
:on-press (fn []
7069
(rf/dispatch [:hide-bottom-sheet])

src/status_im/contexts/profile/contact/actions/view.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
(if untrustworthy?
6666
[:contact/remove-trust-status public-key full-name]
6767
[:contact/mark-as-untrusted-sheet contact])))
68-
[untrustworthy? contact])
68+
[untrustworthy? contact full-name public-key])
6969
on-remove-contact (rn/use-callback
7070
(fn []
7171
(rf/dispatch [:hide-bottom-sheet])

src/status_im/contexts/profile/contact/header/view.cljs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@
3535
theme (quo.context/use-theme)
3636
contact-status (rn/use-memo
3737
(fn []
38-
(let [is-contact? (= contact-request-state
39-
constants/contact-request-state-mutual)
40-
is-untrustworthy? (= trust-status
41-
constants/contact-trust-status-untrustworthy)]
38+
(let [contact? (= contact-request-state
39+
constants/contact-request-state-mutual)
40+
untrustworthy? (= trust-status
41+
constants/contact-trust-status-untrustworthy)]
4242
(cond
43-
(and is-contact?
44-
is-untrustworthy?) :untrustworthy-contact
45-
blocked? :blocked
46-
is-contact? :contact
47-
is-untrustworthy? :untrustworthy
48-
:else nil)))
43+
(and contact?
44+
untrustworthy?) :untrustworthy-contact
45+
blocked? :blocked
46+
contact? :contact
47+
untrustworthy? :untrustworthy
48+
:else nil)))
4949
[blocked? contact-request-state trust-status])
5050
on-start-chat (rn/use-callback
5151
#(rf/dispatch [:chat.ui/start-chat public-key ens-name])

0 commit comments

Comments
 (0)