[perf] extensions module

This commit is contained in:
Roman Volosovskyi 2019-06-08 07:04:07 +03:00
parent 908f730b1d
commit 7097de6e05
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
27 changed files with 272 additions and 194 deletions

View File

@ -121,18 +121,38 @@
:externs ["externs.js"]
:language-in :es-2015
:language-out :es-2015
:modules {:cljs-base {:output-to "index.ios.js"}
:i18n {:entries #{"status_im.goog.i18n"}
:output-to "status-modules/cljs/i18n-raw.js"}
:network {:entries #{"status_im.network.ui.network_details.views"
"status_im.network.ui.edit_network.views"
"status_im.network.ui.edit_network.styles"
"status_im.network.ui.views"
"status_im.network.ui.styles"
"status_im.network.events"
"status_im.network.subs"
"status_im.network.core"}
:output-to "status-modules/cljs/network-raw.js"}}}
:modules {:cljs-base {:output-to "index.ios.js"}
:i18n {:entries #{"status_im.goog.i18n"}
:output-to "status-modules/cljs/i18n-raw.js"}
:network {:entries #{"status_im.network.ui.network_details.views"
"status_im.network.ui.edit_network.views"
"status_im.network.ui.edit_network.styles"
"status_im.network.ui.views"
"status_im.network.ui.styles"
"status_im.network.events"
"status_im.network.subs"
"status_im.network.core"}
:output-to "status-modules/cljs/network-raw.js"}
:extensions {:entries #{"status_im.extensions.ui.db"
"status_im.extensions.ui.add.events"
"status_im.extensions.ui.add.views"
"status_im.extensions.ui.add.styles"
"status_im.extensions.ui.views"
"status_im.extensions.ui.styles"
"status_im.extensions.events"
"status_im.extensions.registry"
"status_im.extensions.core"
"status_im.extensions.module"
"status_im.extensions.capacities.events"
"status_im.extensions.capacities.subs"
"status_im.extensions.capacities.camera.events"
"status_im.extensions.capacities.camera.views"
"status_im.extensions.capacities.components"
"status_im.extensions.capacities.views"
"status_im.extensions.capacities.ethereum"
"status_im.extensions.capacities.map"
"status_im.extensions.capacities.network"}
:output-to "status-modules/cljs/extensions-raw.js"}}}
:warning-handlers [status-im.utils.build/warning-handler]}
:android
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/mobile" "src" "env/prod" "prod"]
@ -150,18 +170,38 @@
:externs ["externs.js"]
:language-in :es-2015
:language-out :es-2015
:modules {:cljs-base {:output-to "index.android.js"}
:i18n {:entries #{"status_im.goog.i18n"}
:output-to "status-modules/cljs/i18n-raw.js"}
:network {:entries #{"status_im.network.ui.network_details.views"
"status_im.network.ui.edit_network.views"
"status_im.network.ui.edit_network.styles"
"status_im.network.ui.views"
"status_im.network.ui.styles"
"status_im.network.events"
"status_im.network.subs"
"status_im.network.core"}
:output-to "status-modules/cljs/network-raw.js"}}}
:modules {:cljs-base {:output-to "index.android.js"}
:i18n {:entries #{"status_im.goog.i18n"}
:output-to "status-modules/cljs/i18n-raw.js"}
:network {:entries #{"status_im.network.ui.network_details.views"
"status_im.network.ui.edit_network.views"
"status_im.network.ui.edit_network.styles"
"status_im.network.ui.views"
"status_im.network.ui.styles"
"status_im.network.events"
"status_im.network.subs"
"status_im.network.core"}
:output-to "status-modules/cljs/network-raw.js"}
:extensions {:entries #{"status_im.extensions.ui.db"
"status_im.extensions.ui.add.events"
"status_im.extensions.ui.add.views"
"status_im.extensions.ui.add.styles"
"status_im.extensions.ui.views"
"status_im.extensions.ui.styles"
"status_im.extensions.events"
"status_im.extensions.registry"
"status_im.extensions.core"
"status_im.extensions.module"
"status_im.extensions.capacities.events"
"status_im.extensions.capacities.subs"
"status_im.extensions.capacities.camera.events"
"status_im.extensions.capacities.camera.views"
"status_im.extensions.capacities.components"
"status_im.extensions.capacities.views"
"status_im.extensions.capacities.ethereum"
"status_im.extensions.capacities.map"
"status_im.extensions.capacities.network"}
:output-to "status-modules/cljs/extensions-raw.js"}}}
:warning-handlers [status-im.utils.build/warning-handler]}
:desktop
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/desktop" "src" "env/prod" "prod"]
@ -189,5 +229,25 @@
"status_im.network.events"
"status_im.network.subs"
"status_im.network.core"}
:output-to "status-modules/cljs/network-raw.js"}}}
:output-to "status-modules/cljs/network-raw.js"}
:extensions {:entries #{"status_im.extensions.ui.db"
"status_im.extensions.ui.add.events"
"status_im.extensions.ui.add.views"
"status_im.extensions.ui.add.styles"
"status_im.extensions.ui.views"
"status_im.extensions.ui.styles"
"status_im.extensions.events"
"status_im.extensions.registry"
"status_im.extensions.core"
"status_im.extensions.module"
"status_im.extensions.capacities.events"
"status_im.extensions.capacities.subs"
"status_im.extensions.capacities.camera.events"
"status_im.extensions.capacities.camera.views"
"status_im.extensions.capacities.components"
"status_im.extensions.capacities.views"
"status_im.extensions.capacities.ethereum"
"status_im.extensions.capacities.map"
"status_im.extensions.capacities.network"}
:output-to "status-modules/cljs/extensions-raw.js"}}}
:warning-handlers [status-im.utils.build/warning-handler]}}}}})

