two permissions in a row
This commit is contained in:
parent
6d936786c6
commit
6bee2ea3c3
|
@ -6,9 +6,6 @@
|
||||||
[status-dapp.views :as views]
|
[status-dapp.views :as views]
|
||||||
[status-dapp.config :as config]))
|
[status-dapp.config :as config]))
|
||||||
|
|
||||||
(js/window.addEventListener "statusapi"
|
|
||||||
#(re-frame/dispatch [:on-status-api (js->clj (.-detail %) :keywordize-keys true)]))
|
|
||||||
|
|
||||||
(defn dev-setup []
|
(defn dev-setup []
|
||||||
(when config/debug?
|
(when config/debug?
|
||||||
(enable-console-print!)
|
(enable-console-print!)
|
||||||
|
|
|
@ -3,8 +3,11 @@
|
||||||
|
|
||||||
(def web3 (or (when (exists? js/web3) js/web3)
|
(def web3 (or (when (exists? js/web3) js/web3)
|
||||||
(when js/ethereum
|
(when js/ethereum
|
||||||
(js/setTimeout (fn [] (.then (.enable js/ethereum) #(do
|
(js/setTimeout (fn []
|
||||||
(re-frame/dispatch [:set-default-account]))) 100))
|
(.then (.enable js/ethereum) #(re-frame/dispatch [:set-default-account]))
|
||||||
|
(when js/ethereum.status
|
||||||
|
(.then (.getContactCode js/ethereum.status) #(re-frame/dispatch [:on-status-api :contact %]))))
|
||||||
|
100)
|
||||||
(js/Web3. js/ethereum))))
|
(js/Web3. js/ethereum))))
|
||||||
|
|
||||||
(def default-db
|
(def default-db
|
||||||
|
|
|
@ -246,9 +246,8 @@
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
:on-status-api
|
:on-status-api
|
||||||
(fn [{db :db} [_ {:keys [data permissions]}]]
|
(fn [{db :db} [_ api data]]
|
||||||
(println "ON MESSAGE DATA" data)
|
{:db (assoc-in db [:api api] data)}))
|
||||||
{:db (assoc-in db [:api :contact] (:CONTACT_CODE data))}))
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
:set-default-account
|
:set-default-account
|
||||||
|
|
|
@ -139,14 +139,13 @@
|
||||||
|
|
||||||
(when (= :api tab-view)
|
(when (= :api tab-view)
|
||||||
[react/view
|
[react/view
|
||||||
|
(when (exists? js/window.ethereum.status)
|
||||||
[ui/button "Request contact code (public key)"
|
[react/view
|
||||||
#(js/window.postMessage
|
[ui/button "Request contact code (public key)"
|
||||||
(clj->js {:type "STATUS_API_REQUEST" :permissions ["CONTACT_CODE" "CONTACTS"]})
|
(fn [] (.then (.getContactCode js/window.ethereum.status) #(re-frame/dispatch [:on-status-api :contact %])))]
|
||||||
"*")]
|
[react/view {:style {:margin-bottom 10}}
|
||||||
[react/view {:style {:margin-bottom 10}}
|
[ui/label "Contact code: " ""]
|
||||||
[ui/label "Contact code: " ""]
|
[react/text (:contact status-api)]]])
|
||||||
[react/text (:contact status-api)]]
|
|
||||||
|
|
||||||
[ui/button "Scan QR"
|
[ui/button "Scan QR"
|
||||||
(fn [] (if (and web3 (.-currentProvider web3) (.-scanQRCode (.-currentProvider web3)))
|
(fn [] (if (and web3 (.-currentProvider web3) (.-scanQRCode (.-currentProvider web3)))
|
||||||
|
|
Loading…
Reference in New Issue