Andrey Shovkoplyas 507cc5cf39
send transaction GUI
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
2019-11-27 14:32:04 +01:00

27 lines
825 B
Clojure

(ns status-im.qr-scanner.core
(:require [re-frame.core :as re-frame]
[status-im.i18n :as i18n]
[status-im.utils.utils :as utils]
[status-im.utils.fx :as fx]))
(fx/defn scan-qr-code
[_ opts]
{:request-permissions-fx
{:permissions [:camera]
:on-allowed #(re-frame/dispatch [:navigate-to :qr-scanner opts])
:on-denied (fn []
(utils/set-timeout
#(utils/show-popup (i18n/label :t/error)
(i18n/label :t/camera-access-error))
50))}})
(fx/defn set-qr-code
[{:keys [db]} opts data]
(when-let [handler (:handler opts)]
{:dispatch [handler data opts]}))
(fx/defn set-qr-code-cancel
[_ opts]
(when-let [handler (:cancel-handler opts)]
{:dispatch [handler opts]}))