View File

@ -2,7 +2,7 @@
(:require status-im.utils.db
status-im.network.module
status-im.ui.screens.bootnodes-settings.db
status-im.ui.screens.extensions.db
status-im.extensions.module
[cljs.spec.alpha :as spec]
[status-im.constants :as const]))

View File

@ -2,7 +2,7 @@
(:require [status-im.constants :as constants]
[status-im.data-store.dapp-permissions :as dapp-permissions]
[status-im.ethereum.core :as ethereum]
[status-im.extensions.registry :as extensions.registry]
[status-im.extensions.module :as extensions.module]
[status-im.i18n :as i18n]
[status-im.qr-scanner.core :as qr-scanner]
[status-im.ui.screens.navigation :as navigation]
@ -28,7 +28,7 @@
(cond
(= permission constants/dapp-permission-install-extension)
(fx/merge cofx
(extensions.registry/load (:uri params) true)
(extensions.module/load (:uri params) true)
(send-response-to-bridge permission message-id true nil)
(process-next-permission dapp-name))

View File

@ -23,8 +23,6 @@
[status-im.contact.core :as contact]
[status-im.ethereum.subscriptions :as ethereum.subscriptions]
[status-im.ethereum.transactions.core :as ethereum.transactions]
[status-im.extensions.core :as extensions]
[status-im.extensions.registry :as extensions.registry]
[status-im.fleet.core :as fleet]
[status-im.group-chats.core :as group-chats]
[status-im.hardwallet.core :as hardwallet]
@ -538,48 +536,6 @@
(fn [cofx [_ bootnode-id]]
(bootnodes/delete-bootnode cofx bootnode-id)))
;; extensions module
(handlers/register-handler-fx
:extensions.callback/qr-code-scanned
(fn [cofx [_ _ url]]
(extensions/set-extension-url-from-qr cofx url)))
(handlers/register-handler-fx
:extensions.ui/add-extension-pressed
(fn [cofx [_ extension-key]]
(extensions/edit cofx extension-key)))
(handlers/register-handler-fx
:extensions.ui/uninstall-extension-pressed
(fn [cofx [_ extension-key]]
(extensions.registry/uninstall cofx extension-key)))
(handlers/register-handler-fx
:extensions.ui/input-changed
(fn [cofx [_ input-key value]]
(extensions/set-input cofx input-key value)))
(handlers/register-handler-fx
:extensions.ui/activation-checkbox-pressed
(fn [cofx [_ extension-key active?]]
(extensions.registry/change-state cofx extension-key active?)))
(handlers/register-handler-fx
:extensions.ui/find-button-pressed
(fn [cofx [_ url]]
(extensions.registry/load cofx url false)))
(handlers/register-handler-fx
:extensions.ui/install-extension-button-pressed
(fn [cofx [_ url]]
(extensions.registry/install-from-message cofx url true)))
(handlers/register-handler-fx
:extensions.ui/install-button-pressed
(fn [cofx [_ url data modal?]]
(extensions.registry/install cofx url data modal?)))
;; logging module
(handlers/register-handler-fx
@ -1514,19 +1470,9 @@
(browser.permissions/process-next-permission cofx dapp-name)))
(handlers/register-handler-fx
:browser.ui/open-in-status-option-selected
(fn [cofx [_ url]]
(browser/open-url cofx url)))
(handlers/register-handler-fx
:browser.ui/open-dapp-button-pressed
(fn [cofx [_ dapp-url]]
(browser/open-url cofx dapp-url)))
(handlers/register-handler-fx
:browser.ui/dapp-url-submitted
(fn [cofx [_ dapp-url]]
(browser/open-url cofx dapp-url)))
:browser.ui/open-url
(fn [cofx [_ url extension-params]]
(browser/open-url cofx (or (:url extension-params) url))))
(handlers/register-handler-fx
:browser.ui/open-modal-chat-button-pressed

View File

@ -73,7 +73,7 @@
:text-decoration-line :underline}
:on-press (case open-in
:device #(.openURL (react/linking) uri)
:status #(re-frame/dispatch [:browser.ui/open-in-status-option-selected uri])
:status #(re-frame/dispatch [:browser.ui/open-url uri])
#(re-frame/dispatch [:browser.ui/message-link-pressed uri]))}
(when style {:style style}))
(or text uri)])

