Skip to content

Commit 71ff67f

Browse files
committed
move mark as untrusted confirmation drawer to event
1 parent d6a7a3b commit 71ff67f

File tree

2 files changed

+31
-23
lines changed

2 files changed

+31
-23
lines changed

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

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -131,30 +131,9 @@
131131
public-key])}])}]))
132132

133133
(defn mark-as-untrusted-action
134-
[{:keys [public-key primary-name] :as item}]
135-
(tap> item)
134+
[item]
136135
(hide-sheet-and-dispatch
137-
[:show-bottom-sheet
138-
{:content (fn []
139-
[confirmation-drawer/confirmation-drawer
140-
{:title (i18n/label :t/mark-as-untrusted)
141-
:description (i18n/label :t/mark-as-untrusted-description
142-
{:username (:primary-name item)})
143-
:extra-action (fn []
144-
(rf/dispatch [:toasts/upsert
145-
{:id :remove-contact
146-
:type :positive
147-
:text (->> (i18n/label :t/removed-from-contacts)
148-
(string/lower-case)
149-
(str primary-name " "))}])
150-
(rf/dispatch [:contact.ui/remove-contact-pressed item]))
151-
:extra-text (i18n/label :t/remove-contact)
152-
:context item
153-
:accessibility-label :block-user
154-
:button-text (i18n/label :t/mark-as-untrusted-button)
155-
:on-press #(hide-sheet-and-dispatch
156-
[:contact/mark-as-untrusted
157-
public-key primary-name])}])}]))
136+
[:contact/mark-as-untrusted-sheet item]))
158137

159138
(defn remove-untrusted-mark-action
160139
[{:keys [public-key primary-name]}]

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
(ns status-im.contexts.contact.trust.events
22
(:require
3+
[clojure.string :as string]
34
[re-frame.core :as re-frame]
5+
[status-im.common.confirmation-drawer.view :as confirmation-drawer]
46
[status-im.constants :as constants]
57
[taoensso.timbre :as log]
68
[utils.i18n :as i18n]
@@ -41,3 +43,30 @@
4143
:params [contact-id]
4244
:on-success #(re-frame/dispatch [:contact/remove-trust-status-success contact-id name])
4345
:on-error #(log/error "failed remove contact trust status" % contact-id)}]}))
46+
47+
(rf/reg-event-fx :contact/mark-as-untrusted-sheet
48+
(fn [_ [public-key primary-name] :as item]
49+
{:dispatch
50+
[:show-bottom-sheet
51+
{:content (fn []
52+
[confirmation-drawer/confirmation-drawer
53+
{:title (i18n/label :t/mark-as-untrusted)
54+
:description (i18n/label :t/mark-as-untrusted-description
55+
{:username (:primary-name item)})
56+
:extra-action (fn []
57+
(rf/dispatch [:toasts/upsert
58+
{:id :remove-contact
59+
:type :positive
60+
:text (->> (i18n/label :t/removed-from-contacts)
61+
(string/lower-case)
62+
(str primary-name " "))}])
63+
(rf/dispatch [:contact.ui/remove-contact-pressed item]))
64+
:extra-text (i18n/label :t/remove-contact)
65+
:context item
66+
:accessibility-label :block-user
67+
:button-text (i18n/label :t/mark-as-untrusted-button)
68+
:on-press (fn []
69+
(rf/dispatch [:hide-bottom-sheet])
70+
(rf/dispatch
71+
[:contact/mark-as-untrusted
72+
public-key primary-name]))}])}]}))

0 commit comments

Comments
 (0)