|
6 | 6 | [status-im.constants :as constants] |
7 | 7 | [taoensso.timbre :as log] |
8 | 8 | [utils.i18n :as i18n] |
9 | | - [utils.re-frame :as rf])) |
| 9 | + [utils.re-frame :as rf] |
| 10 | + [status-im.contexts.profile.utils :as profile.utils])) |
10 | 11 |
|
11 | 12 | (rf/reg-event-fx :contact/mark-as-untrusted-success |
12 | 13 | (fn [{:keys [db]} [contact-id name]] |
|
45 | 46 | :on-error #(log/error "failed remove contact trust status" % contact-id)}]})) |
46 | 47 |
|
47 | 48 | (rf/reg-event-fx :contact/mark-as-untrusted-sheet |
48 | | - (fn [_ [{:keys [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 :mark-as-untrustworthy |
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]))}])}]})) |
| 49 | + (fn [_ [{:keys [public-key] :as contact}]] |
| 50 | + (let [name (profile.utils/displayed-name contact)] |
| 51 | + {:dispatch |
| 52 | + [:show-bottom-sheet |
| 53 | + {:content (fn [] |
| 54 | + [confirmation-drawer/confirmation-drawer |
| 55 | + {:title (i18n/label :t/mark-as-untrusted) |
| 56 | + :description (i18n/label :t/mark-as-untrusted-description |
| 57 | + {:username (:primary-name contact)}) |
| 58 | + :extra-action (fn [] |
| 59 | + (rf/dispatch [:toasts/upsert |
| 60 | + {:id :remove-contact |
| 61 | + :type :positive |
| 62 | + :text (->> (i18n/label |
| 63 | + :t/removed-from-contacts) |
| 64 | + (string/lower-case) |
| 65 | + (str name " "))}]) |
| 66 | + (rf/dispatch [:contact.ui/remove-contact-pressed contact])) |
| 67 | + :extra-text (i18n/label :t/remove-contact) |
| 68 | + :context contact |
| 69 | + :accessibility-label :mark-as-untrustworthy |
| 70 | + :button-text (i18n/label :t/mark-as-untrusted-button) |
| 71 | + :on-press (fn [] |
| 72 | + (rf/dispatch [:hide-bottom-sheet]) |
| 73 | + (rf/dispatch |
| 74 | + [:contact/mark-as-untrusted |
| 75 | + public-key name]))}])}]}))) |
0 commit comments