File tree 4 files changed +21
-16
lines changed
ui/screens/profile/contact
status_im2/contexts/contacts
4 files changed +21
-16
lines changed Original file line number Diff line number Diff line change 82
82
(if-not validation-result
83
83
(if new-contact?
84
84
(rf/merge cofx
85
- (contact/add -contact chat-key nickname ens-name )
85
+ (contact/send -contact-request chat-key)
86
86
(navigation/navigate-to :contacts-list {}))
87
87
(chat/start-chat cofx chat-key ens-name))
88
88
{:utils/show-popup {:title (i18n/label :t/unable-to-read-this-code )
Original file line number Diff line number Diff line change 1
1
(ns status-im.contact.chat
2
2
(:require [re-frame.core :as re-frame]
3
3
[status-im2.contexts.contacts.events :as contact]
4
- [utils.re-frame :as rf ]
5
- [status-im2.navigation.events :as navigation ]))
4
+ [status-im2.navigation.events :as navigation ]
5
+ [utils.re-frame :as rf ]))
6
6
7
7
(rf/defn contact-code-submitted
8
8
{:events [:contact.ui/contact-code-submitted ]
11
11
(let [{:keys [public-key ens-name]} new-identity]
12
12
(rf/merge cofx
13
13
#(if new-contact?
14
- (contact/add -contact % public-key nickname ens-name )
14
+ (contact/send -contact-request % public-key)
15
15
{:dispatch [:chat.ui/start-chat public-key ens-name]})
16
16
#(when new-contact?
17
17
(navigation/navigate-back %)))))
Original file line number Diff line number Diff line change 36
36
:disabled blocked?
37
37
:accessibility-label :add-to-contacts-button
38
38
:action (when-not blocked?
39
- #(re-frame/dispatch [:contact.ui/add-contact-pressed public-key
40
- nil ens-name]))}])
39
+ (fn []
40
+ (re-frame/dispatch [:contact.ui/send-contact-request
41
+ public-key])))}])
41
42
[{:label (i18n/label (if (or muted? blocked?) :t/unmute :t/mute ))
42
43
:icon :main-icons/notification
43
44
:accessibility-label :mute-chat
Original file line number Diff line number Diff line change 75
75
[{:keys [db]} contacts]
76
76
{:db (assoc db :contacts/contacts (into {} (map #(vector (:public-key %) %) contacts)))})
77
77
78
- (rf/defn add-contact
79
- " Add a contact and set pending to false"
80
- {:events [:contact.ui/add-contact-pressed ]}
81
- [{:keys [db]} public-key nickname ens-name]
82
- (when (not= (get-in db [:multiaccount :public-key ]) public-key)
83
- {:json-rpc/call [{:method " wakuext_addContact"
84
- :params [{:id public-key :nickname nickname :ensName ens-name}]
85
- :js-response true
86
- :on-success #(rf/dispatch [:sanitize-messages-and-process-response %])
87
- :on-error #(log/error " failed to add contact" public-key %)}]}))
78
+ (rf/defn send-contact-request
79
+ {:events [:contact.ui/send-contact-request ]}
80
+ [{:keys [db]} id]
81
+ (when (not= id (get-in db [:multiaccount :public-key ]))
82
+ {:json-rpc/call
83
+ [{:method " wakuext_sendContactRequest"
84
+ :js-response true
85
+ :params [{:id id :message " Please add me to your contacts" }]
86
+ :on-error (fn [error]
87
+ (log/error " Failed to send contact request"
88
+ {:error error
89
+ :event :contact.ui/send-contact-request
90
+ :id id}))
91
+ :on-success #(rf/dispatch [:transport/message-sent %])}]}))
88
92
89
93
(rf/defn remove-contact
90
94
" Remove a contact from current account's contact list"
You can’t perform that action at this time.
0 commit comments