View File

@ -5,7 +5,6 @@
[status-im.chat.commands.sending :as commands-sending]
[status-im.ui.screens.navigation :as navigation]
[status-im.ipfs.core :as ipfs]
[status-im.browser.core :as browser]
[status-im.utils.fx :as fx]
[status-im.accounts.update.core :as accounts.update]
status-im.extensions.capacities.ethereum
@ -306,11 +305,6 @@
(fn [_ [_ _ m]]
{::arithmetic m}))
(handlers/register-handler-fx
:extensions/open-url
(fn [cofx [_ _ {:keys [url]}]]
(browser/open-url cofx url)))
(handlers/register-handler-fx
:extensions/profile-settings-close
(fn [{:keys [db] :as cofx} [_ _ {:keys [on-close on-failure]}]]
@ -408,7 +402,7 @@
:on-result :event}}
'browser/open-url
{:permissions [:read]
:data :extensions/open-url
:data :browser.ui/open-url
:arguments {:url :string}}
'camera/picture
{:permissions [:read]
@ -750,4 +744,4 @@
{:permissions [:read]
:data :extensions/wallet-settings-close
:arguments {:on-close? :event
:on-failure? :event}}})
:on-failure? :event}}})

View File

@ -0,0 +1,4 @@
(ns status-im.extensions.constants)
(def uri-prefix "https://get.status.im/extension/")
(def link-prefix "status-im://extension/")

View File

