Allow user to add contact by scanning their QR code (with a fake QR code reader) (#15076)
* Allow user to add contact by scanning their QR code * Newline * Small fix * Fix
This commit is contained in:
parent
8ff7a1630c
commit
1753ea0de0
|
@ -6,6 +6,7 @@
|
||||||
[status-im.ethereum.ens :as ens]
|
[status-im.ethereum.ens :as ens]
|
||||||
[status-im.ethereum.stateofus :as stateofus]
|
[status-im.ethereum.stateofus :as stateofus]
|
||||||
[status-im.native-module.core :as status]
|
[status-im.native-module.core :as status]
|
||||||
|
[status-im2.navigation.events :as navigation]
|
||||||
[status-im2.utils.validators :as validators]
|
[status-im2.utils.validators :as validators]
|
||||||
[status-im.utils.utils :as utils]))
|
[status-im.utils.utils :as utils]))
|
||||||
|
|
||||||
|
@ -109,3 +110,10 @@
|
||||||
{:events [:contacts/clear-new-identity :contacts/new-chat-focus]}
|
{:events [:contacts/clear-new-identity :contacts/new-chat-focus]}
|
||||||
[{:keys [db]}]
|
[{:keys [db]}]
|
||||||
{:db (dissoc db :contacts/new-identity)})
|
{:db (dissoc db :contacts/new-identity)})
|
||||||
|
|
||||||
|
(rf/defn qr-code-scanned
|
||||||
|
{:events [:contacts/qr-code-scanned]}
|
||||||
|
[{:keys [db] :as cofx} input]
|
||||||
|
(rf/merge cofx
|
||||||
|
(set-new-identity input)
|
||||||
|
(navigation/navigate-back)))
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
(:require [quo2.core :as quo]
|
(:require [quo2.core :as quo]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[status-im.react-native.resources :as resources]
|
[status-im.react-native.resources :as resources]
|
||||||
|
[status-im.qr-scanner.core :as qr-scanner]
|
||||||
[status-im2.contexts.add-new-contact.style :as style]
|
[status-im2.contexts.add-new-contact.style :as style]
|
||||||
[utils.debounce :as debounce]
|
[utils.debounce :as debounce]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
|
@ -42,7 +43,8 @@
|
||||||
600)})]
|
600)})]
|
||||||
[quo/button
|
[quo/button
|
||||||
(merge style/button-qr
|
(merge style/button-qr
|
||||||
{:on-press #(js/alert "TODO: to be implemented")})
|
{:on-press #(rf/dispatch [::qr-scanner/scan-code
|
||||||
|
{:handler :contacts/qr-code-scanned}])})
|
||||||
:i/scan]]
|
:i/scan]]
|
||||||
(when error?
|
(when error?
|
||||||
[rn/view style/container-error
|
[rn/view style/container-error
|
||||||
|
|
Loading…
Reference in New Issue