Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alwx committed Feb 8, 2024
1 parent 1d14ef0 commit 30da1e3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
24 changes: 12 additions & 12 deletions src/status_im/contexts/chat/home/add_new_contact/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

(declare build-contact)

(defn set-new-identity
(defn- set-new-identity
[{:keys [db]} [{:keys [input build-success-fn failure-fn]}]]
(let [user-public-key (get-in db [:profile/profile :public-key])
{:keys [input id ens state]
Expand Down Expand Up @@ -130,18 +130,18 @@

(re-frame/reg-event-fx :contacts/set-new-identity set-new-identity)

(defn set-new-identity-success
(defn- set-new-identity-success
[{:keys [db]} [{:keys [input pubkey build-success-fn]}]]
(let [contact (get-in db [:contacts/new-identity])]
(when (= (:input contact) input)
(merge {:db (assoc db :contacts/new-identity (->state (assoc contact :public-key pubkey)))}
(build-contact {:pubkey pubkey
:ens (:ens contact)
:success-fn build-success-fn})))))
{:db (assoc db :contacts/new-identity (->state (assoc contact :public-key pubkey)))
:dispatch [:contacts/build-contact {:pubkey pubkey
:ens (:ens contact)
:success-fn build-success-fn}]})))

(re-frame/reg-event-fx :contacts/set-new-identity-success set-new-identity-success)

(defn set-new-identity-error
(defn- set-new-identity-error
[{:keys [db]} [{:keys [input err failure-fn]}]]
(let [contact (get-in db [:contacts/new-identity])]
(when (= (:input contact) input)
Expand All @@ -159,8 +159,8 @@

(re-frame/reg-event-fx :contacts/set-new-identity-error set-new-identity-error)

(defn build-contact
[{:keys [pubkey ens success-fn]}]
(defn- build-contact
[_ [{:keys [pubkey ens success-fn]}]]
{:json-rpc/call [{:method "wakuext_buildContact"
:params [{:publicKey pubkey
:ENSName ens}]
Expand All @@ -170,17 +170,17 @@
:contact (data-store.contacts/<-rpc-js %)
:success-fn success-fn}])}]})

(re-frame/reg-event-fx :contacts/build-contact (fn [_ [contact-data]] (build-contact contact-data)))
(re-frame/reg-event-fx :contacts/build-contact build-contact)

(defn build-contact-success
(defn- build-contact-success
[{:keys [db]} [{:keys [pubkey contact success-fn]}]]
(merge {:db (assoc-in db [:contacts/contacts pubkey] contact)}
(when success-fn
(success-fn contact))))

(re-frame/reg-event-fx :contacts/build-contact-success build-contact-success)

(defn clear-new-identity
(defn- clear-new-identity
[{:keys [db]}]
{:db (dissoc db :contacts/new-identity)})

Expand Down
5 changes: 2 additions & 3 deletions src/status_im/contexts/chat/home/add_new_contact/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
[quo/text (style/text-title) (i18n/label :t/add-a-contact)]
[quo/text (style/text-subtitle) (i18n/label :t/find-your-friends)]])

;; TODO(alwx): check why it is not filled
(defn- search-input
[]
(reagent/with-let [input-value (reagent/atom nil)
Expand Down Expand Up @@ -111,8 +110,8 @@

(defn new-contact
[]
(let [{:keys [public-key ens state msg] :as i} (rf/sub [:contacts/new-identity])
customization-color (rf/sub [:profile/customization-color])]
(let [{:keys [public-key ens state msg]} (rf/sub [:contacts/new-identity])
customization-color (rf/sub [:profile/customization-color])]
[rn/keyboard-avoiding-view {:style {:flex 1}}
[rn/touchable-without-feedback {:on-press rn/dismiss-keyboard!}
[rn/view {:style (style/container-outer)}
Expand Down
1 change: 0 additions & 1 deletion src/status_im/contexts/communities/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@

(rf/reg-event-fx :communities/navigate-to-community-overview
(fn [cofx [deserialized-key]]
(js/console.log "ALWX KEY" deserialized-key)
(if (string/starts-with? deserialized-key constants/serialization-key)
(navigate-to-serialized-community cofx deserialized-key)
(rf/merge
Expand Down
6 changes: 3 additions & 3 deletions src/status_im/contexts/shell/qr_reader/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@
(let [address (extract-id scanned-text)]
(cond
(text-for-url-path? scanned-text router/community-with-data-path)
;; TODO(alwx): community link, to be implemented
;; TODO: https://github.com/status-im/status-mobile/issues/18743
nil

(text-for-url-path? scanned-text router/channel-path)
;; TODO(alwx): channel link, to be implemented
;; TODO: https://github.com/status-im/status-mobile/issues/18743
nil

(text-for-url-path? scanned-text router/user-with-data-path)
Expand All @@ -74,7 +74,7 @@
(debounce/debounce-and-dispatch [:navigate-to :wallet-accounts address] 300)

(pairing-qr-code? scanned-text)
;; TODO(alwx): pairing link, to be implemented
;; TODO: https://github.com/status-im/status-mobile/issues/18744
nil

:else
Expand Down

0 comments on commit 30da1e3

Please sign in to comment.