added scan QR code api

This commit is contained in:
Andrey Shovkoplyas 2018-09-18 22:28:24 +03:00
parent 8941331e40
commit 6d936786c6
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
1 changed files with 16 additions and 3 deletions

View File

@ -3,7 +3,8 @@
(:require [status-dapp.react-native-web :as react]
[re-frame.core :as re-frame]
[status-dapp.components :as ui]
[status-dapp.constants :as constants]))
[status-dapp.constants :as constants]
[reagent.core :as reagent]))
(defn no-web3 []
[react/view {:style {:flex 1 :padding 10 :align-items :center :justify-content :center}}
@ -70,7 +71,8 @@
status-api [:get :api]
web3 [:get :web3]
tab-view [:get :tab-view]
balances [:get :balances]]
balances [:get :balances]
qr-result (reagent/atom "")]
[react/view {:style {:flex 1}}
[ui/tab-buttons tab-view]
[react/scroll-view {:style {:flex 1}}
@ -144,7 +146,18 @@
"*")]
[react/view {:style {:margin-bottom 10}}
[ui/label "Contact code: " ""]
[react/text (:contact status-api)]]])
[react/text (:contact status-api)]]
[ui/button "Scan QR"
(fn [] (if (and web3 (.-currentProvider web3) (.-scanQRCode (.-currentProvider web3)))
(.catch (.then (.scanQRCode (.-currentProvider web3))
#(reset! qr-result %))
#(reset! qr-result (str "Error" %)))
(reset! qr-result "No QR API found")))]
[react/view {:style {:margin-bottom 10}}
[ui/label "Scan QR result: " ""]
[react/text @qr-result]]])
(when (= :about tab-view)
[react/view