reloadable js resources for jail
This commit is contained in:
parent
e8aa157ea5
commit
958d900af7
|
@ -59,6 +59,7 @@ figwheel_server.log
|
||||||
# Lein
|
# Lein
|
||||||
#
|
#
|
||||||
.lein-failures
|
.lein-failures
|
||||||
|
.lein-repl-history
|
||||||
|
|
||||||
## Doo
|
## Doo
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
(ns ^:figwheel-no-load env.android.main
|
(ns ^:figwheel-no-load env.android.main
|
||||||
(:require [reagent.core :as r]
|
(:require [reagent.core :as r]
|
||||||
[status-im.android.core :as core]
|
[status-im.android.core :as core]
|
||||||
[figwheel.client :as figwheel :include-macros true]))
|
[figwheel.client :as figwheel :include-macros true]))
|
||||||
|
@ -8,10 +8,14 @@
|
||||||
(def cnt (r/atom 0))
|
(def cnt (r/atom 0))
|
||||||
(defn reloader [] @cnt [core/app-root])
|
(defn reloader [] @cnt [core/app-root])
|
||||||
(def root-el (r/as-element [reloader]))
|
(def root-el (r/as-element [reloader]))
|
||||||
|
(defn callback []
|
||||||
|
(swap! cnt inc)
|
||||||
|
(status-im.components.status/init-jail)
|
||||||
|
(re-frame.core/dispatch [:load-commands!]))
|
||||||
|
|
||||||
(figwheel/watch-and-reload
|
(figwheel/watch-and-reload
|
||||||
:websocket-url "ws://10.0.2.2:3449/figwheel-ws"
|
:websocket-url "ws://10.0.3.2:3449/figwheel-ws"
|
||||||
:heads-up-display false
|
:heads-up-display false
|
||||||
:jsload-callback #(swap! cnt inc))
|
:jsload-callback callback)
|
||||||
|
|
||||||
(core/init)
|
(core/init)
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
(:require [reagent.core :as r]
|
(:require [reagent.core :as r]
|
||||||
[status-im.android.core :as core]
|
[status-im.android.core :as core]
|
||||||
[figwheel.client :as figwheel :include-macros true]
|
[figwheel.client :as figwheel :include-macros true]
|
||||||
[status-im.test.handlers-stubs :refer [init-stubs]]))
|
;[status-im.test.handlers-stubs :refer [init-stubs]]
|
||||||
|
))
|
||||||
(enable-console-print!)
|
(enable-console-print!)
|
||||||
|
|
||||||
(set! js/console.disableYellowBox true)
|
(set! js/console.disableYellowBox true)
|
||||||
|
@ -18,4 +18,4 @@
|
||||||
:jsload-callback #(swap! cnt inc))
|
:jsload-callback #(swap! cnt inc))
|
||||||
|
|
||||||
(core/init :test)
|
(core/init :test)
|
||||||
(init-stubs)
|
;(init-stubs)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
(ns user
|
(ns user
|
||||||
(:use [figwheel-sidecar.repl-api :as ra]))
|
(:use [figwheel-sidecar.repl-api :as ra])
|
||||||
|
(:require [hawk.core :as hawk]
|
||||||
|
[clojure.string :as s]))
|
||||||
;; This namespace is loaded automatically by nREPL
|
;; This namespace is loaded automatically by nREPL
|
||||||
|
|
||||||
;; read project.clj to get build configs
|
;; read project.clj to get build configs
|
||||||
|
@ -10,17 +12,34 @@
|
||||||
(apply hash-map)
|
(apply hash-map)
|
||||||
:profiles))
|
:profiles))
|
||||||
|
|
||||||
(def cljs-builds (get-in profiles [:dev :cljsbuild :builds]))
|
(def cljs-builds
|
||||||
|
(get-in profiles [:dev :cljsbuild :builds]))
|
||||||
|
|
||||||
(defn start-figwheel
|
(defn start-figwheel
|
||||||
"Start figwheel for one or more builds"
|
"Start figwheel for one or more builds"
|
||||||
[& build-ids]
|
[build-ids]
|
||||||
(ra/start-figwheel!
|
(ra/start-figwheel!
|
||||||
{:build-ids build-ids
|
{:figwheel-options {:nrepl-port 7888}
|
||||||
:all-builds cljs-builds})
|
:build-ids build-ids
|
||||||
(ra/cljs-repl))
|
:all-builds cljs-builds}))
|
||||||
|
|
||||||
|
(def start-cljs-repl ra/cljs-repl)
|
||||||
|
|
||||||
(defn stop-figwheel
|
(defn stop-figwheel
|
||||||
"Stops figwheel"
|
"Stops figwheel"
|
||||||
[]
|
[]
|
||||||
(ra/stop-figwheel!))
|
(ra/stop-figwheel!))
|
||||||
|
|
||||||
|
(hawk/watch! [{:paths ["resources"]
|
||||||
|
:handler (fn [ctx e]
|
||||||
|
(let [path "src/status_im/utils/js_resources.cljs"
|
||||||
|
js-resourced (slurp path)]
|
||||||
|
(spit path (str js-resourced " ;;"))
|
||||||
|
(spit path js-resourced))
|
||||||
|
ctx)}])
|
||||||
|
|
||||||
|
(let [env-build-ids (System/getenv "BUILD_IDS")
|
||||||
|
build-ids (if env-build-ids
|
||||||
|
(map keyword (s/split env-build-ids #","))
|
||||||
|
[:android])]
|
||||||
|
(start-figwheel build-ids))
|
||||||
|
|
|
@ -164,11 +164,23 @@ function interceptRequire() {
|
||||||
function compileWarningsToYellowBox() {
|
function compileWarningsToYellowBox() {
|
||||||
var log = window.console.log;
|
var log = window.console.log;
|
||||||
var compileWarningRx = /Figwheel: Compile/;
|
var compileWarningRx = /Figwheel: Compile/;
|
||||||
|
var compileExceptionRx = /Figwheel: Compile Exception/;
|
||||||
|
var errorInFileRx = /Error on file/;
|
||||||
|
var isBuffering = false;
|
||||||
|
var compileExceptionBuffer = "";
|
||||||
window.console.log = function (msg) {
|
window.console.log = function (msg) {
|
||||||
if (compileWarningRx.test(msg)) {
|
log.apply(window.console, arguments);
|
||||||
|
if (compileExceptionRx.test(msg)) { // enter buffering mode to get all the messages for exception
|
||||||
|
isBuffering = true;
|
||||||
|
compileExceptionBuffer = msg + "\n";
|
||||||
|
} else if (errorInFileRx.test(msg) && isBuffering) { // exit buffering mode and log buffered messages to YellowBox
|
||||||
|
isBuffering = false;
|
||||||
|
console.warn(compileExceptionBuffer + msg);
|
||||||
|
compileExceptionBuffer = "";
|
||||||
|
} else if (isBuffering) { //log messages buffering mode
|
||||||
|
compileExceptionBuffer += msg + "\n";
|
||||||
|
} else if (compileWarningRx.test(msg)) {
|
||||||
console.warn(msg);
|
console.warn(msg);
|
||||||
} else {
|
|
||||||
log.apply(window.console, arguments);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -208,7 +220,7 @@ function loadApp(platform, devHost, onLoadCb) {
|
||||||
// seriously React packager? why.
|
// seriously React packager? why.
|
||||||
var googreq = goog.require;
|
var googreq = goog.require;
|
||||||
|
|
||||||
googreq('figwheel.connect');
|
googreq('figwheel.connect.' + platform);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -278,4 +290,4 @@ self = {
|
||||||
start: startApp
|
start: startApp
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = self;
|
module.exports = self;
|
||||||
|
|
89
project.clj
89
project.clj
|
@ -5,14 +5,14 @@
|
||||||
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
||||||
:dependencies [[org.clojure/clojure "1.9.0-alpha13"]
|
:dependencies [[org.clojure/clojure "1.9.0-alpha13"]
|
||||||
[org.clojure/clojurescript "1.9.229"]
|
[org.clojure/clojurescript "1.9.229"]
|
||||||
[reagent "0.5.1" :exclusions [cljsjs/react]]
|
[reagent "0.6.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server]]
|
||||||
[re-frame "0.7.0"]
|
[re-frame "0.7.0"]
|
||||||
[natal-shell "0.3.0"]
|
[natal-shell "0.3.0"]
|
||||||
[com.andrewmcveigh/cljs-time "0.4.0"]
|
[com.andrewmcveigh/cljs-time "0.4.0"]
|
||||||
[tailrecursion/cljs-priority-map "1.2.0"]
|
[tailrecursion/cljs-priority-map "1.2.0"]
|
||||||
[com.taoensso/timbre "4.7.4"]]
|
[com.taoensso/timbre "4.7.4"]]
|
||||||
:plugins [[lein-cljsbuild "1.1.4"]
|
:plugins [[lein-cljsbuild "1.1.4"]
|
||||||
[lein-figwheel "0.5.0-2"]]
|
[lein-figwheel "0.5.8"]]
|
||||||
:clean-targets ["target/" "index.ios.js" "index.android.js"]
|
:clean-targets ["target/" "index.ios.js" "index.android.js"]
|
||||||
:aliases {"prod-build" ^{:doc "Recompile code with prod profile."}
|
:aliases {"prod-build" ^{:doc "Recompile code with prod profile."}
|
||||||
["do" "clean"
|
["do" "clean"
|
||||||
|
@ -20,51 +20,56 @@
|
||||||
["with-profile" "prod" "cljsbuild" "once" "android"]]}
|
["with-profile" "prod" "cljsbuild" "once" "android"]]}
|
||||||
:test-paths ["test/clj"]
|
:test-paths ["test/clj"]
|
||||||
:figwheel {:nrepl-port 7888}
|
:figwheel {:nrepl-port 7888}
|
||||||
:profiles {:dev {:dependencies [[figwheel-sidecar "0.5.0-2"]
|
:profiles {:dev {:dependencies [[figwheel-sidecar "0.5.8"]
|
||||||
[com.cemerick/piggieback "0.2.1"]
|
[com.cemerick/piggieback "0.2.1"]
|
||||||
[io.appium/java-client "3.4.1"]]
|
[io.appium/java-client "3.4.1"]
|
||||||
|
[hawk "0.2.10"]]
|
||||||
:plugins [[lein-doo "0.1.6"]]
|
:plugins [[lein-doo "0.1.6"]]
|
||||||
:source-paths ["src" "env/dev"]
|
:source-paths ["src" "env/dev"]
|
||||||
:cljsbuild {:builds {:ios {:source-paths ["src" "env/dev"]
|
:cljsbuild {:builds [{:id :ios
|
||||||
:figwheel true
|
:source-paths ["src" "env/dev"]
|
||||||
:compiler {:output-to "target/ios/not-used.js"
|
:figwheel true
|
||||||
:main "env.ios.main"
|
:compiler {:output-to "target/ios/not-used.js"
|
||||||
:output-dir "target/ios"
|
:main "env.ios.main"
|
||||||
:optimizations :none}}
|
:output-dir "target/ios"
|
||||||
:android {:source-paths ["src" "env/dev"]
|
:optimizations :none}}
|
||||||
:figwheel true
|
{:id :android
|
||||||
:compiler {:output-to "target/android/not-used.js"
|
:source-paths ["src" "env/dev"]
|
||||||
:main "env.android.main"
|
:figwheel true
|
||||||
:output-dir "target/android"
|
:compiler {:output-to "target/android/not-used.js"
|
||||||
:optimizations :none}}
|
:main "env.android.main"
|
||||||
:android-test {:source-paths ["src" "env/dev"]
|
:output-dir "target/android"
|
||||||
:figwheel true
|
:optimizations :none}}
|
||||||
:compiler {:output-to "target/android/not-used.js"
|
{:id :android-test
|
||||||
:main "env.android-test.main"
|
:source-paths ["src" "env/dev"]
|
||||||
:output-dir "target/android"
|
:compiler {:output-to "target/android/not-used.js"
|
||||||
:optimizations :none}}
|
:main "env.android-test.main"
|
||||||
:test {:source-paths ["src" "test/cljs"]
|
:output-dir "target/android-test"
|
||||||
:compiler
|
:optimizations :none}}
|
||||||
{:main status-im.test.runner
|
{:id :test
|
||||||
:output-to "target/test/test.js"
|
:source-paths ["src" "test/cljs"]
|
||||||
:optimizations :none
|
:compiler
|
||||||
:target :nodejs}}}}
|
{:main status-im.test.runner
|
||||||
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}
|
:output-to "target/test/test.js"
|
||||||
|
:optimizations :none
|
||||||
|
:target :nodejs}}]}
|
||||||
|
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]
|
||||||
|
:timeout 120000}}
|
||||||
:prod {:cljsbuild {:builds [{:id "ios"
|
:prod {:cljsbuild {:builds [{:id "ios"
|
||||||
:source-paths ["src" "env/prod"]
|
:source-paths ["src" "env/prod"]
|
||||||
:compiler {:output-to "index.ios.js"
|
:compiler {:output-to "index.ios.js"
|
||||||
:main "env.ios.main"
|
:main "env.ios.main"
|
||||||
:output-dir "target/ios"
|
:output-dir "target/ios-prod"
|
||||||
:static-fns true
|
:static-fns true
|
||||||
:optimize-constants true
|
:optimize-constants true
|
||||||
:optimizations :simple
|
:optimizations :simple
|
||||||
:closure-defines {"goog.DEBUG" false}}}
|
:closure-defines {"goog.DEBUG" false}}}
|
||||||
{:id "android"
|
{:id "android"
|
||||||
:source-paths ["src" "env/prod"]
|
:source-paths ["src" "env/prod"]
|
||||||
:compiler {:output-to "index.android.js"
|
:compiler {:output-to "index.android.js"
|
||||||
:main "env.android.main"
|
:main "env.android.main"
|
||||||
:output-dir "target/android"
|
:output-dir "target/android-prod"
|
||||||
:static-fns true
|
:static-fns true
|
||||||
:optimize-constants true
|
:optimize-constants true
|
||||||
:optimizations :simple
|
:optimizations :simple
|
||||||
:closure-defines {"goog.DEBUG" false}}}]}}})
|
:closure-defines {"goog.DEBUG" false}}}]}}})
|
||||||
|
|
|
@ -57,7 +57,7 @@ fi
|
||||||
lein deps && re-natal deps && re-natal use-android-device "${device_type}" && re-natal use-figwheel
|
lein deps && re-natal deps && re-natal use-android-device "${device_type}" && re-natal use-figwheel
|
||||||
|
|
||||||
# open figwheel in new tab
|
# open figwheel in new tab
|
||||||
tab "lein figwheel ${cljs_build}"
|
tab "BUILD_IDS=${cljs_build} lein repl"
|
||||||
|
|
||||||
# open react-native package in new tab
|
# open react-native package in new tab
|
||||||
tab "react-native start"
|
tab "react-native start"
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
(ns cljsjs.react)
|
(ns cljsjs.react)
|
||||||
|
|
||||||
(when (exists? js/window)
|
(when (exists? js/window)
|
||||||
;; cause there is no window.document object in the newest version
|
|
||||||
;; of React Native, but chance.js requires it
|
|
||||||
(set! js/window.document #js {})
|
|
||||||
|
|
||||||
(set! js/window.React (js/require "react"))
|
|
||||||
(set! js/ReactNative (js/require "react-native")))
|
(set! js/ReactNative (js/require "react-native")))
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
(ns cljsjs.react.dom)
|
|
@ -0,0 +1 @@
|
||||||
|
(ns cljsjs.react.dom.server)
|
|
@ -305,7 +305,9 @@
|
||||||
(let [chat-id (or id current-chat-id)
|
(let [chat-id (or id current-chat-id)
|
||||||
messages (get-in db [:chats chat-id :messages])
|
messages (get-in db [:chats chat-id :messages])
|
||||||
db' (assoc db :current-chat-id chat-id)
|
db' (assoc db :current-chat-id chat-id)
|
||||||
commands-loaded? (get-in db [:chats chat-id :commands-loaded])]
|
commands-loaded? (if js/goog.DEBUG
|
||||||
|
false
|
||||||
|
(get-in db [:chats chat-id :commands-loaded]))]
|
||||||
(when (= current-chat-id wallet-chat-id)
|
(when (= current-chat-id wallet-chat-id)
|
||||||
(dispatch [:cancel-command]))
|
(dispatch [:cancel-command]))
|
||||||
(dispatch [:load-requests! chat-id])
|
(dispatch [:load-requests! chat-id])
|
||||||
|
|
|
@ -53,12 +53,12 @@
|
||||||
:loop? loop?}]
|
:loop? loop?}]
|
||||||
(r/create-class
|
(r/create-class
|
||||||
{:component-did-mount
|
{:component-did-mount
|
||||||
(when-not @answered? #(request-button-animation-logic context))
|
(if @answered? #(request-button-animation-logic context) (fn []))
|
||||||
:component-will-unmount
|
:component-will-unmount
|
||||||
#(reset! loop? false)
|
#(reset! loop? false)
|
||||||
:reagent-render
|
:reagent-render
|
||||||
(fn [message-id {command-icon :icon :as command} status-initialized?]
|
(fn [message-id {command-icon :icon :as command} status-initialized?]
|
||||||
(if command
|
(when command
|
||||||
[touchable-highlight
|
[touchable-highlight
|
||||||
{:on-press (when (and (not @answered?) status-initialized?)
|
{:on-press (when (and (not @answered?) status-initialized?)
|
||||||
#(set-chat-command message-id command))
|
#(set-chat-command message-id command))
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
(ns status-im.chat.views.response
|
(ns status-im.chat.views.response
|
||||||
(:require-macros [reagent.ratom :refer [reaction]]
|
(:require-macros [reagent.ratom :refer [reaction]]
|
||||||
[status-im.utils.views :refer [defview]]
|
[status-im.utils.views :refer [defview]])
|
||||||
[status-im.utils.slurp :refer [slurp]])
|
|
||||||
(:require [re-frame.core :refer [subscribe dispatch]]
|
(:require [re-frame.core :refer [subscribe dispatch]]
|
||||||
[reagent.core :as r]
|
[reagent.core :as r]
|
||||||
[status-im.components.react :refer [view
|
[status-im.components.react :refer [view
|
||||||
|
@ -25,7 +24,8 @@
|
||||||
[status-im.i18n :refer [label]]
|
[status-im.i18n :refer [label]]
|
||||||
[status-im.utils.datetime :as dt]
|
[status-im.utils.datetime :as dt]
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
[status-im.utils.name :refer [shortened-name]]))
|
[status-im.utils.name :refer [shortened-name]]
|
||||||
|
[status-im.utils.js-resources :as js-res]))
|
||||||
|
|
||||||
(defn drag-icon []
|
(defn drag-icon []
|
||||||
[view st/drag-container
|
[view st/drag-container
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
:source {:uri url}
|
:source {:uri url}
|
||||||
:render-error web-view-error
|
:render-error web-view-error
|
||||||
:java-script-enabled true
|
:java-script-enabled true
|
||||||
:injected-java-script (slurp "resources/webview.js")
|
:injected-java-script js-res/webview-js
|
||||||
:bounces false
|
:bounces false
|
||||||
:on-navigation-state-change on-navigation-change}]))
|
:on-navigation-state-change on-navigation-change}]))
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
(ns status-im.commands.handlers.loading
|
(ns status-im.commands.handlers.loading
|
||||||
(:require-macros [status-im.utils.slurp :refer [slurp]])
|
|
||||||
(:require [re-frame.core :refer [path after dispatch subscribe trim-v debug]]
|
(:require [re-frame.core :refer [path after dispatch subscribe trim-v debug]]
|
||||||
[status-im.utils.handlers :as u]
|
[status-im.utils.handlers :as u]
|
||||||
[status-im.utils.utils :refer [http-get show-popup]]
|
[status-im.utils.utils :refer [http-get show-popup]]
|
||||||
|
@ -10,13 +9,14 @@
|
||||||
[status-im.commands.utils :refer [reg-handler]]
|
[status-im.commands.utils :refer [reg-handler]]
|
||||||
[status-im.constants :refer [console-chat-id wallet-chat-id]]
|
[status-im.constants :refer [console-chat-id wallet-chat-id]]
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
[status-im.utils.homoglyph :as h]))
|
[status-im.utils.homoglyph :as h]
|
||||||
|
[status-im.utils.js-resources :as js-res]))
|
||||||
|
|
||||||
(def commands-js "commands.js")
|
(def commands-js "commands.js")
|
||||||
|
|
||||||
(defn load-commands!
|
(defn load-commands!
|
||||||
[_ [identity]]
|
[{:keys [current-chat-id]} [identity]]
|
||||||
(dispatch [::fetch-commands! identity])
|
(dispatch [::fetch-commands! (or identity current-chat-id)])
|
||||||
;; todo uncomment
|
;; todo uncomment
|
||||||
#_(if-let [{:keys [file]} (commands/get-by-chat-id identity)]
|
#_(if-let [{:keys [file]} (commands/get-by-chat-id identity)]
|
||||||
(dispatch [::parse-commands! identity file])
|
(dispatch [::parse-commands! identity file])
|
||||||
|
@ -28,13 +28,13 @@
|
||||||
;-let [url (get-in db [:chats identity :dapp-url])]
|
;-let [url (get-in db [:chats identity :dapp-url])]
|
||||||
(cond
|
(cond
|
||||||
(= console-chat-id identity)
|
(= console-chat-id identity)
|
||||||
(dispatch [::validate-hash identity (slurp "resources/console.js")])
|
(dispatch [::validate-hash identity js-res/console-js])
|
||||||
|
|
||||||
(= wallet-chat-id identity)
|
(= wallet-chat-id identity)
|
||||||
(dispatch [::validate-hash identity (slurp "resources/wallet.js")])
|
(dispatch [::validate-hash identity js-res/wallet-js])
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(dispatch [::validate-hash identity (slurp "resources/commands.js")])
|
(dispatch [::validate-hash identity js-res/commands-js])
|
||||||
#_(http-get (s/join "/" [url commands-js])
|
#_(http-get (s/join "/" [url commands-js])
|
||||||
|
|
||||||
#(dispatch [::validate-hash identity %])
|
#(dispatch [::validate-hash identity %])
|
||||||
|
@ -89,8 +89,8 @@
|
||||||
(let [commands' (filter-forbidden-names id commands)
|
(let [commands' (filter-forbidden-names id commands)
|
||||||
responses' (filter-forbidden-names id responses)]
|
responses' (filter-forbidden-names id responses)]
|
||||||
(-> db
|
(-> db
|
||||||
(update-in [id :commands] merge (mark-as :command commands'))
|
(assoc-in [id :commands] (mark-as :command commands'))
|
||||||
(update-in [id :responses] merge (mark-as :response responses'))
|
(assoc-in [id :responses] (mark-as :response responses'))
|
||||||
(assoc-in [id :commands-loaded] true)
|
(assoc-in [id :commands-loaded] true)
|
||||||
(assoc-in [id :autorun] autorun))))
|
(assoc-in [id :autorun] autorun))))
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(ns status-im.components.refreshable-text.view
|
(ns status-im.components.refreshable-text.view
|
||||||
(:require [reagent.core :as r]
|
(:require [reagent.core :as r]
|
||||||
[reagent.impl.util :as ru]
|
[reagent.impl.component :as rc]
|
||||||
[status-im.components.react :refer [view
|
[status-im.components.react :refer [view
|
||||||
animated-view
|
animated-view
|
||||||
text]]
|
text]]
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
:value value})
|
:value value})
|
||||||
:component-will-update
|
:component-will-update
|
||||||
(fn [component props]
|
(fn [component props]
|
||||||
(let [{new-value :value} (ru/extract-props props)
|
(let [{new-value :value} (rc/extract-props props)
|
||||||
{old-value :value} (r/props component)]
|
{old-value :value} (r/props component)]
|
||||||
(r/set-state component {:old-value old-value
|
(r/set-state component {:old-value old-value
|
||||||
:value new-value})
|
:value new-value})
|
||||||
|
@ -64,4 +64,4 @@
|
||||||
:opacity new-value-opacity}}
|
:opacity new-value-opacity}}
|
||||||
[text {:style text-style
|
[text {:style text-style
|
||||||
:font font}
|
:font font}
|
||||||
value]]]))})))
|
value]]]))})))
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
(ns status-im.components.status
|
(ns status-im.components.status
|
||||||
(:require-macros [status-im.utils.slurp :refer [slurp]]
|
(:require-macros
|
||||||
[cljs.core.async.macros :refer [go-loop go]])
|
[cljs.core.async.macros :refer [go-loop go]])
|
||||||
(:require [status-im.components.react :as r]
|
(:require [status-im.components.react :as r]
|
||||||
[status-im.utils.types :as t]
|
[status-im.utils.types :as t]
|
||||||
[re-frame.core :refer [dispatch]]
|
[re-frame.core :refer [dispatch]]
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
[cljs.core.async :refer [<! timeout]]))
|
[cljs.core.async :refer [<! timeout]]
|
||||||
|
[status-im.utils.js-resources :as js-res]))
|
||||||
|
|
||||||
;; if StatusModule is not initialized better to store
|
;; if StatusModule is not initialized better to store
|
||||||
;; calls and make them only when StatusModule is ready
|
;; calls and make them only when StatusModule is ready
|
||||||
|
@ -23,7 +24,7 @@
|
||||||
(swap! calls conj args))
|
(swap! calls conj args))
|
||||||
|
|
||||||
(defn call-module [f]
|
(defn call-module [f]
|
||||||
(log/debug :call-module)
|
(log/debug :call-module f)
|
||||||
(if @module-initialized?
|
(if @module-initialized?
|
||||||
(f)
|
(f)
|
||||||
(store-call f)))
|
(store-call f)))
|
||||||
|
@ -40,14 +41,12 @@
|
||||||
(reset! loop-started false))
|
(reset! loop-started false))
|
||||||
(recur (<! (timeout 500))))))
|
(recur (<! (timeout 500))))))
|
||||||
|
|
||||||
(def status-js (slurp "resources/status.js"))
|
|
||||||
|
|
||||||
(def status
|
(def status
|
||||||
(when (exists? (.-NativeModules r/react-native))
|
(when (exists? (.-NativeModules r/react-native))
|
||||||
(.-Status (.-NativeModules r/react-native))))
|
(.-Status (.-NativeModules r/react-native))))
|
||||||
|
|
||||||
(defn init-jail []
|
(defn init-jail []
|
||||||
(.initJail status status-js #(log/debug "jail initialized")))
|
(.initJail status js-res/status-js #(log/debug "jail initialized")))
|
||||||
|
|
||||||
(when status (call-module init-jail))
|
(when status (call-module init-jail))
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
(ns ^:figwheel-always status-im.utils.js-resources
|
||||||
|
(:require-macros [status-im.utils.slurp :refer [slurp]]))
|
||||||
|
|
||||||
|
(def commands-js (slurp "resources/commands.js"))
|
||||||
|
(def console-js (slurp "resources/console.js"))
|
||||||
|
(def status-js (slurp "resources/status.js"))
|
||||||
|
(def wallet-js (slurp "resources/wallet.js"))
|
||||||
|
(def webview-js (slurp "resources/webview.js"))
|
Loading…
Reference in New Issue