open-url extension event

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2019-02-15 10:27:13 +01:00
parent 60fd80f353
commit c0d659d008
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
1 changed files with 11 additions and 1 deletions

View File

@ -23,7 +23,8 @@
status-im.extensions.camera status-im.extensions.camera
[status-im.utils.ethereum.tokens :as tokens] [status-im.utils.ethereum.tokens :as tokens]
[status-im.utils.ethereum.core :as ethereum] [status-im.utils.ethereum.core :as ethereum]
[status-im.chat.commands.sending :as commands-sending])) [status-im.chat.commands.sending :as commands-sending]
[status-im.browser.core :as browser]))
(re-frame/reg-fx (re-frame/reg-fx
::identity-event ::identity-event
@ -320,6 +321,11 @@
(fn [_ [_ _ m]] (fn [_ [_ _ m]]
{::arithmetic m})) {::arithmetic m}))
(handlers/register-handler-fx
:extensions/open-url
(fn [cofx [_ _ {:keys [url]}]]
(browser/open-url cofx url)))
(defn button [{:keys [on-click enabled disabled] :as m} label] (defn button [{:keys [on-click enabled disabled] :as m} label]
[button/secondary-button (merge {:disabled? (or (when (contains? m :enabled) (or (nil? enabled) (false? enabled))) disabled)} [button/secondary-button (merge {:disabled? (or (when (contains? m :enabled) (or (nil? enabled) (false? enabled))) disabled)}
(when on-click {:on-press #(re-frame/dispatch (on-click {}))})) label]) (when on-click {:on-press #(re-frame/dispatch (on-click {}))})) label])
@ -478,6 +484,10 @@
:arguments {:values :vector :arguments {:values :vector
:operation {:one-of #{:plus :minus :times :divide}} :operation {:one-of #{:plus :minus :times :divide}}
:on-result :event}} :on-result :event}}
'browser/open-url
{:permissions [:read]
:value :extensions/open-url
:arguments {:url :string}}
'camera/picture 'camera/picture
{:permissions [:read] {:permissions [:read]
:value :extensions/camera-picture :value :extensions/camera-picture