Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
alwx committed Feb 5, 2024
1 parent fa2fc4e commit 1ef4692
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
19 changes: 5 additions & 14 deletions src/status_im/contexts/chat/home/add_new_contact/events.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(ns status-im.contexts.chat.home.add-new-contact.events
(:require
[clojure.string :as string]
[re-frame.core :as re-frame]
[status-im.common.validators :as validators]
[status-im.contexts.chat.contacts.events :as data-store.contacts]
status-im.contexts.chat.home.add-new-contact.effects
Expand Down Expand Up @@ -89,18 +90,15 @@

(defn dispatcher [event input] (fn [arg] (rf/dispatch [event input arg])))

(rf/defn set-new-identity
{:events [:contacts/set-new-identity]}
[{:keys [db]} input scanned]
(defn set-new-identity
[{:keys [db]} [input]]
(let [user-public-key (get-in db [:profile/profile :public-key])
{:keys [input id ens state]
:as contact} (-> {:user-public-key user-public-key
:input input
:scanned scanned}
:input input}
init-contact
validate-contact)]
(case state

:empty {:db (dissoc db :contacts/new-identity)}
(:valid :invalid) {:db (assoc db :contacts/new-identity contact)}
:decompress-key {:db (assoc db :contacts/new-identity contact)
Expand All @@ -119,7 +117,7 @@
:on-error
(dispatcher :contacts/set-new-identity-error input)}})))


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

(rf/defn build-contact
{:events [:contacts/build-contact]}
Expand Down Expand Up @@ -170,13 +168,6 @@
[{:keys [db]}]
{:db (dissoc db :contacts/new-identity)})

(rf/defn qr-code-scanned
{:events [:contacts/qr-code-scanned]}
[{:keys [db] :as cofx} scanned]
(rf/merge cofx
(set-new-identity scanned scanned)
(navigation/navigate-back)))

(rf/defn set-new-identity-reconnected
[{:keys [db]}]
(let [input (get-in db [:contacts/new-identity :input])]
Expand Down
4 changes: 1 addition & 3 deletions src/status_im/contexts/shell/qr_reader/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
nil

(text-for-path? scanned-text router/user-with-data-path)
(do
(js/console.log "ALWX" scanned-text address)
(debounce/debounce-and-dispatch [:chat.ui/show-profile address] 300))
(debounce/debounce-and-dispatch [:contacts/set-new-identity address] 300)

(legacy-eth-address? scanned-text)
;; :wallet/scan-address-success
Expand Down

0 comments on commit 1ef4692

Please sign in to comment.