@ -2,14 +2,14 @@
(:refer-clojure :exclude [list])
(:require [clojure.string :as string]
[pluto.core :as pluto]
[pluto.storages :as storages]
[re-frame.core :as re-frame]
[re-frame.registrar :as registrar]
[status-im.ui.screens.navigation :as navigation]
[status-im.utils.fx :as fx]
[status-im.extensions.capacities.components :as components]
[status-im.extensions.capacities.subs :as subs]
[status-im.extensions.capacities.events :as events]))
[status-im.extensions.capacities.events :as events]
[status-im.extensions.constants :as constants]))
(def capacities
{:components components/all
@ -64,26 +64,13 @@
(parse (pluto/read (:content value)) id)
{:errors [{:type type :value value}]}))
(def uri-prefix "https://get.status.im/extension/")
(def link-prefix "status-im://extension/")
(defn valid-uri? [s]
(boolean
(when s
(let [s' (string/trim s)]
(or
(re-matches (re-pattern (str "^" uri-prefix "\\w+@.+")) s')
(re-matches (re-pattern (str "^" link-prefix "\\w+@.+")) s'))))))
(defn url->uri [s]
(when s
(-> s
(string/replace uri-prefix "")
(string/replace link-prefix ""))))
(defn load-from [url f]
(when-let [uri (url->uri url)]
(storages/fetch uri f)))
(re-matches (re-pattern (str "^" constants/uri-prefix "\\w+@.+")) s')
(re-matches (re-pattern (str "^" constants/link-prefix "\\w+@.+")) s'))))))
(fx/defn set-extension-url-from-qr
[cofx url]

View File

@ -0,0 +1,44 @@
(ns status-im.extensions.events
(:require [status-im.utils.handlers :as handlers]
[status-im.extensions.core :as extensions]
[status-im.extensions.registry :as extensions.registry]))
(handlers/register-handler-fx
:extensions.callback/qr-code-scanned
(fn [cofx [_ _ url]]
(extensions/set-extension-url-from-qr cofx url)))
(handlers/register-handler-fx
:extensions.ui/add-extension-pressed
(fn [cofx [_ extension-key]]
(extensions/edit cofx extension-key)))
(handlers/register-handler-fx
:extensions.ui/uninstall-extension-pressed
(fn [cofx [_ extension-key]]
(extensions.registry/uninstall cofx extension-key)))
(handlers/register-handler-fx
:extensions.ui/input-changed
(fn [cofx [_ input-key value]]
(extensions/set-input cofx input-key value)))
(handlers/register-handler-fx
:extensions.ui/activation-checkbox-pressed
(fn [cofx [_ extension-key active?]]
(extensions.registry/change-state cofx extension-key active?)))
(handlers/register-handler-fx
:extensions.ui/find-button-pressed
(fn [cofx [_ url]]
(extensions.registry/load cofx url false)))
(handlers/register-handler-fx
:extensions.ui/install-extension-button-pressed
(fn [cofx [_ url]]
(extensions.registry/install-from-message cofx url true)))
(handlers/register-handler-fx
:extensions.ui/install-button-pressed
(fn [cofx [_ url data modal?]]
(extensions.registry/install cofx url data modal?)))

View File

@ -0,0 +1,78 @@
(ns status-im.extensions.module
(:require-macros [status-im.modules :as modules])
(:require status-im.extensions.ui.db
[pluto.storages :as storages]
[re-frame.core :as re-frame]
[status-im.utils.fx :as fx]
[clojure.string :as string]
[status-im.extensions.constants :as constants]))
(modules/defmodule extensions
{:load 'status-im.extensions.registry/load
:valid-uri? 'status-im.extensions.core/valid-uri?
:parse-extension 'status-im.extensions.core/parse-extension
:take-picture-view 'status-im.extensions.capacities.camera.views/take-picture
:screen-holder-view 'status-im.extensions.capacities.views/screen-holder
:extensions-settings-view 'status-im.extensions.ui.views/extensions-settings
:selection-modal-screen-view 'status-im.extensions.ui.views/selection-modal-screen
:edit-extension-view 'status-im.extensions.ui.add.views/edit-extension
:show-extension-view 'status-im.extensions.ui.add.views/show-extension
:show-extension-modal-view 'status-im.extensions.ui.add.views/show-extension-modal})
(defn load [& args]
(apply (get-symbol :load) args))
(defn valid-uri? [& args]
(apply (get-symbol :valid-uri?) args))
(defn parse-extension [& args]
(apply (get-symbol :parse-extension) args))
(defn take-picture-view []
[(get-symbol :take-picture-view)])
(defn screen-holder-view []
[(get-symbol :screen-holder-view)])
(defn extensions-settings-view []
[(get-symbol :extensions-settings-view)])
(defn selection-modal-screen-view []
[(get-symbol :selection-modal-screen-view)])
(defn edit-extension-view []
[(get-symbol :edit-extension-view)])
(defn show-extension-view []
[(get-symbol :show-extension-view)])
(defn show-extension-modal-view []
[(get-symbol :show-extension-modal-view)])
;; Initialization
;; Prevents loading of the rest of the module till it is necessary.
(defn url->uri [s]
(when s
(-> s
(string/replace constants/uri-prefix "")
(string/replace constants/link-prefix ""))))
(defn load-from [url f]
(when-let [uri (url->uri url)]
(storages/fetch uri f)))
(re-frame/reg-fx
:extensions/load
(fn [{:keys [extensions follow-up]}]
(doseq [{:keys [url active?]} extensions]
(load-from url #(re-frame/dispatch [follow-up url (parse-extension % url) active?])))))
(fx/defn initialize
[{{:account/keys [account] :as db} :db}]
(let [{:keys [extensions dev-mode?]} account
ext-vals (vals extensions)]
(when dev-mode?
{:db (assoc db :extensions/store (into {} (map (fn [{:keys [id data]}] {id data}) ext-vals)))
:extensions/load {:extensions ext-vals
:follow-up :extensions/add-to-registry}})))

View File

@ -188,15 +188,6 @@
(re-frame/dispatch [:accounts.ui/dev-mode-switched true])
(re-frame/dispatch [:extensions.ui/install-extension-button-pressed url]))}}))
(fx/defn initialize
[{{:account/keys [account] :as db} :db}]
(let [{:keys [extensions dev-mode?]} account
ext-vals (vals extensions)]
(when dev-mode?
{:db (assoc db :extensions/store (into {} (map (fn [{:keys [id data]}] {id data}) ext-vals)))
:extensions/load {:extensions ext-vals
:follow-up :extensions/add-to-registry}})))
(defn existing-hooks-for
[type cofx extension-data]
(let [added-hooks (reduce (fn [acc [_ {:keys [hooks]}]]

View File

@ -1,17 +1,7 @@
(ns status-im.ui.screens.extensions.add.events
(:require [re-frame.core :as re-frame]
[status-im.extensions.core :as extensions]
[status-im.extensions.registry :as extensions.registry]
[status-im.ui.screens.navigation :as navigation]
(ns status-im.extensions.ui.add.events
(:require [status-im.extensions.registry :as extensions.registry]
[status-im.utils.handlers :as handlers]
[status-im.utils.fx :as fx]
[status-im.i18n :as i18n]))
(re-frame/reg-fx
:extensions/load
(fn [{:keys [extensions follow-up]}]
(doseq [{:keys [url active?]} extensions]
(extensions/load-from url #(re-frame/dispatch [follow-up url (extensions/parse-extension % url) active?])))))
[status-im.utils.fx :as fx]))
(handlers/register-handler-fx
:extensions/stage

View File

@ -1,4 +1,4 @@
(ns status-im.ui.screens.extensions.add.styles
(ns status-im.extensions.ui.add.styles
(:require-macros [status-im.utils.styles :refer [defstyle]])
(:require [status-im.ui.components.styles :as styles]
[status-im.ui.components.colors :as colors]))

View File

@ -1,10 +1,10 @@
(ns status-im.ui.screens.extensions.add.views
(ns status-im.extensions.ui.add.views
(:require-macros [status-im.utils.views :as views])
(:require [re-frame.core :as re-frame]
[reagent.core :as reagent]
[clojure.string :as string]
[pluto.error :as error]
[status-im.extensions.core :as extensions]
[status-im.extensions.core :as core]
[status-im.i18n :as i18n]
[status-im.ui.components.react :as react]
[status-im.ui.components.colors :as colors]
@ -14,7 +14,8 @@
[status-im.ui.components.styles :as components.styles]
[status-im.ui.components.toolbar.view :as toolbar]
[status-im.ui.components.text-input.view :as text-input]
[status-im.ui.screens.extensions.add.styles :as styles]))
[status-im.extensions.ui.add.styles :as styles]
status-im.extensions.ui.add.events))
(defn cartouche [{:keys [header]} content]
[react/view {:style styles/cartouche-container}
@ -106,5 +107,5 @@
[components.common/bottom-button
{:forward? true
:label (i18n/label :t/find)
:disabled? (and (not @pressed) (not (extensions/valid-uri? url)))
:disabled? (and (not @pressed) (not (core/valid-uri? url)))
:on-press #(do (reset! pressed true) (re-frame/dispatch [:extensions.ui/find-button-pressed (string/trim url)]))}]]]])))

View File

@ -1,4 +1,4 @@
(ns status-im.ui.screens.extensions.db
(ns status-im.extensions.ui.db
(:require
[clojure.string :as string]
[cljs.spec.alpha :as spec]))

View File

@ -1,4 +1,4 @@
(ns status-im.ui.screens.extensions.styles
(ns status-im.extensions.ui.styles
(:require [status-im.ui.components.colors :as colors])
(:require-macros [status-im.utils.styles :refer [defstyle]]))
@ -6,21 +6,6 @@
{:flex 1
:background-color colors/white})
(defstyle extension-item
{:flex-direction :row
:background-color :white
:align-items :center
:padding-horizontal 16
:ios {:height 64}
:android {:height 56}})
(def extension-item-inner
{:flex 1
:padding-horizontal 16})
(defstyle extension-item-name-text
{:typography :title})
(defn mailserver-icon [connected?]
{:width 40
:height 40

View File

@ -1,4 +1,4 @@
(ns status-im.ui.screens.extensions.views
(ns status-im.extensions.ui.views
(:require-macros [status-im.utils.views :as views])
(:require [re-frame.core :as re-frame]
[status-im.i18n :as i18n]
@ -8,7 +8,8 @@
[status-im.ui.components.status-bar.view :as status-bar]
[status-im.ui.components.toolbar.view :as toolbar]
[status-im.ui.components.toolbar.actions :as toolbar.actions]
[status-im.ui.screens.extensions.styles :as styles]))
[status-im.extensions.ui.styles :as styles]
status-im.extensions.events))
(def mailserver-icon
[react/view (styles/mailserver-icon true)

View File

@ -8,11 +8,10 @@
[status-im.data-store.core :as data-store]
[status-im.data-store.realm.core :as realm]
[status-im.ethereum.core :as ethereum]
[status-im.extensions.registry :as extensions.registry]
[status-im.extensions.module :as extensions.module]
[status-im.i18n :as i18n]
[status-im.models.dev-server :as models.dev-server]
[status-im.native-module.core :as status]
[status-im.node.core :as node]
[status-im.notifications.core :as notifications]
[status-im.pairing.core :as pairing]
[status-im.react-native.js-dependencies :as rn-dependencies]
@ -243,7 +242,7 @@
(models.dev-server/start))
(browser/initialize-browsers)
(browser/initialize-dapp-permissions)
(extensions.registry/initialize)
(extensions.module/initialize)
(stickers/init-stickers-packs)
(accounts.update/update-sign-in-time)
#(when-not (or (creating-account? %)

View File

@ -14,12 +14,13 @@
symbols)))
(defmacro defmodule [module-name symbols]
(let [module (gensym "module")
loaded? (gensym "loaded?")
path (str "status-modules/cljs/" module-name ".js")
k (gensym)
get-symbol 'get-symbol
load-module 'load-module]
(let [module (gensym "module")
loaded? (gensym "loaded?")
path (str "status-modules/cljs/" module-name ".js")
k (gensym)
get-symbol 'get-symbol
load-module 'load-module
load-module-later 'load-module-later]
(if prod?
`(do
(defonce ~loaded? (atom false))
@ -30,6 +31,10 @@
(reset! ~module
(hash-map ~@(prepare-symbols symbols)))
(reset! ~loaded? true)))
(defn ~load-module-later []
((resolve 'status-im.utils.utils/set-timeout)
(fn [] (~load-module))
10))
(defn ~get-symbol [~k]
(~load-module)
(get @~module ~k)))
@ -42,6 +47,10 @@
(reset! ~module
(hash-map ~@(prepare-symbols symbols)))
(reset! ~loaded? true)))
(defn ~load-module-later []
((resolve 'status-im.utils.utils/set-timeout)
(fn [] (~load-module))
10))
(defn ~get-symbol [~k]
(~load-module)
(get @~module ~k))))))

View File

@ -39,7 +39,7 @@
(defn browse [link]
(show {:title (i18n/label :t/browsing-title)
:options [{:label (i18n/label :t/browsing-open-in-status)
:action #(re-frame/dispatch [:browser.ui/open-in-status-option-selected link])}
:action #(re-frame/dispatch [:browser.ui/open-url link])}
{:label (i18n/label (platform-web-browser))
:action #(.openURL (react/linking) (http/normalize-url link))}]
:cancel-text (i18n/label :t/browsing-cancel)}))
@ -53,5 +53,5 @@
(defn browse-dapp [link]
(show {:title (i18n/label :t/browsing-title)
:options [{:label (i18n/label :t/browsing-open-in-status)
:action #(re-frame/dispatch [:browser.ui/open-in-status-option-selected link])}]
:action #(re-frame/dispatch [:browser.ui/open-url link])}]
:cancel-text (i18n/label :t/browsing-cancel)}))

View File

@ -3,7 +3,6 @@
(:require [clojure.string :as string]
[status-im.ui.screens.accounts.styles :as ast]
[status-im.ui.screens.profile.components.views :as profile.components]
[status-im.ui.components.checkbox.view :as checkbox]
[status-im.ui.components.text-input.view :as text-input]
[status-im.ui.components.status-bar.view :as status-bar]
[status-im.ui.components.toolbar.view :as toolbar]
@ -15,11 +14,8 @@
[status-im.ui.components.common.common :as components.common]
[status-im.ui.screens.chat.photos :as photos]
[re-frame.core :as re-frame]
[cljs.spec.alpha :as spec]
[status-im.utils.platform :as platform]
[status-im.accounts.db :as db]
[status-im.utils.security :as security]
[status-im.utils.keychain.core :as keychain]))
[status-im.utils.security :as security]))
(defn login-toolbar [can-navigate-back?]
[toolbar/toolbar

View File

@ -67,7 +67,7 @@
(defn list-header [empty?]
[react/view (when empty? {:flex 1})
[privacy-options]
[react/touchable-highlight {:on-press #(re-frame/dispatch [:browser.ui/dapp-url-submitted "https://dap.ps"])}
[react/touchable-highlight {:on-press #(re-frame/dispatch [:browser.ui/open-url "https://dap.ps"])}
[react/view styles/dapp-store-container
[dapp-image nil dapp-image-data]
[react/text {:style styles/open-dapp-store} (i18n/label :t/open-dapp-store)]
@ -85,7 +85,7 @@
[react/keyboard-avoiding-view {:style {:flex 1}}
[status-bar/status-bar]
[react/text-input {:on-change-text #(reset! url-text %)
:on-submit-editing #(re-frame/dispatch [:browser.ui/dapp-url-submitted @url-text])
:on-submit-editing #(re-frame/dispatch [:browser.ui/open-url @url-text])
:placeholder (i18n/label :t/enter-url)
:auto-capitalize :none
:auto-correct false

View File

@ -4,7 +4,7 @@
[status-im.chat.commands.protocol :as protocol]
[status-im.chat.commands.receiving :as commands-receiving]
[status-im.constants :as constants]
[status-im.extensions.core :as extensions]
[status-im.extensions.module :as extensions.module]
[status-im.i18n :as i18n]
[status-im.ui.components.action-sheet :as action-sheet]
[status-im.ui.components.colors :as colors]
@ -35,7 +35,7 @@
(let [{:keys [type] :as command} (commands-receiving/lookup-command-by-ref command-message id->command)
extension-id (get-in command-message [:content :params :extension-id])]
(if (and platform/mobile? extension-id
(extensions/valid-uri? extension-id)
(extensions.module/valid-uri? extension-id)
(or (not type) (and type (satisfies? protocol/Extension type)
(not= extension-id (protocol/extension-id type)))))
;; Show install message only for mobile and if message contains extension id and there is no extension installed

View File

@ -1,7 +1,6 @@
(ns status-im.ui.screens.db
(:require [cljs.spec.alpha :as spec]
[status-im.constants :as constants]
[status-im.utils.platform :as platform]
[status-im.utils.dimensions :as dimensions]
[status-im.fleet.core :as fleet]
status-im.transport.db

View File

@ -9,7 +9,6 @@
status-im.web3.events
status-im.ui.screens.add-new.new-chat.navigation
status-im.ui.screens.profile.events
status-im.ui.screens.extensions.add.events
status-im.ui.screens.wallet.collectibles.events
status-im.ui.screens.wallet.send.events
status-im.ui.screens.wallet.request.events

View File

@ -1,8 +1,5 @@
(ns status-im.ui.screens.routing.screens
(:require [status-im.extensions.capacities.camera.views
:as
extensions.camera.views]
[status-im.extensions.capacities.views :as extensions.views]
(:require [status-im.extensions.module :as extensions.module]
[status-im.ui.screens.about-app.views :as about-app]
[status-im.ui.screens.accounts.create.views :as accounts.create]
[status-im.ui.screens.accounts.login.views :as login]
@ -21,8 +18,6 @@
[status-im.ui.screens.contacts-list.views :as contacts-list]
[status-im.ui.screens.currency-settings.views :as currency-settings]
[status-im.ui.screens.dapps-permissions.views :as dapps-permissions]
[status-im.ui.screens.extensions.add.views :as extensions.add]
[status-im.ui.screens.extensions.views :as screens.extensions]
[status-im.ui.screens.fleet-settings.views :as fleet-settings]
[status-im.ui.screens.group.views :as group]
[status-im.ui.screens.hardwallet.authentication-method.views
@ -92,8 +87,8 @@
:new-chat new-chat/new-chat
:qr-scanner qr-scanner/qr-scanner
:profile-qr-viewer [:modal profile.user/qr-viewer]
:take-picture extensions.camera.views/take-picture
:extension-screen-holder extensions.views/screen-holder
:take-picture extensions.module/take-picture-view
:extension-screen-holder extensions.module/screen-holder-view
:new-group group/new-group
:add-participants-toggle-list group/add-participants-toggle-list
:contact-toggle-list group/contact-toggle-list
@ -106,7 +101,7 @@
:stickers-pack-modal [:modal stickers/pack-modal]
:tribute-learn-more [:modal tr-to-talk/learn-more]
:chat-modal [:modal chat/chat-modal]
:show-extension-modal [:modal extensions.add/show-extension-modal]
:show-extension-modal [:modal extensions.module/show-extension-modal-view]
:wallet-onboarding-setup-modal [:modal wallet.onboarding/modal]
:wallet wallet.main/wallet
:collectibles-list collectibles/collectibles-list
@ -123,7 +118,7 @@
:transactions-history wallet-transactions/transactions
:wallet-transaction-details wallet-transactions/transaction-details
:wallet-settings-hook wallet-settings/settings-hook
:selection-modal-screen [:modal screens.extensions/selection-modal-screen]
:selection-modal-screen [:modal extensions.module/selection-modal-screen-view]
:wallet-settings-assets wallet-settings/manage-assets
:wallet-add-custom-token custom-tokens/add-custom-token
:wallet-custom-token-details custom-tokens/custom-token-details
@ -142,9 +137,9 @@
:help-center help-center/help-center
:dapps-permissions dapps-permissions/dapps-permissions
:manage-dapps-permissions dapps-permissions/manage
:extensions-settings screens.extensions/extensions-settings
:edit-extension extensions.add/edit-extension
:show-extension extensions.add/show-extension
:extensions-settings extensions.module/extensions-settings-view
:edit-extension extensions.module/edit-extension-view
:show-extension extensions.module/show-extension-view
:network-settings network/network-settings-view
:network-details network/network-details-view
:edit-network network/edit-network-view

View File

@ -6,7 +6,7 @@
[status-im.chat.models :as chat]
[status-im.constants :as constants]
[status-im.ethereum.eip681 :as eip681]
[status-im.extensions.registry :as extensions.registry]
[status-im.extensions.module :as extensions.module]
[status-im.pairing.core :as pairing]
[status-im.ui.components.list-selection :as list-selection]
[status-im.ui.components.react :as react]
@ -81,7 +81,7 @@
(fx/defn handle-extension [cofx url]
(log/info "universal-links: handling url profile" url)
(extensions.registry/load cofx url false))
(extensions.module/load cofx url false))
(fx/defn handle-eip681 [cofx url]
(let [wallet-set-up-passed? (get-in cofx [:db :account/account :wallet-set-up-passed?])]