add locale and debug props to context object in jail (#459)

This commit is contained in:
Roman Volosovskyi 2016-11-18 12:19:28 +02:00
parent 3401cffaed
commit 5fe3a1b91a
2 changed files with 18 additions and 10 deletions

View File

@ -1,6 +1,10 @@
function wallet(params) {
function wallet(params, context) {
var url = 'http://status.im/dapps/wallet';
if (context.debug) {
url = 'http://127.0.0.1:3450'
}
if (params.url && params.url !== "undefined" && params.url != "") {
url = params.url;
if (!/^[a-zA-Z-_]+:/.test(url)) {

View File

@ -6,7 +6,8 @@
[re-frame.core :refer [dispatch]]
[taoensso.timbre :as log]
[cljs.core.async :refer [<! timeout]]
[status-im.utils.js-resources :as js-res]))
[status-im.utils.js-resources :as js-res]
[status-im.i18n :as i]))
;; if StatusModule is not initialized better to store
;; calls and make them only when StatusModule is ready
@ -92,14 +93,17 @@
(when status
(call-module
#(do
(log/debug :chat-id chat-id)
(log/debug :path path)
(log/debug :params params)
(let [cb (fn [r]
(let [r' (t/json->clj r)]
(log/debug r')
(callback r')))]
(.callJail status chat-id (cljs->json path) (cljs->json params) cb))))))
(log/debug :chat-id chat-id)
(log/debug :path path)
(log/debug :params params)
(let [params' (update params :context assoc
:debug js/goog.DEBUG
:locale i/i18n.locale)
cb (fn [r]
(let [r' (t/json->clj r)]
(log/debug r')
(callback r')))]
(.callJail status chat-id (cljs->json path) (cljs->json params') cb))))))
(defn set-soft-input-mode [mode]
(when status