fix bugs related to release build for android devices
Former-commit-id: 53e7ca91d9
This commit is contained in:
parent
7247e29c5a
commit
b9d29b7fd8
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "StatusIm",
|
"name": "StatusIm",
|
||||||
"interface": "reagent",
|
"interface": "reagent",
|
||||||
"androidHost": "localhost",
|
"androidHost": "10.0.3.2",
|
||||||
"modules": [
|
"modules": [
|
||||||
"react-native-contacts",
|
"react-native-contacts",
|
||||||
"react-native-invertible-scroll-view",
|
"react-native-invertible-scroll-view",
|
||||||
|
@ -28,7 +28,10 @@
|
||||||
"react-native-image-crop-picker",
|
"react-native-image-crop-picker",
|
||||||
"react-native-webview-bridge",
|
"react-native-webview-bridge",
|
||||||
"react-native-drawer-layout",
|
"react-native-drawer-layout",
|
||||||
"homoglyph-finder"
|
"homoglyph-finder",
|
||||||
|
"web3",
|
||||||
|
"eccjs",
|
||||||
|
"chance"
|
||||||
],
|
],
|
||||||
"imageDirs": [
|
"imageDirs": [
|
||||||
"images"
|
"images"
|
||||||
|
|
|
@ -58,6 +58,9 @@ import com.android.build.OutputFile
|
||||||
* inputExcludes: ["android/**", "ios/**"]
|
* inputExcludes: ["android/**", "ios/**"]
|
||||||
* ]
|
* ]
|
||||||
*/
|
*/
|
||||||
|
project.ext.react = [
|
||||||
|
nodeExecutableAndArgs: ["node", "--max-old-space-size=4096"]
|
||||||
|
]
|
||||||
|
|
||||||
apply from: "../../node_modules/react-native/react.gradle"
|
apply from: "../../node_modules/react-native/react.gradle"
|
||||||
|
|
||||||
|
@ -90,6 +93,14 @@ android {
|
||||||
abiFilters "armeabi-v7a", "x86"
|
abiFilters "armeabi-v7a", "x86"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
signingConfigs {
|
||||||
|
release {
|
||||||
|
storeFile file(MYAPP_RELEASE_STORE_FILE)
|
||||||
|
storePassword MYAPP_RELEASE_STORE_PASSWORD
|
||||||
|
keyAlias MYAPP_RELEASE_KEY_ALIAS
|
||||||
|
keyPassword MYAPP_RELEASE_KEY_PASSWORD
|
||||||
|
}
|
||||||
|
}
|
||||||
splits {
|
splits {
|
||||||
abi {
|
abi {
|
||||||
reset()
|
reset()
|
||||||
|
@ -102,6 +113,7 @@ android {
|
||||||
release {
|
release {
|
||||||
minifyEnabled enableProguardInReleaseBuilds
|
minifyEnabled enableProguardInReleaseBuilds
|
||||||
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
||||||
|
signingConfig signingConfigs.release
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// applicationVariants are e.g. debug, release
|
// applicationVariants are e.g. debug, release
|
||||||
|
|
|
@ -32,21 +32,28 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHostResume() { // Actvity `onResume`
|
public void onHostResume() { // Actvity `onResume`
|
||||||
|
|
||||||
Activity currentActivity = getCurrentActivity();
|
Activity currentActivity = getCurrentActivity();
|
||||||
if (currentActivity == null) {
|
if (currentActivity == null) {
|
||||||
|
Log.d(TAG, "On host Activity doesn't exist");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (status == null) {
|
if (status == null) {
|
||||||
status = new StatusConnector(currentActivity, StatusService.class);
|
status = new StatusConnector(currentActivity, StatusService.class);
|
||||||
status.registerHandler(this);
|
status.registerHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
status.bindService();
|
status.bindService();
|
||||||
|
|
||||||
|
WritableMap params = Arguments.createMap();
|
||||||
|
Log.d(TAG, "Send module.initialized event");
|
||||||
|
params.putString("jsonEvent", "{\"type\":\"module.initialized\"}");
|
||||||
|
getReactApplicationContext()
|
||||||
|
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
||||||
|
.emit("gethEvent", params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHostPause() { // Actvity `onPause`
|
public void onHostPause() { // Actvity `onPause`
|
||||||
|
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
status.unbindService();
|
status.unbindService();
|
||||||
}
|
}
|
||||||
|
@ -54,7 +61,6 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHostDestroy() { // Actvity `onDestroy`
|
public void onHostDestroy() { // Actvity `onDestroy`
|
||||||
|
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
status.stopNode(null);
|
status.stopNode(null);
|
||||||
}
|
}
|
||||||
|
@ -126,7 +132,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void startNode(Callback callback) {
|
public void startNode(Callback callback) {
|
||||||
|
Log.d(TAG, "startNode");
|
||||||
if (!checkAvailability()) {
|
if (!checkAvailability()) {
|
||||||
callback.invoke(false);
|
callback.invoke(false);
|
||||||
return;
|
return;
|
||||||
|
@ -140,7 +146,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void login(String address, String password, Callback callback) {
|
public void login(String address, String password, Callback callback) {
|
||||||
|
Log.d(TAG, "login");
|
||||||
if (!checkAvailability()) {
|
if (!checkAvailability()) {
|
||||||
callback.invoke(false);
|
callback.invoke(false);
|
||||||
return;
|
return;
|
||||||
|
@ -154,7 +160,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void createAccount(String password, Callback callback) {
|
public void createAccount(String password, Callback callback) {
|
||||||
|
Log.d(TAG, "createAccount");
|
||||||
if (!checkAvailability()) {
|
if (!checkAvailability()) {
|
||||||
callback.invoke(false);
|
callback.invoke(false);
|
||||||
return;
|
return;
|
||||||
|
@ -168,7 +174,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void recoverAccount(String passphrase, String password, Callback callback) {
|
public void recoverAccount(String passphrase, String password, Callback callback) {
|
||||||
|
Log.d(TAG, "recoverAccount");
|
||||||
if (!checkAvailability()) {
|
if (!checkAvailability()) {
|
||||||
callback.invoke(false);
|
callback.invoke(false);
|
||||||
return;
|
return;
|
||||||
|
@ -186,7 +192,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void completeTransaction(String hash, String password, Callback callback) {
|
public void completeTransaction(String hash, String password, Callback callback) {
|
||||||
|
Log.d(TAG, "completeTransaction");
|
||||||
if (!checkAvailability()) {
|
if (!checkAvailability()) {
|
||||||
callback.invoke(false);
|
callback.invoke(false);
|
||||||
return;
|
return;
|
||||||
|
@ -203,7 +209,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void initJail(String js, Callback callback) {
|
public void initJail(String js, Callback callback) {
|
||||||
|
Log.d(TAG, "initJail");
|
||||||
if (!checkAvailability()) {
|
if (!checkAvailability()) {
|
||||||
callback.invoke(false);
|
callback.invoke(false);
|
||||||
return;
|
return;
|
||||||
|
@ -217,7 +223,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void parseJail(String chatId, String js, Callback callback) {
|
public void parseJail(String chatId, String js, Callback callback) {
|
||||||
|
Log.d(TAG, "parseJail");
|
||||||
if (!checkAvailability()) {
|
if (!checkAvailability()) {
|
||||||
callback.invoke(false);
|
callback.invoke(false);
|
||||||
return;
|
return;
|
||||||
|
@ -231,7 +237,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void callJail(String chatId, String path, String params, Callback callback) {
|
public void callJail(String chatId, String path, String params, Callback callback) {
|
||||||
|
Log.d(TAG, "callJail");
|
||||||
if (!checkAvailability()) {
|
if (!checkAvailability()) {
|
||||||
callback.invoke(false);
|
callback.invoke(false);
|
||||||
return;
|
return;
|
||||||
|
@ -245,7 +251,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void setAdjustResize() {
|
public void setAdjustResize() {
|
||||||
|
Log.d(TAG, "setAdjustResize");
|
||||||
final Activity activity = getCurrentActivity();
|
final Activity activity = getCurrentActivity();
|
||||||
if (activity == null) {
|
if (activity == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -261,7 +267,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void setAdjustPan() {
|
public void setAdjustPan() {
|
||||||
|
Log.d(TAG, "setAdjustPan");
|
||||||
final Activity activity = getCurrentActivity();
|
final Activity activity = getCurrentActivity();
|
||||||
if (activity == null) {
|
if (activity == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -277,7 +283,7 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void setSoftInputMode(final int mode) {
|
public void setSoftInputMode(final int mode) {
|
||||||
|
Log.d(TAG, "setSoftInputMode");
|
||||||
final Activity activity = getCurrentActivity();
|
final Activity activity = getCurrentActivity();
|
||||||
if (activity == null) {
|
if (activity == null) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -13,10 +13,12 @@
|
||||||
"assert": "^1.4.1",
|
"assert": "^1.4.1",
|
||||||
"awesome-phonenumber": "^1.0.13",
|
"awesome-phonenumber": "^1.0.13",
|
||||||
"browserify-zlib": "^0.1.4",
|
"browserify-zlib": "^0.1.4",
|
||||||
|
"chance": "1.0.4",
|
||||||
"console-browserify": "^1.1.0",
|
"console-browserify": "^1.1.0",
|
||||||
"constants-browserify": "0.0.1",
|
"constants-browserify": "0.0.1",
|
||||||
"dns.js": "^1.0.1",
|
"dns.js": "^1.0.1",
|
||||||
"domain-browser": "^1.1.7",
|
"domain-browser": "^1.1.7",
|
||||||
|
"eccjs": "0.3.1",
|
||||||
"events": "^1.1.1",
|
"events": "^1.1.1",
|
||||||
"homoglyph-finder": "^1.1.1",
|
"homoglyph-finder": "^1.1.1",
|
||||||
"https-browserify": "0.0.1",
|
"https-browserify": "0.0.1",
|
||||||
|
@ -28,7 +30,7 @@
|
||||||
"querystring-es3": "^0.2.1",
|
"querystring-es3": "^0.2.1",
|
||||||
"re-natal": "0.2.38",
|
"re-natal": "0.2.38",
|
||||||
"react": "^15.3.1",
|
"react": "^15.3.1",
|
||||||
"react-native": "^0.33.0",
|
"react-native": "^0.34.0",
|
||||||
"react-native-action-button": "^1.1.11",
|
"react-native-action-button": "^1.1.11",
|
||||||
"react-native-android-sms-listener": "github:adrian-tiberius/react-native-android-sms-listener#listener-bugfix",
|
"react-native-android-sms-listener": "github:adrian-tiberius/react-native-android-sms-listener#listener-bugfix",
|
||||||
"react-native-camera": "git+https://github.com/lwansbrough/react-native-camera.git",
|
"react-native-camera": "git+https://github.com/lwansbrough/react-native-camera.git",
|
||||||
|
@ -58,7 +60,8 @@
|
||||||
"timers-browserify": "^1.4.2",
|
"timers-browserify": "^1.4.2",
|
||||||
"tty-browserify": "0.0.0",
|
"tty-browserify": "0.0.0",
|
||||||
"url": "^0.10.3",
|
"url": "^0.10.3",
|
||||||
"vm-browserify": "0.0.4"
|
"vm-browserify": "0.0.4",
|
||||||
|
"web3": "0.16.0"
|
||||||
},
|
},
|
||||||
"browser": {
|
"browser": {
|
||||||
"crypto": "react-native-crypto",
|
"crypto": "react-native-crypto",
|
||||||
|
|
35
project.clj
35
project.clj
|
@ -11,12 +11,9 @@
|
||||||
[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"]
|
||||||
[cljsjs/web3 "0.16.0-0"]
|
|
||||||
[com.taoensso/timbre "4.7.4"]
|
[com.taoensso/timbre "4.7.4"]
|
||||||
[org.clojure/test.check "0.9.0"]
|
[org.clojure/test.check "0.9.0"]]
|
||||||
[cljsjs/chance "0.7.3-0"]
|
:plugins [[lein-cljsbuild "1.1.4"]
|
||||||
[cljsjs/eccjs "0.3.1-0"]]
|
|
||||||
: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"]
|
||||||
:aliases {"prod-build" ^{:doc "Recompile code with prod profile."}
|
:aliases {"prod-build" ^{:doc "Recompile code with prod profile."}
|
||||||
|
@ -55,13 +52,21 @@
|
||||||
:optimizations :none
|
:optimizations :none
|
||||||
:target :nodejs}}}}
|
:target :nodejs}}}}
|
||||||
: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 [{:id "ios"
|
||||||
:compiler {:output-to "index.ios.js"
|
:source-paths ["src" "env/prod"]
|
||||||
:main "env.ios.main"
|
:compiler {:output-to "index.ios.js"
|
||||||
:output-dir "target/ios"
|
:main "env.ios.main"
|
||||||
:optimizations :simple}}
|
:output-dir "target/ios"
|
||||||
:android {:source-paths ["src" "env/prod"]
|
:static-fns true
|
||||||
:compiler {:output-to "index.android.js"
|
:optimize-constants true
|
||||||
:main "env.android.main"
|
:optimizations :simple
|
||||||
:output-dir "target/android"
|
:closure-defines {"goog.DEBUG" false}}}
|
||||||
:optimizations :simple}}}}}})
|
{:id "android"
|
||||||
|
:source-paths ["src" "env/prod"]
|
||||||
|
:compiler {:output-to "index.android.js"
|
||||||
|
:main "env.android.main"
|
||||||
|
:output-dir "target/android"
|
||||||
|
:static-fns true
|
||||||
|
:optimize-constants true
|
||||||
|
:optimizations :simple
|
||||||
|
:closure-defines {"goog.DEBUG" false}}}]}}})
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
(ns status-im.accounts.recover.validations
|
(ns status-im.accounts.recover.validations
|
||||||
(:require [cljs.spec :as s]
|
(:require [cljs.spec :as s]))
|
||||||
[cljsjs.web3]))
|
|
||||||
|
|
||||||
(s/def ::not-empty-string (s/and string? not-empty))
|
(s/def ::not-empty-string (s/and string? not-empty))
|
||||||
(s/def ::passphrase ::not-empty-string)
|
(s/def ::passphrase ::not-empty-string)
|
||||||
|
|
|
@ -105,10 +105,10 @@
|
||||||
|
|
||||||
(defn init [& [env]]
|
(defn init [& [env]]
|
||||||
(dispatch-sync [:reset-app])
|
(dispatch-sync [:reset-app])
|
||||||
|
(.registerComponent app-registry "StatusIm" #(r/reactify-component app-root)
|
||||||
(dispatch [:listen-to-network-status!])
|
(dispatch [:listen-to-network-status!])
|
||||||
(dispatch [:initialize-crypt])
|
(dispatch [:initialize-crypt])
|
||||||
(dispatch [:initialize-geth])
|
(dispatch [:initialize-geth])
|
||||||
(status/set-soft-input-mode status/adjust-resize)
|
(status/set-soft-input-mode status/adjust-resize)
|
||||||
(dispatch [:load-user-phone-number])
|
(dispatch [:load-user-phone-number])
|
||||||
(init-back-button-handler!)
|
(init-back-button-handler!)))
|
||||||
(.registerComponent app-registry "StatusIm" #(r/reactify-component app-root)))
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
;; Dialogs
|
;; Dialogs
|
||||||
|
|
||||||
(def react-native-dialogs (u/require "react-native-dialogs"))
|
(def react-native-dialogs (js/require "react-native-dialogs"))
|
||||||
|
|
||||||
(defn show-dialog [{:keys [title options callback]}]
|
(defn show-dialog [{:keys [title options callback]}]
|
||||||
(let [dialog (new react-native-dialogs)]
|
(let [dialog (new react-native-dialogs)]
|
||||||
|
|
|
@ -5,14 +5,14 @@
|
||||||
:refer [get-react-property get-class adapt-class]]
|
:refer [get-react-property get-class adapt-class]]
|
||||||
[status-im.utils.platform :refer [platform-specific]]))
|
[status-im.utils.platform :refer [platform-specific]]))
|
||||||
|
|
||||||
(def react-native (u/require "react-native"))
|
(def react-native (js/require "react-native"))
|
||||||
(def native-modules (.-NativeModules react-native))
|
(def native-modules (.-NativeModules react-native))
|
||||||
(def device-event-emitter (.-DeviceEventEmitter react-native))
|
(def device-event-emitter (.-DeviceEventEmitter react-native))
|
||||||
|
|
||||||
(def linear-gradient-module (u/require "react-native-linear-gradient"))
|
(def linear-gradient-module (js/require "react-native-linear-gradient"))
|
||||||
(def dismiss-keyboard! (u/require "dismissKeyboard"))
|
(def dismiss-keyboard! (js/require "dismissKeyboard"))
|
||||||
(def orientation (u/require "react-native-orientation"))
|
(def orientation (js/require "react-native-orientation"))
|
||||||
(def drawer (u/require "react-native-drawer-layout"))
|
(def drawer (js/require "react-native-drawer-layout"))
|
||||||
|
|
||||||
;; React Components
|
;; React Components
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
|
|
||||||
;; Image picker
|
;; Image picker
|
||||||
|
|
||||||
(def image-picker-class (u/require "react-native-image-crop-picker"))
|
(def image-picker-class (js/require "react-native-image-crop-picker"))
|
||||||
|
|
||||||
(defn show-image-picker [images-fn]
|
(defn show-image-picker [images-fn]
|
||||||
(let [image-picker (.-default image-picker-class)]
|
(let [image-picker (.-default image-picker-class)]
|
||||||
|
|
|
@ -1,9 +1,44 @@
|
||||||
(ns status-im.components.status
|
(ns status-im.components.status
|
||||||
(:require-macros [status-im.utils.slurp :refer [slurp]])
|
(:require-macros [status-im.utils.slurp :refer [slurp]]
|
||||||
|
[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]]))
|
||||||
|
|
||||||
|
;; if StatusModule is not initialized better to store
|
||||||
|
;; calls and make them only when StatusModule is ready
|
||||||
|
;; this flag helps to handle this
|
||||||
|
(defonce module-initialized? (atom js/goog.DEBUG))
|
||||||
|
|
||||||
|
;; array of calls to StatusModule
|
||||||
|
(defonce calls (atom []))
|
||||||
|
|
||||||
|
(defn module-initialized! []
|
||||||
|
(reset! module-initialized? true))
|
||||||
|
|
||||||
|
(defn store-call [args]
|
||||||
|
(log/debug :store-call args)
|
||||||
|
(swap! calls conj args))
|
||||||
|
|
||||||
|
(defn call-module [f]
|
||||||
|
(log/debug :call-module)
|
||||||
|
(if @module-initialized?
|
||||||
|
(f)
|
||||||
|
(store-call f)))
|
||||||
|
|
||||||
|
(defonce loop-started (atom false))
|
||||||
|
|
||||||
|
(when-not @loop-started
|
||||||
|
(go-loop [_ nil]
|
||||||
|
(reset! loop-started true)
|
||||||
|
(if (and (seq @calls) @module-initialized?)
|
||||||
|
(do (swap! calls (fn [calls]
|
||||||
|
(doseq [call calls]
|
||||||
|
(call))))
|
||||||
|
(reset! loop-started false))
|
||||||
|
(recur (<! (timeout 500))))))
|
||||||
|
|
||||||
(def status-js (slurp "resources/status.js"))
|
(def status-js (slurp "resources/status.js"))
|
||||||
|
|
||||||
|
@ -11,55 +46,59 @@
|
||||||
(when (exists? (.-NativeModules r/react-native))
|
(when (exists? (.-NativeModules r/react-native))
|
||||||
(.-Status (.-NativeModules r/react-native))))
|
(.-Status (.-NativeModules r/react-native))))
|
||||||
|
|
||||||
(when status
|
(defn init-jail []
|
||||||
(.initJail status status-js #(log/debug "jail initialized")))
|
(.initJail status status-js #(log/debug "jail initialized")))
|
||||||
|
|
||||||
|
(when status (call-module init-jail))
|
||||||
|
|
||||||
(.addListener r/device-event-emitter "gethEvent"
|
(.addListener r/device-event-emitter "gethEvent"
|
||||||
#(dispatch [:signal-event (.-jsonEvent %)]))
|
#(dispatch [:signal-event (.-jsonEvent %)]))
|
||||||
|
|
||||||
(defn start-node [on-result]
|
(defn start-node [on-result]
|
||||||
(when status
|
(when status
|
||||||
(.startNode status on-result)))
|
(call-module #(.startNode status on-result))))
|
||||||
|
|
||||||
(defn create-account [password on-result]
|
(defn create-account [password on-result]
|
||||||
(when status
|
(when status
|
||||||
(.createAccount status password on-result)))
|
(call-module #(.createAccount status password on-result))))
|
||||||
|
|
||||||
(defn recover-account [passphrase password on-result]
|
(defn recover-account [passphrase password on-result]
|
||||||
(when status
|
(when status
|
||||||
(.recoverAccount status passphrase password on-result)))
|
(call-module #(.recoverAccount status passphrase password on-result))))
|
||||||
|
|
||||||
(defn login [address password on-result]
|
(defn login [address password on-result]
|
||||||
(when status
|
(when status
|
||||||
(.login status address password on-result)))
|
(call-module #(.login status address password on-result))))
|
||||||
|
|
||||||
(defn complete-transaction
|
(defn complete-transaction
|
||||||
[hash password callback]
|
[hash password callback]
|
||||||
(log/debug :complete-transaction (boolean status) hash password)
|
(log/debug :complete-transaction (boolean status) hash password)
|
||||||
(when status
|
(when status
|
||||||
(.completeTransaction status hash password callback)))
|
(call-module #(.completeTransaction status hash password callback))))
|
||||||
|
|
||||||
(defn parse-jail [chat-id file callback]
|
(defn parse-jail [chat-id file callback]
|
||||||
(when status
|
(when status
|
||||||
(.parseJail status chat-id file callback)))
|
(call-module #(.parseJail status chat-id file callback))))
|
||||||
|
|
||||||
(defn cljs->json [data]
|
(defn cljs->json [data]
|
||||||
(.stringify js/JSON (clj->js data)))
|
(.stringify js/JSON (clj->js data)))
|
||||||
|
|
||||||
(defn call-jail [chat-id path params callback]
|
(defn call-jail [chat-id path params callback]
|
||||||
(when status
|
(when status
|
||||||
(log/debug :chat-id chat-id)
|
(call-module
|
||||||
(log/debug :path path)
|
#(do
|
||||||
(log/debug :params params)
|
(log/debug :chat-id chat-id)
|
||||||
(let [cb (fn [r]
|
(log/debug :path path)
|
||||||
(let [r' (t/json->clj r)]
|
(log/debug :params params)
|
||||||
(log/debug r')
|
(let [cb (fn [r]
|
||||||
(callback r')))]
|
(let [r' (t/json->clj r)]
|
||||||
(.callJail status chat-id (cljs->json path) (cljs->json params) cb))))
|
(log/debug r')
|
||||||
|
(callback r')))]
|
||||||
|
(.callJail status chat-id (cljs->json path) (cljs->json params) cb))))))
|
||||||
|
|
||||||
(defn set-soft-input-mode [mode]
|
(defn set-soft-input-mode [mode]
|
||||||
(when status
|
(when status
|
||||||
(.setSoftInputMode status mode)))
|
(call-module #(.setSoftInputMode status mode))))
|
||||||
|
|
||||||
(def adjust-resize 16)
|
(def adjust-resize 16)
|
||||||
(def adjust-pan 32)
|
(def adjust-pan 32)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[reagent.core :as r]))
|
[reagent.core :as r]))
|
||||||
|
|
||||||
(def webview-bridge-class
|
(def webview-bridge-class
|
||||||
(r/adapt-react-class (u/require "react-native-webview-bridge")))
|
(r/adapt-react-class (js/require "react-native-webview-bridge")))
|
||||||
|
|
||||||
(defn webview-bridge [opts]
|
(defn webview-bridge [opts]
|
||||||
[webview-bridge-class opts])
|
[webview-bridge-class opts])
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
(register-handler :load-contacts load-contacts!)
|
(register-handler :load-contacts load-contacts!)
|
||||||
|
|
||||||
;; TODO see https://github.com/rt2zz/react-native-contacts/issues/45
|
;; TODO see https://github.com/rt2zz/react-native-contacts/issues/45
|
||||||
(def react-native-contacts (require "react-native-contacts"))
|
(def react-native-contacts (js/require "react-native-contacts"))
|
||||||
|
|
||||||
(defn contact-name [contact]
|
(defn contact-name [contact]
|
||||||
(->> contact
|
(->> contact
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
(ns status-im.contacts.validations
|
(ns status-im.contacts.validations
|
||||||
(:require [cljs.spec :as s]
|
(:require [cljs.spec :as s]
|
||||||
[cljsjs.web3]
|
|
||||||
[status-im.data-store.contacts :as contacts]))
|
[status-im.data-store.contacts :as contacts]))
|
||||||
|
|
||||||
|
(def web3 (js/require "web3"))
|
||||||
|
|
||||||
(defn is-address? [s]
|
(defn is-address? [s]
|
||||||
(.isAddress js/Web3.prototype s))
|
(.isAddress web3.prototype s))
|
||||||
|
|
||||||
(defn unique-identity? [identity]
|
(defn unique-identity? [identity]
|
||||||
(not (contacts/exists? identity)))
|
(not (contacts/exists? identity)))
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
[clojure.string :as str])
|
[clojure.string :as str])
|
||||||
(:refer-clojure :exclude [exists?]))
|
(:refer-clojure :exclude [exists?]))
|
||||||
|
|
||||||
(def realm-class (u/require "realm"))
|
(def realm-class (js/require "realm"))
|
||||||
|
|
||||||
(defn realm-version
|
(defn realm-version
|
||||||
[file-name]
|
[file-name]
|
||||||
|
|
|
@ -75,6 +75,8 @@
|
||||||
(dispatch [:init-wallet-chat])
|
(dispatch [:init-wallet-chat])
|
||||||
(dispatch [:load-commands! console-chat-id]))))
|
(dispatch [:load-commands! console-chat-id]))))
|
||||||
|
|
||||||
|
(def ecc (js/require "eccjs"))
|
||||||
|
|
||||||
(register-handler :initialize-crypt
|
(register-handler :initialize-crypt
|
||||||
(u/side-effect!
|
(u/side-effect!
|
||||||
(fn [_ _]
|
(fn [_ _]
|
||||||
|
@ -87,8 +89,8 @@
|
||||||
:error error}]))
|
:error error}]))
|
||||||
(do
|
(do
|
||||||
(->> (.toString buffer "hex")
|
(->> (.toString buffer "hex")
|
||||||
(.toBits (.. js/ecc -sjcl -codec -hex))
|
(.toBits (.. ecc -sjcl -codec -hex))
|
||||||
(.addEntropy (.. js/ecc -sjcl -random)))
|
(.addEntropy (.. ecc -sjcl -random)))
|
||||||
(dispatch [:crypt-initialized]))))))))
|
(dispatch [:crypt-initialized]))))))))
|
||||||
|
|
||||||
(defn node-started [db result]
|
(defn node-started [db result]
|
||||||
|
@ -96,9 +98,9 @@
|
||||||
|
|
||||||
(register-handler :initialize-geth
|
(register-handler :initialize-geth
|
||||||
(u/side-effect!
|
(u/side-effect!
|
||||||
(fn [db _]
|
(fn [db _]
|
||||||
(log/debug "Starting node")
|
(log/debug "Starting node")
|
||||||
(status/start-node (fn [result] (node-started db result))))))
|
(status/start-node (fn [result] (node-started db result))))))
|
||||||
|
|
||||||
(register-handler :signal-event
|
(register-handler :signal-event
|
||||||
(u/side-effect!
|
(u/side-effect!
|
||||||
|
@ -108,8 +110,14 @@
|
||||||
(case type
|
(case type
|
||||||
"transaction.queued" (dispatch [:transaction-queued event])
|
"transaction.queued" (dispatch [:transaction-queued event])
|
||||||
"node.started" (log/debug "Event *node.started* received")
|
"node.started" (log/debug "Event *node.started* received")
|
||||||
|
"module.initialized" (dispatch [:status-module-initialized!])
|
||||||
(log/debug "Event " type " not handled"))))))
|
(log/debug "Event " type " not handled"))))))
|
||||||
|
|
||||||
|
(register-handler :status-module-initialized!
|
||||||
|
(u/side-effect!
|
||||||
|
(fn [db]
|
||||||
|
(status/module-initialized!))))
|
||||||
|
|
||||||
(register-handler :crypt-initialized
|
(register-handler :crypt-initialized
|
||||||
(u/side-effect!
|
(u/side-effect!
|
||||||
(fn [_ _]
|
(fn [_ _]
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[status-im.translations.en :as en]
|
[status-im.translations.en :as en]
|
||||||
[status-im.utils.utils :as u]))
|
[status-im.utils.utils :as u]))
|
||||||
|
|
||||||
(def i18n (u/require "react-native-i18n"))
|
(def i18n (js/require "react-native-i18n"))
|
||||||
(set! (.-fallbacks i18n) true)
|
(set! (.-fallbacks i18n) true)
|
||||||
(set! (.-defaultSeparator i18n) "/")
|
(set! (.-defaultSeparator i18n) "/")
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
;; Dialogs
|
;; Dialogs
|
||||||
|
|
||||||
(def react-native (u/require "react-native"))
|
(def react-native (js/require "react-native"))
|
||||||
|
|
||||||
(defn show-action-sheet [{:keys [options callback cancel-text]}]
|
(defn show-action-sheet [{:keys [options callback cancel-text]}]
|
||||||
(.showActionSheetWithOptions (.-ActionSheetIOS react-native)
|
(.showActionSheetWithOptions (.-ActionSheetIOS react-native)
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
(ns status-im.protocol.encryption
|
(ns status-im.protocol.encryption)
|
||||||
(:require [cljsjs.chance]
|
|
||||||
[cljsjs.eccjs]))
|
|
||||||
|
|
||||||
(def default-curve 384)
|
(def default-curve 384)
|
||||||
|
|
||||||
|
(def ecc (js/require "eccjs"))
|
||||||
|
|
||||||
(defn new-keypair!
|
(defn new-keypair!
|
||||||
"Returns {:private \"private key\" :public \"public key\""
|
"Returns {:private \"private key\" :public \"public key\""
|
||||||
[]
|
[]
|
||||||
(let [{:keys [enc dec]}
|
(let [{:keys [enc dec]}
|
||||||
(-> (.generate js/ecc (.-ENC_DEC js/ecc) default-curve)
|
(-> (.generate ecc (.-ENC_DEC ecc) default-curve)
|
||||||
(js->clj :keywordize-keys true))]
|
(js->clj :keywordize-keys true))]
|
||||||
{:private dec
|
{:private dec
|
||||||
:public enc}))
|
:public enc}))
|
||||||
|
|
||||||
(defn encrypt [public-key content]
|
(defn encrypt [public-key content]
|
||||||
(.encrypt js/ecc public-key content))
|
(.encrypt ecc public-key content))
|
||||||
|
|
||||||
(defn decrypt [private-key content]
|
(defn decrypt [private-key content]
|
||||||
(.decrypt js/ecc private-key content))
|
(.decrypt ecc private-key content))
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
(ns status-im.protocol.web3.utils
|
(ns status-im.protocol.web3.utils
|
||||||
(:require cljsjs.web3
|
(:require [cljs-time.core :refer [now]]
|
||||||
[cljs-time.core :refer [now]]
|
|
||||||
[cljs-time.coerce :refer [to-long]]))
|
[cljs-time.coerce :refer [to-long]]))
|
||||||
|
|
||||||
(def web3 js/Web3)
|
(def web3 (js/require "web3"))
|
||||||
|
|
||||||
(def status-app-topic "status-app")
|
(def status-app-topic "status-app")
|
||||||
|
|
||||||
(defn from-utf8 [s]
|
(defn from-utf8 [s]
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
[status-im.utils.handlers :as u]
|
[status-im.utils.handlers :as u]
|
||||||
[status-im.utils.types :as t]
|
[status-im.utils.types :as t]
|
||||||
[status-im.components.status :as status]
|
[status-im.components.status :as status]
|
||||||
cljsjs.web3
|
|
||||||
[clojure.string :as s]
|
[clojure.string :as s]
|
||||||
[taoensso.timbre :as log]))
|
[taoensso.timbre :as log]))
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
[status-im.components.styles :refer [icon-ok
|
[status-im.components.styles :refer [icon-ok
|
||||||
icon-close]]
|
icon-close]]
|
||||||
[status-im.transactions.styles :as st]
|
[status-im.transactions.styles :as st]
|
||||||
[status-im.i18n :refer [label label-pluralize]]
|
[status-im.i18n :refer [label label-pluralize]]))
|
||||||
cljsjs.web3))
|
|
||||||
|
|
||||||
(defn title-bar [title id]
|
(defn title-bar [title id]
|
||||||
[view st/title-bar
|
[view st/title-bar
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
[status-im.utils.utils :as u])
|
[status-im.utils.utils :as u])
|
||||||
(:import goog.crypt.Sha256))
|
(:import goog.crypt.Sha256))
|
||||||
|
|
||||||
(def random-bytes (u/require "react-native-randombytes"))
|
(def random-bytes (js/require "react-native-randombytes"))
|
||||||
|
|
||||||
(def sha-256 (Sha256.))
|
(def sha-256 (Sha256.))
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
(:require [clojure.string :as s]
|
(:require [clojure.string :as s]
|
||||||
[status-im.utils.utils :as u]))
|
[status-im.utils.utils :as u]))
|
||||||
|
|
||||||
(def fs (u/require "react-native-fs"))
|
(def fs (js/require "react-native-fs"))
|
||||||
|
|
||||||
(defn move-file [src dst handler]
|
(defn move-file [src dst handler]
|
||||||
(let [result (.moveFile fs src dst)
|
(let [result (.moveFile fs src dst)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(ns status-im.utils.homoglyph
|
(ns status-im.utils.homoglyph
|
||||||
(:require [status-im.utils.utils :as u]))
|
(:require [status-im.utils.utils :as u]))
|
||||||
|
|
||||||
(def homoglyph-finder (u/require "homoglyph-finder"))
|
(def homoglyph-finder (js/require "homoglyph-finder"))
|
||||||
|
|
||||||
(defn matches [s1 s2]
|
(defn matches [s1 s2]
|
||||||
(.isMatches homoglyph-finder s1 s2))
|
(.isMatches homoglyph-finder s1 s2))
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
(def default-size 40)
|
(def default-size 40)
|
||||||
|
|
||||||
(def identicon-js (u/require "identicon.js"))
|
(def identicon-js (js/require "identicon.js"))
|
||||||
|
|
||||||
(defn identicon
|
(defn identicon
|
||||||
([hash] (identicon hash default-size))
|
([hash] (identicon hash default-size))
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
(ns status-im.utils.phone-number
|
(ns status-im.utils.phone-number
|
||||||
(:require [status-im.utils.utils :as u]))
|
(:require [status-im.utils.utils :as u]))
|
||||||
|
|
||||||
(def i18n (u/require "react-native-i18n"))
|
(def i18n (js/require "react-native-i18n"))
|
||||||
(def locale (or (.-locale i18n) "___en"))
|
(def locale (or (.-locale i18n) "___en"))
|
||||||
(def country-code (subs locale 3 5))
|
(def country-code (subs locale 3 5))
|
||||||
(def awesome-phonenumber (u/require "awesome-phonenumber"))
|
(def awesome-phonenumber (js/require "awesome-phonenumber"))
|
||||||
|
|
||||||
;; todo check wrong numbers, .getNumber returns empty string
|
;; todo check wrong numbers, .getNumber returns empty string
|
||||||
(defn format-phone-number [number]
|
(defn format-phone-number [number]
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[status-im.android.platform :as android]
|
[status-im.android.platform :as android]
|
||||||
[status-im.ios.platform :as ios]))
|
[status-im.ios.platform :as ios]))
|
||||||
|
|
||||||
(def react-native (u/require "react-native"))
|
(def react-native (js/require "react-native"))
|
||||||
|
|
||||||
(def platform
|
(def platform
|
||||||
(when-let [pl (.-Platform react-native)]
|
(when-let [pl (.-Platform react-native)]
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
(ns status-im.utils.random
|
(ns status-im.utils.random)
|
||||||
(:require [cljsjs.chance]))
|
|
||||||
|
|
||||||
(defn timestamp []
|
(defn timestamp []
|
||||||
(.getTime (js/Date.)))
|
(.getTime (js/Date.)))
|
||||||
|
|
||||||
|
(def Chance (js/require "chance"))
|
||||||
|
|
||||||
|
(def chance (Chance.))
|
||||||
|
|
||||||
(defn id []
|
(defn id []
|
||||||
(str (timestamp) "-" (.guid js/chance)))
|
(str (timestamp) "-" (.guid chance)))
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
(:require [status-im.utils.platform :refer [android?]]
|
(:require [status-im.utils.platform :refer [android?]]
|
||||||
[status-im.utils.utils :as u]))
|
[status-im.utils.utils :as u]))
|
||||||
|
|
||||||
(def sms-listener (.-default (u/require "react-native-android-sms-listener")))
|
(def sms-listener (.-default (js/require "react-native-android-sms-listener")))
|
||||||
|
|
||||||
;; Only android is supported!
|
;; Only android is supported!
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
(defn log [obj]
|
(defn log [obj]
|
||||||
(.log js/console obj))
|
(.log js/console obj))
|
||||||
|
|
||||||
(def react-native (require "react-native"))
|
(def react-native (js/require "react-native"))
|
||||||
|
|
||||||
(defn show-popup [title content]
|
(defn show-popup [title content]
|
||||||
(.alert (.-Alert react-native)
|
(.alert (.-Alert react-native)
|
||||||
|
|
Loading…
Reference in New Issue