open url refactor
This commit is contained in:
parent
942c130d23
commit
bb71d5ebdb
|
@ -9,7 +9,8 @@
|
|||
(defn- crypto-on-ramp-item
|
||||
[{:keys [name description fees logo-url site-url recurrent-site-url]} _ _ {:keys [tab]}]
|
||||
(let [open-url (rn/use-callback (fn []
|
||||
(rn/open-url (if (= tab :recurrent) recurrent-site-url site-url)))
|
||||
(rf/dispatch [:open-url
|
||||
(if (= tab :recurrent) recurrent-site-url site-url)]))
|
||||
[site-url recurrent-site-url tab])]
|
||||
[quo/settings-item
|
||||
{:title name
|
||||
|
|
|
@ -12,7 +12,16 @@
|
|||
[status-im.navigation.state :as state]
|
||||
[status-im.navigation.view :as views]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.re-frame :as rf]))
|
||||
[utils.re-frame :as rf]
|
||||
[clojure.string :as string]
|
||||
[react-native.core :as react]
|
||||
[utils.url :as url]))
|
||||
|
||||
(rf/reg-fx
|
||||
:open-url
|
||||
(fn [url]
|
||||
(when (not (string/blank? url))
|
||||
(.openURL ^js react/linking (url/normalize-url url)))))
|
||||
|
||||
(defn get-status-nav-color
|
||||
[view-id theme]
|
||||
|
|
|
@ -135,3 +135,7 @@
|
|||
{:fx [[:effects.share/open config]]})
|
||||
|
||||
(rf/reg-event-fx :open-share open-share)
|
||||
|
||||
(rf/reg-event-fx :open-url
|
||||
(fn [_ [url]]
|
||||
{:fx [[:open-url url]]}))
|
||||
|
|
Loading…
Reference in New Issue