jail component

Former-commit-id: 3aef0f2d9c
This commit is contained in:
Roman Volosovskyi 2016-06-10 17:04:12 +03:00
parent 836ebc2a30
commit f6da400ec8
2 changed files with 23 additions and 13 deletions

View File

@ -5,7 +5,8 @@
[status-im.components.react :as r]
[status-im.utils.utils :refer [http-get toast]]
[clojure.string :as s]
[status-im.persistence.realm :as realm]))
[status-im.persistence.realm :as realm]
[status-im.components.jail :as j]))
(defn reg-handler
([name handler] (reg-handler name nil handler))
@ -42,12 +43,6 @@
;; todo tbd hashing algorithm
(hash file))
(defn get-jail []
(.-Jail (.-NativeModules r/react)))
(defn parse [file success-callback fail-callback]
(.parse (get-jail) file success-callback fail-callback))
(defn json->clj [json]
(js->clj (.parse js/JSON json) :keywordize-keys true))
@ -69,7 +64,7 @@
:icon "icon_lock_white"}}})
(defn parse-commands! [_ [identity file]]
(parse file
(j/parse identity file
(fn [result]
(let [commands (json->clj result)]
;; todo use commands from jail

View File

@ -0,0 +1,15 @@
(ns status-im.components.jail
(:require [status-im.components.react :as r]))
(def jail (.-Jail (.-NativeModules r/react)))
(defn parse [chat-id file success-callback fail-callback]
(.parse jail chat-id file success-callback fail-callback))
(defn call
[chat-id path params callback]
(.call jail chat-id (clj->js path) (clj->js params) callback))
(defn add-listener
[chat-id callback]
(.addListener jail chat-id callback))