This commit is contained in:
virvar 2016-03-04 20:28:06 +03:00
parent 68ae5ce5a9
commit 22310a3ee8
3 changed files with 70 additions and 43 deletions

View File

@ -5,7 +5,8 @@
"modules": [ "modules": [
"react-native-contacts", "react-native-contacts",
"react-native-invertible-scroll-view", "react-native-invertible-scroll-view",
"awesome-phonenumber" "awesome-phonenumber",
"web3"
], ],
"imageDirs": [ "imageDirs": [
"images" "images"

View File

@ -6,7 +6,7 @@
:dependencies [[org.clojure/clojure "1.7.0"] :dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.170"] [org.clojure/clojurescript "1.7.170"]
[org.omcljs/om "1.0.0-alpha28" :exclusions [cljsjs/react cljsjs/react-dom]] [org.omcljs/om "1.0.0-alpha28" :exclusions [cljsjs/react cljsjs/react-dom]]
[natal-shell "0.1.6"]] [natal-shell "0.1.6"]]
:plugins [[lein-cljsbuild "1.1.1"] :plugins [[lein-cljsbuild "1.1.1"]
[lein-figwheel "0.5.0-2"]] [lein-figwheel "0.5.0-2"]]
:clean-targets ["target/" "index.ios.js" "index.android.js"] :clean-targets ["target/" "index.ios.js" "index.android.js"]
@ -14,10 +14,12 @@
["do" "clean" ["do" "clean"
["with-profile" "prod" "cljsbuild" "once" "ios"] ["with-profile" "prod" "cljsbuild" "once" "ios"]
["with-profile" "prod" "cljsbuild" "once" "android"]]} ["with-profile" "prod" "cljsbuild" "once" "android"]]}
:profiles {:dev {:dependencies [[figwheel-sidecar "0.5.0-2"] :profiles
{:dev {:dependencies [[figwheel-sidecar "0.5.0-2"]
[com.cemerick/piggieback "0.2.1"]] [com.cemerick/piggieback "0.2.1"]]
:source-paths ["src" "env/dev"] :source-paths ["src" "env/dev"]
:cljsbuild {:builds {:ios {:source-paths ["src" "env/dev"] :cljsbuild {:builds
{:ios {:source-paths ["src" "env/dev"]
:figwheel true :figwheel true
:compiler {:output-to "target/ios/not-used.js" :compiler {:output-to "target/ios/not-used.js"
:main "env.ios.main" :main "env.ios.main"
@ -30,7 +32,8 @@
:output-dir "target/android" :output-dir "target/android"
:optimizations :none}}}} :optimizations :none}}}}
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}} :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}
:prod {:cljsbuild {:builds {:ios {:source-paths ["src" "env/prod"] :prod {:cljsbuild {:builds
{:ios {: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"
@ -39,5 +42,4 @@
: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"
:optimizations :simple}}}} :optimizations :simple}}}}}})
}})

View File

@ -14,6 +14,30 @@
(set! js/PhoneNumber (js/require "awesome-phonenumber")) (set! js/PhoneNumber (js/require "awesome-phonenumber"))
(def country-code "US") (def country-code "US")
(set! js/Web3 (js/require "web3"))
(def ethereum-rpc-url "http://localhost:8545")
(defn make-web3 [rpc-url]
(->> (js/Web3.providers.HttpProvider. rpc-url)
(js/Web3.)))
(defn new-identity [web3 handler]
(.newIdentity (.-shh web3) handler))
(defn my-handler [error result]
(if error
(do (alert (str error))
(.log js/console "error")
(.log js/console error))
(alert (str result)))
(.log js/console "result")
(.log js/console result))
;; (def web3 (make-web3 ethereum-rpc-url))
(new-identity (make-web3 ethereum-rpc-url) my-handler)
;; (def whisper-identity (new-identity web3 my-handler))
;; (alert (str whisper-identity))
(defn show-home-view [nav] (defn show-home-view [nav]
(binding [state/*nav-render* false] (binding [state/*nav-render* false]
(.replace nav (clj->js {:component contacts-list (.replace nav (clj->js {:component contacts-list