Skip to content

Commit 11b89cc

Browse files
committed
wip: mark as untrusted option & drawer
1 parent 223af91 commit 11b89cc

File tree

3 files changed

+32
-18
lines changed

3 files changed

+32
-18
lines changed

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

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

133+
(defn mark-as-untrusted-action
134+
[{:keys [public-key] :as item}]
135+
(hide-sheet-and-dispatch
136+
[:show-bottom-sheet
137+
{:content (fn []
138+
[confirmation-drawer/confirmation-drawer
139+
{:title (i18n/label :t/mark-as-untrusted)
140+
:description (i18n/label :t/mark-as-untrusted-description
141+
{:username (:primary-name item)})
142+
:context item
143+
:accessibility-label :block-user
144+
:button-text (i18n/label :t/mark-as-untrusted-button)
145+
:on-press #(print "Not implemented")}])}]))
146+
133147
(defn mute-chat-entry
134148
[chat-id chat-type muted-till]
135149
(let [muted? (rf/sub [:chats/muted chat-id])]
@@ -260,7 +274,7 @@
260274
(entry {:icon :i/remove-user
261275
:label (i18n/label :t/remove-from-contacts)
262276
:on-press #(hide-sheet-and-dispatch [:contact.ui/remove-contact-pressed contact])
263-
:danger? false
277+
:danger? true
264278
:accessibility-label :remove-from-contacts
265279
:sub-label nil
266280
:chevron? false}))
@@ -300,14 +314,14 @@
300314
:sub-label nil
301315
:chevron? false}))
302316

303-
;; TODO(OmarBasem): Requires status-go impl.
304317
(defn mark-untrustworthy-entry
305-
[]
306-
(entry {:icon :i/alert
307-
:label (i18n/label :t/mark-untrustworthy)
308-
:on-press #(js/alert "TODO: to be implemented, requires status-go impl.")
318+
[item]
319+
(entry {:icon :i/untrustworthy
320+
:label (i18n/label :t/mark-as-untrusted)
321+
;; :on-press #(js/alert "TODO: to be implemented, requires status-go impl.")
322+
:on-press #(mark-as-untrusted-action item)
309323
:danger? true
310-
:accessibility-label :mark-untrustworthy
324+
:accessibility-label :mark-as-untrusted
311325
:sub-label nil
312326
:chevron? false
313327
:add-divider? true}))
@@ -437,6 +451,7 @@
437451

438452
(defn contact-actions
439453
[{:keys [public-key added?] :as contact} {:keys [chat-id admin?] :as extra-data}]
454+
(tap> contact)
440455
(let [current-pub-key (rf/sub [:multiaccount/public-key])]
441456
[quo/action-drawer
442457
[[(view-profile-entry public-key)
@@ -445,8 +460,7 @@
445460
(show-qr-entry public-key)
446461
(share-profile-entry public-key)]
447462
[(when-not (= current-pub-key public-key)
448-
(when config/show-not-implemented-features?
449-
(mark-untrustworthy-entry)))
463+
(mark-untrustworthy-entry contact))
450464
(when added? (remove-from-contacts-entry contact))
451465
(when-not (= current-pub-key public-key) (block-user-entry contact))]
452466
(when (and admin? chat-id)

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[quo.core :as quo]
44
[react-native.core :as rn]
55
[status-im.common.not-implemented :as not-implemented]
6-
[status-im.config :as config]
76
[status-im.constants :as constants]
87
[status-im.contexts.profile.contact.add-nickname.view :as add-nickname]
98
[status-im.contexts.profile.contact.block-contact.view :as block-contact]
@@ -87,13 +86,12 @@
8786
:add-divider? true
8887
:accessibility-label :remove-nickname
8988
:danger? true})
90-
(when config/show-not-implemented-features?
91-
{:icon :i/untrustworthy
92-
:label (i18n/label :t/mark-untrustworthy)
93-
:on-press not-implemented/alert
94-
:accessibility-label :mark-untrustworthy
95-
:add-divider? (when-not has-nickname? true)
96-
:danger? true})
89+
{:icon :i/untrustworthy
90+
:label (i18n/label :t/mark-as-untrusted)
91+
:on-press not-implemented/alert
92+
:accessibility-label :mark-as-untrusted
93+
:add-divider? (when-not has-nickname? true)
94+
:danger? true}
9795
(when (= constants/contact-request-state-mutual contact-request-state)
9896
{:icon :i/remove-user
9997
:label (i18n/label :t/remove-contact)

translations/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1604,7 +1604,9 @@
16041604
"mark-all-notifications-as-read": "Mark all notifications as read",
16051605
"mark-all-read": "Mark all read",
16061606
"mark-as-read": "Mark as read",
1607-
"mark-untrustworthy": "Mark as Untrustworthy",
1607+
"mark-as-untrusted": "Mark as untrusted",
1608+
"mark-as-untrusted-button": "Mark",
1609+
"mark-as-untrusted-description": "{{username}} will be marked as untrusted. This mark will only be visible to you.",
16081610
"mark-user-untrustworthy": "Mark {{username}} as untrustworthy",
16091611
"market": "Market",
16101612
"market-cap": "Market cap",

0 commit comments

Comments
 (0)