use shadow-cljs

Signed-off-by: Jakub Sokołowski <jakub@status.im>
Signed-off-by: yenda <eric@status.im>
This commit is contained in:
yenda 2019-09-07 14:57:22 +02:00
parent 1150626801
commit d5ef218584
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
252 changed files with 6310 additions and 7736 deletions

View File

@ -1,6 +1,9 @@
{:lint-as {status-im.utils.views/defview clojure.core/defn
status-im.utils.views/letsubs clojure.core/let
status-im.utils.fx/defn clojure.core/defn
status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all
status-im.utils.styles/def clojure.core/def
status-im.utils.styles/defn clojure.core/defn}
:linters {:invalid-arity {:skip-args [status-im.utils.fx/defn]}}}
:linters {:invalid-arity {:skip-args [status-im.utils.fx/defn]}
;;TODO remove number when this is fixed
;;https://github.com/borkdude/clj-kondo/issues/867
:unresolved-symbol {:exclude [PersistentPriorityMap.EMPTY number]}}}

6
.gitignore vendored
View File

@ -86,6 +86,9 @@ figwheel_server.log
.lein-failures
.lein-repl-history
# Shadow
.shadow-cljs
## Doo
#
out
@ -100,6 +103,7 @@ Statusgo.framework
#ios
/ios/Pods/
/ios/StatusIm.xcworkspace
/ios/react-native-xcode.log
.ruby-version
status-e2e/
@ -185,3 +189,5 @@ status-modules/resources
/fiddle/resources/public/images/
trace.edn
app

View File

@ -92,11 +92,11 @@ nix-add-gcroots: ##@nix Add Nix GC roots to avoid status-react expressions being
nix-update-gradle: ##@nix Update maven nix expressions based on current gradle setup
nix/mobile/android/maven-and-npm-deps/maven/generate-nix.sh
nix-update-lein: export TARGET := lein
nix-update-lein: ##@nix Update maven nix expressions based on current lein setup
nix/tools/lein/generate-nix.sh nix/lein
nix-update-clojure: export TARGET := clojure
nix-update-clojure: ##@nix Update maven nix expressions based on current clojure setup
nix/deps/clojure/generate.sh
nix-update-gems: export TARGET := lein
nix-update-gems: export TARGET := default
nix-update-gems: ##@nix Update Ruby gems in fastlane/Gemfile.lock and fastlane/gemset.nix
fastlane/update.sh
@ -131,14 +131,6 @@ watchman-clean: export TARGET := watchman
watchman-clean: ##@prepare Delete repo directory from watchman
watchman watch-del $${STATUS_REACT_HOME}
disable-githooks: SHELL := /bin/sh
disable-githooks: ##@prepare Disables lein githooks
@rm -f ${env.WORKSPACE}/.git/hooks/pre-commit && \
sed -i'~' -e 's|\[rasom/lein-githooks|;; [rasom/lein-githooks|' \
-e 's|:githooks|;; :githooks|' \
-e 's|:pre-commit|;; :pre-commit|' project.clj; \
rm project.clj~
pod-install: export TARGET := ios
pod-install: ##@prepare Run 'pod install' to install podfiles and update Podfile.lock
cd ios && pod install; cd --
@ -196,11 +188,10 @@ prod-build-android: jsbundle-android ##@legacy temporary legacy alias for jsbund
jsbundle-android: SHELL := /bin/sh
jsbundle-android: export TARGET ?= android
jsbundle-android: export BUILD_ENV ?= prod
jsbundle-android: ##@jsbundle Compile JavaScript and Clojure into index.android.js
# Call nix-build to build the 'targets.mobile.android.jsbundle' attribute and copy the index.android.js file to the project root
@git clean -dxf ./index.$(TARGET).js
jsbundle-android: ##@jsbundle Compile JavaScript and Clojurescript into app directory
# Call nix-build to build the 'targets.mobile.android.jsbundle' attribute and copy the.js files to the project root
nix/scripts/build.sh targets.mobile.android.jsbundle && \
mv result/index.$(TARGET).js ./
mv result/* ./
prod-build-ios: jsbundle-ios ##@legacy temporary legacy alias for jsbundle-ios
@echo "${YELLOW}This a deprecated target name, use jsbundle-ios.$(RESET)"
@ -208,19 +199,7 @@ prod-build-ios: jsbundle-ios ##@legacy temporary legacy alias for jsbundle-ios
jsbundle-ios: export TARGET ?= ios
jsbundle-ios: export BUILD_ENV ?= prod
jsbundle-ios: ##@jsbundle Compile JavaScript and Clojure into index.ios.js
@git clean -dxf -f ./index.$(TARGET).js && \
lein jsbundle-ios && \
node prepare-modules.js
prod-build-desktop: jsbundle-desktop ##@legacy temporary legacy alias for jsbundle-desktop
@echo "${YELLOW}This a deprecated target name, use jsbundle-desktop.$(RESET)"
jsbundle-desktop: export TARGET ?= $(HOST_OS)
jsbundle-desktop: export BUILD_ENV ?= prod
jsbundle-desktop: ##@jsbundle Compile JavaScript and Clojure into index.desktop.js
git clean -qdxf -f ./index.desktop.js desktop/ && \
lein jsbundle-desktop && \
node prepare-modules.js
yarn shadow-cljs release ios
#--------------
# Clojure REPL
@ -229,7 +208,7 @@ jsbundle-desktop: ##@jsbundle Compile JavaScript and Clojure into index.desktop.
_watch-%: ##@watch Start development for device
$(eval SYSTEM := $(word 2, $(subst -, , $@)))
$(eval DEVICE := $(word 3, $(subst -, , $@)))
clj -R:dev build.clj watch --platform $(SYSTEM) --$(SYSTEM)-device $(DEVICE)
yarn shadow-cljs watch $(SYSTEM)
watch-ios-real: export TARGET := ios
watch-ios-real: _watch-ios-real
@ -278,21 +257,24 @@ endif
# Tests
#--------------
lint: export TARGET := lein
lint: export TARGET := clojure
lint: ##@test Run code style checks
lein cljfmt check
# yarn clj-kondo --confg .clj-kondo/config.edn --lint src
clojure -Sdeps '{:deps {cljfmt {:mvn/version "0.6.7"}}}' \
-m cljfmt.main check src \
--indents indentation.edn
lint-fix: export TARGET := lein
lint-fix: export TARGET := clojure
lint-fix: ##@test Run code style checks and fix issues
lein cljfmt fix
clojure -Sdeps '{:deps {cljfmt {:mvn/version "0.6.7"}}}' \
-m cljfmt.main fix src \
--indents indentation.edn
test: export TARGET := lein
test: export TARGET := clojure
test: ##@test Run tests once in NodeJS
lein with-profile test doo node test once
test-auto: export TARGET := lein
test-auto: ##@test Run tests in interactive (auto) mode in NodeJS
lein with-profile test doo node test
yarn shadow-cljs compile mocks && \
yarn shadow-cljs compile test && \
node --require ./test-resources/override.js target/test/test.js
coverage: ##@test Run tests once in NodeJS generating coverage
@scripts/run-coverage.sh

View File

@ -21,7 +21,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation
* entryFile: "index.android.js",
* entryFile: "index.js",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
@ -70,7 +70,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
* nodeExecutableAndArgs: ["node", "--max-old-space-size=8192"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
@ -78,7 +78,7 @@ import com.sun.org.apache.xalan.internal.xsltc.compiler.Copy
*/
project.ext.react = [
nodeExecutableAndArgs: ["node", "--max-old-space-size=16384"],
entryFile: "index.android.js",
entryFile: "index.js",
enableHermes: true, // clean and rebuild if changing. NOTE: Hermes engine is required for Android 64-bit builds running on 64 devices, to guard against a hang in the UI thread after invoking status-go
bundleInPr: true,
inputExcludes: ["android/**", "ios/**", "react-native/**", "src/**", "test/**"]

View File

@ -37,7 +37,7 @@ public class MainApplication extends MultiDexApplication implements ReactApplica
@Override
protected String getJSMainModuleName() {
return "index.android";
return "index";
}
};

264
build.clj
View File

@ -1,264 +0,0 @@
(require '[cljs.build.api :as api]
'[clojure.string :as str])
;; clj build.clj help # Prints details about tasks
;;; Configuration.
(def cljsbuild-config
{:dev
{:ios
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/mobile" "src"]
:compiler {:output-to "target/ios/app.js"
:main "env.ios.main"
:output-dir "target/ios"
:npm-deps false
:optimizations :none}
:warning-handlers '[status-im.utils.build/warning-handler]}
:android
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/mobile" "src"]
:compiler {:output-to "target/android/app.js"
:main "env.android.main"
:output-dir "target/android"
:npm-deps false
:optimizations :none}
:warning-handlers '[status-im.utils.build/warning-handler]}
:desktop
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/desktop" "src"]
:compiler {:output-to "target/desktop/app.js"
:main "env.desktop.main"
:output-dir "target/desktop"
:npm-deps false
:optimizations :none}
:warning-handlers '[status-im.utils.build/warning-handler]}}
:prod
{:ios
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/mobile" "src" "env/prod"]
:compiler {:output-to "index.ios.js"
:output-dir "target/ios-prod"
:static-fns true
:optimize-constants true
:optimizations :simple
:closure-defines {"goog.DEBUG" false}
:parallel-build false
:elide-asserts true
:language-in :ecmascript5}
:warning-handlers '[status-im.utils.build/warning-handler]}
:android
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/mobile" "src" "env/prod"]
:compiler {:output-to "index.android.js"
:output-dir "target/android-prod"
:static-fns true
:optimize-constants true
:optimizations :simple
:closure-defines {"goog.DEBUG" false}
:parallel-build false
:elide-asserts true
:language-in :ecmascript5}
:warning-handlers '[status-im.utils.build/warning-handler]}
:desktop
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/desktop" "src" "env/prod"]
:compiler {:output-to "index.desktop.js"
:output-dir "target/desktop-prod"
:static-fns true
:optimize-constants true
:optimizations :simple
:closure-defines {"goog.DEBUG" false}
:parallel-build false
:elide-asserts true
:language-in :ecmascript5}
:warning-handlers '[status-im.utils.build/warning-handler]}}
:test
{:test
{:source-paths ["src" "test/cljs"]
:compiler {:main "status-im.test.runner"
:output-to "target/test/test.js"
:output-dir "target/test"
:optimizations :none
:preamble ["js/hook-require.js"]
:target :nodejs}}
:protocol
{:source-paths ["src" "test/cljs"]
:compiler {:main "status-im.test.protocol.runner"
:output-to "target/test/test.js"
:output-dir "target/test"
:optimizations :none
:target :nodejs}}
:env-dev-utils
{:source-paths ["env/dev/env/utils.cljs" "test/env/dev"]
:compiler {:main "env.test.runner"
:output-to "target/test/test.js"
:output-dir "target/test"
:optimizations :none
:target :nodejs}}}})
(def cli-tasks-info
{:compile {:desc "Compile ClojureScript"
:usage ["Usage: clj build.clj compile [env] [build-id] [type]"
""
"[env] (required): Pre-defined build environment. Allowed values: \"dev\", \"prod\", \"test\""
"[build-id] (optional): Build ID. When omitted, this task will compile all builds from the specified [env]."
"[type] (optional): Build type - value could be \"once\" or \"watch\". Default: \"once\"."]}
:watch {:desc "Start development"
:usage ["Usage: clj -R:dev build.clj watch [options]"
""
"[-h|--help] to see all available options"]}
:test {:desc "Run tests"
:usage ["Usage: clj -R:test build.clj test [build-id]"
""
"[build-id] (required): Value could be \"test\", \"protocol\" or \"env-dev-utils\". It will compile then run the tests once."]}
:help {:desc "Show this help"}})
;;; Helper functions.
(def reset-color "\u001b[0m")
(def red-color "\u001b[31m")
(def green-color "\u001b[32m")
(def yellow-color "\u001b[33m")
(defn- colorizer [c]
(fn [& args]
(str c (apply str args) reset-color)))
(defn- println-colorized [message color]
(println ((colorizer color) message)))
(defn- elapsed [started-at]
(let [elapsed-us (- (System/currentTimeMillis) started-at)]
(with-precision 2
(str (/ (double elapsed-us) 1000) " seconds"))))
(defn- try-require [ns-sym]
(try
(require ns-sym)
true
(catch Exception e
false)))
(defmacro with-namespaces [namespaces & body]
(if (every? try-require namespaces)
`(do ~@body)
`(do (println-colorized "task not available - required dependencies not found" red-color)
(System/exit 1))))
(defn- get-cljsbuild-config [name-env & [name-build-id]]
(try
(let [env (keyword name-env)]
(when-not (contains? cljsbuild-config env)
(throw (Exception. (str "ENV " (pr-str name-env) " does not exist"))))
(let [env-config (get cljsbuild-config env)]
(if name-build-id
(let [build-id (keyword name-build-id)]
(when-not (contains? env-config build-id)
(throw (Exception. (str "Build ID " (pr-str name-build-id) " does not exist"))))
(get env-config build-id))
env-config)))
(catch Exception e
(println-colorized (.getMessage e) red-color)
(System/exit 1))))
(defn- get-output-files [compiler-options]
(if-let [output-file (:output-to compiler-options)]
[output-file]
(into [] (map :output-to (->> compiler-options :modules vals)))))
(defn- compile-cljs-with-build-config [build-config build-fn env build-id]
(let [{:keys [source-paths compiler]} build-config
output-files (get-output-files compiler)
started-at (System/currentTimeMillis)]
(println (str "Compiling " (pr-str build-id) " for " (pr-str env) "..."))
(flush)
(build-fn (apply api/inputs source-paths) compiler)
(println-colorized (str "Successfully compiled " (pr-str output-files) " in " (elapsed started-at) ".") green-color)))
(defn- compile-cljs [env & [build-id watch?]]
(let [build-fn (if watch? api/watch api/build)]
(if build-id
(compile-cljs-with-build-config (get-cljsbuild-config env build-id) build-fn env build-id)
(doseq [[build-id build-config] (get-cljsbuild-config env)]
(compile-cljs-with-build-config (get-cljsbuild-config env build-id) build-fn env build-id)))))
(defn- show-help []
(doseq [[task {:keys [desc usage]}] cli-tasks-info]
(println (format (str yellow-color "%-12s" reset-color green-color "%s" reset-color)
(name task) desc))
(when usage
(println)
(->> usage
(map #(str " " %))
(str/join "\n")
println)
(println))))
;;; Task dispatching
(defmulti task first)
(defmethod task :default [args]
(println (format "Unknown or missing task. Choose one of: %s\n"
(->> cli-tasks-info
keys
(map name)
(interpose ", ")
(apply str))))
(show-help)
(System/exit 1))
;;; Compiling task
(defmethod task "compile" [[_ env build-id type]]
(case type
(nil "once") (compile-cljs env build-id)
"watch" (compile-cljs env build-id true)
(do (println "Unknown argument to compile task:" type)
(System/exit 1))))
;;; Testing task
(defmethod task "test" [[_ build-id]]
(with-namespaces [[doo.core :as doo]]
(compile-cljs :test build-id)
(doo/run-script :node (->> build-id (get-cljsbuild-config :test) :compiler))))
;;; :watch task
(defn hawk-handler-resources
[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)
(defn hawk-handler-translations
[ctx e]
(let [path "dev/status_im/i18n_resources.cljs"
i18n (slurp path)]
(spit path (str i18n " ;;"))
(spit path i18n))
ctx)
(defmethod task "watch" [[_ & args]]
(with-namespaces [[hawk.core :as hawk]
[re-frisk-remote.core :as re-frisk]
[figwheel-sidecar.repl-api :as ra]
[clj-rn.core :as clj-rn]
[clj-rn.main :as main]]
(let [options (main/parse-cli-options args main/watch-task-options)]
(clj-rn/watch (assoc options :start-cljs-repl false))
(re-frisk/start)
(hawk/watch! [{:paths ["resources"] :handler hawk-handler-resources}
{:paths ["translations"] :handler hawk-handler-translations}])
(when (:start-cljs-repl options) (ra/cljs-repl)))))
;;; Help
(defmethod task "help" [_]
(show-help)
(System/exit 1))
;;; Build script entrypoint.
(task *command-line-args*)

View File

@ -31,8 +31,6 @@ pipeline {
BUILD_ENV = 'prod'
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
FASTLANE_DISABLE_COLORS = 1
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
LEIN_HOME = "/var/tmp/lein-${EXECUTOR_NUMBER}"
/* coverage report identification */
COVERALLS_SERVICE_NAME = "jenkins"
COVERALLS_SERVICE_JOB_ID = "${JOB_NAME}#${BUILD_NUMBER}"
@ -50,14 +48,6 @@ pipeline {
}
}
}
stage('Implicit dependencies') {
steps {
/* Build implicit dependencies if needed (we run `lein deps :tree` but it's not really required, for this purpose)
Implicit dependencies include building a patched node_modules, fetching maven dependencies, and anything else required.
We do this before the parallel steps so we have a known starting situation. */
script { nix.shell('lein deps :tree', attr: 'shells.lein') }
}
}
stage('Parallel Assemble') {
parallel {
stage('Checks') { stages {
@ -70,14 +60,16 @@ pipeline {
buildResult: 'FAILURE',
stageResult: 'FAILURE'
) {
nix.shell('lein cljfmt check', attr: 'shells.lein')
sh 'make lint'
}
}
}
}
stage('Tests') {
steps {
script { nix.shell('lein test-cljs', attr: 'shells.lein') }
script {
sh 'make test'
}
}
}
} }

View File

@ -33,8 +33,6 @@ pipeline {
NIX_IGNORE_SYMLINK_STORE = 1
FASTLANE_DISABLE_COLORS = 1
BUNDLE_PATH = "${HOME}/.bundle"
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
LEIN_HOME = "/var/tmp/lein-${EXECUTOR_NUMBER}"
}
stages {
@ -61,14 +59,16 @@ pipeline {
buildResult: 'FAILURE',
stageResult: 'FAILURE'
) {
nix.shell('lein cljfmt check', attr: 'shells.lein')
sh 'make lint'
}
}
}
}
stage('Tests') {
steps {
script { nix.shell('lein test-cljs', attr: 'shells.lein') }
script {
sh 'make test'
}
}
}
} }

View File

@ -35,7 +35,6 @@ pipeline {
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
VERBOSE_LEVEL = '3'
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
LEIN_HOME = "/var/tmp/lein-${EXECUTOR_NUMBER}"
YARN_CACHE_FOLDER = "/var/tmp/yarn-${EXECUTOR_NUMBER}"
GRADLE_USER_HOME = "/var/tmp/gradle-${EXECUTOR_NUMBER}"
}
@ -64,14 +63,16 @@ pipeline {
buildResult: 'FAILURE',
stageResult: 'FAILURE'
) {
nix.shell('lein cljfmt check', attr: 'shells.lein')
sh 'make lint'
}
}
}
}
stage('Tests') {
steps {
script { nix.shell('lein test-cljs', attr: 'shells.lein') }
script {
sh 'make test'
}
}
}
} }

View File

@ -33,7 +33,6 @@ pipeline {
NIX_IGNORE_SYMLINK_STORE = 1
VERBOSE_LEVEL = '3'
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
LEIN_HOME = "/var/tmp/lein-${EXECUTOR_NUMBER}"
YARN_CACHE_FOLDER = "/var/tmp/yarn-${EXECUTOR_NUMBER}"
GRADLE_USER_HOME = "/var/tmp/gradle-${EXECUTOR_NUMBER}"
}
@ -62,14 +61,16 @@ pipeline {
buildResult: 'FAILURE',
stageResult: 'FAILURE'
) {
nix.shell('lein cljfmt check', attr: 'shells.lein')
sh 'make lint'
}
}
}
}
stage('Tests') {
steps {
script { nix.shell('lein test-cljs', attr: 'shells.lein') }
script {
sh 'make test'
}
}
}
} }

View File

@ -39,7 +39,6 @@ pipeline {
CONAN_SYSREQUIRES_MODE = 'disabled'
CONAN_SYSREQUIRES_SUDO = '0'
/* We use EXECUTOR_NUMBER to avoid multiple instances clashing */
LEIN_HOME = "/var/tmp/lein-${EXECUTOR_NUMBER}"
YARN_CACHE_FOLDER = "/var/tmp/yarn-${EXECUTOR_NUMBER}"
}
@ -67,14 +66,16 @@ pipeline {
buildResult: 'FAILURE',
stageResult: 'FAILURE'
) {
nix.shell('lein cljfmt check', attr: 'shells.lein')
sh 'make lint'
}
}
}
}
stage('Tests') {
steps {
script { nix.shell('lein test-cljs', attr: 'shells.lein') }
script {
sh 'make test'
}
}
}
} }

View File

@ -1,121 +0,0 @@
{:name "StatusIm"
:run-options {:android {"appIdSuffix" "debug"}}
:figwheel-bridge "./figwheel-bridge.js"
;; JS modules
:js-modules ["buffer"
"bignumber.js"
"react-native-languages"
"i18n-js"
"react-native-splash-screen"
"react-native-status"
"react-native-status-keycard"
"react-native-camera"
"qrcode"
"react-native-fs"
"react-native-dialogs"
"react-native-image-resizer"
"react-native-image-crop-picker"
"react-native-svg"
"react-native-webview"
"react-native-touch-id"
"web3-utils"
"chance"
"emojilib"
"eth-phishing-detect"
"react-native-config"
"react-native-screens"
"react-native-keychain"
"rn-snoopy"
"rn-snoopy/stream/bars"
"rn-snoopy/stream/filter"
"rn-snoopy/stream/buffer"
"react-native/Libraries/vendor/emitter/EventEmitter"
"react-native-background-timer"
"react-native-fetch-polyfill"
"@react-navigation/native"
"@react-navigation/stack"
"@react-navigation/bottom-tabs"
;; "react-native-navigation-twopane"
"hi-base32"
"functional-red-black-tree"
"react-native-mail"
"react-native-shake"
"@react-native-community/netinfo"
"react-native-gesture-handler"
"react-native-reanimated"
"react-native-redash"
"react-native-haptic-feedback"
"react-native-safe-area-context"
"react-native-dark-mode"]
;; Desktop modules
:desktop-modules ["buffer"
"bignumber.js"
"react-native-languages"
"i18n-js"
"dismissKeyboard"
"react-native-splash-screen"
"react-native-status"
"qrcode"
"identicon.js"
"react-native-fs"
"react-native-dialogs"
"react-native-image-crop-picker"
"react-native-webview-bridge"
"chance"
"emojilib"
"eth-phishing-detect"
"react-native-config"
"react-native-keychain"
"rn-snoopy"
"rn-snoopy/stream/bars"
"rn-snoopy/stream/filter"
"rn-snoopy/stream/buffer"
"react-native/Libraries/vendor/emitter/EventEmitter"
"react-native-fetch-polyfill"
"react-native-desktop-linking"
"react-native-desktop-menu"
"react-native-desktop-config"
"react-native-desktop-shortcuts"
"react-native-desktop-notification"
"react-native-desktop-gesture-handler"
"web3-utils"
"functional-red-black-tree"
;; "react-native-navigation-twopane"
"hi-base32"]
;; Resoures
:resource-dirs ["resources/images"
"desktop/resources"]
:figwheel-options {:nrepl-port 7888
:nrepl-middleware ["cider.nrepl/cider-middleware"
"refactor-nrepl.middleware/wrap-refactor"
"cider.piggieback/wrap-cljs-repl"]}
:builds [{:id :desktop
:source-paths ["react-native/src/desktop" "src" "env/dev" "components/src" "dev"]
:compiler {:output-to "target/desktop/app.js"
:main "env.desktop.main"
:output-dir "target/desktop"
:npm-deps false
:optimizations :none}
:figwheel true}
{:id :ios
:source-paths ["react-native/src/mobile" "src" "env/dev" "components/src" "dev"]
:compiler {:output-to "target/ios/app.js"
:main "env.ios.main"
:output-dir "target/ios"
:npm-deps false
:optimizations :none}
:figwheel true}
{:id :android
:source-paths ["react-native/src/mobile" "src" "env/dev" "components/src" "dev"]
:compiler {:output-to "target/android/app.js"
:main "env.android.main"
:output-dir "target/android"
:npm-deps false
:optimizations :none}
:warning-handlers [status-im.utils.build/warning-handler]
:figwheel true}]}

View File

@ -1,52 +0,0 @@
(ns status-im.react-native.resources
(:require [status-im.ui.components.colors :as colors]))
(def ui
{:empty-chats-header (js/require "./resources/images/ui/empty-chats-header.png")
:welcome (js/require "./resources/images/ui/welcome.jpg")
:welcome-dark (js/require "./resources/images/ui/welcome-dark.jpg")
:chat (js/require "./resources/images/ui/chat.jpg")
:wallet (js/require "./resources/images/ui/wallet.jpg")
:browser (js/require "./resources/images/ui/browser.jpg")
:chat-dark (js/require "./resources/images/ui/chat-dark.jpg")
:wallet-dark (js/require "./resources/images/ui/wallet-dark.jpg")
:browser-dark (js/require "./resources/images/ui/browser-dark.jpg")
:keys (js/require "./resources/images/ui/keys.jpg")
:keys-dark (js/require "./resources/images/ui/keys-dark.jpg")
:lock (js/require "./resources/images/ui/lock.png")
:tribute-to-talk (js/require "./resources/images/ui/tribute-to-talk.png")
:hardwallet-card (js/require "./resources/images/ui/hardwallet-card.png")
:keycard-lock (js/require "./resources/images/ui/keycard-lock.png")
:keycard (js/require "./resources/images/ui/keycard.png")
:keycard-logo (js/require "./resources/images/ui/keycard-logo.png")
:keycard-logo-blue (js/require "./resources/images/ui/keycard-logo-blue.png")
:keycard-logo-gray (js/require "./resources/images/ui/keycard-logo-gray.png")
:keycard-key (js/require "./resources/images/ui/keycard-key.png")
:keycard-empty (js/require "./resources/images/ui/keycard-empty.png")
:keycard-phone (js/require "./resources/images/ui/keycard-phone.png")
:keycard-connection (js/require "./resources/images/ui/keycard-connection.png")
:keycard-wrong (js/require "./resources/images/ui/keycard-wrong.png")
:not-keycard (js/require "./resources/images/ui/not-keycard.png")
:status-logo (js/require "./resources/images/ui/status-logo.png")
:warning-sign (js/require "./resources/images/ui/warning-sign.png")
:phone-nfc-on (js/require "./resources/images/ui/phone-nfc-on.png")
:phone-nfc-off (js/require "./resources/images/ui/phone-nfc-off.png")
:dapp-store (js/require "./resources/images/ui/dapp-store.png")
:ens-header (js/require "./resources/images/ui/ens-header.png")
:ens-header-dark (js/require "./resources/images/ui/ens-header-dark.png")
:new-chat-header (js/require "./resources/images/ui/new-chat-header.png")
:onboarding-phone (js/require "./resources/images/ui/onboarding-phone.png")
:theme-dark (js/require "./resources/images/ui/theme-dark.png")
:theme-light (js/require "./resources/images/ui/theme-light.png")
:theme-system (js/require "./resources/images/ui/theme-system.png")})
(defn get-theme-image [k]
(get ui (when (colors/dark?) (keyword (str (name k) "-dark"))) (get ui k)))
(def loaded-images (atom {}))
(defn get-image [k]
(if (contains? @loaded-images k)
(get @loaded-images k)
(get (swap! loaded-images assoc k
(get ui k)) k)))

View File

@ -1,33 +0,0 @@
{:paths ["components/src" "src" "react-native/src/cljsjs" "resources"]
:deps {org.clojure/clojure {:mvn/version "1.10.0"} ;; Keep in sync with version from Nix
org.clojure/clojurescript {:mvn/version "1.10.520"}
org.clojure/core.async {:mvn/version "0.4.474"}
reagent {:mvn/version "0.7.0"
:exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server cljsjs/create-react-class]}
re-frame {:mvn/version "0.12.0"}
com.andrewmcveigh/cljs-time {:mvn/version "0.5.2"}
binaryage/oops {:mvn/version "0.7.0"}
status-im/timbre {:mvn/version "4.10.0-2-status"}
com.taoensso/encore {:mvn/version "2.94.0"}
hickory {:mvn/version "0.7.1"}
cljs-bean {:mvn/version "1.3.0"}
mvxcvi/alphabase {:mvn/version "1.0.0"}}
:aliases
{:dev {:extra-deps
{clj-rn {:git/url "https://github.com/status-im/clj-rn"
:sha "144eeecfb389edd9b5d4d94507acf828c5265b97"}
;; Figwheel ClojureScript REPL
cider/piggieback {:mvn/version "0.4.0"
:exclusions [com.google.javascript/closure-compiler]}
figwheel-sidecar {:mvn/version "0.5.18"}
re-frisk-remote {:mvn/version "1.2.0"}
hawk {:mvn/version "0.2.11"}
day8.re-frame/tracing {:mvn/version "0.5.0"}
;; CIDER compatible nREPL
cider/cider-nrepl {:mvn/version "0.21.1"}
refactor-nrepl {:mvn/version "2.4.0"}}}
:test {:extra-deps {day8.re-frame/test {:mvn/version "0.1.5"}
doo {:mvn/version "0.1.9"}}}}}

View File

@ -1,31 +0,0 @@
(ns ^:figwheel-no-load env.android.main
(:require [reagent.core :as r]
[status-im.android.core :as core]
[figwheel.client :as figwheel]
[re-frisk-remote.core :as re-frisk]
[env.config :as conf]
[env.utils]
[re-frame.interop :as interop]
[reagent.impl.batching :as batching]))
(set! interop/next-tick js/setTimeout)
(set! batching/fake-raf #(js/setTimeout % 0))
(enable-console-print!)
(assert (exists? core/init) "Fatal Error - Your core.cljs file doesn't define an 'init' function!!! - Perhaps there was a compilation failure?")
(assert (exists? core/app-root) "Fatal Error - Your core.cljs file doesn't define an 'app-root' function!!! - Perhaps there was a compilation failure?")
(def cnt (r/atom 0))
(defn reloader [props] @cnt [core/app-root props])
;; Do not delete, root-el is used by the figwheel-bridge.js
(def root-el (r/reactify-component reloader))
(figwheel/start {:websocket-url (:android conf/figwheel-urls)
:heads-up-display false
:jsload-callback #(swap! cnt inc)})
(re-frisk/enable {:host (env.utils/re-frisk-url (:android conf/figwheel-urls))})
(core/init)

View File

@ -1,26 +0,0 @@
(ns ^:figwheel-no-load env.desktop.main
(:require [reagent.core :as r]
[re-frisk-remote.core :as re-frisk]
[status-im.desktop.core :as core]
[figwheel.client :as figwheel]
[env.config :as conf]
[env.utils]))
(enable-console-print!)
(assert (exists? core/init) "Fatal Error - Your core.cljs file doesn't define an 'init' function!!! - Perhaps there was a compilation failure?")
(assert (exists? core/app-root) "Fatal Error - Your core.cljs file doesn't define an 'app-root' function!!! - Perhaps there was a compilation failure?")
(def cnt (r/atom 0))
(defn reloader [props] @cnt [core/app-root props])
;; Do not delete, root-el is used by the figwheel-bridge.js
(def root-el (r/reactify-component reloader))
(figwheel/start {:websocket-url (:desktop conf/figwheel-urls)
:heads-up-display false
:jsload-callback #(swap! cnt inc)})
(re-frisk/enable {:host (env.utils/re-frisk-url (:desktop conf/figwheel-urls))})
(core/init)

View File

@ -1,31 +0,0 @@
(ns ^:figwheel-no-load env.ios.main
(:require [reagent.core :as r]
[re-frisk-remote.core :as re-frisk]
[status-im.ios.core :as core]
[figwheel.client :as figwheel]
[env.config :as conf]
[env.utils]
[re-frame.interop :as interop]
[reagent.impl.batching :as batching]))
(set! interop/next-tick js/setTimeout)
(set! batching/fake-raf #(js/setTimeout % 0))
(enable-console-print!)
(assert (exists? core/init) "Fatal Error - Your core.cljs file doesn't define an 'init' function!!! - Perhaps there was a compilation failure?")
(assert (exists? core/app-root) "Fatal Error - Your core.cljs file doesn't define an 'app-root' function!!! - Perhaps there was a compilation failure?")
(def cnt (r/atom 0))
(defn reloader [props] @cnt [core/app-root props])
;; Do not delete, root-el is used by the figwheel-bridge.js
(def root-el (r/reactify-component reloader))
(figwheel/start {:websocket-url (:ios conf/figwheel-urls)
:heads-up-display false
:jsload-callback #(swap! cnt inc)})
(re-frisk/enable {:host (env.utils/re-frisk-url (:ios conf/figwheel-urls))})
(core/init)

View File

@ -1,21 +0,0 @@
(ns env.utils
(:require [clojure.string :as string]))
(defn get-host
"Expects the input url to be in the form protocol://host:port
Returns host or an empty string upon failure"
[url]
(->
url
(string/split #"/")
(get 2 "")
(string/split #":")
(get 0 "")))
(defn re-frisk-url
"Expects the input url to be in the form ws://host:port/figwheel-ws"
[url]
(let [host (get-host url)]
(if (string/blank? host)
(throw (js/Error. "Failed to parse figwheel url. re-frisk url cannot be blank"))
(str host ":" 4567))))

31
env/dev/figwheel.clj vendored
View File

@ -1,31 +0,0 @@
(ns figwheel
(:require [clojure.string :as s]))
(defn system-options [builds-to-start]
{:nrepl-port 7888
:builds [{:id :desktop
:source-paths ["react-native/src/cljsjs" "react-native/src/desktop" "src" "env/dev"]
:compiler {:output-to "target/desktop/app.js"
:main "env.desktop.main"
:output-dir "target/desktop"
:npm-deps false
:optimizations :none}
:figwheel true}
{:id :ios
:source-paths ["react-native/src/cljsjs" "react-native/src/mobile" "src" "env/dev"]
:compiler {:output-to "target/ios/app.js"
:main "env.ios.main"
:output-dir "target/ios"
:npm-deps false
:optimizations :none}
:figwheel true}
{:id :android
:source-paths ["react-native/src/cljsjs" "react-native/src/mobile" "src" "env/dev"]
:compiler {:output-to "target/android/app.js"
:main "env.android.main"
:output-dir "target/android"
:npm-deps false
:optimizations :none}
:warning-handlers '[status-im.utils.build/warning-handler]
:figwheel true}]
:builds-to-start builds-to-start})

View File

@ -1,36 +0,0 @@
(ns figwheel-api
(:use [figwheel-sidecar.repl-api :as ra])
(:require [hawk.core :as hawk]
[re-frisk-sidecar.core :as rfs]
[status-im.utils.core :as utils]
[figwheel :as config]))
(defn start-figwheel
"Start figwheel for one or more builds"
[build-ids]
(ra/start-figwheel! (config/system-options build-ids)))
(defn stop-figwheel
"Stops figwheel"
[]
(ra/stop-figwheel!))
(defn start
([]
(start (if *command-line-args*
(map keyword *command-line-args*)
[:android])))
([build-ids]
(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)}])
(start-figwheel build-ids)
(rfs/-main)))
(def stop ra/stop-figwheel!)
(def start-cljs-repl ra/cljs-repl)

5
env/dev/run.clj vendored
View File

@ -1,5 +0,0 @@
(ns ^:figwheel-no-load run
(:use [figwheel-api]))
(start)
(start-cljs-repl)

View File

@ -1,11 +0,0 @@
(ns env.android.main
(:require [status-im.android.core :as core]
[re-frame.interop :as interop]
[reagent.impl.batching :as batching]))
(set! interop/next-tick js/setTimeout)
(set! batching/fake-raf #(js/setTimeout % 0))
(core/init)

View File

@ -1,4 +0,0 @@
(ns env.desktop.main
(:require [status-im.desktop.core :as core]))
(core/init)

View File

@ -1,9 +0,0 @@
(ns env.ios.main
(:require [status-im.ios.core :as core]
[re-frame.interop :as interop]
[reagent.impl.batching :as batching]))
(set! interop/next-tick js/setTimeout)
(set! batching/fake-raf #(js/setTimeout % 0))
(core/init)

View File

@ -1,627 +0,0 @@
var TopLevel = {
"abs" : function () {},
"ActionSheetIOS" : function () {},
"add" : function () {},
"addEventListener" : function () {},
"addListener" : function () {},
"addPeer" : function () {},
"addSymKey" : function () {},
"addTier2Support" : function () {},
"Alert" : function () {},
"alert" : function () {},
"all" : function () {},
"Android" : function () {},
"android" : function () {},
"Animated" : function () {},
"append" : function () {},
"appStateChange" : function () {},
"args" : function () {},
"argv" : function () {},
"Array" : function () {},
"array" : function () {},
"AsyncStorage" : function () {},
"at" : function () {},
"back" : function () {},
"BACK" : function () {},
"BackHandler" : function () {},
"balanceOf" : function () {},
"bezier" : function () {},
"BigNumber" : function () {},
"blur" : function () {},
"button" : function () {},
"bytesToHex" : function () {},
"call" : function () {},
"callPrivateRPC" : function () {},
"callRPC" : function () {},
"canImplyAuthentication" : function () {},
"catch" : function () {},
"Chance" : function () {},
"changePin" : function () {},
"Channel" : function () {},
"chaosModeUpdate" : function () {},
"charCodeAt" : function () {},
"checkAddressChecksum" : function () {},
"checkVideoAuthorizationStatus" : function () {},
"author": function() {},
"encryptionId": function() {},
"chat": function() {},
"messageId": function() {},
"clear" : function () {},
"clearCookies" : function () {},
"clearInterval" : function () {},
"clearStorageAPIs" : function () {},
"clearTimeout" : function () {},
"Clipboard" : function () {},
"close" : function () {},
"closeApplication" : function () {},
"code" : function () {},
"concat" : function () {},
"confirmMessagesProcessed" : function () {},
"chats": function() {},
"rawMessages": function() {},
"messages": function() {},
"discovery": function() {},
"dismiss": function() {},
"negotiated": function() {},
"chatId": function() {},
"confirmMessagesProcessedByID" : function () {},
"connectionChange" : function () {},
"console" : function () {},
"contacts": function () {},
"ContactRequest" : function () {},
"ContactRequestConfirmed" : function () {},
"ContactRequestConfirmedHandler" : function () {},
"ContactRequestHandler" : function () {},
"ContactUpdate" : function () {},
"ContactUpdateHandler" : function () {},
"contentOffset" : function () {},
"contentSize" : function () {},
"contract" : function () {},
"createAccount" : function () {},
"createBatch" : function () {},
"createChannel" : function () {},
"cubic" : function () {},
"CURRENCY" : function () {},
"data" : function () {},
"Date" : function () {},
"DateTimeFormat" : function () {},
"DEBUG" : function () {},
"decay" : function () {},
"dedupId": function() {},
"DECIMAL_SEP" : function () {},
"GROUP_SEP" : function () {},
"PERCENT" : function () {},
"ZERO_DIGIT" : function () {},
"PLUS_SIGN" : function () {},
"MINUS_SIGN" : function () {},
"EXP_SYMBOL" : function () {},
"PERMILL" : function () {},
"INFINITY" : function () {},
"NAN" : function () {},
"DECIMAL_PATTERN" : function () {},
"SCIENTIFIC_PATTERN" : function () {},
"PERCENT_PATTERN" : function () {},
"CURRENCY_PATTERN" : function () {},
"DEF_CURRENCY_CODE" : function () {},
"decimals" : function () {},
"decodeURI" : function () {},
"default" : function () {},
"defaultAccount" : function () {},
"defaultSeparator" : function () {},
"delay" : function () {},
"DesktopNotification" : function () {},
"DeviceEventEmitter" : function () {},
"Dimensions" : function () {},
"dispatch" : function () {},
"disableNotifications" : function () {},
"displayNotification" : function () {},
"dividedBy" : function () {},
"DocumentDirectoryPath" : function () {},
"dx" : function () {},
"dy" : function () {},
"ease" : function () {},
"Easing" : function () {},
"enableNotifications" : function () {},
"enableVibration" : function () {},
"encode" : function () {},
"encodeURIComponent" : function () {},
"encryptionKey" : function () {},
"end" : function () {},
"endCoordinates" : function () {},
"entries" : function () {},
"eq" : function () {},
"Error" : function () {},
"error" : function () {},
"ErrorUtils" : function () {},
"estimateGas" : function () {},
"eth" : function () {},
"event" : function () {},
"EventEmmiter" : function () {},
"exec" : function () {},
"execute" : function () {},
"exists" : function () {},
"exportKeyWithPath" : function () {},
"extPost" : function () {},
"extractGroupMembershipSignatures" : function () {},
"identicon": function() {},
"identiconAsync": function() {},
"installations": function() {},
"generateAlias": function() {},
"generateAliasAsync": function() {},
"generateAliasAndIdenticonAsync": function() {},
"fallbacks" : function () {},
"fetch" : function () {},
"floor" : function () {},
"focus" : function () {},
"format" : function () {},
"FormData" : function () {},
"from" : function () {},
"fromCharCode" : function () {},
"fromWei" : function () {},
"generateAndLoadKey" : function () {},
"generateMnemonic" : function () {},
"generateSymKeyFromPassword" : function () {},
"get" : function () {},
"getApplicationInfo" : function () {},
"getBalance" : function () {},
"getBlock" : function () {},
"getBlockNumber" : function () {},
"getConnectionInfo" : function () {},
"getDomain" : function () {},
"getGasPrice" : function () {},
"getGenericPassword" : function () {},
"getGlobalHandler" : function () {},
"getInitialNotification" : function () {},
"getInitialURL" : function () {},
"getInternetCredentials" : function () {},
"getItem" : function () {},
"getKeys" : function () {},
"getLayout" : function () {},
"getNetwork" : function () {},
"getNode" : function () {},
"getNodesFromContract" : function () {},
"getPublicKey" : function () {},
"publicKey": function() {},
"alias": function() {},
"getSecurityLevel" : function () {},
"getStateForAction" : function () {},
"getString" : function () {},
"getSymKey" : function () {},
"getSyncing" : function () {},
"getTimezoneOffset" : function () {},
"getToken" : function () {},
"getTransactionReceipt" : function () {},
"getValue" : function () {},
"goog" : function () {},
"greaterThanOrEqualTo" : function () {},
"GroupMembershipUpdate" : function () {},
"GroupMembershipUpdateHandler" : function () {},
"guid" : function () {},
"hashMessage" : function () {},
"hashTransaction" : function () {},
"hashTypedData" : function () {},
"headers" : function () {},
"height" : function () {},
"hexToNumber" : function () {},
"hexToNumberString" : function () {},
"hexToUtf8" : function () {},
"utf8ToHex" : function () {},
"hide" : function () {},
"i18n" : function () {},
"ignoreWarnings" : function () {},
"in" : function () {},
"index" : function () {},
"indexOf" : function () {},
"init" : function () {},
"initKeystore" : function () {},
"injectJavaScript" : function () {},
"installApplet" : function () {},
"installAppletAndInitCard" : function () {},
"installCashApplet" : function () {},
"Int8Array" : function () {},
"integer" : function () {},
"interpolate" : function () {},
"is24Hour" : function () {},
"isAddress" : function () {},
"isConnected" : function () {},
"isConnectionExpensive" : function () {},
"isDeviceRooted" : function () {},
"isFocused" : function () {},
"isLinux" : function () {},
"isMacOs" : function () {},
"isMatches" : function () {},
"isNaN" : function () {},
"isUnix" : function () {},
"isWin" : function () {},
"isZero" : function () {},
"Item" : function () {},
"item" : function () {},
"JSON" : function () {},
"jsonEvent" : function () {},
"keccak512" : function () {},
"Keyboard" : function () {},
"language" : function () {},
"layout" : function () {},
"layoutMeasurement" : function () {},
"leftPad" : function () {},
"length" : function () {},
"LibraryDirectoryPath" : function () {},
"Linking" : function () {},
"locale" : function () {},
"log" : function () {},
"login" : function () {},
"loginWithKeycard" : function () {},
"logout" : function () {},
"loop" : function () {},
"lt" : function () {},
"mail" : function () {},
"map" : function () {},
"map->GroupMembershipUpdate" : function () {},
"MapEntry" : function () {},
"markTrustedPeer" : function () {},
"MaskedData" : function () {},
"Math" : function () {},
"Message" : function () {},
"message" : function () {},
"MessageHandler" : function () {},
"MessagesSeen" : function () {},
"MessagesSeenHandler" : function () {},
"messaging" : function () {},
"method" : function () {},
"metadata": function() {},
"minus" : function () {},
"plus" : function () {},
"mkdir" : function () {},
"module" : function () {},
"moveFile" : function () {},
"Multihash" : function () {},
"name" : function () {},
"response-to": function() {},
"content_type": function() {},
"message_type": function() {},
"chat_id": function() {},
"clock": function() {},
"nativeEvent" : function () {},
"NativeEventEmitter" : function () {},
"NativeModules" : function () {},
"navigate" : function () {},
"navigation" : function () {},
"NavigationActions" : function () {},
"NavigationEvents" : function () {},
"newKeyPair" : function () {},
"newMessageFilter" : function () {},
"newRawMessageFilter": function() {},
"newSymKey" : function () {},
"nfcIsEnabled" : function () {},
"nfcIsSupported" : function () {},
"Notification" : function () {},
"notification" : function () {},
"notifications" : function () {},
"now" : function () {},
"Number" : function () {},
"NumberFormatSymbols" : function () {},
"NumberFormatSymbols_af" : function () {},
"NumberFormatSymbols_am" : function () {},
"NumberFormatSymbols_ar" : function () {},
"NumberFormatSymbols_ar_DZ" : function () {},
"NumberFormatSymbols_az" : function () {},
"NumberFormatSymbols_be" : function () {},
"NumberFormatSymbols_bg" : function () {},
"NumberFormatSymbols_bn" : function () {},
"NumberFormatSymbols_br" : function () {},
"NumberFormatSymbols_bs" : function () {},
"NumberFormatSymbols_cs" : function () {},
"NumberFormatSymbols_cy" : function () {},
"NumberFormatSymbols_da" : function () {},
"NumberFormatSymbols_de_CH" : function () {},
"NumberFormatSymbols_en" : function () {},
"NumberFormatSymbols_en_AU" : function () {},
"NumberFormatSymbols_en_CA" : function () {},
"NumberFormatSymbols_en_IN" : function () {},
"NumberFormatSymbols_en_SG" : function () {},
"NumberFormatSymbols_es_419" : function () {},
"NumberFormatSymbols_fa" : function () {},
"NumberFormatSymbols_fil" : function () {},
"NumberFormatSymbols_he" : function () {},
"NumberFormatSymbols_hr" : function () {},
"NumberFormatSymbols_hu" : function () {},
"NumberFormatSymbols_hy" : function () {},
"NumberFormatSymbols_id" : function () {},
"NumberFormatSymbols_is" : function () {},
"NumberFormatSymbols_ja" : function () {},
"NumberFormatSymbols_ka" : function () {},
"NumberFormatSymbols_kk" : function () {},
"NumberFormatSymbols_km" : function () {},
"NumberFormatSymbols_ko" : function () {},
"NumberFormatSymbols_ky" : function () {},
"NumberFormatSymbols_ln" : function () {},
"NumberFormatSymbols_lo" : function () {},
"NumberFormatSymbols_mk" : function () {},
"NumberFormatSymbols_mn" : function () {},
"NumberFormatSymbols_mo" : function () {},
"NumberFormatSymbols_ms" : function () {},
"NumberFormatSymbols_my" : function () {},
"NumberFormatSymbols_nb" : function () {},
"NumberFormatSymbols_ne" : function () {},
"NumberFormatSymbols_pl" : function () {},
"NumberFormatSymbols_pt" : function () {},
"NumberFormatSymbols_ro" : function () {},
"NumberFormatSymbols_ru" : function () {},
"NumberFormatSymbols_sh" : function () {},
"NumberFormatSymbols_si" : function () {},
"NumberFormatSymbols_sq" : function () {},
"NumberFormatSymbols_sv" : function () {},
"NumberFormatSymbols_sw" : function () {},
"NumberFormatSymbols_th" : function () {},
"NumberFormatSymbols_tr" : function () {},
"NumberFormatSymbols_uk" : function () {},
"NumberFormatSymbols_ur" : function () {},
"NumberFormatSymbols_uz" : function () {},
"NumberFormatSymbols_vi" : function () {},
"NumberFormatSymbols_zh" : function () {},
"NumberFormatSymbols_zh_HK" : function () {},
"NumberFormatSymbols_zh_TW" : function () {},
"numberToHex" : function () {},
"ok" : function () {},
"onMessage" : function () {},
"onNotification" : function () {},
"onNotificationOpened" : function () {},
"onTokenRefresh" : function () {},
"openAccounts" : function () {},
"openNfcSettings" : function () {},
"openPicker" : function () {},
"openURL" : function () {},
"OS" : function () {},
"out" : function () {},
"p" : function () {},
"pageY" : function () {},
"pair" : function () {},
"PairInstallation" : function () {},
"PairInstallationHandler" : function () {},
"panHandlers" : function () {},
"PanResponder" : function () {},
"parallel" : function () {},
"parse" : function () {},
"parseFloat" : function () {},
"parseInt" : function () {},
"password" : function () {},
"path" : function () {},
"payload" : function () {},
"PermissionsAndroid" : function () {},
"PersistentPriorityMap" : function () {},
"PersonalRequestCommand" : function () {},
"PersonalSendCommand" : function () {},
"Platform" : function () {},
"pow" : function () {},
"Priority" : function () {},
"Category" : function () {},
"High" : function () {},
"Importance" : function () {},
"prepareDirAndUpdateConfig" : function () {},
"Promise" : function () {},
"props" : function () {},
"prototype" : function () {},
"push" : function () {},
"quad" : function () {},
"ReactNative" : function () {},
"readDir" : function () {},
"readFile" : function () {},
"recoverAccount" : function () {},
"reduce" : function () {},
"register" : function () {},
"registerComponent" : function () {},
"registerHeadlessTask" : function () {},
"reject" : function () {},
"reload" : function () {},
"remove" : function () {},
"removeAllListeners" : function () {},
"removeEventListener" : function () {},
"removeKey" : function () {},
"removeKeyWithUnpair" : function () {},
"removeListener" : function () {},
"repeat" : function () {},
"request" : function () {},
"requestMessages" : function () {},
"requestMultiple" : function () {},
"requestPermission" : function () {},
"require" : function () {},
"reset" : function () {},
"resetGenericPassword" : function () {},
"resetInternetCredentials" : function () {},
"resolve" : function () {},
"respond" : function () {},
"rightPad" : function () {},
"round" : function () {},
"routeName" : function () {},
"router" : function () {},
"routes" : function () {},
"saveAccountAndLogin" : function () {},
"saveAccountAndLoginWithKeycard" : function () {},
"schemaVersion" : function () {},
"scrollTo" : function () {},
"scrollToEnd" : function () {},
"scrollToIndex" : function () {},
"scrollToLocation" : function () {},
"section" : function () {},
"selection" : function () {},
"sendDirectMessage" : function () {},
"sendLogs" : function () {},
"sendPairingMessage" : function () {},
"sendPublicMessage" : function () {},
"sendToBridge" : function () {},
"sendTransaction" : function () {},
"sendTransactionWithSignature" : function () {},
"separators" : function () {},
"sequence" : function () {},
"set" : function () {},
"setAutoCancel" : function () {},
"setBackgroundColor" : function () {},
"setBarStyle" : function () {},
"setBlankPreviewFlag" : function () {},
"setCategory" : function () {},
"setChannelId" : function () {},
"setCurrentDapp" : function () {},
"setDockBadgeLabel" : function () {},
"setGenericPassword" : function () {},
"setGlobalHandler" : function () {},
"setGroup" : function () {},
"setHidden" : function () {},
"setInternetCredentials" : function () {},
"setInterval" : function () {},
"setItem" : function () {},
"setNativeProps" : function () {},
"setNetworkActivityIndicatorVisible" : function () {},
"setPriority" : function () {},
"setShowBadge" : function () {},
"setSmallIcon" : function () {},
"setSoftInputMode" : function () {},
"setSound" : function () {},
"setString" : function () {},
"setTimeout" : function () {},
"setTranslucent" : function () {},
"setUsername" : function () {},
"setValue" : function () {},
"sha3" : function () {},
"Share" : function () {},
"share" : function () {},
"shh" : function () {},
"show" : function () {},
"showActionSheetWithOptions" : function () {},
"showPicker" : function () {},
"sign" : function () {},
"signWithPath" : function () {},
"signGroupMembership" : function () {},
"signMessage" : function () {},
"signPinless" : function () {},
"signTypedData" : function () {},
"slice" : function () {},
"SplashScreen" : function () {},
"spring" : function () {},
"stack" : function () {},
"StackActions" : function () {},
"start" : function () {},
"startNode" : function () {},
"state" : function () {},
"Status" : function () {},
"status" : function () {},
"statusText" : function () {},
"stop" : function () {},
"stopAnimation" : function () {},
"stopNode" : function () {},
"stopWatching" : function () {},
"stream" : function () {},
"String" : function () {},
"stringify" : function () {},
"subscribe" : function () {},
"substr" : function () {},
"symbol" : function () {},
"SyncInstallation" : function () {},
"SyncInstallationHandler" : function () {},
"t" : function () {},
"takePictureAsync" : function () {},
"Text" : function () {},
"text" : function () {},
"parsedText": function() {},
"parsedMessage": function() {},
"content": function() {},
"TextEncoder" : function () {},
"then" : function () {},
"times" : function () {},
"timestamp" : function () {},
"timing" : function () {},
"title" : function () {},
"toAscii" : function () {},
"toChecksumAddress" : function () {},
"toFixed" : function () {},
"toHex" : function () {},
"toLocaleString" : function () {},
"toNumber" : function () {},
"torchMode" : function () {},
"toString" : function () {},
"totalSupply" : function () {},
"toTwosComplement" : function () {},
"toUtf8" : function () {},
"toWei" : function () {},
"translations" : function () {},
"type": function() {},
"Uint8Array" : function () {},
"unblockPin" : function () {},
"unlink" : function () {},
"unpair" : function () {},
"unpairAndDelete" : function () {},
"updateMailservers" : function () {},
"Uri" : function () {},
"url" : function () {},
"Value" : function () {},
"ValueXY": function() {},
"value" : function () {},
"verify" : function () {},
"verifyPin" : function () {},
"Version" : function () {},
"version" : function () {},
"vibrate" : function () {},
"View" : function () {},
"viewableItems": function() {},
"FlatList" : function () {},
"warn" : function () {},
"WebView" : function () {},
"width" : function () {},
"window" : function () {},
"writeCopyTo" : function () {},
"x" : function () {},
"y" : function () {},
"YellowBox" : function () {},
"UtcDateTime": function () {},
"fromTimestamp": function () {},
"ERAS": function () {},
"ERANAMES": function () {},
"NARROWMONTHS": function () {},
"STANDALONENARROWMONTHS": function () {},
"MONTHS": function () {},
"STANDALONEMONTHS": function () {},
"SHORTMONTHS": function () {},
"STANDALONESHORTMONTHS": function () {},
"WEEKDAYS": function () {},
"STANDALONEWEEKDAYS": function () {},
"SHORTWEEKDAYS": function () {},
"STANDALONESHORTWEEKDAYS": function () {},
"NARROWWEEKDAYS": function () {},
"STANDALONENARROWWEEKDAYS": function () {},
"SHORTQUARTERS": function () {},
"QUARTERS": function () {},
"AMPMS": function () {},
"DATEFORMATS": function () {},
"TIMEFORMATS": function () {},
"DATETIMEFORMATS": function () {},
"FIRSTDAYOFWEEK": function () {},
"WEEKENDRANGE": function () {},
"FIRSTWEEKCUTOFFDAY": function () {},
"decimalPlaces": function () {},
"_android": function () {},
"next": function() {},
"prev": function() {},
"hasNext": function() {},
"hasPrev": function() {},
"rtl": function() {},
"lineCount": function() {},
"key": function() {},
"keys": function() {},
"values": function() {},
"find": function() {},
"insert": function() {},
"update": function() {},
"isSupported" : function () {},
"authenticate" : function () {},
"createAppContainer" : function () {},
"useScreens" : function () {},
"multiAccountGenerateAndDeriveAddresses" : function () {},
"multiAccountStoreDerived" : function () {},
"multiAccountDeriveAddresses" : function () {},
"multiAccountReset" : function () {},
"multiAccountLoadAccount" : function () {},
"multiAccountStoreAccount" : function () {},
"multiAccountImportMnemonic" : function () {},
"multiAccountImportPrivateKey" : function () {},
"validateMnemonic" : function () {}
}

View File

@ -1,266 +0,0 @@
/*
* Originally taken from https://github.com/decker405/figwheel-react-native
*
* @providesModule figwheel-bridge
*/
var CLOSURE_UNCOMPILED_DEFINES = null;
var debugEnabled = true;
var config = {
basePath: "target/",
googBasePath: 'goog/',
serverPort: 8081
};
var React = require('react');
var createReactClass = require('create-react-class');
var ReactNative = require('react-native');
var self;
var evaluate = eval; // This is needed, direct calls to eval does not work (RN packager???)
var externalModules = {};
var evalListeners = {};
var asyncImportChain = new Promise(function (succ,fail) {succ(true);});
function fireEvalListenters(url) {
Object.values(evalListeners).forEach(function (listener) {
listener(url)
});
}
function formatCompileError(msg) {
var errorStr = "Figwheel Compile Exception: "
var data = msg['exception-data'];
if(data['message']) {
errorStr += data['message'] + " ";
}
if(data['file']) {
errorStr += "in file " + data['file'] + " ";
}
if(data['line']) {
errorStr += "at line " + data['line'];
}
if(data['column']) {
errorStr += ", column " + data['column'];
}
return errorStr;
}
/* This is simply demonstrating that we can receive and react to
* arbitrary messages from Figwheel this will enable creating a nicer
* feedback system in the Figwheel top level React component.
*/
function figwheelMessageHandler(msg) {
if(msg["msg-name"] == "compile-failed") {
console.warn(formatCompileError(msg));
}
}
function listenToFigwheelMessages() {
if(figwheel.client.add_json_message_watch) {
figwheel.client.add_json_message_watch("ReactNativeMessageIntercept",
figwheelMessageHandler);
}
}
var figwheelApp = function (platform, devHost) {
return createReactClass({
getInitialState: function () {
return {loaded: false}
},
render: function () {
if (!this.state.loaded) {
var plainStyle = {flex: 1, alignItems: 'center', justifyContent: 'center'};
return (
<ReactNative.View style={plainStyle}>
<ReactNative.Text>Waiting for Figwheel to load files.</ReactNative.Text>
</ReactNative.View>
);
}
return React.createElement(this.state.root, this.props);
},
componentDidMount: function () {
var app = this;
if (typeof goog === "undefined") {
loadApp(platform, devHost, function (appRoot) {
app.setState({root: appRoot, loaded: true});
listenToFigwheelMessages();
});
}
}
})
};
function logDebug(msg) {
if (debugEnabled) {
console.log(msg);
}
}
var isChrome = function () {
return typeof importScripts === "function"
};
async function getUrlText(url) {
const text = await fetch(url).then(response => {
if(!response.ok) {
throw new Error("Failed to Fetch: " + url + " - Perhaps your project was cleaned and you haven't recompiled?");
}
return response.text()
});
return text;
}
var ATTEMPTS_COUNT = 3;
async function asyncImportScripts(url, success, error) {
var attempt = 0;
var text = await getUrlText(url);
while(attempt < ATTEMPTS_COUNT && text.length === 0)
{
text = await getUrlText(url);
++attempt;
}
if(!text || 0 === text.length) {
console.log("Can't fetch file: ", url)
return;
}
evaluate(text);
fireEvalListenters(url);
success();
}
function syncImportScripts(url, success, error) {
try {
importScripts(url);
logDebug('Evaluated: ' + url);
fireEvalListenters(url);
success();
} catch (e) {
console.error(e);
error()
}
}
// Loads js file sync if possible or async.
function importJs(src, success, error) {
var noop = function(){};
success = (typeof success == 'function') ? success : noop;
error = (typeof error == 'function') ? error : noop;
logDebug('(importJs) Importing: ' + src);
if (isChrome()) {
syncImportScripts(src, success, error);
} else {
asyncImportChain = asyncImportChain.then(function (v) {return asyncImportScripts(src, success, error);})
}
}
function interceptRequire() {
var oldRequire = window.require;
console.info("Shimming require");
window.require = function (id) {
console.info("Requiring: " + id);
if (externalModules[id]) {
return externalModules[id];
}
return oldRequire(id);
};
}
function serverBaseUrl(host) {
return "http://" + host + ":" + config.serverPort
}
function isUnDefined(x) {
return typeof x == "undefined";
}
// unlikely to happen but it happened to me a couple of times so ...
function assertRootElExists(platform) {
var basicMessage = "ClojureScript project didn't compile, or didn't load correctly.";
if(isUnDefined(env)) {
throw new Error("Critical Error: env namespace not defined - " + basicMessage);
} else if(isUnDefined(env[platform])) {
throw new Error("Critical Error: env." + platform + " namespace not defined - " + basicMessage);
} else if(isUnDefined(env[platform].main)) {
throw new Error("Critical Error: env." + platform + ".main namespace not defined - " + basicMessage);
} else if(isUnDefined(env[platform].main.root_el)) {
throw new Error("Critical Error: env." +
platform + ".main namespace doesn't define a root-el which should hold the root react node of your app.");
}
}
function loadApp(platform, devHost, onLoadCb) {
var fileBasePath = serverBaseUrl((isChrome() ? "localhost" : devHost)) + "/" + config.basePath + platform;
// callback when app is ready to get the reloadable component
var mainJs = `/env/${platform}/main.js`;
evalListeners.waitForFinalEval = function (url) {
if (url.indexOf(mainJs) > -1) {
assertRootElExists(platform);
onLoadCb(env[platform].main.root_el);
console.info('Done loading Clojure app');
delete evalListeners.waitForFinalEval;
}
};
if (typeof goog === "undefined") {
console.info('Loading Closure base.');
interceptRequire();
// need to know base path here
importJs(fileBasePath + '/goog/base.js', function () {
shimBaseGoog(fileBasePath);
importJs(fileBasePath + '/cljs_deps.js');
importJs(fileBasePath + '/goog/deps.js', function () {
// This is needed because of RN packager
// seriously React packager? why.
var googreq = goog.require;
// NOTE: :closure-defines is not working with RN
goog.global.CLOSURE_UNCOMPILED_DEFINES = {
"re_frame.trace.trace_enabled_QMARK_":true,
"day8.re_frame.tracing.trace_enabled_QMARK_": true
};
googreq(`env.${platform}.main`);
});
});
}
}
function startApp(appName, platform, devHost) {
ReactNative.AppRegistry.registerComponent(
appName, () => figwheelApp(platform, devHost));
}
function withModules(moduleById) {
externalModules = moduleById;
return self;
}
function figwheelImportScript(uri, callback) {
importJs(uri.toString(),
function () {callback(true);},
function () {callback(false);})
}
// Goog fixes
function shimBaseGoog(basePath) {
console.info('Shimming goog functions.');
goog.basePath = basePath + '/' + config.googBasePath;
goog.global.FIGWHEEL_WEBSOCKET_CLASS = WebSocket;
goog.global.FIGWHEEL_IMPORT_SCRIPT = figwheelImportScript;
goog.writeScriptSrcNode = importJs;
goog.writeScriptTag_ = function (src, optSourceText) {
importJs(src);
return true;
};
}
self = {
withModules: withModules,
start: startApp
};
module.exports = self;

View File

@ -1,110 +0,0 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @format
* @flow
*/
const path = require('path');
const fs = require('fs');
/**
* Find symlinked modules inside "node_modules."
*
* Naively, we could just perform a depth-first search of all folders in
* node_modules, recursing when we find a symlink.
*
* We can be smarter than this due to our knowledge of how npm/Yarn lays out
* "node_modules" / how tools that build on top of npm/Yarn (such as Lerna)
* install dependencies.
*
* Starting from a given root node_modules folder, this algorithm will look at
* both the top level descendants of the node_modules folder or second level
* descendants of folders that start with "@" (which indicates a scoped
* package). If any of those folders is a symlink, it will recurse into the
* link, and perform the same search in the linked folder.
*
* The end result should be a list of all resolved module symlinks for a given
* root.
*/
module.exports = function findSymlinkedModules(
projectRoot: string,
ignoredRoots: Array<string> = [],
) {
const timeStart = Date.now();
const nodeModuleRoot = path.join(projectRoot, 'node_modules');
const resolvedSymlinks = findModuleSymlinks(nodeModuleRoot, [
...ignoredRoots,
projectRoot,
]);
const timeEnd = Date.now();
console.log(
`Scanning folders for symlinks in ${nodeModuleRoot} (${timeEnd -
timeStart}ms)`,
);
return resolvedSymlinks;
};
function findModuleSymlinks(
modulesPath: string,
ignoredPaths: Array<string> = [],
): Array<string> {
if (!fs.existsSync(modulesPath)) {
return [];
}
// Find module symlinks
const moduleFolders = fs.readdirSync(modulesPath);
const symlinks = moduleFolders.reduce((links, folderName) => {
const folderPath = path.join(modulesPath, folderName);
const maybeSymlinkPaths = [];
if (folderName.startsWith('@')) {
const scopedModuleFolders = fs.readdirSync(folderPath);
maybeSymlinkPaths.push(
...scopedModuleFolders.map(name => path.join(folderPath, name)),
);
} else {
maybeSymlinkPaths.push(folderPath);
}
return links.concat(resolveSymlinkPaths(maybeSymlinkPaths, ignoredPaths));
}, []);
// For any symlinks found, look in _that_ modules node_modules directory
// and find any symlinked modules
const nestedSymlinks = symlinks.reduce(
(links, symlinkPath) =>
links.concat(
// We ignore any found symlinks or anything from the ignored list,
// to prevent infinite recursion
findModuleSymlinks(path.join(symlinkPath, 'node_modules'), [
...ignoredPaths,
...symlinks,
]),
),
[],
);
return [...new Set([...symlinks, ...nestedSymlinks])];
}
function resolveSymlinkPaths(maybeSymlinkPaths, ignoredPaths) {
return maybeSymlinkPaths.reduce((links, maybeSymlinkPath) => {
if (fs.lstatSync(maybeSymlinkPath).isSymbolicLink()) {
const resolved = path.resolve(
path.dirname(maybeSymlinkPath),
fs.readlinkSync(maybeSymlinkPath),
);
if (ignoredPaths.indexOf(resolved) === -1 && fs.existsSync(resolved)) {
links.push(resolved);
}
}
return links;
}, []);
}

1
indentation.edn Normal file
View File

@ -0,0 +1 @@
{letsubs [[:inner 0]]}

1
index.js Normal file
View File

@ -0,0 +1 @@
import "./app/index.js";

View File

@ -183,21 +183,21 @@ PODS:
- React-cxxreact (= 0.61.5)
- React-jsi (= 0.61.5)
- React-jsinspector (0.61.5)
- react-native-background-timer (2.1.1):
- react-native-background-timer (2.2.0):
- React
- react-native-camera (3.6.0):
- react-native-camera (3.23.1):
- React
- react-native-camera/RCT (= 3.6.0)
- react-native-camera/RN (= 3.6.0)
- react-native-camera/RCT (3.6.0):
- react-native-camera/RCT (= 3.23.1)
- react-native-camera/RN (= 3.23.1)
- react-native-camera/RCT (3.23.1):
- React
- react-native-camera/RN (3.6.0):
- react-native-camera/RN (3.23.1):
- React
- react-native-image-resizer (1.0.0):
- React
- react-native-mail (4.0.0):
- React
- react-native-netinfo (4.4.0):
- react-native-netinfo (4.7.0):
- React
- react-native-safe-area-context (0.7.3):
- React
@ -244,11 +244,11 @@ PODS:
- ReactCommon/jscallinvoker (= 0.61.5)
- ReactNativeDarkMode (0.2.2):
- React
- RNCMaskedView (0.1.6):
- RNCMaskedView (0.1.9):
- React
- RNFS (2.14.1):
- RNFS (2.16.6):
- React
- RNGestureHandler (1.6.0):
- RNGestureHandler (1.6.1):
- React
- RNImageCropPicker (0.25.3):
- QBImagePickerController
@ -261,11 +261,11 @@ PODS:
- React
- RNReactNativeHapticFeedback (1.9.0):
- React
- RNReanimated (1.7.0):
- RNReanimated (1.8.0):
- React
- RNScreens (2.3.0):
- RNScreens (2.5.0):
- React
- RNSVG (9.11.1):
- RNSVG (9.13.6):
- React
- RSKImageCropper (2.2.3)
- SQLCipher (3.4.2):
@ -439,7 +439,7 @@ SPEC CHECKSUMS:
FBLazyVector: aaeaf388755e4f29cd74acbc9e3b8da6d807c37f
FBReactNativeSpec: 118d0d177724c2d67f08a59136eb29ef5943ec75
Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
glog: 353a32027a69db3807b94c7cbc2900fc4370098c
glog: 682164e7ac67e41afd8f7b6a37a96d04caf61cc0
QBImagePickerController: d54cf93db6decf26baf6ed3472f336ef35cae022
RCTRequired: b153add4da6e7dbc44aebf93f3cf4fcae392ddf1
RCTTypeSafety: 9aa1b91d7f9310fc6eadc3cf95126ffe818af320
@ -450,11 +450,11 @@ SPEC CHECKSUMS:
React-jsi: cb2cd74d7ccf4cffb071a46833613edc79cdf8f7
React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386
React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
react-native-background-timer: 1b6e6b4e10f1b74c367a1fdc3c72b67c619b222b
react-native-camera: b6a6a61bcdbd619c19df3df581fcb009131938bf
react-native-background-timer: 1f7d560647b40e6a60b01c452ba29c54bf581fc4
react-native-camera: 1b52abea404d04e040edb3e74b7c5523c01a3089
react-native-image-resizer: 4516052af6ae0248caf4ccf356caecefe60072d7
react-native-mail: 7e37dfbe93ff0d4c7df346b738854dbed533e86f
react-native-netinfo: 6bb847e64f45a2d69c6173741111cfd95c669301
react-native-netinfo: ddaca8bbb9e6e914b1a23787ccb879bc642931c9
react-native-safe-area-context: e200d4433aba6b7e60b52da5f37af11f7a0b0392
react-native-shake: de052eaa3eadc4a326b8ddd7ac80c06e8d84528c
react-native-splash-screen: 200d11d188e2e78cea3ad319964f6142b6384865
@ -470,16 +470,16 @@ SPEC CHECKSUMS:
React-RCTVibration: a49a1f42bf8f5acf1c3e297097517c6b3af377ad
ReactCommon: 198c7c8d3591f975e5431bec1b0b3b581aa1c5dd
ReactNativeDarkMode: 0178ffca3b10f6a7c9f49d6f9810232b328fa949
RNCMaskedView: a88953beefbd347a29072d9eba90e42945fe291e
RNFS: a8fbe7060fa49157d819466404794ad9c58e58cf
RNGestureHandler: dde546180bf24af0b5f737c8ad04b6f3fa51609a
RNCMaskedView: 71fc32d971f03b7f03d6ab6b86b730c4ee64f5b6
RNFS: 2bd9eb49dc82fa9676382f0585b992c424cd59df
RNGestureHandler: 8f09cd560f8d533eb36da5a6c5a843af9f056b38
RNImageCropPicker: bfb3ea9c8622f290532e2fe63f369e0d5a52f597
RNKeychain: 216f37338fcb9e5c3a2530f1e3295f737a690cb1
RNLanguages: 962e562af0d34ab1958d89bcfdb64fafc37c513e
RNReactNativeHapticFeedback: 2566b468cc8d0e7bb2f84b23adc0f4614594d071
RNReanimated: 031fe8d9ea93c2bd689a40f05320ef9d96f74d7f
RNScreens: 03bf608b92ac0acf323f47d8f5b63a8f829340c8
RNSVG: be27aa7c58819f97399388ae53d7fa0572f32c7f
RNReanimated: 955cf4068714003d2f1a6e2bae3fb1118f359aff
RNScreens: ac02d0e4529f08ced69f5580d416f968a6ec3a1d
RNSVG: 8ba35cbeb385a52fd960fd28db9d7d18b4c2974f
RSKImageCropper: a446db0e8444a036b34f3c43db01b2373baa4b2a
SQLCipher: f9fcf29b2e59ced7defc2a2bdd0ebe79b40d4990
SSZipArchive: fa16b8cc4cdeceb698e5e5d9f67e9558532fbf23
@ -488,4 +488,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 37924c57abbfcd77aec07d65c45ecba137cdf289
COCOAPODS: 1.8.4
COCOAPODS: 1.9.1

View File

@ -453,7 +453,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -o errexit\nexport NODE_BINARY=\"node\"\nexport NODE_ARGS=\" --max-old-space-size=16384 \"\n\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
shellScript = "set -o errexit\nexport NODE_BINARY=\"node\"\nexport NODE_ARGS=\" --max-old-space-size=16384 \"\n\nbash -x ../node_modules/react-native/scripts/react-native-xcode.sh 2>&1 > ./react-native-xcode.log\n";
};
291E1A8BC076990A77B59232 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;

View File

@ -9,7 +9,7 @@ module.exports = {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
inlineRequires: true,
},
}),
},

View File

@ -3,7 +3,11 @@
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start"
"start": "react-native start",
"app:compile:android": "shadow-cljs compile android",
"app:watch": "shadow-cljs watch android",
"app:packager": "react-native start --host 0.0.0.0 --port 8081",
"app:android": "react-native run-android"
},
"dependencies": {
"@react-native-community/masked-view": "^0.1.6",
@ -58,9 +62,12 @@
"@babel/plugin-transform-block-scoping": "7.0.0",
"@babel/preset-env": "7.1.0",
"@babel/register": "7.0.0",
"clj-kondo": "^2020.1.13",
"coveralls": "^3.0.4",
"jest": "^25.1.0",
"nyc": "^14.1.1",
"process": "0.11.10",
"rn-snoopy": "git+https://github.com/status-im/rn-snoopy.git#v2.0.2-status"
"rn-snoopy": "git+https://github.com/status-im/rn-snoopy.git#v2.0.2-status",
"shadow-cljs": "2.8.99"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,66 @@
{
"name": "StatusIm-Mobile",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"classpath": "shadow-cljs classpath android",
"app:compile:android": "shadow-cljs compile android",
"app:watch": "shadow-cljs watch android",
"app:packager": "react-native start --host 0.0.0.0 --port 8081",
"app:android": "react-native run-android"
},
"dependencies": {
"@react-native-community/netinfo": "^4.4.0",
"bignumber.js": "git+https://github.com/status-im/bignumber.js.git#v4.0.2-status",
"buffer": "^5.4.2",
"chance": "^1.1.0",
"create-react-class": "^15.6.2",
"emojilib": "^2.4.0",
"eth-phishing-detect": "^1.1.13",
"functional-red-black-tree": "^1.0.1",
"hermes-engine": "0.2.1",
"hi-base32": "^0.5.0",
"i18n-js": "^3.3.0",
"qrcode": "^1.4.1",
"react": "16.9.0",
"react-dom": "^16.4.2",
"react-native": "0.61.5",
"react-native-background-timer": "^2.1.1",
"react-native-camera": "^3.3.3",
"react-native-config": "git+https://github.com/status-im/react-native-config.git#0.11.2-1-status",
"react-native-dialogs": "^1.0.4",
"react-native-fetch-polyfill": "^1.1.2",
"react-native-fs": "^2.14.1",
"react-native-gesture-handler": "^1.3.0",
"react-native-image-crop-picker": "^0.25.0",
"react-native-image-resizer": "git+https://github.com/status-im/react-native-image-resizer.git#1.0.0-1-status",
"react-native-keychain": "git+https://github.com/status-im/react-native-keychain.git#v.3.0.0-status",
"react-native-languages": "^3.0.2",
"react-native-mail": "git+https://github.com/status-im/react-native-mail.git#v4.0.0-status",
"react-native-navigation-twopane": "git+https://github.com/status-im/react-native-navigation-twopane.git#v0.0.2-status",
"react-native-safe-area-context": "^0.6.0",
"react-native-screens": "^1.0.0-alpha.23",
"react-native-shake": "^3.3.1",
"react-native-splash-screen": "^3.2.0",
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#v2.5.17",
"react-native-svg": "^9.8.4",
"react-native-touch-id": "^4.4.1",
"react-native-webview": "^6.11.1",
"react-native-webview-bridge": "git+https://github.com/status-im/react-native-webview-bridge.git#fix/community-webview",
"react-navigation": "^3.11.0",
"web3-utils": "^1.2.1"
},
"devDependencies": {
"@babel/generator": "7.0.0",
"@babel/helper-builder-react-jsx": "7.0.0",
"@babel/plugin-transform-block-scoping": "7.0.0",
"@babel/preset-env": "7.1.0",
"@babel/register": "7.0.0",
"coveralls": "^3.0.4",
"nyc": "^14.1.1",
"process": "0.11.10",
"rn-snoopy": "git+https://github.com/status-im/rn-snoopy.git#v2.0.2-status",
"shadow-cljs": "2.8.83"
}
}

View File

@ -8,6 +8,7 @@ There are four main folders in the `nix` directory:
* `nix/scripts` - Bash scripts for easier usage of Nix
* `nix/pkgs` - Packages we add to or modify in `nixpkgs`
* `nix/deps` - Project dependencies managed by Nix
* `nix/tools` - Various tools used by our derivations and shells
* `nix/status-go` - Derivations for building [`status-go`](https://github.com/status-im/status-go) repo

View File

@ -0,0 +1,98 @@
args4j/args4j/2.0.26/args4j-2.0.26.jar
binaryage/env-config/0.2.2/env-config-0.2.2.jar
binaryage/oops/0.7.0/oops-0.7.0.jar
cider/cider-nrepl/0.24.0/cider-nrepl-0.24.0.jar
cider/piggieback/0.4.1/piggieback-0.4.1.jar
cljs-bean/cljs-bean/1.3.0/cljs-bean-1.3.0.jar
cljsjs/react/16.13.0-0/react-16.13.0-0.jar
cljsjs/react-dom/16.13.0-0/react-dom-16.13.0-0.jar
cljsjs/react-dom-server/16.13.0-0/react-dom-server-16.13.0-0.jar
com/andrewmcveigh/cljs-time/0.5.2/cljs-time-0.5.2.jar
com/bhauman/cljs-test-display/0.1.1/cljs-test-display-0.1.1.jar
com/cognitect/transit-clj/1.0.324/transit-clj-1.0.324.jar
com/cognitect/transit-cljs/0.8.248/transit-cljs-0.8.248.jar
com/cognitect/transit-java/1.0.343/transit-java-1.0.343.jar
com/cognitect/transit-js/0.8.846/transit-js-0.8.846.jar
com/fasterxml/jackson/core/jackson-core/2.8.7/jackson-core-2.8.7.jar
com/google/code/findbugs/jsr305/3.0.1/jsr305-3.0.1.jar
com/google/code/gson/gson/2.7/gson-2.7.jar
com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar
com/google/elemental2/elemental2-core/1.0.0-RC1/elemental2-core-1.0.0-RC1.jar
com/google/errorprone/error_prone_annotations/2.3.1/error_prone_annotations-2.3.1.jar
com/google/guava/guava/25.1-jre/guava-25.1-jre.jar
com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar
com/google/javascript/closure-compiler-externs/v20191027/closure-compiler-externs-v20191027.jar
com/google/javascript/closure-compiler-unshaded/v20191027/closure-compiler-unshaded-v20191027.jar
com/google/jsinterop/base/1.0.0/base-1.0.0.jar
com/google/jsinterop/jsinterop-annotations/1.0.2/jsinterop-annotations-1.0.2.jar
com/google/protobuf/protobuf-java/3.0.2/protobuf-java-3.0.2.jar
com/google/re2j/re2j/1.3/re2j-1.3.jar
commons-codec/commons-codec/1.10/commons-codec-1.10.jar
commons-fileupload/commons-fileupload/1.4/commons-fileupload-1.4.jar
commons-io/commons-io/2.6/commons-io-2.6.jar
com/taoensso/encore/2.94.0/encore-2.94.0.jar
com/taoensso/truss/1.5.0/truss-1.5.0.jar
com/taoensso/tufte/2.1.0/tufte-2.1.0.jar
com/wsscode/pathom/2.2.31/pathom-2.2.31.jar
com/wsscode/spec-inspec/1.0.0-alpha2/spec-inspec-1.0.0-alpha2.jar
crypto-equality/crypto-equality/1.0.0/crypto-equality-1.0.0.jar
crypto-random/crypto-random/1.2.0/crypto-random-1.2.0.jar
day8/re-frame/test/0.1.5/test-0.1.5.jar
edn-query-language/eql/0.0.9/eql-0.0.9.jar
expound/expound/0.8.4/expound-0.8.4.jar
fipp/fipp/0.6.22/fipp-0.6.22.jar
hawk/hawk/0.2.11/hawk-0.2.11.jar
hiccup/hiccup/1.0.5/hiccup-1.0.5.jar
hickory/hickory/0.7.1/hickory-0.7.1.jar
io/aviso/pretty/0.1.33/pretty-0.1.33.jar
io/undertow/undertow-core/2.0.30.Final/undertow-core-2.0.30.Final.jar
javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar
mvxcvi/alphabase/1.0.0/alphabase-1.0.0.jar
net/cgrand/macrovich/0.2.1/macrovich-0.2.1.jar
net/incongru/watchservice/barbary-watchservice/1.0/barbary-watchservice-1.0.jar
net/java/dev/jna/jna/3.2.2/jna-3.2.2.jar
nrepl/nrepl/0.7.0/nrepl-0.7.0.jar
org/checkerframework/checker-qual/2.0.0/checker-qual-2.0.0.jar
org/clojure/clojure/1.10.1/clojure-1.10.1.jar
org/clojure/clojurescript/1.10.597/clojurescript-1.10.597.jar
org/clojure/core.async/0.4.474/core.async-0.4.474.jar
org/clojure/core.cache/0.6.5/core.cache-0.6.5.jar
org/clojure/core.memoize/0.5.9/core.memoize-0.5.9.jar
org/clojure/core.rrb-vector/0.1.1/core.rrb-vector-0.1.1.jar
org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.jar
org/clojure/data.json/1.0.0/data.json-1.0.0.jar
org/clojure/data.priority-map/0.0.7/data.priority-map-0.0.7.jar
org/clojure/google-closure-library/0.0-20191016-6ae1f72f/google-closure-library-0.0-20191016-6ae1f72f.jar
org/clojure/google-closure-library-third-party/0.0-20191016-6ae1f72f/google-closure-library-third-party-0.0-20191016-6ae1f72f.jar
org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.jar
org/clojure/test.check/1.0.0/test.check-1.0.0.jar
org/clojure/tools.analyzer/0.6.9/tools.analyzer-0.6.9.jar
org/clojure/tools.analyzer.jvm/0.7.0/tools.analyzer.jvm-0.7.0.jar
org/clojure/tools.cli/1.0.194/tools.cli-1.0.194.jar
org/clojure/tools.logging/0.4.1/tools.logging-0.4.1.jar
org/clojure/tools.reader/1.3.2/tools.reader-1.3.2.jar
org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar
org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA.jar
org/jboss/logging/jboss-logging/3.4.0.Final/jboss-logging-3.4.0.Final.jar
org/jboss/threads/jboss-threads/3.1.0.Final/jboss-threads-3.1.0.Final.jar
org/jboss/xnio/xnio-api/3.8.0.Final/xnio-api-3.8.0.Final.jar
org/jboss/xnio/xnio-nio/3.8.0.Final/xnio-nio-3.8.0.Final.jar
org/jsoup/jsoup/1.9.2/jsoup-1.9.2.jar
org/mozilla/rhino/1.7R5/rhino-1.7R5.jar
org/msgpack/msgpack/0.6.12/msgpack-0.6.12.jar
org/ow2/asm/asm-all/4.2/asm-all-4.2.jar
org/wildfly/client/wildfly-client-config/1.0.1.Final/wildfly-client-config-1.0.1.Final.jar
org/wildfly/common/wildfly-common/1.5.2.Final/wildfly-common-1.5.2.Final.jar
quoin/quoin/0.1.2/quoin-0.1.2.jar
reagent/reagent/0.10.0/reagent-0.10.0.jar
refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0.jar
re-frame/re-frame/0.12.0/re-frame-0.12.0.jar
ring/ring-codec/1.1.2/ring-codec-1.1.2.jar
ring/ring-core/1.8.0/ring-core-1.8.0.jar
spec-coerce/spec-coerce/1.0.0-alpha6/spec-coerce-1.0.0-alpha6.jar
status-im/timbre/4.10.0-2-status/timbre-4.10.0-2-status.jar
thheller/shadow-client/1.3.2/shadow-client-1.3.2.jar
thheller/shadow-cljs/2.8.99/shadow-cljs-2.8.99-aot.jar
thheller/shadow-cljsjs/0.0.21/shadow-cljsjs-0.0.21.jar
thheller/shadow-util/0.7.0/shadow-util-0.7.0.jar
viebel/codox-klipse-theme/0.0.1/codox-klipse-theme-0.0.1.jar

1481
nix/deps/clojure/deps.nix Normal file

File diff suppressed because it is too large Load Diff

98
nix/deps/clojure/generate.sh Executable file
View File

@ -0,0 +1,98 @@
#!/usr/bin/env bash
set -e
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
if [[ -z "${IN_NIX_SHELL}" ]]; then
echo "Remember to call 'make shell'!"
exit 1
fi
CLASSPATH_FILE="${GIT_ROOT}/nix/deps/clojure/deps.list"
NIX_DEPS_FILE="${GIT_ROOT}/nix/deps/clojure/deps.nix"
MAVEN_CACHE_PATH="${HOME}/.m2/repository"
function gen_deps_list() {
# split into separate lines
CLASSPATH_LINES=$(yarn shadow-cljs classpath | tr ':' '\n')
# remove unnecessary lines
CLASSPATH_LINES=$(echo "${CLASSPATH_LINES}" | grep -vE '^(\$|yarn|Done|shadow-cljs|src|test)')
# remove local home path
CLASSPATH_LINES=$(echo "${CLASSPATH_LINES}" | sed "s#${MAVEN_CACHE_PATH}/##")
# print cleaned up entries from classpath
echo "${CLASSPATH_LINES}" | sort | uniq
}
function get_repo_for_dir() {
grep -oP '.*>\K\w+' "${1}/_remote.repositories" | uniq
}
function get_nix_sha() {
nix hash-file --base32 --type sha256 "$1" 2> /dev/null
}
function get_deps_header() {
echo "# Auto-generated by /nix/deps/clojure/generate.sh
{ }:
let
repos = rec {
central = \"https://repo1.maven.org/maven2\";
clojars = \"https://repo.clojars.org\";
};
in {"
}
function nix_entry_from_jar() {
JAR_REL_PATH="${1}"
JAR_REL_NAME="${JAR_REL_PATH%.jar}"
JAR_PATH="${MAVEN_CACHE_PATH}/${JAR_REL_PATH}"
JAR_NAME=$(basename "${JAR_PATH}")
JAR_DIR=$(dirname "${JAR_PATH}")
# POM might have a slightly different name
POM_PATH=$(echo ${JAR_DIR}/*.pom)
REPO_NAME=$(get_repo_for_dir "${JAR_DIR}")
JAR_SHA1=$(cat "${JAR_PATH}.sha1")
JAR_SHA256=$(get_nix_sha "${JAR_PATH}")
POM_SHA1=$(cat "${POM_PATH}.sha1")
POM_SHA256=$(get_nix_sha "${POM_PATH}")
# Format into a Nix attrset entry
echo -n "
\"${JAR_REL_NAME}\" =
{
host = repos.${REPO_NAME};
path = \"${JAR_REL_NAME}\";
type = \"jar\";
pom = {
sha1 = \"${POM_SHA1}\";
sha256 = \"${POM_SHA256}\";
};
jar = {
sha1 = \"${JAR_SHA1}\";
sha256 = \"${JAR_SHA256}\";
};
};
"
}
# generate the deps.list file with relative paths
gen_deps_list > "${CLASSPATH_FILE}"
echo "Saved Clojure deps list to: ${CLASSPATH_FILE}" >&2
# add the header which defines repo URLs
get_deps_header > "${NIX_DEPS_FILE}"
# for each dependency generate an attrset with metadata
DEPS=$(cat "${CLASSPATH_FILE}")
for DEP in ${DEPS}; do
nix_entry_from_jar "${DEP}" >> "${NIX_DEPS_FILE}"
done
# close the attrset
echo -e "\n}" >> "${NIX_DEPS_FILE}"
echo "Generated Clojure deps for Nix: ${NIX_DEPS_FILE}" >&2

View File

@ -1,165 +0,0 @@
https://repo.clojars.org/binaryage/env-config/0.2.2/env-config-0.2.2
https://repo.clojars.org/binaryage/oops/0.7.0/oops-0.7.0
https://repo.clojars.org/clj-stacktrace/clj-stacktrace/0.2.5/clj-stacktrace-0.2.5
https://repo.clojars.org/cljfmt/cljfmt/0.5.7/cljfmt-0.5.7
https://repo.clojars.org/cljs-bean/cljs-bean/1.3.0/cljs-bean-1.3.0
https://repo.clojars.org/cljsbuild/cljsbuild/1.1.7/cljsbuild-1.1.7
https://repo.clojars.org/cljsjs/react-dom-server/16.13.0-0/react-dom-server-16.13.0-0
https://repo.clojars.org/cljsjs/react-dom/16.13.0-0/react-dom-16.13.0-0
https://repo.clojars.org/cljsjs/react/16.13.0-0/react-16.13.0-0
https://repo.clojars.org/com/andrewmcveigh/cljs-time/0.5.2/cljs-time-0.5.2
https://repo.clojars.org/com/taoensso/encore/2.91.0/encore-2.91.0
https://repo.clojars.org/com/taoensso/encore/2.94.0/encore-2.94.0
https://repo.clojars.org/com/taoensso/truss/1.5.0/truss-1.5.0
https://repo.clojars.org/fs/fs/1.1.2/fs-1.1.2
https://repo.clojars.org/hickory/hickory/0.7.1/hickory-0.7.1
https://repo.clojars.org/io/aviso/pretty/0.1.33/pretty-0.1.33
https://repo.clojars.org/lein-cljfmt/lein-cljfmt/0.5.7/lein-cljfmt-0.5.7
https://repo.clojars.org/lein-cljsbuild/lein-cljsbuild/1.1.7/lein-cljsbuild-1.1.7
https://repo.clojars.org/meta-merge/meta-merge/1.0.0/meta-merge-1.0.0
https://repo.clojars.org/mvxcvi/alphabase/1.0.0/alphabase-1.0.0
https://repo.clojars.org/net/cgrand/macrovich/0.2.1/macrovich-0.2.1
https://repo.clojars.org/quoin/quoin/0.1.2/quoin-0.1.2
https://repo.clojars.org/rasom/lein-githooks/0.1.5/lein-githooks-0.1.5
https://repo.clojars.org/re-frame/re-frame/0.12.0/re-frame-0.12.0
https://repo.clojars.org/reagent/reagent/0.10.0/reagent-0.10.0
https://repo.clojars.org/reagent/reagent/0.7.0/reagent-0.7.0
https://repo.clojars.org/rewrite-clj/rewrite-clj/0.5.2/rewrite-clj-0.5.2
https://repo.clojars.org/rewrite-cljs/rewrite-cljs/0.4.3/rewrite-cljs-0.4.3
https://repo.clojars.org/status-im/timbre/4.10.0-2-status/timbre-4.10.0-2-status
https://repo.clojars.org/viebel/codox-klipse-theme/0.0.1/codox-klipse-theme-0.0.1
https://repo1.maven.org/maven2/args4j/args4j-site/2.0.26/args4j-site-2.0.26
https://repo1.maven.org/maven2/args4j/args4j-site/2.33/args4j-site-2.33
https://repo1.maven.org/maven2/args4j/args4j/2.0.26/args4j-2.0.26
https://repo1.maven.org/maven2/args4j/args4j/2.33/args4j-2.33
https://repo1.maven.org/maven2/com/cognitect/transit-clj/0.8.309/transit-clj-0.8.309
https://repo1.maven.org/maven2/com/cognitect/transit-java/0.8.332/transit-java-0.8.332
https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.8.7/jackson-core-2.8.7
https://repo1.maven.org/maven2/com/fasterxml/jackson/jackson-parent/2.8/jackson-parent-2.8
https://repo1.maven.org/maven2/com/fasterxml/oss-parent/27/oss-parent-27
https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9
https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.1/jsr305-3.0.1
https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2
https://repo1.maven.org/maven2/com/google/code/gson/gson-parent/2.7/gson-parent-2.7
https://repo1.maven.org/maven2/com/google/code/gson/gson/2.2.4/gson-2.2.4
https://repo1.maven.org/maven2/com/google/code/gson/gson/2.7/gson-2.7
https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.0.18/error_prone_annotations-2.0.18
https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.1.3/error_prone_annotations-2.1.3
https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.3.1/error_prone_annotations-2.3.1
https://repo1.maven.org/maven2/com/google/errorprone/error_prone_parent/2.0.18/error_prone_parent-2.0.18
https://repo1.maven.org/maven2/com/google/errorprone/error_prone_parent/2.1.3/error_prone_parent-2.1.3
https://repo1.maven.org/maven2/com/google/errorprone/error_prone_parent/2.3.1/error_prone_parent-2.3.1
https://repo1.maven.org/maven2/com/google/google/1/google-1
https://repo1.maven.org/maven2/com/google/guava/guava-parent/17.0/guava-parent-17.0
https://repo1.maven.org/maven2/com/google/guava/guava-parent/18.0/guava-parent-18.0
https://repo1.maven.org/maven2/com/google/guava/guava-parent/19.0/guava-parent-19.0
https://repo1.maven.org/maven2/com/google/guava/guava-parent/20.0/guava-parent-20.0
https://repo1.maven.org/maven2/com/google/guava/guava-parent/25.1-jre/guava-parent-25.1-jre
https://repo1.maven.org/maven2/com/google/guava/guava/17.0/guava-17.0
https://repo1.maven.org/maven2/com/google/guava/guava/18.0/guava-18.0
https://repo1.maven.org/maven2/com/google/guava/guava/19.0/guava-19.0
https://repo1.maven.org/maven2/com/google/guava/guava/20.0/guava-20.0
https://repo1.maven.org/maven2/com/google/guava/guava/25.1-jre/guava-25.1-jre
https://repo1.maven.org/maven2/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-externs/v20150126/closure-compiler-externs-v20150126
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-externs/v20160911/closure-compiler-externs-v20160911
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-externs/v20170521/closure-compiler-externs-v20170521
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-externs/v20190325/closure-compiler-externs-v20190325
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-main/v20160911/closure-compiler-main-v20160911
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-main/v20170521/closure-compiler-main-v20170521
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-main/v20190325/closure-compiler-main-v20190325
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-parent/v20150126/closure-compiler-parent-v20150126
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-parent/v20151216/closure-compiler-parent-v20151216
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-parent/v20160911/closure-compiler-parent-v20160911
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-parent/v20170521/closure-compiler-parent-v20170521
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-parent/v20190325/closure-compiler-parent-v20190325
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-unshaded/v20160911/closure-compiler-unshaded-v20160911
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-unshaded/v20170521/closure-compiler-unshaded-v20170521
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-unshaded/v20190325/closure-compiler-unshaded-v20190325
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler/v20150126/closure-compiler-v20150126
https://repo1.maven.org/maven2/com/google/javascript/closure-compiler/v20151216/closure-compiler-v20151216
https://repo1.maven.org/maven2/com/google/jsinterop/jsinterop-annotations/1.0.0/jsinterop-annotations-1.0.0
https://repo1.maven.org/maven2/com/google/jsinterop/jsinterop/1.0.0/jsinterop-1.0.0
https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/2.5.0/protobuf-java-2.5.0
https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.0.2/protobuf-java-3.0.2
https://repo1.maven.org/maven2/com/google/protobuf/protobuf-parent/3.0.2/protobuf-parent-3.0.2
https://repo1.maven.org/maven2/com/google/truth/truth-parent/0.24/truth-parent-0.24
https://repo1.maven.org/maven2/com/google/truth/truth/0.24/truth-0.24
https://repo1.maven.org/maven2/com/googlecode/java-diff-utils/diffutils/1.2.1/diffutils-1.2.1
https://repo1.maven.org/maven2/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1
https://repo1.maven.org/maven2/commons-codec/commons-codec/1.10/commons-codec-1.10
https://repo1.maven.org/maven2/junit/junit/4.10/junit-4.10
https://repo1.maven.org/maven2/org/apache/apache/15/apache-15
https://repo1.maven.org/maven2/org/apache/apache/9/apache-9
https://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.3/commons-compress-1.3
https://repo1.maven.org/maven2/org/apache/commons/commons-parent/22/commons-parent-22
https://repo1.maven.org/maven2/org/apache/commons/commons-parent/35/commons-parent-35
https://repo1.maven.org/maven2/org/checkerframework/checker-qual/2.0.0/checker-qual-2.0.0
https://repo1.maven.org/maven2/org/clojure/clojure/1.10.0/clojure-1.10.0
https://repo1.maven.org/maven2/org/clojure/clojure/1.10.1/clojure-1.10.1
https://repo1.maven.org/maven2/org/clojure/clojure/1.3.0/clojure-1.3.0
https://repo1.maven.org/maven2/org/clojure/clojure/1.4.0/clojure-1.4.0
https://repo1.maven.org/maven2/org/clojure/clojure/1.5.0/clojure-1.5.0
https://repo1.maven.org/maven2/org/clojure/clojure/1.5.1/clojure-1.5.1
https://repo1.maven.org/maven2/org/clojure/clojure/1.7.0-beta1/clojure-1.7.0-beta1
https://repo1.maven.org/maven2/org/clojure/clojure/1.7.0/clojure-1.7.0
https://repo1.maven.org/maven2/org/clojure/clojure/1.8.0/clojure-1.8.0
https://repo1.maven.org/maven2/org/clojure/clojurescript/0.0-3211/clojurescript-0.0-3211
https://repo1.maven.org/maven2/org/clojure/clojurescript/1.10.520/clojurescript-1.10.520
https://repo1.maven.org/maven2/org/clojure/clojurescript/1.7.228/clojurescript-1.7.228
https://repo1.maven.org/maven2/org/clojure/clojurescript/1.9.293/clojurescript-1.9.293
https://repo1.maven.org/maven2/org/clojure/clojurescript/1.9.655/clojurescript-1.9.655
https://repo1.maven.org/maven2/org/clojure/core.async/0.4.474/core.async-0.4.474
https://repo1.maven.org/maven2/org/clojure/core.cache/0.6.5/core.cache-0.6.5
https://repo1.maven.org/maven2/org/clojure/core.memoize/0.5.9/core.memoize-0.5.9
https://repo1.maven.org/maven2/org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44
https://repo1.maven.org/maven2/org/clojure/data.json/0.2.6/data.json-0.2.6
https://repo1.maven.org/maven2/org/clojure/data.priority-map/0.0.7/data.priority-map-0.0.7
https://repo1.maven.org/maven2/org/clojure/google-closure-library-third-party/0.0-20140718-946a7d39/google-closure-library-third-party-0.0-20140718-946a7d39
https://repo1.maven.org/maven2/org/clojure/google-closure-library-third-party/0.0-20151016-61277aea/google-closure-library-third-party-0.0-20151016-61277aea
https://repo1.maven.org/maven2/org/clojure/google-closure-library-third-party/0.0-20160609-f42b4a24/google-closure-library-third-party-0.0-20160609-f42b4a24
https://repo1.maven.org/maven2/org/clojure/google-closure-library-third-party/0.0-20170519-fa0499ef/google-closure-library-third-party-0.0-20170519-fa0499ef
https://repo1.maven.org/maven2/org/clojure/google-closure-library-third-party/0.0-20190213-2033d5d9/google-closure-library-third-party-0.0-20190213-2033d5d9
https://repo1.maven.org/maven2/org/clojure/google-closure-library/0.0-20140718-946a7d39/google-closure-library-0.0-20140718-946a7d39
https://repo1.maven.org/maven2/org/clojure/google-closure-library/0.0-20151016-61277aea/google-closure-library-0.0-20151016-61277aea
https://repo1.maven.org/maven2/org/clojure/google-closure-library/0.0-20160609-f42b4a24/google-closure-library-0.0-20160609-f42b4a24
https://repo1.maven.org/maven2/org/clojure/google-closure-library/0.0-20170519-fa0499ef/google-closure-library-0.0-20170519-fa0499ef
https://repo1.maven.org/maven2/org/clojure/google-closure-library/0.0-20190213-2033d5d9/google-closure-library-0.0-20190213-2033d5d9
https://repo1.maven.org/maven2/org/clojure/pom.contrib/0.1.2/pom.contrib-0.1.2
https://repo1.maven.org/maven2/org/clojure/pom.contrib/0.2.0/pom.contrib-0.2.0
https://repo1.maven.org/maven2/org/clojure/pom.contrib/0.2.2/pom.contrib-0.2.2
https://repo1.maven.org/maven2/org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176
https://repo1.maven.org/maven2/org/clojure/tools.analyzer.jvm/0.7.0/tools.analyzer.jvm-0.7.0
https://repo1.maven.org/maven2/org/clojure/tools.analyzer/0.6.9/tools.analyzer-0.6.9
https://repo1.maven.org/maven2/org/clojure/tools.logging/0.4.1/tools.logging-0.4.1
https://repo1.maven.org/maven2/org/clojure/tools.namespace/0.2.11/tools.namespace-0.2.11
https://repo1.maven.org/maven2/org/clojure/tools.reader/0.10.0/tools.reader-0.10.0
https://repo1.maven.org/maven2/org/clojure/tools.reader/0.9.1/tools.reader-0.9.1
https://repo1.maven.org/maven2/org/clojure/tools.reader/1.0.0-alpha1/tools.reader-1.0.0-alpha1
https://repo1.maven.org/maven2/org/clojure/tools.reader/1.0.0-alpha3/tools.reader-1.0.0-alpha3
https://repo1.maven.org/maven2/org/clojure/tools.reader/1.0.0-alpha4/tools.reader-1.0.0-alpha4
https://repo1.maven.org/maven2/org/clojure/tools.reader/1.0.0-beta3/tools.reader-1.0.0-beta3
https://repo1.maven.org/maven2/org/clojure/tools.reader/1.0.0-beta4/tools.reader-1.0.0-beta4
https://repo1.maven.org/maven2/org/clojure/tools.reader/1.0.0/tools.reader-1.0.0
https://repo1.maven.org/maven2/org/clojure/tools.reader/1.0.5/tools.reader-1.0.5
https://repo1.maven.org/maven2/org/clojure/tools.reader/1.2.1/tools.reader-1.2.1
https://repo1.maven.org/maven2/org/clojure/tools.reader/1.3.0/tools.reader-1.3.0
https://repo1.maven.org/maven2/org/codehaus/codehaus-parent/4/codehaus-parent-4
https://repo1.maven.org/maven2/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14
https://repo1.maven.org/maven2/org/codehaus/mojo/animal-sniffer-parent/1.14/animal-sniffer-parent-1.14
https://repo1.maven.org/maven2/org/codehaus/mojo/mojo-parent/34/mojo-parent-34
https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1
https://repo1.maven.org/maven2/org/hamcrest/hamcrest-parent/1.1/hamcrest-parent-1.1
https://repo1.maven.org/maven2/org/javassist/javassist/3.18.1-GA/javassist-3.18.1-GA
https://repo1.maven.org/maven2/org/jsoup/jsoup/1.9.2/jsoup-1.9.2
https://repo1.maven.org/maven2/org/kohsuke/pom/14/pom-14
https://repo1.maven.org/maven2/org/kohsuke/pom/6/pom-6
https://repo1.maven.org/maven2/org/mozilla/rhino/1.7R5/rhino-1.7R5
https://repo1.maven.org/maven2/org/msgpack/msgpack/0.6.12/msgpack-0.6.12
https://repo1.maven.org/maven2/org/ow2/asm/asm-all/4.2/asm-all-4.2
https://repo1.maven.org/maven2/org/ow2/asm/asm-parent/4.2/asm-parent-4.2
https://repo1.maven.org/maven2/org/ow2/ow2/1.3/ow2-1.3
https://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/4/oss-parent-4
https://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/5/oss-parent-5
https://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7
https://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/9/oss-parent-9

File diff suppressed because it is too large Load Diff

View File

@ -3,11 +3,11 @@
let
gradle = gradle_5; # Currently 5.6.4
leinProjectDeps = import ../../lein/lein-project-deps.nix { };
clojureDeps = import ../../deps/clojure/deps.nix { };
# Import a jsbundle compiled out of clojure codebase
jsbundle = callPackage ./jsbundle {
inherit leinProjectDeps localMavenRepoBuilder projectNodePackage;
inherit clojureDeps localMavenRepoBuilder projectNodePackage;
};
# Import a patched version of watchman (important for sandboxed builds on macOS)

View File

@ -1,17 +1,15 @@
#
# This Nix expression builds an index.*.js file for the current repository given a node modules Nix expression
# This Nix expression builds the js files for the current repository given a node modules Nix expression
#
{ target-os ? "android",
stdenv, lib, clojure, leiningen, nodejs, bash, git,
leinProjectDeps, localMavenRepoBuilder, projectNodePackage }:
{ target ? "android",
stdenv, lib, clojure, nodejs, bash, git, openjdk,
clojureDeps, localMavenRepoBuilder, projectNodePackage }:
let
lein-command = if target-os == "all" then "lein jsbundle" else "lein jsbundle-${target-os}";
leinProjectDepsLocalRepo = localMavenRepoBuilder "lein-project-deps" leinProjectDeps;
clojureDepsLocal = localMavenRepoBuilder "clojure-project-deps" clojureDeps;
in stdenv.mkDerivation {
name = "status-react-build-jsbundle-${target-os}";
name = "status-react-build-jsbundle-${target}";
src =
let path = ./../../../..;
in builtins.path { # We use builtins.path so that we can name the resulting derivation, otherwise the name would be taken from the checkout directory, which is outside of our control
@ -26,52 +24,47 @@ in stdenv.mkDerivation {
"VERSION" "BUILD_NUMBER" "scripts/version/.*"
# I want to avoid including the whole .git directory
".git/HEAD" ".git/objects" ".git/refs/heads/.*"
"src/.*" "prod/.*" "env/prod/.*"
"components/src/.*"
"react-native/src"
"react-native/src/cljsjs/.*"
"react-native/src/mobile/.*"
"status-modules/cljs/.*"
"status-modules/resources/.*"
"build.clj" "externs.js"
"project.clj" "prepare-modules.js"
# lein jsbundle stat's images to check if they exist
"resources/.*"
"src/.*" "shadow-cljs.edn" "index.js"
# shadow-cljs expects these for deps resolution
"mobile/js_files/package.json" "mobile/js_files/yarn.lock"
# build stat's images to check if they exist
"resources/.*" "translations/.*"
];
exclude = [
"resources/fonts/.*"
];
};
};
buildInputs = [ clojure leiningen nodejs bash git ];
buildInputs = [ clojure nodejs bash git openjdk];
LEIN_OFFLINE = "y";
phases = [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" ];
phases = [ "unpackPhase" "patchPhase" "configurePhase" "buildPhase" "installPhase" ];
# Patching shadow-cljs.edn so it uses the local maven repo of dependencies provided by Nix
patchPhase =
let anchor = '':url "https://github.com/status-im/status-react/"'';
let anchor = ''{:source-paths ["src" "test/cljs"]'';
in ''
substituteInPlace project.clj \
substituteInPlace shadow-cljs.edn \
--replace '${anchor}' \
'${anchor}
:local-repo "${leinProjectDepsLocalRepo}"' \
--replace '[rasom/lein-githooks "' ';; [rasom/lein-githooks "' \
--replace ':githooks' ';; :githooks' \
--replace ':pre-commit' ';; :pre-commit'
:maven {:local-repo "${clojureDepsLocal}"}'
'';
buildPhase = ''
configurePhase = ''
# Symlink Node.js modules to build directory
ln -s ${projectNodePackage}/node_modules
# On macOS, lein tries to create $HOME/.lein, which fails with java.lang.Exception: Couldn't create directories: /homeless-shelter/.lein, so we just make it use a temp dir
tmp=$(mktemp -d)
HOME=$tmp ${lein-command}
rm -rf $tmp
unset tmp
# Symlink Node.JS dependency definitions
ln -sf mobile/js_files/package.json ./
ln -sf mobile/js_files/yarn.lock ./
'';
buildPhase = ''
# Assemble CLASSPATH from available clojure dependencies.
# We append 'src' so it can find the local sources.
export CLASS_PATH="$(find ${clojureDepsLocal} -iname '*.jar' | tr '\n' ':')src"
node prepare-modules.js
# target must be one of the builds defined in shadow-cljs.edn
java -cp "$CLASS_PATH" clojure.main -m shadow.cljs.devtools.cli release ${target}
'';
installPhase = ''
mkdir -p $out
cp index.*.js $out/
cp -r index.js app $out/
'';
}

View File

@ -99,8 +99,8 @@ in stdenv.mkDerivation rec {
# Ensure we have the right .env file
cp -f $sourceRoot/${envFileName} $sourceRoot/.env
# Copy index.*.js input file
cp -a --no-preserve=ownership ${jsbundle}/index*.js $sourceRoot/
# Copy index.js and app/ input files
cp -ra --no-preserve=ownership ${jsbundle}/* $sourceRoot/
# Copy android/ directory
cp -a --no-preserve=ownership ${sourceProjectDir}/android/ $sourceRoot/

View File

@ -20,7 +20,7 @@ let
# core utilities that should always be present in a shell
bash curl wget file unzip flock git gnumake jq ncurses
# build specific utilities
clojure leiningen maven watchman
clojure maven watchman
# other nice to have stuff
yarn nodejs python27
] # and some special cases
@ -43,12 +43,12 @@ let
};
# An attrset for easier merging with default shell
shells = rec {
shells = {
inherit default;
# for calling lein targets in CI or Makefile
lein = pkgs.mkShell {
buildInputs = with pkgs; [ clojure leiningen flock maven nodejs openjdk ];
# for calling clojure targets in CI or Makefile
clojure = pkgs.mkShell {
buildInputs = with pkgs; [ clojure flock maven nodejs openjdk ];
};
# for 'make watchman-clean'
@ -73,12 +73,6 @@ let
windows = targets.desktop.windows.shell;
android = targets.mobile.android.shell;
ios = targets.mobile.ios.shell;
# all shells together depending on host OS
all = lib.mergeSh (pkgs.mkShell {}) (lib.unique (
lib.optionals stdenv.isLinux [ android linux windows ] ++
lib.optionals stdenv.isDarwin [ android macos ios ]
));
};
# for merging the default shell with others

View File

@ -1,32 +0,0 @@
#!/usr/bin/env bash
set -Eeu
# This script computes the required Maven dependencies required by cljsbuild for this project
# and outputs them as a text file, where each line represents a URL to a Maven dependency
# (minus the extension).
# For this, we start with a clean cache (in a temporary directory) and call cljsbuild
# to cause it to download all the artifacts.
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)
_current_dir=$(cd "${BASH_SOURCE%/*}" && pwd)
_project_file_name='project.clj'
_lein_cmd='lein with-profile prod cljsbuild once'
_repo_path=$(mktemp -d)
function filter() {
sed -E "s;Retrieving ([^ ]+)\.(pom|jar) from $1.*;$2\1;"
}
echo "Computing maven dependencies with \`$_lein_cmd\`..." > /dev/stderr
trap "rm -rf ${_repo_path}; [ -f ${_project_file_name}.bak ] && mv -f ${_project_file_name}.bak ${_project_file_name}" HUP ERR EXIT INT
cd $GIT_ROOT
# Add a :local-repo entry to project.clj so that we always start with a clean repo
sed -i'.bak' -E "s|(:license \{)|:local-repo \"$_repo_path\" \1|" ${_project_file_name}
rm -rf ./${_repo_path}
$_lein_cmd 2>&1 \
| grep Retrieving \
| filter clojars https://repo.clojars.org/ \
| filter central https://repo1.maven.org/maven2/ # NOTE: We could use `lein pom` to figure out the repository names and URLs so they're not hardcoded

View File

@ -1,31 +0,0 @@
#!/usr/bin/env bash
if [[ -z "${IN_NIX_SHELL}" ]]; then
echo "Remember to call 'make shell'!"
exit 1
fi
# This script takes care of generating/updating the nix files in the directory passed as a single argument.
# For this, we start with a clean cache (in ./.m2~/repository/) and call cljsbuild
# to cause it to download all the artifacts. At the same time, we note them
# in $1/lein-project-deps-maven-inputs.txt so that we can use that as an input
# to ../maven/maven-inputs2nix.sh
set -Eeuo pipefail
output_dir=$1
mkdir -p $output_dir
_current_dir=$(cd "${BASH_SOURCE%/*}" && pwd)
_inputs_file_path="$output_dir/lein-project-deps-maven-inputs.txt"
_deps_nix_file_path="$output_dir/lein-project-deps.nix"
_nix_shell_opts="-I nixpkgs=https://github.com/status-im/nixpkgs/archive/db492b61572251c2866f6b5e6e94e9d70e7d3021.tar.gz"
echo "Regenerating Nix files, this process should take 5-10 minutes"
nix-shell ${_nix_shell_opts} --run "set -Eeuo pipefail; $_current_dir/fetch-maven-deps.sh | sort -u > $_inputs_file_path" \
--pure --packages leiningen git
echo "Generating $(basename $_deps_nix_file_path) from $(basename $_inputs_file_path)..."
nix-shell ${_nix_shell_opts} \
--run "$_current_dir/../maven/maven-inputs2nix.sh $_inputs_file_path > $_deps_nix_file_path" \
--packages maven
echo "Done"

View File

@ -1,157 +0,0 @@
#!/usr/bin/env bash
#
# This script takes a maven-inputs.txt file and builds a Nix expression that can be used by maven-repo-builder.nix to produce a path to a local Maven repository
#
function getSHA() {
nix-prefetch-url --type sha256 "$1" 2> /dev/null
}
_tmp=$(mktemp)
sort $1 | uniq > $_tmp
trap "rm $_tmp" EXIT INT
apacheUrl='https://repo.maven.apache.org/maven2'
clojarsUrl='https://repo.clojars.org'
fabricUrl='https://maven.fabric.io/public'
googleUrl='https://dl.google.com/dl/android/maven2'
gradleUrl='http://repo.gradle.org/gradle/libs-releases-local'
gradlePluginsUrl='https://plugins.gradle.org/m2'
javaUrl='https://maven.java.net/content/repositories/releases'
jcenterUrl='https://jcenter.bintray.com'
jitpackUrl='https://jitpack.io'
mavenUrl='https://repo1.maven.org/maven2'
sonatypeSnapshotsUrl='https://oss.sonatype.org/content/repositories/snapshots'
sonatypePublicGridUrl='https://repository.sonatype.org/content/groups/sonatype-public-grid'
# Writes Nix attribute set describing a package (represented by its URL)
function writeEntry() {
local depurl=$1
if [[ "$depurl" = "$apacheUrl"* ]]; then
host='apache'
prefix=$apacheUrl
elif [[ "$depurl" = "$clojarsUrl"* ]]; then
host='clojars'
prefix=$clojarsUrl
elif [[ "$depurl" = "$fabricUrl"* ]]; then
host='fabric-io'
prefix=$fabricUrl
elif [[ "$depurl" = "$googleUrl"* ]]; then
host='google'
prefix=$googleUrl
elif [[ "$depurl" = "$gradleUrl"* ]]; then
host='gradle'
prefix=$gradleUrl
elif [[ "$depurl" = "$gradlePluginsUrl"* ]]; then
host='gradlePlugins'
prefix=$gradlePluginsUrl
elif [[ "$depurl" = "$jcenterUrl"* ]]; then
host='jcenter'
prefix=$jcenterUrl
elif [[ "$depurl" = "$jitpackUrl"* ]]; then
host='jitpack'
prefix=$jitpackUrl
elif [[ "$depurl" = "$javaUrl"* ]]; then
host='java'
prefix=$javaUrl
elif [[ "$depurl" = "$mavenUrl"* ]]; then
host='maven'
prefix=$mavenUrl
elif [[ "$depurl" = "$sonatypeSnapshotsUrl"* ]]; then
host='sonatypeSnapshots'
prefix=$sonatypeSnapshotsUrl
elif [[ "$depurl" = "$sonatypePublicGridUrl"* ]]; then
host='sonatypePublicGrid'
prefix=$sonatypePublicGridUrl
else
echo "Unknown host in $depurl, exiting."
exit 1
fi
deppath="${depurl/$prefix\//}"
pom_sha256=$(getSHA "$depurl.pom")
[ -n "$pom_sha256" ] && pom_sha1=$(curl -s --location "$depurl.pom.sha1") || unset pom_sha1
jar_sha256=$(getSHA "$depurl.jar")
type='jar'
if [ -z "$jar_sha256" ]; then
jar_sha256=$(getSHA "$depurl.aar")
[ -n "$jar_sha256" ] && type='aar'
fi
[ -n "$jar_sha256" ] && jar_sha1=$(curl -s --location "$depurl.${type}.sha1") || unset jar_sha1
if [ -z "$pom_sha256" ] && [ -z "$jar_sha256" ] && [ -z "$aar_sha256" ]; then
echo "Warning: failed to download $depurl" > /dev/stderr
echo "Exiting." > /dev/stderr
exit 1
fi
echo -n " \"$depurl\" =
{
host = repositories.$host;
path =
\"$deppath\";
type = \"$type\";"
if [ -n "$pom_sha256" ]; then
echo -n "
pom = {
sha1 = \"$pom_sha1\";
sha256 = \"$pom_sha256\";
};"
fi
if [ -n "$jar_sha256" ]; then
echo -n "
jar = {
sha1 = \"$jar_sha1\";
sha256 = \"$jar_sha256\";
};"
fi
echo "
};"
}
lineCount=$(wc -l $1 | cut -f 1 -d ' ')
currentLine=0
pstr="[=======================================================================]"
echo "# Auto-generated by $(realpath --relative-to="$(dirname $1)" ${BASH_SOURCE})
{ }:
let
repositories = {
apache = \"$mavenUrl\";
clojars = \"$clojarsUrl\";
fabric-io = \"$fabricUrl\";
google = \"$googleUrl\";
gradle = \"$gradleUrl\";
gradlePlugins = \"$gradlePluginsUrl\";
java = \"$javaUrl\";
jcenter = \"$jcenterUrl\";
jitpack = \"$jitpackUrl\";
maven = \"$mavenUrl\";
sonatypeSnapshots =
\"$sonatypeSnapshotsUrl\";
sonatypePublicGrid =
\"$sonatypePublicGridUrl\";
};
in {"
echo "Generating Nix file from $1..." > /dev/stderr
while read depurl
do
currentLine=$(( $currentLine + 1 ))
pd=$(( $currentLine * 73 / $lineCount ))
printf "\r%3d.%1d%% %.${pd}s" $(( $currentLine * 100 / $lineCount )) $(( ($currentLine * 1000 / $lineCount) % 10 )) $pstr > /dev/stderr
if [ -z "$depurl" ]; then
continue
fi
writeEntry $depurl
# com.android.tools.build:aapt2 package also includes a platform-specific package, so we should add that too
if [[ "$depurl" = *'com/android/tools/build/aapt2/'* ]]; then
writeEntry "$depurl-linux"
writeEntry "$depurl-osx"
fi
done < $_tmp
echo "}"

View File

@ -4,40 +4,51 @@
name: source:
let
inherit (lib)
removeSuffix optionalString splitString concatMapStrings
attrByPath attrValues last makeOverridable;
# some .jar files have an `-aot` suffix that doesn't work for .pom files
getPOM = jarUrl: "${removeSuffix "-aot" jarUrl}.pom";
script = writeShellScriptBin "create-local-maven-repo" (''
mkdir -p $out
cd $out
'' +
(lib.concatMapStrings (dep':
(concatMapStrings (dep':
let
dep = { postCopy = ""; } // dep';
url = "${dep.host}/${dep.path}";
pom = {
sha1 = lib.attrByPath [ "pom" "sha1" ] "" dep;
sha256 = lib.attrByPath [ "pom" "sha256" ] "" dep;
sha1 = attrByPath [ "pom" "sha1" ] "" dep;
sha256 = attrByPath [ "pom" "sha256" ] "" dep;
};
pom-download = lib.optionalString (pom.sha256 != "") (fetchurl { url = "${url}.pom"; inherit (pom) sha256; });
pom-download = optionalString (pom.sha256 != "") (
fetchurl { url = getPOM url; inherit (pom) sha256; }
);
jar = {
sha1 = lib.attrByPath [ "jar" "sha1" ] "" dep;
sha256 = lib.attrByPath [ "jar" "sha256" ] "" dep;
sha1 = attrByPath [ "jar" "sha1" ] "" dep;
sha256 = attrByPath [ "jar" "sha256" ] "" dep;
};
jar-download = lib.optionalString (jar.sha256 != "") (fetchurl { url = "${url}.${dep.type}"; inherit (jar) sha256; });
fileName = lib.last (lib.splitString "/" dep.path);
directory = lib.removeSuffix fileName dep.path;
jar-download = optionalString (jar.sha256 != "") (
fetchurl { url = "${url}.${dep.type}"; inherit (jar) sha256; }
);
fileName = last (splitString "/" dep.path);
directory = removeSuffix fileName dep.path;
in
''
mkdir -p ${directory}
${lib.optionalString (pom-download != "") ''
cp -f "${pom-download}" "${dep.path}.pom"
${optionalString (pom-download != "") ''
cp -f "${pom-download}" "${getPOM dep.path}"
''}
${lib.optionalString (pom.sha1 != "") ''
echo "${pom.sha1}" > "${dep.path}.pom.sha1"
${optionalString (pom.sha1 != "") ''
echo "${pom.sha1}" > "${getPOM dep.path}.sha1"
''}
${lib.optionalString (jar-download != "") ''
${optionalString (jar-download != "") ''
cp -f "${jar-download}" "${dep.path}.${dep.type}"
''}
${lib.optionalString (jar.sha1 != "") ''
${optionalString (jar.sha1 != "") ''
echo "${jar.sha1}" > "${dep.path}.${dep.type}.sha1"
''}
@ -48,9 +59,9 @@ let
'' else ""
}
'')
(lib.attrValues source)));
(attrValues source)));
in lib.makeOverridable stdenv.mkDerivation {
in makeOverridable stdenv.mkDerivation {
inherit name;
phases = [ "buildPhase" ];
buildPhase = "${script}/bin/create-local-maven-repo";

View File

@ -1,25 +0,0 @@
var fs = require("fs");
var path = require('path');
var dirs = ["status-modules/cljs", "status-modules/resources"];
dirs.forEach(dir => {
fs.readdir(dir, (err, files) => {
if (files) {
files.forEach(file => {
if (file.endsWith("-raw.js")) {
const filePath = path.resolve(dir, file);
fs.readFile(filePath, "utf8", function (err, data) {
if (err) throw err;
fs.writeFile(filePath.replace("-raw.js", ".js"),
("module.exports=`" + data.replace(/[\\$'"]/g, "\\$&") + "`;"),
function (err) {
if (err) {
return console.log(err);
}
});
});
}
});
}
});
});

View File

@ -1,62 +0,0 @@
(ns status-im.i18n-resources
(:require [status-im.react-native.js-dependencies :as rn-dependencies]
[clojure.string :as string]))
(def default-device-language
(keyword (.-language rn-dependencies/react-native-languages)))
(def languages [:ar :en :es :es_419 :fil :fr :id :in :it :ko :ru :zh :zh_Hant :zh_TW])
(defonce loaded-languages
(atom
(conj #{:en} default-device-language)))
(def prod-translations
{
:ar (js/require "status-modules/translations/ar.json")
:en (js/require "status-modules/translations/en.json")
:es (js/require "status-modules/translations/es.json")
:es_419 (js/require "status-modules/translations/es_419.json")
:fil (js/require "status-modules/translations/fil.json")
:fr (js/require "status-modules/translations/fr.json")
:id (js/require "status-modules/translations/id.json")
:in (js/require "status-modules/translations/id.json")
:it (js/require "status-modules/translations/it.json")
:ko (js/require "status-modules/translations/ko.json")
:ru (js/require "status-modules/translations/ru.json")
:zh (js/require "status-modules/translations/zh.json")
:zh_Hant (js/require "status-modules/translations/zh_TW.json")
:zh_TW (js/require "status-modules/translations/zh_TW.json")})
(defn valid-language [lang]
(if (contains? prod-translations lang)
lang
(let [parts (string/split (name lang) #"_")
short-lang (keyword (str (first parts) "_" (second parts)))
shortest-lang (keyword (first parts))]
(if (and (> (count parts) 2) (contains? prod-translations short-lang))
short-lang
(when (contains? prod-translations shortest-lang)
shortest-lang)))))
(defn require-translation [lang-key]
(when-let [lang (valid-language lang-key)]
(get prod-translations lang)))
;; translations
(def translations-by-locale
(cond->
{:en (require-translation :en)}
(not= :en default-device-language)
(assoc default-device-language
(require-translation (-> (name default-device-language)
(string/replace "-" "_")
keyword)))))
(defn load-language [lang]
(let [lang-key (valid-language (keyword lang))]
(when-not (contains? @loaded-languages lang-key)
(aset (.-translations rn-dependencies/i18n)
lang
(require-translation lang-key))
(swap! loaded-languages conj lang-key))))

View File

@ -1,183 +0,0 @@
(defproject status-im "0.1.0-SNAPSHOT"
:url "https://github.com/status-im/status-react/"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
;; NOTE: Dependecies here are used in CI, till the CI script will be updated
;; all deps should be maintained in deps.edn and here.
:dependencies [[org.clojure/clojure "1.10.0"]
[org.clojure/clojurescript "1.10.520"
:exclusions
[com.google.javascript/closure-compiler-unshaded
org.clojure/google-closure-library]]
;; [com.google.javascript/closure-compiler-unshaded "v20180319"]
;; v20180506
[com.google.javascript/closure-compiler-unshaded "v20190325"]
[org.clojure/google-closure-library "0.0-20190213-2033d5d9"]
[org.clojure/core.async "0.4.474"]
[reagent "0.7.0" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server cljsjs/create-react-class]]
[re-frame "0.12.0"]
[com.andrewmcveigh/cljs-time "0.5.2"]
[status-im/timbre "4.10.0-2-status"]
[com.taoensso/encore "2.94.0"]
[hickory "0.7.1"]
[cljs-bean "1.3.0"]
[binaryage/oops "0.7.0"]
[mvxcvi/alphabase "1.0.0"]]
:plugins [[rasom/lein-githooks "0.1.5"]
[lein-cljsbuild "1.1.7"]
[lein-cljfmt "0.5.7"]]
:githooks {:auto-install true
:pre-commit ["lein cljfmt check src/status_im/core.cljs $(git diff --diff-filter=d --cached --name-only src test/cljs)"]}
:cljfmt {:indents {letsubs [[:inner 0]]}}
:clean-targets ["target/" "index.ios.js" "index.android.js" "status-modules/cljs"]
:aliases {"jsbundle" ^{:doc "Recompile code with prod profile."}
["do" "clean"
["with-profile" "prod" "cljsbuild" "once" "ios"]
["with-profile" "prod" "cljsbuild" "once" "android"]
["with-profile" "prod" "cljsbuild" "once" "desktop"]]
"jsbundle-android" ^{:doc "Recompile code for Android with prod profile."}
["do" "clean"
["with-profile" "prod" "cljsbuild" "once" "android"]]
"jsbundle-ios" ^{:doc "Recompile code for iOS with prod profile."}
["do" "clean"
["with-profile" "prod" "cljsbuild" "once" "ios"]]
"jsbundle-desktop" ^{:doc "Recompile code for desktop with prod profile."}
["do" "clean"
["with-profile" "prod" "cljsbuild" "once" "desktop"]]
"figwheel-repl" ["with-profile" "+figwheel" "run" "-m" "clojure.main" "env/dev/run.clj"]
"test-cljs" ["with-profile" "test" "doo" "node" "test" "once"]
"test-cljs-auto" ["with-profile" "test" "doo" "node" "test" "auto"]
"test-protocol" ["with-profile" "test" "doo" "node" "protocol" "once"]
"test-env-dev-utils" ["with-profile" "test" "doo" "node" "env-dev-utils" "once"]}
:profiles {:dev {:dependencies [[cider/piggieback "0.4.0"]]
:cljsbuild {:builds
{:ios
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/mobile" "src" "dev"]
:compiler {:output-to "target/ios/app.js"
:main "env.ios.main"
:output-dir "target/ios"
:optimizations :none}}
:android
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/mobile" "src" "dev"]
:compiler {:output-to "target/android/app.js"
:main "env.android.main"
:output-dir "target/android"
:optimizations :none}
:warning-handlers [status-im.utils.build/warning-handler]}
:desktop
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/desktop" "src" "dev"]
:compiler {:output-to "target/desktop/app.js"
:main "env.desktop.main"
:output-dir "target/desktop"
:optimizations :none}}}}
:repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]
:timeout 240000}}
:test {:dependencies [[com.taoensso/tufte "2.1.0"]
[day8.re-frame/test "0.1.5"]]
:plugins [[lein-doo "0.1.9"]]
:cljsbuild {:builds
[{:id "test"
:source-paths ["components/src" "src" "test/cljs" "dev"]
:compiler {:main status-im.test.runner
:output-to "target/test/test.js"
:output-dir "target/test"
:optimizations :none
:preamble ["js/hook-require.js"]
:target :nodejs}}
{:id "protocol"
:source-paths ["components/src" "src" "test/cljs" "dev"]
:compiler {:main status-im.test.protocol.runner
:output-to "target/test/test.js"
:output-dir "target/test"
:optimizations :none
:preamble ["js/hook-require.js"]
:target :nodejs}}
{:id "env-dev-utils"
:source-paths ["env/dev/env/utils.cljs" "test/env/dev" "dev"]
:compiler {:main env.test.runner
:output-to "target/test/test.js"
:output-dir "target/test"
:optimizations :none
:target :nodejs}}]}}
:prod {:cljsbuild {:builds
{:ios
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/mobile" "src" "env/prod" "prod"]
:compiler {:main "env.ios.main"
:output-dir "target/ios-prod"
:static-fns true
:fn-invoke-direct true
:optimize-constants true
:optimizations :advanced
:pseudo-names false
:pretty-print false
:closure-defines {"goog.DEBUG" false}
:parallel-build false
:elide-asserts true
:externs ["externs.js"]
:language-in :es-2015
:language-out :es-2015
:modules {:cljs-base {:output-to "index.ios.js"}
:i18n {:entries #{"status_im.goog.i18n"}
:output-to "status-modules/cljs/i18n-raw.js"}
:network {:entries #{"status_im.network.ui.network_details.views"
"status_im.network.ui.edit_network.views"
"status_im.network.ui.edit_network.styles"
"status_im.network.ui.views"
"status_im.network.ui.styles"
"status_im.network.core"}
:output-to "status-modules/cljs/network-raw.js"}}}
:warning-handlers [status-im.utils.build/warning-handler]}
:android
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/mobile" "src" "env/prod" "prod"]
:compiler {:main "env.android.main"
:output-dir "target/android-prod"
:static-fns true
:fn-invoke-direct true
:optimize-constants true
:optimizations :advanced
:stable-names true
:pseudo-names false
:pretty-print false
:closure-defines {"goog.DEBUG" false}
:parallel-build false
:elide-asserts true
:externs ["externs.js"]
:language-in :es-2015
:language-out :es-2015
:modules {:cljs-base {:output-to "index.android.js"}
:i18n {:entries #{"status_im.goog.i18n"}
:output-to "status-modules/cljs/i18n-raw.js"}
:network {:entries #{"status_im.network.ui.network_details.views"
"status_im.network.ui.edit_network.views"
"status_im.network.ui.edit_network.styles"
"status_im.network.ui.views"
"status_im.network.ui.styles"
"status_im.network.core"}
:output-to "status-modules/cljs/network-raw.js"}}}
:warning-handlers [status-im.utils.build/warning-handler]}
:desktop
{:source-paths ["components/src" "react-native/src/cljsjs" "react-native/src/desktop" "src" "env/prod" "prod"]
:compiler {:main "env.desktop.main"
:output-dir "target/desktop-prod"
:static-fns true
:fn-invoke-direct true
:optimize-constants true
:optimizations :simple
:closure-defines {"goog.DEBUG" false}
:pseudo-names false
:pretty-print false
:parallel-build false
:elide-asserts true
:language-in :es-2015
:language-out :es-2015
:modules {:cljs-base {:output-to "index.desktop.js"}
:i18n {:entries #{"status_im.goog.i18n"}
:output-to "status-modules/cljs/i18n-raw.js"}
:network {:entries #{"status_im.network.ui.network_details.views"
"status_im.network.ui.edit_network.views"
"status_im.network.ui.edit_network.styles"
"status_im.network.ui.views"
"status_im.network.ui.styles"
"status_im.network.core"}
:output-to "status-modules/cljs/network-raw.js"}}}
:warning-handlers [status-im.utils.build/warning-handler]}}}}})

View File

@ -1 +0,0 @@
(ns cljsjs.create-react-class)

View File

@ -1,5 +0,0 @@
(ns cljsjs.react
(:require [status-im.react-native.js-dependencies :as rn-dependencies]))
(when (exists? js/window)
(set! js/ReactNative rn-dependencies/react-native))

View File

@ -1 +0,0 @@
(ns cljsjs.react.dom)

View File

@ -1 +0,0 @@
(ns cljsjs.react.dom.server)

View File

@ -1,41 +0,0 @@
(ns status-im.react-native.js-dependencies)
(def config (js/require "react-native-config"))
(def fs (js/require "react-native-fs"))
(def keychain (js/require "react-native-keychain"))
(def qr-code (js/require "qrcode"))
(def react-native (js/require "react-native"))
(def webview-bridge (js/require "react-native-webview-bridge"))
(def webview #js {:WebView #js {}})
(def EventEmmiter #js {})
(def fetch-polyfill (js/require "react-native-fetch-polyfill"))
(def fetch (.-default fetch-polyfill))
(def i18n (js/require "i18n-js"))
(def react-native-languages (.-default (js/require "react-native-languages")))
(def desktop-linking (.-DesktopLinking (.-NativeModules react-native)))
(def desktop-menu (js/require "react-native-desktop-menu"))
(def desktop-config (js/require "react-native-desktop-config"))
(def desktop-shortcuts (js/require "react-native-desktop-shortcuts"))
(def touchid #js {})
(def camera #js {:RNCamera #js {:constants #js {:Aspect "Portrait"}}})
(def status-keycard #js {:default #js {}})
(def dialogs #js {})
(def dismiss-keyboard #())
(def image-crop-picker #js {})
(def image-resizer #js {})
(def svg #js {})
(def snoopy #js {})
(def snoopy-filter #js {})
(def snoopy-bars #js {})
(def snoopy-buffer #js {})
(def react-native-screens #js {})
(def background-timer #js {:setTimeout (fn [cb ms] (js/setTimeout cb ms))})
(def react-navigation (js/require "react-navigation"))
(def react-native-navigation-twopane (js/require "react-native-navigation-twopane"))
(def react-native-shake #js {})
(def net-info #js {:default #js {}})
(def react-native-mail #js {:mail (fn [])})
(def async-storage #js {})
(def back-handler #js {:addEventListener (fn [])})
(def safe-area-context #js {})
(def react-native-dark-mode #js {})

View File

@ -1,51 +0,0 @@
(ns status-im.react-native.js-dependencies)
(def config (js/require "react-native-config"))
(def fs (js/require "react-native-fs"))
(def keychain (js/require "react-native-keychain"))
(def qr-code (js/require "qrcode"))
(def react (js/require "react"))
(def react-native (js/require "react-native"))
(def status-keycard (js/require "react-native-status-keycard"))
(def webview (js/require "react-native-webview"))
(def touchid-class (js/require "react-native-touch-id"))
(def touchid (.-default touchid-class))
(def EventEmmiter (js/require "react-native/Libraries/vendor/emitter/EventEmitter"))
(def fetch-polyfill (js/require "react-native-fetch-polyfill"))
(def fetch (.-default fetch-polyfill))
(def i18n (js/require "i18n-js"))
(def react-native-languages (.-default (js/require "react-native-languages")))
(def camera (js/require "react-native-camera"))
(def dialogs (js/require "react-native-dialogs"))
(def image-crop-picker (js/require "react-native-image-crop-picker"))
(def image-resizer (js/require "react-native-image-resizer"))
(def snoopy (js/require "rn-snoopy"))
(def snoopy-filter (js/require "rn-snoopy/stream/filter"))
(def snoopy-bars (js/require "rn-snoopy/stream/bars"))
(def snoopy-buffer (js/require "rn-snoopy/stream/buffer"))
(def background-timer-class (js/require "react-native-background-timer"))
(def background-timer (.-default background-timer-class))
(def svg (js/require "react-native-svg"))
(def react-native-shake (js/require "react-native-shake"))
(def react-native-screens (js/require "react-native-screens"))
(def net-info (js/require "@react-native-community/netinfo"))
(def mail-class (js/require "react-native-mail"))
(def react-native-mail (.-default mail-class))
(def async-storage (.-AsyncStorage react-native))
(def back-handler (.-BackHandler react-native))
(def desktop-linking #js {:addEventListener (fn [])})
(def desktop-menu #js {:addEventListener (fn [])})
(def desktop-config #js {:addEventListener (fn [])})
(def desktop-shortcuts #js {:addEventListener (fn [])})
(def safe-area-context (js/require "react-native-safe-area-context"))
(def react-native-dark-mode (js/require "react-native-dark-mode"))
(def react-navigation-native (js/require "@react-navigation/native"))
(def react-navigation-stack (js/require "@react-navigation/stack"))
(def react-navigation-bottom-tabs (js/require "@react-navigation/bottom-tabs"))
(def react-native-haptic-feedback (js/require "react-native-haptic-feedback"))
(def react-native-reanimated (js/require "react-native-reanimated"))
(def react-native-redash (js/require "react-native-redash"))
(def react-native-gesture-handler (js/require "react-native-gesture-handler"))

View File

@ -1,3 +1,4 @@
#!/usr/bin/env bash
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && git rev-parse --show-toplevel)

95
shadow-cljs.edn Normal file
View File

@ -0,0 +1,95 @@
;; shadow-cljs configuration
{:source-paths ["src" "test/cljs"]
:dependencies [[org.clojure/core.async "0.4.474"]
[reagent "0.10.0"]
[re-frame "0.12.0"]
[binaryage/oops "0.7.0"]
[com.andrewmcveigh/cljs-time "0.5.2"]
[status-im/timbre "4.10.0-2-status"]
[com.taoensso/encore "2.94.0"]
[hickory "0.7.1"]
[cljs-bean "1.3.0"]
[com.cognitect/transit-cljs "0.8.248"]
[mvxcvi/alphabase "1.0.0"]
;; dev dependencies
[refactor-nrepl "2.5.0"]
[cider/cider-nrepl "0.24.0"]
[cider/piggieback "0.4.1"]
;; test dependencies
[day8.re-frame/test "0.1.5"]
[com.taoensso/tufte "2.1.0"]]
;; port and middleware for repl in development
:nrepl {:port 7888
:middleware [cider.piggieback/wrap-cljs-repl
refactor-nrepl.middleware/wrap-refactor]}
;; shadow-cljs web interface
:http {:port 3449
:host "0.0.0.0"}
:builds {:android
{:target :react-native
:output-dir "app"
:init-fn status-im.android.core/init
:dev {:devtools {:autoload true}
;; if you want to use a real device, set your local ip
;; in the SHADOW_HOST env variable to make sure that
;; it will use the right interface
:local-ip #shadow/env "SHADOW_HOST"}
:chunks {:fleets status-im.default-fleet/default-fleets}
:release {:compiler-options {:output-feature-set :es6
;;disable for android build as there
;;is an intermittent warning with deftype
:warnings-as-errors false
:infer-externs :auto
:static-fns true
:fn-invoke-direct true
:optimizations :advanced
:js-options {:js-provider :closure}}}}
:ios
{:target :react-native
:output-dir "app"
:init-fn status-im.ios.core/init
:dev {:devtools {:autoload true}
;; if you want to use a real device, set your local ip
;; in the SHADOW_HOST env variable to make sure that
;; it will use the right interface
:local-ip #shadow/env "SHADOW_HOST"}
:chunks {:fleets status-im.default-fleet/default-fleets}
:release {:compiler-options {:output-feature-set :es6
:warnings-as-errors true
:infer-externs :auto
:static-fns true
:fn-invoke-direct true
:optimizations :advanced
:js-options {:js-provider :closure}}}}
;; the tests are ran with node, react-native dependencies are mocked
;; by using node --require override.js, which uses the node-library
;; produced by the target :mocks below and redefines node require
;; function to use the mocks instead of the rn libraries
:test
{:ns-regexp "status-im.test."
:output-to "target/test/test.js"
:output-dir "target/test"
:optimizations :simple
:target :node-test
:compiler-options {;; needed because we override require and it
;; messes with source-map which reports callstack
;; exceeded exceptions instead of real issues
:source-map false
;; needed because we use deref in tests
:static-fns false
:optimizations :simple}}
;; mock.js-dependencies is mocking the react-native libraries
;; we build it as a node library so that it can be required by
;; override.js
:mocks
{:target :node-library
:exports {:mocks mocks.js-dependencies/mock}
:output-to "target/mocks/mocks.js"
:output-dir "target/mocks"
:compiler-options {:optimizations :simple
:source-map false}}}}

View File

@ -1,4 +1,5 @@
(ns status-im.react-native.js-dependencies)
(ns mocks.js-dependencies
(:require [status-im.default-fleet :refer (default-fleets)]))
(def action-button #js {:default #js {:Item #js {}}})
(def config #js {:default #js {}})
@ -8,20 +9,51 @@
(def emoji-picker #js {:default #js {}})
(def fs #js {})
(def i18n #js {:locale "en"})
(def react-native-languages #js {:language "en", :addEventListener (fn []), :removeEventListener (fn [])})
(def image-crop-picker #js {})
(def image-resizer #js {})
(def qr-code #js {})
(def svg #js {})
(def react-native
#js {:NativeModules #js {}
:Animated #js {:View #js {}
:FlatList #js {}
:Text #js {}}
:Easing #js {:bezier (fn [])}
:DeviceEventEmitter #js {:addListener (fn [])}
:Dimensions #js {:get (fn [])}})
(clj->js {:NativeModules {:RNGestureHandlerModule {:Direction (fn [])}
:ReanimatedModule {:configureProps (fn [])}}
:View {}
:FlatList {}
:Text {}
:ProgressBarAndroid {}
:StatusBar {}
:ScrollView {}
:KeyboardAvoidingView {}
:TextInput {}
:Image {}
:Picker {:Item {}}
:Switch {}
:Modal {}
:Keyboard {:dismiss (fn [])}
:Linking {}
:TouchableWithoutFeedback {}
:TouchableHighlight {}
:TouchableOpacity {}
:ActivityIndicator {}
:StyleSheet {:create (fn [])}
:Animated {:createAnimatedComponent identity
:Value (fn [])
:ValueXY (fn [])
:View {}
:FlatList {}
:Text {}}
:Easing {:bezier (fn [])
:poly (fn [])
:out (fn [])
:in (fn [])
:inOut (fn [])}
:DeviceEventEmitter {:addListener (fn [])}
:Dimensions {:get (fn [])}
:Platform {:select (fn [])}
:I18nManager {:isRTL ""}
:NativeEventEmitter (fn [])
:requireNativeComponent (fn [] {:propTypes ""})}))
(set! js/ReactNative react-native)
@ -38,10 +70,10 @@
(def snoopy-buffer #js {:default #js {}})
(def fetch #js {})
(def background-timer #js {:setTimeout js/setTimeout
(def background-timer (clj->js {:default {:setTimeout js/setTimeout
:setInterval js/setInterval
:clearTimeout js/clearTimeout
:clearInterval js/clearInterval})
:clearInterval js/clearInterval}}))
(def keychain #js {:setGenericPassword (constantly (.resolve js/Promise true))
"ACCESSIBLE" {}
@ -54,7 +86,9 @@
(def react-native-shake #js {})
(def net-info #js {})
(def touchid #js {})
(def safe-area-context #js {})
(def safe-area-context (clj->js {:SafeAreaProvider {:_reactNativeIphoneXHelper {:getStatusBarHeight (fn [])}}
:SafeAreaConsumer {}
:SafeAreaView {}}))
(def react-native-dark-mode #js {"eventEmitter" {} "initialMode" {}})
(def back-handler #js {:addEventListener identity
@ -104,7 +138,7 @@
:View #js {}
:ScrollView #js {}
:Text #js {}
:extrapolate #js {:CLAMP nil}
:Extrapolate #js {:CLAMP nil}
:Code #js {}}
:Easing #js {:bezier nil
:linear nil}
@ -124,3 +158,35 @@
:createNativeWrapper identity})
(def react-native-redash #js {:clamp nil})
(def react-native-languages
(clj->js {:default {:language "en",
:addEventListener (fn []),
:removeEventListener (fn [])}}))
(defn mock [module]
(case module
"react-native-languages" react-native-languages
"react-native-background-timer" background-timer
"react-native-image-crop-picker" image-crop-picker
"react-native-gesture-handler" react-native-gesture-handler
"react-native-safe-area-context" safe-area-context
"react-native-config" config
"react-native-dark-mode" react-native-dark-mode
"react-native-iphone-x-helper" (clj->js {:getStatusBarHeight (fn [])
:getBottomSpace (fn [])})
"react-native-screens" (clj->js {})
"react-native-reanimated" react-native-reanimated
"react-native-redash" react-native-redash
"react-native-fetch-polyfill" fetch
"react-native-status-keycard" status-keycard
"react-native-keychain" keychain
"react-native-touch-id" touchid
"@react-native-community/netinfo" net-info
"react-native-dialogs" dialogs
"react-native" react-native
"react-native-fs" fs
"react-native-mail" react-native-mail
"react-native-image-resizer" image-resizer
"./fleets.js" default-fleets
nil))

View File

@ -2,18 +2,13 @@
(:refer-clojure :exclude [set])
(:require [reagent.core :as reagent]
[oops.core :refer [oget ocall]]
[status-im.react-native.js-dependencies :as js-deps]))
["react-native-reanimated" :default animated :refer (clockRunning Easing)]
["react-native-redash" :as redash]))
(def animated (oget js-deps/react-native-reanimated "default"))
(def createAnimatedComponent (oget animated "createAnimatedComponent"))
(def view (reagent/adapt-react-class (oget animated "View")))
(def text (reagent/adapt-react-class (oget animated "Text")))
(def scroll-view (reagent/adapt-react-class (oget animated "ScrollView")))
(def code (reagent/adapt-react-class (oget animated "Code")))
(def clock-running (oget js-deps/react-native-reanimated "clockRunning"))
(def Easing (oget js-deps/react-native-reanimated "Easing"))
(def view (reagent/adapt-react-class (.-View animated)))
(def text (reagent/adapt-react-class (.-Text animated)))
(def scroll-view (reagent/adapt-react-class (.-ScrollView animated)))
(def code (reagent/adapt-react-class (.-Code animated)))
(def eq (oget animated "eq"))
(def neq (oget animated "neq"))
@ -33,8 +28,8 @@
(def set (oget animated "set"))
(def start-clock (oget animated "startClock"))
(def stop-clock (oget animated "stopClock"))
(def bezier (oget Easing "bezier"))
(def linear (oget Easing "linear"))
(def bezier (.-bezier ^js Easing))
(def linear (.-linear ^js Easing))
(defn set-value [anim val]
(ocall anim "setValue" val))
@ -103,8 +98,6 @@
;; utilities
(def redash js-deps/react-native-redash)
(def clamp (oget redash "clamp"))
(defn with-spring [config]
@ -117,4 +110,4 @@
(ocall redash "timing" (clj->js config)))
(defn on-scroll [opts]
(ocall redash "onScroll" (clj->js opts)))
(ocall redash "onScrollEvent" (clj->js opts)))

View File

@ -1,11 +1,11 @@
(ns quo.components.safe-area
(:require [status-im.react-native.js-dependencies :refer [safe-area-context]]
[reagent.core :as reagent]
[oops.core :refer [oget]]))
(:require ["react-native-safe-area-context" :as safe-area-context
:refer (SafeAreaView SafeAreaProvider SafeAreaConsumer)]
[reagent.core :as reagent]))
(def provider (reagent/adapt-react-class (oget safe-area-context "SafeAreaProvider")))
(def ^:private consumer-raw (reagent/adapt-react-class (oget safe-area-context "SafeAreaConsumer")))
(def view (reagent/adapt-react-class (oget safe-area-context "SafeAreaView")))
(def provider (reagent/adapt-react-class SafeAreaProvider))
(def ^:private consumer-raw (reagent/adapt-react-class SafeAreaConsumer))
(def view (reagent/adapt-react-class SafeAreaView))
(defn consumer [component]
[consumer-raw

View File

@ -1,28 +1,25 @@
(ns quo.gesture-handler
(:require [oops.core :refer [oget]]
[quo.animated :as animated]
["react-native-reanimated" :default animated]
[reagent.core :as reagent]
[status-im.react-native.js-dependencies :as js-deps]))
["react-native-gesture-handler"
:refer (TapGestureHandler PanGestureHandler LongPressGestureHandler
PureNativeButton TouchableWithoutFeedback createNativeWrapper State)]))
(def tap-gesture-handler
(reagent/adapt-react-class
(oget js-deps/react-native-gesture-handler "TapGestureHandler")))
(reagent/adapt-react-class TapGestureHandler))
(def pan-gesture-handler
(reagent/adapt-react-class
(oget js-deps/react-native-gesture-handler "PanGestureHandler")))
(reagent/adapt-react-class PanGestureHandler))
(def long-press-gesture-handler
(reagent/adapt-react-class
(oget js-deps/react-native-gesture-handler "LongPressGestureHandler")))
(reagent/adapt-react-class LongPressGestureHandler))
(def pure-native-button (oget js-deps/react-native-gesture-handler "PureNativeButton"))
(def pure-native-button PureNativeButton)
(def touchable-without-feedback-class
(oget js-deps/react-native-gesture-handler "TouchableWithoutFeedback"))
(def touchable-without-feedback-class TouchableWithoutFeedback)
(def createNativeWrapper
(oget js-deps/react-native-gesture-handler "createNativeWrapper"))
(def createNativeWrapper createNativeWrapper)
(def touchable-without-feedback
(reagent/adapt-react-class touchable-without-feedback-class))
@ -30,9 +27,9 @@
(def animated-raw-button
(reagent/adapt-react-class
(createNativeWrapper
(animated/createAnimatedComponent touchable-without-feedback-class))))
(.createAnimatedComponent animated touchable-without-feedback-class))))
(def state (oget js-deps/react-native-gesture-handler "State"))
(def state State)
(def states {:began (oget state "BEGAN")
:active (oget state "ACTIVE")

View File

@ -4,7 +4,6 @@
[quo.previews.text :as text]
[quo.react-native :as rn]
[reagent.core :as reagent]
[status-im.react-native.js-dependencies :refer [react-native]]
[status-im.ui.screens.routing.core :as navigation]))
(def screens [{:name :texts
@ -44,10 +43,12 @@
:component main-screen}]
screens)]]))
;; TODO(Ferossgp): Add separate build when shadow-cljs will be integrated
;; NOTE(Ferossgp): Separate app can be used to preview all available
;; and possible state for componetns, and for UI testing based on screenshots
;; and possible state for components, and for UI testing based on screenshots
(defn init []
(ocall react-native ["AppRegistry" "registerComponent"]
"StatusIm"
#(reagent/reactify-component preview-screens)))
(.registerComponent ^js rn/app-registry "StatusIm" #(reagent/reactify-component preview-screens)))

View File

@ -1,7 +1,7 @@
(ns quo.react
(:require [oops.core :refer [oget]]
[reagent.core :as reagent]
[status-im.react-native.js-dependencies :refer [react]]))
["react" :as react]))
;; NOTE(Ferossgp): Available in new versions of reagent as `:<>`
(def fragment (reagent/adapt-react-class (oget react "Fragment")))

View File

@ -1,15 +1,16 @@
(ns quo.react-native
(:require [oops.core :refer [oget]]
[reagent.core :as reagent]
[status-im.react-native.js-dependencies :refer [react-native]]))
(:require [reagent.core :as reagent]
["react-native" :as rn]))
(def platform (oget react-native "Platform"))
(def app-registry (.-AppRegistry rn))
(def view (reagent/adapt-react-class (oget react-native "View")))
(def platform (.-Platform ^js rn))
(def text (reagent/adapt-react-class (oget react-native "Text")))
(def view (reagent/adapt-react-class (.-View ^js rn)))
(def scroll-view (reagent/adapt-react-class (oget react-native "ScrollView")))
(def text (reagent/adapt-react-class (.-Text ^js rn)))
(def touchable-opacity (reagent/adapt-react-class (oget react-native "TouchableOpacity")))
(def touchable-highlight (reagent/adapt-react-class (oget react-native "TouchableHighlight")))
(def scroll-view (reagent/adapt-react-class (.-ScrollView ^js rn)))
(def touchable-opacity (reagent/adapt-react-class (.-TouchableOpacity ^js rn)))
(def touchable-highlight (reagent/adapt-react-class (.-TouchableHighlight ^js rn)))

11
src/reagent/dom.cljs Normal file
View File

@ -0,0 +1,11 @@
(ns reagent.dom)
;; Shimmed namespace to make reagent 0.6.0 work with react native packager
(defn render
([_ _])
([_ _ _]))
(defn unmount-component-at-node [_])
(defn dom-node [_])
(defn force-update-all [])

View File

@ -1,59 +1,7 @@
(ns status-im.android.core
(:require [reagent.core :as reagent]
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
status-im.utils.db
status-im.ui.screens.db
status-im.ui.screens.events
status-im.subs
[status-im.ui.screens.views :as views]
[status-im.ui.components.react :as react]
[status-im.native-module.core :as status]
[status-im.core :as core]
[oops.core :refer [ocall]]
[status-im.react-native.js-dependencies :as rn-dependencies]
[status-im.utils.snoopy :as snoopy]
[status-im.i18n :as i18n]
[status-im.ui.screens.routing.core :as routing]))
(defn app-state-change-handler [state]
(dispatch [:app-state-change state]))
(defn on-languages-change [event]
(i18n/set-language (.-language event)))
(defn on-shake []
(dispatch [:shake-event]))
(defn app-root [props]
(reagent/create-class
{:component-did-mount
(fn [this]
(.addListener react/keyboard
"keyboardDidShow"
(fn [e]
(let [h (.. e -endCoordinates -height)]
(dispatch-sync [:set :keyboard-height h])
(dispatch-sync [:set :keyboard-max-height h]))))
(.addListener react/keyboard
"keyboardDidHide"
(fn [_]
(dispatch-sync [:set :keyboard-height 0])))
(.hide react/splash-screen)
(.addEventListener react/app-state "change" app-state-change-handler)
(.addEventListener rn-dependencies/react-native-languages "change" on-languages-change)
(.addEventListener rn-dependencies/react-native-shake
"ShakeEvent"
on-shake)
(dispatch [:set-initial-props (reagent/props this)]))
:component-will-unmount
(fn []
(.removeEventListener react/app-state "change" app-state-change-handler)
(.removeEventListener rn-dependencies/react-native-languages "change" on-languages-change))
:display-name "root"
:reagent-render views/main}))
(:require [status-im.native-module.core :as status]
[status-im.core :as core]))
(defn init []
(status/set-soft-input-mode status/adjust-resize)
(ocall rn-dependencies/react-native-screens "enableScreens")
(core/init app-root)
(snoopy/subscribe!))
(core/init core/root))

View File

@ -8,7 +8,6 @@
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.ethereum.resolver :as resolver]
[status-im.i18n :as i18n]
[status-im.js-dependencies :as js-dependencies]
[status-im.native-module.core :as status]
[status-im.ui.components.list-selection :as list-selection]
[status-im.ui.screens.navigation :as navigation]
@ -24,7 +23,10 @@
[status-im.signing.core :as signing]
[status-im.multiaccounts.update.core :as multiaccounts.update]
[status-im.ui.components.bottom-sheet.core :as bottom-sheet]
[status-im.browser.webview-ref :as webview-ref]))
[status-im.browser.webview-ref :as webview-ref]
[alphabase.base58 :as alphabase.base58]
["eth-phishing-detect" :as eth-phishing-detect]
["hi-base32" :as hi-base32]))
(fx/defn update-browser-option
[{:keys [db]} option-key option-value]
@ -69,7 +71,7 @@
(defn check-if-phishing-url [{:keys [history history-index] :as browser}]
(let [history-host (http/url-host (try (nth history history-index) (catch js/Error _)))]
(cond-> browser history-host (assoc :unsafe? (js-dependencies/phishing-detect history-host)))))
(cond-> browser history-host (assoc :unsafe? (eth-phishing-detect history-host)))))
(defn- content->hash [hex]
(when (and hex (not= hex "0x"))
@ -105,13 +107,13 @@
(fx/defn resolve-ens-contenthash
[{:keys [db]}]
(let [current-url (get-current-url (get-current-browser db))
host (http/url-host current-url)]
(let [chain (ethereum/chain-keyword db)]
host (http/url-host current-url)
chain (ethereum/chain-keyword db)]
{:db (update db :browser/options assoc :resolving? true)
:browser/resolve-ens-contenthash {:registry (get ens/ens-registries
chain)
:ens-name host
:cb resolve-ens-contenthash-callback}})))
:cb resolve-ens-contenthash-callback}}))
(fx/defn update-browser
[{:keys [db now]}
@ -163,7 +165,7 @@
(defmethod storage-gateway :ipfs
[{:keys [hash]}]
(let [base32hash (-> (.encode js-dependencies/hi-base32 (alphabase.base58/decode hash))
(let [base32hash (-> (.encode ^js hi-base32 (alphabase.base58/decode hash))
(string/replace #"=" "")
(string/lower-case))]
(str base32hash ".infura.status.im")))
@ -176,7 +178,7 @@
[{:keys [db] :as cofx} m]
(let [current-url (get-current-url (get-current-browser db))
host (http/url-host current-url)
path (subs current-url (+ (.indexOf current-url host) (count host)))
path (subs current-url (+ (.indexOf ^js current-url host) (count host)))
gateway (storage-gateway m)]
(fx/merge cofx
{:db (-> (update db :browser/options
@ -214,7 +216,8 @@
options (get-in cofx [:db :browser/options])
current-url (:url options)]
(when (and (not= "about:blank" url) (not= current-url url) (not= (str current-url "/") url))
(let [resolved-ens (first (filter #(not= (.indexOf url (second %)) -1) (:resolved-ens options)))
(let [resolved-ens (first (filter #(not= (.indexOf ^js url (second %)) -1) (:resolved-ens options)))
resolved-url (if resolved-ens (string/replace url (second resolved-ens) (first resolved-ens)) url)]
(fx/merge cofx
(update-browser-history browser resolved-url)
@ -285,7 +288,7 @@
(fx/defn web3-error-callback
{:events [:browser.dapp/transaction-on-error]}
[cofx message-id message]
[_ message-id message]
{:browser/send-to-bridge
{:type constants/web3-send-async-callback
:messageId message-id
@ -293,7 +296,7 @@
(fx/defn dapp-complete-transaction
{:events [:browser.dapp/transaction-on-result]}
[cofx message-id id result]
[_ message-id id result]
;;TODO check and test id
{:browser/send-to-bridge
{:type constants/web3-send-async-callback
@ -394,7 +397,8 @@
(= type constants/api-request)
(browser.permissions/process-permission cofx dapp-name permission messageId params))))
(defn filter-letters-numbers-and-replace-dot-on-dash [value]
(defn filter-letters-numbers-and-replace-dot-on-dash
[^js value]
(let [cc (.charCodeAt value 0)]
(cond (or (and (> cc 96) (< cc 123))
(and (> cc 64) (< cc 91))
@ -421,7 +425,7 @@
(re-frame/reg-fx
:browser/send-to-bridge
(fn [message]
(let [webview @webview-ref/webview-ref
(let [^js webview @webview-ref/webview-ref
msg (str "ReactNativeWebView.onMessage('"
(types/clj->json message)
"');")]

View File

@ -296,7 +296,7 @@
(defn set-dock-badge-label [label]
"Sets dock badge label (OSX only for now).
Label must be a string. Pass nil or empty string to clear the label."
(.setDockBadgeLabel react/desktop-notification label))
(.setDockBadgeLabel ^js react/desktop-notification label))
(re-frame/reg-fx
:set-dock-badge-label

View File

@ -7,10 +7,10 @@
[status-im.chat.models.message-content :as message-content]
[status-im.chat.models.message :as chat.message]
[status-im.constants :as constants]
[status-im.js-dependencies :as dependencies]
[status-im.utils.datetime :as datetime]
[status-im.utils.fx :as fx]
[taoensso.timbre :as log]))
[taoensso.timbre :as log]
["emojilib" :as emojis]))
(defn text->emoji
"Replaces emojis in a specified `text`"
@ -19,8 +19,8 @@
(string/replace text
#":([a-z_\-+0-9]*):"
(fn [[original emoji-id]]
(if-let [emoji-map (object/get (object/get dependencies/emojis "lib") emoji-id)]
(object/get emoji-map "char")
(if-let [emoji-map (object/get (.-lib emojis) emoji-id)]
(.-char ^js emoji-map)
original)))))
(fx/defn set-chat-input-text
@ -133,12 +133,11 @@
;;TODO: should be implemented on status-go side
;;see https://github.com/status-im/team-core/blob/6c3d67d8e8bd8500abe52dab06a59e976ec942d2/rfc-001.md#status-gostatus-react-interface
;; effects
(re-frame/reg-fx
::focus-rn-component
(fn [ref]
(fn [^js ref]
(try
(.focus ref)
(catch :default e

View File

@ -12,7 +12,8 @@
[taoensso.timbre :as log]
[status-im.chat.models.message-seen :as message-seen]))
(defn cursor->clock-value [cursor]
(defn cursor->clock-value
[^js cursor]
(js/parseInt (.substring cursor 51 64)))
(defn clock-value->cursor [clock-value]
@ -37,9 +38,9 @@
(fx/defn handle-chat-visibility-changed
{:events [:chat.ui/message-visibility-changed]}
[{:keys [db] :as cofx} event]
(let [viewable-items (.-viewableItems event)
last-element (aget viewable-items (dec (.-length viewable-items)))]
[{:keys [db] :as cofx} ^js event]
(let [^js viewable-items (.-viewableItems event)
^js last-element (aget viewable-items (dec (.-length viewable-items)))]
(when last-element
(let [last-element-clock-value (:clock-value (.-item last-element))
chat-id (:chat-id (.-item last-element))]

View File

@ -13,19 +13,21 @@
[:tag constants/regx-tag]
[:mention constants/regx-mention]])
(def blank " ")
(defn- blank-string [size]
(.repeat " " size))
(.repeat ^js blank size))
(defn- clear-ranges [ranges input]
(reduce (fn [acc [start end]]
(.concat (subs acc 0 start) (blank-string (- end start)) (subs acc end)))
(.concat ^js (subs acc 0 start) (blank-string (- end start)) (subs acc end)))
input ranges))
(defn- query-regex [regex content]
(defn- query-regex [^js regex content]
(loop [input content
matches []
offset 0]
(if-let [match (.exec regex input)]
(if-let [^js match (.exec regex input)]
(let [match-value (first match)
match-size (count match-value)
relative-index (.-index match)

View File

@ -1,6 +1,6 @@
(ns status-im.chat.models.message-list
(:require
[status-im.js-dependencies :as dependencies]
["functional-red-black-tree" :as rb-tree]
[taoensso.timbre :as log]
[status-im.constants :as constants]
[status-im.utils.fx :as fx]
@ -117,7 +117,7 @@
(defn get-prev-element
"Get previous item in the iterator, and wind it back to the initial state"
[iter]
[^js iter]
(.prev iter)
(let [e (.-value iter)]
(.next iter)
@ -125,7 +125,7 @@
(defn get-next-element
"Get next item in the iterator, and wind it back to the initial state"
[iter]
[^js iter]
(.next iter)
(let [e (.-value iter)]
(.prev iter)
@ -133,33 +133,33 @@
(defn update-message
"Update the message and siblings with positional info"
[tree message]
(let [iter (.find tree message)
previous-message (when (.-hasPrev iter)
[^js tree message]
(let [^js iter (.find tree message)
^js previous-message (when (.-hasPrev iter)
(get-prev-element iter))
next-message (when (.-hasNext iter)
^js next-message (when (.-hasNext iter)
(get-next-element iter))
message-with-pos-data (add-group-info message previous-message next-message)]
^js message-with-pos-data (add-group-info message previous-message next-message)]
(cond->
(.update iter message-with-pos-data)
next-message
(-> (.find next-message)
(-> ^js (.find next-message)
(.update (update-next-message message-with-pos-data next-message)))
(and previous-message
(not= :datemark (:type previous-message)))
(-> (.find previous-message)
(-> ^js (.find previous-message)
(.update (update-previous-message message-with-pos-data previous-message))))))
(defn remove-message
"Remove a message in the list"
[tree prepared-message]
[^js tree prepared-message]
(let [iter (.find tree prepared-message)]
(if (not iter)
tree
(let [new-tree (.remove iter)
next-message (when (.-hasNext iter)
(let [^js new-tree (.remove iter)
^js next-message (when (.-hasNext iter)
(get-next-element iter))]
(if (not next-message)
new-tree
@ -170,12 +170,12 @@
its positional metadata, and update the left & right messages if necessary,
this operation is O(logN) for insertion, and O(logN) for the updates, as
we need to re-find (there's probably a better way)"
[old-message-list prepared-message]
(let [tree (.insert old-message-list prepared-message prepared-message)]
[^js old-message-list prepared-message]
(let [^js tree (.insert old-message-list prepared-message prepared-message)]
(update-message tree prepared-message)))
(defn add [message-list message]
(insert-message (or message-list (dependencies/rb-tree compare-fn))
(insert-message (or message-list (rb-tree compare-fn))
(prepare-message message)))
(defn add-many [message-list messages]
@ -183,7 +183,7 @@
message-list
messages))
(defn ->seq [message-list]
(defn ->seq [^js message-list]
(if message-list
(array-seq (.-values message-list))
[]))

View File

@ -2,21 +2,81 @@
(:require [re-frame.core :as re-frame]
[status-im.utils.error-handler :as error-handler]
[status-im.utils.platform :as platform]
[status-im.ui.screens.views :as views]
[status-im.ui.components.react :as react]
[reagent.core :as reagent]
[status-im.react-native.js-dependencies :as js-dependencies]
status-im.utils.db
status-im.ui.screens.db
status-im.ui.screens.events
status-im.subs
["react-native-languages" :default react-native-languages]
["react-native-shake" :as react-native-shake]
["react-native-screens" :refer (enableScreens)]
[status-im.utils.logging.core :as utils.logs]
cljs.core.specs.alpha))
["react-native" :as rn]
[status-im.utils.snoopy :as snoopy]
[status-im.i18n :as i18n]
[re-frame.interop :as interop]
[reagent.impl.batching :as batching]))
(set! interop/next-tick js/setTimeout)
(set! batching/fake-raf #(js/setTimeout % 0))
(if js/goog.DEBUG
(.ignoreWarnings (.-YellowBox js-dependencies/react-native)
(.ignoreWarnings (.-YellowBox ^js rn)
#js ["re-frame: overwriting"
"Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details."
"Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details."])
(aset js/console "disableYellowBox" true))
(def app-registry (.-AppRegistry rn))
(def splash-screen (-> rn .-NativeModules .-SplashScreen))
(defn on-languages-change [^js event]
(i18n/set-language (.-language event)))
(defn on-shake []
(re-frame/dispatch [:shake-event]))
(defn app-state-change-handler [state]
(re-frame/dispatch [:app-state-change state]))
(defn root [props]
(reagent/create-class
{:component-did-mount
(fn [this]
(.addListener ^js react/keyboard
(if platform/ios?
"keyboardWillShow"
"keyboardDidShow")
(fn [^js e]
(let [h (.. e -endCoordinates -height)]
(re-frame/dispatch-sync [:set :keyboard-height h])
(re-frame/dispatch-sync [:set :keyboard-max-height h]))))
(.addListener ^js react/keyboard
(if platform/ios?
"keyboardWillHide"
"keyboardWDidHide")
(fn [_]
(re-frame/dispatch-sync [:set :keyboard-height 0])))
(.addEventListener ^js react/app-state "change" app-state-change-handler)
(.addEventListener react-native-languages "change" on-languages-change)
(.addEventListener react-native-shake
"ShakeEvent"
on-shake)
(re-frame/dispatch [:set-initial-props (reagent/props this)])
(.hide ^js splash-screen))
:component-will-unmount
(fn []
(.removeEventListener ^js react/app-state "change" app-state-change-handler)
(.removeEventListener react-native-languages "change" on-languages-change))
:display-name "root"
:reagent-render views/main}))
(defn init [app-root]
(utils.logs/init-logs)
(error-handler/register-exception-handler!)
(enableScreens)
(re-frame/dispatch-sync [:init/app-started])
(.registerComponent react/app-registry "StatusIm" #(reagent/reactify-component app-root)))
(.registerComponent ^js app-registry "StatusIm" #(reagent/reactify-component app-root))
(snoopy/subscribe!))

View File

@ -0,0 +1,5 @@
(ns status-im.default-fleet
(:require-macros [status-im.utils.slurp :refer [slurp]]))
(def default-fleets
(slurp "resources/config/fleets.json"))

View File

@ -21,11 +21,11 @@
(reagent/create-class
{:component-did-mount
(fn [this]
(.addEventListener react/app-state "change" app-state-change-handler)
(.addEventListener ^js react/app-state "change" app-state-change-handler)
(re-frame/dispatch [:set-initial-props (reagent/props this)]))
:component-will-unmount
(fn []
(.removeEventListener react/app-state "change" app-state-change-handler))
(.removeEventListener ^js react/app-state "change" app-state-change-handler))
:display-name "root"
:reagent-render views/main})
(reagent/create-class
@ -37,4 +37,4 @@
desktop-views/main)})))
(defn init []
(core/init app-root))
(core/init))

View File

@ -1,10 +1,11 @@
(ns status-im.desktop.deep-links
(:require [re-frame.core :as re-frame]
[status-im.react-native.js-dependencies :as js-dependencies]
[taoensso.timbre :as log]))
[taoensso.timbre :as log]
["react-native" :refer (NativeEventEmitter)]))
(defn add-event-listener []
(let [event-emitter (new (.-NativeEventEmitter js-dependencies/react-native)
(let [^js event-emitter (new NativeEventEmitter
js-dependencies/desktop-linking)]
(.addListener event-emitter
"urlOpened"

View File

@ -2,12 +2,10 @@
(:require [cljs.spec.alpha :as spec]
[clojure.string :as string]
[status-im.ethereum.core :as ethereum]
[status-im.js-dependencies :as dependencies]))
["web3-utils" :as utils]))
;; Utility functions for encoding
(def utils dependencies/web3-utils)
(defn right-pad [x]
(let [len (count x)
to-pad (- 64 (mod len 64))]

View File

@ -1,10 +1,8 @@
(ns status-im.ethereum.core
(:require [clojure.string :as string]
[status-im.ethereum.tokens :as tokens]
[status-im.js-dependencies :as dependencies]
[status-im.utils.money :as money]))
(def utils dependencies/web3-utils)
[status-im.utils.money :as money]
["web3-utils" :as utils]))
(defn sha3 [s]
(when s
@ -122,7 +120,7 @@
(if (tokens/ethereum? symbol)
default-transaction-gas
;; TODO(jeluard) Rely on estimateGas call
(.times default-transaction-gas 5)))
(.times ^js default-transaction-gas 5)))
(defn address= [address1 address2]
(and address1 address2

View File

@ -5,9 +5,7 @@
e.g. 0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed"
(:require [clojure.string :as string]
[status-im.js-dependencies :as dependencies]))
(def utils dependencies/web3-utils)
["web3-utils" :as utils]))
(def hex-prefix "0x")

View File

@ -78,7 +78,7 @@
"Takes a map as returned by `parse-uri` and returns value as BigNumber"
(when (string? s)
(let [eth? (string/ends-with? s "ETH")
n (money/bignumber (string/replace s "ETH" ""))]
^js n (money/bignumber (string/replace s "ETH" ""))]
(if eth? (.times n 1e18) n))))
(defn extract-request-details [{:keys [value address function-name function-arguments] :as details} all-tokens]

View File

@ -1,7 +1,5 @@
(ns status-im.ethereum.encode
(:require [status-im.js-dependencies :as dependencies]))
(def utils dependencies/web3-utils)
(:require ["web3-utils" :as utils]))
(defn uint
[x]

View File

@ -28,7 +28,7 @@
(let [[label remainder] (-> s
string/lower-case
(string/split #"\." 2))]
(ethereum/sha3 (+ (namehash remainder)
(ethereum/sha3 (str (namehash remainder)
(subs (ethereum/sha3 label) 2)))))))
;; Registry contract

View File

@ -4,7 +4,7 @@
(defn token-icon-path
[network symbol]
(let [s (str "./resources/images/tokens/" (name network) "/" (name symbol) ".png")
(let [s (str "../resources/images/tokens/" (name network) "/" (name symbol) ".png")
image (gensym)]
(if (.exists (io/file s))
`(let [~image (atom nil)]
@ -16,7 +16,7 @@
(or
@~image
(reset! ~image
(js/require "./resources/images/tokens/default-token.png"))))))))
(js/require "../resources/images/tokens/default-token.png"))))))))
(defn- token->icon [network {:keys [icon symbol]}]
;; Tokens can define their own icons.
@ -33,7 +33,7 @@
tokens))
(defn network->icon [network]
(let [s (str "./resources/images/tokens/" (name network) "/0-native.png")
(let [s (str "../resources/images/tokens/" (name network) "/0-native.png")
image (gensym)]
(if (.exists (io/file s))
`(let [~image (atom nil)]
@ -45,7 +45,7 @@
(or
@~image
(reset! ~image
(js/require "./resources/images/tokens/default-native.png"))))))))
(js/require "../resources/images/tokens/default-native.png"))))))))
(defmacro resolve-native-currency-icons
"In react-native arguments to require must be static strings.

View File

@ -12,7 +12,7 @@
{:name "Native"
:symbol :ETH
:decimals 18
:icon {:source (js/require "./resources/images/tokens/default-native.png")}})))
:icon {:source (js/require "../resources/images/tokens/default-native.png")}})))
(def all-native-currencies
(ethereum.macros/resolve-native-currency-icons

View File

@ -96,7 +96,7 @@
(def CUD-url "https://chaos-unicorn-day.org")
(defn open-chaos-unicorn-day-link []
(.openURL react/linking CUD-url))
(.openURL ^js react/linking CUD-url))
(handlers/register-handler-fx
:multiaccounts.ui/chaos-mode-switched

View File

@ -240,118 +240,118 @@
goog.i18n.TimeZone))
(def locales
{"af" goog/i18n.DateTimeSymbols_af
"am" goog/i18n.DateTimeSymbols_am
"ar" goog/i18n.DateTimeSymbols_ar
"ar_DZ" goog/i18n.DateTimeSymbols_ar_DZ
"ar_EG" goog/i18n.DateTimeSymbols_ar_EG
"az" goog/i18n.DateTimeSymbols_az
"be" goog/i18n.DateTimeSymbols_be
"bg" goog/i18n.DateTimeSymbols_bg
"bn" goog/i18n.DateTimeSymbols_bn
"br" goog/i18n.DateTimeSymbols_br
"bs" goog/i18n.DateTimeSymbols_bs
"ca" goog/i18n.DateTimeSymbols_ca
"chr" goog/i18n.DateTimeSymbols_chr
"cs" goog/i18n.DateTimeSymbols_cs
"cy" goog/i18n.DateTimeSymbols_cy
"da" goog/i18n.DateTimeSymbols_da
"de" goog/i18n.DateTimeSymbols_de
"de_AT" goog/i18n.DateTimeSymbols_de_AT
"de_CH" goog/i18n.DateTimeSymbols_de_CH
"el" goog/i18n.DateTimeSymbols_el
"en" goog/i18n.DateTimeSymbols_en
"en_AU" goog/i18n.DateTimeSymbols_en_AU
"en_CA" goog/i18n.DateTimeSymbols_en_CA
"en_GB" goog/i18n.DateTimeSymbols_en_GB
"en_IE" goog/i18n.DateTimeSymbols_en_IE
"en_IN" goog/i18n.DateTimeSymbols_en_IN
"en_ISO" goog/i18n.DateTimeSymbols_en_ISO
"en_SG" goog/i18n.DateTimeSymbols_en_SG
"en_US" goog/i18n.DateTimeSymbols_en_US
"en_ZA" goog/i18n.DateTimeSymbols_en_ZA
"es" goog/i18n.DateTimeSymbols_es
"es_419" goog/i18n.DateTimeSymbols_es_419
"es_ES" goog/i18n.DateTimeSymbols_es_ES
"es_MX" goog/i18n.DateTimeSymbols_es_MX
"es_US" goog/i18n.DateTimeSymbols_es_US
"et" goog/i18n.DateTimeSymbols_et
"eu" goog/i18n.DateTimeSymbols_eu
"fa" goog/i18n.DateTimeSymbols_fa
"fi" goog/i18n.DateTimeSymbols_fi
"fil" goog/i18n.DateTimeSymbols_fil
"fr" goog/i18n.DateTimeSymbols_fr
"fr_CA" goog/i18n.DateTimeSymbols_fr_CA
"ga" goog/i18n.DateTimeSymbols_ga
"gl" goog/i18n.DateTimeSymbols_gl
"gsw" goog/i18n.DateTimeSymbols_gsw
"gu" goog/i18n.DateTimeSymbols_gu
"haw" goog/i18n.DateTimeSymbols_haw
"he" goog/i18n.DateTimeSymbols_he
"hi" goog/i18n.DateTimeSymbols_hi
"hr" goog/i18n.DateTimeSymbols_hr
"hu" goog/i18n.DateTimeSymbols_hu
"hy" goog/i18n.DateTimeSymbols_hy
"id" goog/i18n.DateTimeSymbols_id
"in" goog/i18n.DateTimeSymbols_in
"is" goog/i18n.DateTimeSymbols_is
"it" goog/i18n.DateTimeSymbols_it
"iw" goog/i18n.DateTimeSymbols_iw
"ja" goog/i18n.DateTimeSymbols_ja
"ka" goog/i18n.DateTimeSymbols_ka
"kk" goog/i18n.DateTimeSymbols_kk
"km" goog/i18n.DateTimeSymbols_km
"kn" goog/i18n.DateTimeSymbols_kn
"ko" goog/i18n.DateTimeSymbols_ko
"ky" goog/i18n.DateTimeSymbols_ky
"ln" goog/i18n.DateTimeSymbols_ln
"lo" goog/i18n.DateTimeSymbols_lo
"lt" goog/i18n.DateTimeSymbols_lt
"lv" goog/i18n.DateTimeSymbols_lv
"mk" goog/i18n.DateTimeSymbols_mk
"ml" goog/i18n.DateTimeSymbols_ml
"mn" goog/i18n.DateTimeSymbols_mn
"mo" goog/i18n.DateTimeSymbols_mo
"mr" goog/i18n.DateTimeSymbols_mr
"ms" goog/i18n.DateTimeSymbols_ms
"mt" goog/i18n.DateTimeSymbols_mt
"my" goog/i18n.DateTimeSymbols_my
"nb" goog/i18n.DateTimeSymbols_nb
"ne" goog/i18n.DateTimeSymbols_ne
"nl" goog/i18n.DateTimeSymbols_nl
"no" goog/i18n.DateTimeSymbols_no
"no_NO" goog/i18n.DateTimeSymbols_no_NO
"or" goog/i18n.DateTimeSymbols_or
"pa" goog/i18n.DateTimeSymbols_pa
"pl" goog/i18n.DateTimeSymbols_pl
"pt" goog/i18n.DateTimeSymbols_pt
"pt_BR" goog/i18n.DateTimeSymbols_pt_BR
"pt_PT" goog/i18n.DateTimeSymbols_pt_PT
"ro" goog/i18n.DateTimeSymbols_ro
"ru" goog/i18n.DateTimeSymbols_ru
"sh" goog/i18n.DateTimeSymbols_sh
"si" goog/i18n.DateTimeSymbols_si
"sk" goog/i18n.DateTimeSymbols_sk
"sl" goog/i18n.DateTimeSymbols_sl
"sq" goog/i18n.DateTimeSymbols_sq
"sr" goog/i18n.DateTimeSymbols_sr
"sr_Latn" goog/i18n.DateTimeSymbols_sr_Latn
"sv" goog/i18n.DateTimeSymbols_sv
"sw" goog/i18n.DateTimeSymbols_sw
"ta" goog/i18n.DateTimeSymbols_ta
"te" goog/i18n.DateTimeSymbols_te
"th" goog/i18n.DateTimeSymbols_th
"tl" goog/i18n.DateTimeSymbols_tl
"tr" goog/i18n.DateTimeSymbols_tr
"uk" goog/i18n.DateTimeSymbols_uk
"ur" goog/i18n.DateTimeSymbols_ur
"uz" goog/i18n.DateTimeSymbols_uz
"vi" goog/i18n.DateTimeSymbols_vi
"zh" goog/i18n.DateTimeSymbols_zh
"zh_CN" goog/i18n.DateTimeSymbols_zh_CN
"zh_HK" goog/i18n.DateTimeSymbols_zh_HK
"zh_TW" goog/i18n.DateTimeSymbols_zh_TW
"zu" goog/i18n.DateTimeSymbols_zu})
{"af" ^js goog.i18n.DateTimeSymbols_af
"am" ^js goog.i18n.DateTimeSymbols_am
"ar" ^js goog.i18n.DateTimeSymbols_ar
"ar_DZ" ^js goog.i18n.DateTimeSymbols_ar_DZ
"ar_EG" ^js goog.i18n.DateTimeSymbols_ar_EG
"az" ^js goog.i18n.DateTimeSymbols_az
"be" ^js goog.i18n.DateTimeSymbols_be
"bg" ^js goog.i18n.DateTimeSymbols_bg
"bn" ^js goog.i18n.DateTimeSymbols_bn
"br" ^js goog.i18n.DateTimeSymbols_br
"bs" ^js goog.i18n.DateTimeSymbols_bs
"ca" ^js goog.i18n.DateTimeSymbols_ca
"chr" ^js goog.i18n.DateTimeSymbols_chr
"cs" ^js goog.i18n.DateTimeSymbols_cs
"cy" ^js goog.i18n.DateTimeSymbols_cy
"da" ^js goog.i18n.DateTimeSymbols_da
"de" ^js goog.i18n.DateTimeSymbols_de
"de_AT" ^js goog.i18n.DateTimeSymbols_de_AT
"de_CH" ^js goog.i18n.DateTimeSymbols_de_CH
"el" ^js goog.i18n.DateTimeSymbols_el
"en" ^js goog.i18n.DateTimeSymbols_en
"en_AU" ^js goog.i18n.DateTimeSymbols_en_AU
"en_CA" ^js goog.i18n.DateTimeSymbols_en_CA
"en_GB" ^js goog.i18n.DateTimeSymbols_en_GB
"en_IE" ^js goog.i18n.DateTimeSymbols_en_IE
"en_IN" ^js goog.i18n.DateTimeSymbols_en_IN
"en_ISO" ^js goog.i18n.DateTimeSymbols_en_ISO
"en_SG" ^js goog.i18n.DateTimeSymbols_en_SG
"en_US" ^js goog.i18n.DateTimeSymbols_en_US
"en_ZA" ^js goog.i18n.DateTimeSymbols_en_ZA
"es" ^js goog.i18n.DateTimeSymbols_es
"es_419" ^js goog.i18n.DateTimeSymbols_es_419
"es_ES" ^js goog.i18n.DateTimeSymbols_es_ES
"es_MX" ^js goog.i18n.DateTimeSymbols_es_MX
"es_US" ^js goog.i18n.DateTimeSymbols_es_US
"et" ^js goog.i18n.DateTimeSymbols_et
"eu" ^js goog.i18n.DateTimeSymbols_eu
"fa" ^js goog.i18n.DateTimeSymbols_fa
"fi" ^js goog.i18n.DateTimeSymbols_fi
"fil" ^js goog.i18n.DateTimeSymbols_fil
"fr" ^js goog.i18n.DateTimeSymbols_fr
"fr_CA" ^js goog.i18n.DateTimeSymbols_fr_CA
"ga" ^js goog.i18n.DateTimeSymbols_ga
"gl" ^js goog.i18n.DateTimeSymbols_gl
"gsw" ^js goog.i18n.DateTimeSymbols_gsw
"gu" ^js goog.i18n.DateTimeSymbols_gu
"haw" ^js goog.i18n.DateTimeSymbols_haw
"he" ^js goog.i18n.DateTimeSymbols_he
"hi" ^js goog.i18n.DateTimeSymbols_hi
"hr" ^js goog.i18n.DateTimeSymbols_hr
"hu" ^js goog.i18n.DateTimeSymbols_hu
"hy" ^js goog.i18n.DateTimeSymbols_hy
"id" ^js goog.i18n.DateTimeSymbols_id
"in" ^js goog.i18n.DateTimeSymbols_in
"is" ^js goog.i18n.DateTimeSymbols_is
"it" ^js goog.i18n.DateTimeSymbols_it
"iw" ^js goog.i18n.DateTimeSymbols_iw
"ja" ^js goog.i18n.DateTimeSymbols_ja
"ka" ^js goog.i18n.DateTimeSymbols_ka
"kk" ^js goog.i18n.DateTimeSymbols_kk
"km" ^js goog.i18n.DateTimeSymbols_km
"kn" ^js goog.i18n.DateTimeSymbols_kn
"ko" ^js goog.i18n.DateTimeSymbols_ko
"ky" ^js goog.i18n.DateTimeSymbols_ky
"ln" ^js goog.i18n.DateTimeSymbols_ln
"lo" ^js goog.i18n.DateTimeSymbols_lo
"lt" ^js goog.i18n.DateTimeSymbols_lt
"lv" ^js goog.i18n.DateTimeSymbols_lv
"mk" ^js goog.i18n.DateTimeSymbols_mk
"ml" ^js goog.i18n.DateTimeSymbols_ml
"mn" ^js goog.i18n.DateTimeSymbols_mn
"mo" ^js goog.i18n.DateTimeSymbols_mo
"mr" ^js goog.i18n.DateTimeSymbols_mr
"ms" ^js goog.i18n.DateTimeSymbols_ms
"mt" ^js goog.i18n.DateTimeSymbols_mt
"my" ^js goog.i18n.DateTimeSymbols_my
"nb" ^js goog.i18n.DateTimeSymbols_nb
"ne" ^js goog.i18n.DateTimeSymbols_ne
"nl" ^js goog.i18n.DateTimeSymbols_nl
"no" ^js goog.i18n.DateTimeSymbols_no
"no_NO" ^js goog.i18n.DateTimeSymbols_no_NO
"or" ^js goog.i18n.DateTimeSymbols_or
"pa" ^js goog.i18n.DateTimeSymbols_pa
"pl" ^js goog.i18n.DateTimeSymbols_pl
"pt" ^js goog.i18n.DateTimeSymbols_pt
"pt_BR" ^js goog.i18n.DateTimeSymbols_pt_BR
"pt_PT" ^js goog.i18n.DateTimeSymbols_pt_PT
"ro" ^js goog.i18n.DateTimeSymbols_ro
"ru" ^js goog.i18n.DateTimeSymbols_ru
"sh" ^js goog.i18n.DateTimeSymbols_sh
"si" ^js goog.i18n.DateTimeSymbols_si
"sk" ^js goog.i18n.DateTimeSymbols_sk
"sl" ^js goog.i18n.DateTimeSymbols_sl
"sq" ^js goog.i18n.DateTimeSymbols_sq
"sr" ^js goog.i18n.DateTimeSymbols_sr
"sr_Latn" ^js goog.i18n.DateTimeSymbols_sr_Latn
"sv" ^js goog.i18n.DateTimeSymbols_sv
"sw" ^js goog.i18n.DateTimeSymbols_sw
"ta" ^js goog.i18n.DateTimeSymbols_ta
"te" ^js goog.i18n.DateTimeSymbols_te
"th" ^js goog.i18n.DateTimeSymbols_th
"tl" ^js goog.i18n.DateTimeSymbols_tl
"tr" ^js goog.i18n.DateTimeSymbols_tr
"uk" ^js goog.i18n.DateTimeSymbols_uk
"ur" ^js goog.i18n.DateTimeSymbols_ur
"uz" ^js goog.i18n.DateTimeSymbols_uz
"vi" ^js goog.i18n.DateTimeSymbols_vi
"zh" ^js goog.i18n.DateTimeSymbols_zh
"zh_CN" ^js goog.i18n.DateTimeSymbols_zh_CN
"zh_HK" ^js goog.i18n.DateTimeSymbols_zh_HK
"zh_TW" ^js goog.i18n.DateTimeSymbols_zh_TW
"zu" ^js goog.i18n.DateTimeSymbols_zu})
;; xx-YY locale, xx locale or en fallback
(defn locale-symbols [locale-name]
@ -359,90 +359,88 @@
loc
(let [name-first (string/replace (or locale-name "") #"-.*$" "")
loc (get locales name-first)]
(or loc goog/i18n.DateTimeSymbols_en))))
(or loc goog.i18n.DateTimeSymbols_en))))
;; get formatter for current locale symbols and format function
(defn mk-fmt [locale format-fn]
(let [locsym (locale-symbols locale)]
(goog/i18n.DateTimeFormat. (format-fn locsym) locsym)))
(goog.i18n.DateTimeFormat. (format-fn locsym) locsym)))
(defn format-currency
"Formats an amount of a currency based on the currency pattern
If currency-symbol? is false, the currency symbol is excluded from the
formatting"
([value currency-code]
(format-currency value currency-code true))
([value currency-code currency-symbol?]
(.addTier2Support goog/i18n.currency)
(let [currency-code-to-nfs-map {"ZAR" goog/i18n.NumberFormatSymbols_af
"ETB" goog/i18n.NumberFormatSymbols_am
"EGP" goog/i18n.NumberFormatSymbols_ar
"DZD" goog/i18n.NumberFormatSymbols_ar_DZ
"AZN" goog/i18n.NumberFormatSymbols_az
"BYN" goog/i18n.NumberFormatSymbols_be
"BGN" goog/i18n.NumberFormatSymbols_bg
"BDT" goog/i18n.NumberFormatSymbols_bn
"EUR" goog/i18n.NumberFormatSymbols_br
"BAM" goog/i18n.NumberFormatSymbols_bs
"USD" goog/i18n.NumberFormatSymbols_en
"CZK" goog/i18n.NumberFormatSymbols_cs
"GBP" goog/i18n.NumberFormatSymbols_cy
"DKK" goog/i18n.NumberFormatSymbols_da
"CHF" goog/i18n.NumberFormatSymbols_de_CH
"AUD" goog/i18n.NumberFormatSymbols_en_AU
"CAD" goog/i18n.NumberFormatSymbols_en_CA
"INR" goog/i18n.NumberFormatSymbols_en_IN
"SGD" goog/i18n.NumberFormatSymbols_en_SG
"MXN" goog/i18n.NumberFormatSymbols_es_419
"IRR" goog/i18n.NumberFormatSymbols_fa
"PHP" goog/i18n.NumberFormatSymbols_fil
"ILS" goog/i18n.NumberFormatSymbols_he
"HRK" goog/i18n.NumberFormatSymbols_hr
"HUF" goog/i18n.NumberFormatSymbols_hu
"AMD" goog/i18n.NumberFormatSymbols_hy
"IDR" goog/i18n.NumberFormatSymbols_id
"ISK" goog/i18n.NumberFormatSymbols_is
"JPY" goog/i18n.NumberFormatSymbols_ja
"GEL" goog/i18n.NumberFormatSymbols_ka
"KZT" goog/i18n.NumberFormatSymbols_kk
"KHR" goog/i18n.NumberFormatSymbols_km
"KRW" goog/i18n.NumberFormatSymbols_ko
"KGS" goog/i18n.NumberFormatSymbols_ky
"CDF" goog/i18n.NumberFormatSymbols_ln
"LAK" goog/i18n.NumberFormatSymbols_lo
"MKD" goog/i18n.NumberFormatSymbols_mk
"MNT" goog/i18n.NumberFormatSymbols_mn
"MDL" goog/i18n.NumberFormatSymbols_mo
"MYR" goog/i18n.NumberFormatSymbols_ms
"MMK" goog/i18n.NumberFormatSymbols_my
"NOK" goog/i18n.NumberFormatSymbols_nb
"NPR" goog/i18n.NumberFormatSymbols_ne
"PLN" goog/i18n.NumberFormatSymbols_pl
"BRL" goog/i18n.NumberFormatSymbols_pt
"RON" goog/i18n.NumberFormatSymbols_ro
"RUB" goog/i18n.NumberFormatSymbols_ru
"RSD" goog/i18n.NumberFormatSymbols_sh
"LKR" goog/i18n.NumberFormatSymbols_si
"ALL" goog/i18n.NumberFormatSymbols_sq
"SEK" goog/i18n.NumberFormatSymbols_sv
"TZS" goog/i18n.NumberFormatSymbols_sw
"THB" goog/i18n.NumberFormatSymbols_th
"TRY" goog/i18n.NumberFormatSymbols_tr
"UAH" goog/i18n.NumberFormatSymbols_uk
"PKR" goog/i18n.NumberFormatSymbols_ur
"UZS" goog/i18n.NumberFormatSymbols_uz
"VND" goog/i18n.NumberFormatSymbols_vi
"CNY" goog/i18n.NumberFormatSymbols_zh
"HKD" goog/i18n.NumberFormatSymbols_zh_HK
"TWD" goog/i18n.NumberFormatSymbols_zh_TW}
(.addTier2Support ^js goog.i18n.currency)
(let [currency-code-to-nfs-map {"ZAR" ^js goog.i18n.NumberFormatSymbols_af
"ETB" ^js goog.i18n.NumberFormatSymbols_am
"EGP" ^js goog.i18n.NumberFormatSymbols_ar
"DZD" ^js goog.i18n.NumberFormatSymbols_ar_DZ
"AZN" ^js goog.i18n.NumberFormatSymbols_az
"BYN" ^js goog.i18n.NumberFormatSymbols_be
"BGN" ^js goog.i18n.NumberFormatSymbols_bg
"BDT" ^js goog.i18n.NumberFormatSymbols_bn
"EUR" ^js goog.i18n.NumberFormatSymbols_br
"BAM" ^js goog.i18n.NumberFormatSymbols_bs
"USD" ^js goog.i18n.NumberFormatSymbols_en
"CZK" ^js goog.i18n.NumberFormatSymbols_cs
"GBP" ^js goog.i18n.NumberFormatSymbols_cy
"DKK" ^js goog.i18n.NumberFormatSymbols_da
"CHF" ^js goog.i18n.NumberFormatSymbols_de_CH
"AUD" ^js goog.i18n.NumberFormatSymbols_en_AU
"CAD" ^js goog.i18n.NumberFormatSymbols_en_CA
"INR" ^js goog.i18n.NumberFormatSymbols_en_IN
"SGD" ^js goog.i18n.NumberFormatSymbols_en_SG
"MXN" ^js goog.i18n.NumberFormatSymbols_es_419
"IRR" ^js goog.i18n.NumberFormatSymbols_fa
"PHP" ^js goog.i18n.NumberFormatSymbols_fil
"ILS" ^js goog.i18n.NumberFormatSymbols_he
"HRK" ^js goog.i18n.NumberFormatSymbols_hr
"HUF" ^js goog.i18n.NumberFormatSymbols_hu
"AMD" ^js goog.i18n.NumberFormatSymbols_hy
"IDR" ^js goog.i18n.NumberFormatSymbols_id
"ISK" ^js goog.i18n.NumberFormatSymbols_is
"JPY" ^js goog.i18n.NumberFormatSymbols_ja
"GEL" ^js goog.i18n.NumberFormatSymbols_ka
"KZT" ^js goog.i18n.NumberFormatSymbols_kk
"KHR" ^js goog.i18n.NumberFormatSymbols_km
"KRW" ^js goog.i18n.NumberFormatSymbols_ko
"KGS" ^js goog.i18n.NumberFormatSymbols_ky
"CDF" ^js goog.i18n.NumberFormatSymbols_ln
"LAK" ^js goog.i18n.NumberFormatSymbols_lo
"MKD" ^js goog.i18n.NumberFormatSymbols_mk
"MNT" ^js goog.i18n.NumberFormatSymbols_mn
"MDL" ^js goog.i18n.NumberFormatSymbols_mo
"MYR" ^js goog.i18n.NumberFormatSymbols_ms
"MMK" ^js goog.i18n.NumberFormatSymbols_my
"NOK" ^js goog.i18n.NumberFormatSymbols_nb
"NPR" ^js goog.i18n.NumberFormatSymbols_ne
"PLN" ^js goog.i18n.NumberFormatSymbols_pl
"BRL" ^js goog.i18n.NumberFormatSymbols_pt
"RON" ^js goog.i18n.NumberFormatSymbols_ro
"RUB" ^js goog.i18n.NumberFormatSymbols_ru
"RSD" ^js goog.i18n.NumberFormatSymbols_sh
"LKR" ^js goog.i18n.NumberFormatSymbols_si
"ALL" ^js goog.i18n.NumberFormatSymbols_sq
"SEK" ^js goog.i18n.NumberFormatSymbols_sv
"TZS" ^js goog.i18n.NumberFormatSymbols_sw
"THB" ^js goog.i18n.NumberFormatSymbols_th
"TRY" ^js goog.i18n.NumberFormatSymbols_tr
"UAH" ^js goog.i18n.NumberFormatSymbols_uk
"PKR" ^js goog.i18n.NumberFormatSymbols_ur
"UZS" ^js goog.i18n.NumberFormatSymbols_uz
"VND" ^js goog.i18n.NumberFormatSymbols_vi
"CNY" ^js goog.i18n.NumberFormatSymbols_zh
"HKD" ^js goog.i18n.NumberFormatSymbols_zh_HK
"TWD" ^js goog.i18n.NumberFormatSymbols_zh_TW}
nfs (or (get currency-code-to-nfs-map currency-code)
goog/i18n.NumberFormatSymbols_en)]
(set! goog/i18n.NumberFormatSymbols
(if currency-symbol?
nfs
(-> nfs
(js->clj :keywordize-keys true)
;; Remove any currency symbol placeholders in the pattern
(update :CURRENCY_PATTERN (fn [pat]
(string/replace pat #"\s*¤\s*" "")))
clj->js)))
^js goog.i18n.NumberFormatSymbols_en)]
(.format
(new goog/i18n.NumberFormat goog/i18n.NumberFormat.Format.CURRENCY currency-code)
^js (new ^js goog.i18n.NumberFormat
(let [pattern (.-CURRENCY_PATTERN ^js nfs)]
(if currency-symbol?
pattern
(string/replace pattern #"\s*¤\s*" ""))))
value))))

View File

@ -1,15 +0,0 @@
(ns status-im.goog.i18n-module
(:require-macros [status-im.modules :as modules]))
(modules/defmodule i18n
{:mk-fmt 'status-im.goog.i18n/mk-fmt
:format-currency 'status-im.goog.i18n/format-currency})
(defn mk-fmt [locale format-fn]
((get-symbol :mk-fmt) locale format-fn))
(defn format-currency
([value currency-code]
((get-symbol :format-currency) value currency-code true))
([value currency-code currency-symbol?]
((get-symbol :format-currency) value currency-code currency-symbol?)))

View File

@ -4,10 +4,11 @@
[status-im.hardwallet.real-keycard :as real-keycard]
[status-im.hardwallet.simulated-keycard :as simulated-keycard]
[status-im.hardwallet.ios-keycard :as ios-keycard]
[status-im.utils.platform :as platform]
[taoensso.timbre :as log]
[re-frame.core :as re-frame]
[status-im.utils.config :as config]))
[status-im.utils.config :as config]
[status-im.utils.platform :as platform]
["react-native" :as react-native]))
(defonce card (if config/keycard-test-menu-enabled?
(simulated-keycard/SimulatedKeycard.)
@ -71,7 +72,7 @@
:on-nfc-disabled
#(re-frame/dispatch [:hardwallet.callback/check-nfc-enabled-success false])}))
(defn- error-object->map [object]
(defn- error-object->map [^js object]
{:code (.-code object)
:error (.-message object)})

View File

@ -1,6 +1,5 @@
(ns status-im.hardwallet.core
(:require [re-frame.core :as re-frame]
[status-im.multiaccounts.create.core :as multiaccounts.create]
(:require [status-im.multiaccounts.create.core :as multiaccounts.create]
[status-im.i18n :as i18n]
[status-im.ui.screens.navigation :as navigation]
[status-im.utils.datetime :as utils.datetime]
@ -490,4 +489,3 @@
{:events [:hardwallet.callback/on-register-card-events]}
[{:keys [db]} listeners]
{:db (update-in db [:hardwallet :listeners] merge listeners)})

View File

@ -3,8 +3,8 @@
[status-im.utils.types :as types]
[status-im.hardwallet.card :as card]
[status-im.native-module.core :as status]
[status-im.react-native.js-dependencies :as js-dependencies]
[status-im.utils.platform :as platform]))
[status-im.utils.platform :as platform]
["react-native" :refer (AsyncStorage BackHandler)]))
(re-frame/reg-fx
:hardwallet/get-application-info
@ -106,14 +106,14 @@
(re-frame/reg-fx
:hardwallet/persist-pairings
(fn [pairings]
(.. js-dependencies/async-storage
(.. AsyncStorage
(setItem "status-keycard-pairings" (types/serialize pairings)))))
(re-frame/reg-fx
:hardwallet/retrieve-pairings
(fn []
(when platform/android?
(.. js-dependencies/async-storage
(.. AsyncStorage
(getItem "status-keycard-pairings")
(then #(re-frame/dispatch [:hardwallet.callback/on-retrieve-pairings-success
(types/deserialize %)]))))))
@ -125,14 +125,14 @@
;;particular screen to be loaded. An fx is easier to re-use and test.
(fn []
(re-frame/dispatch [:hardwallet/add-listener-to-hardware-back-button
(.addEventListener js-dependencies/back-handler "hardwareBackPress"
(.addEventListener BackHandler "hardwareBackPress"
(fn []
(re-frame/dispatch [:hardwallet/back-button-pressed])
true))])))
(re-frame/reg-fx
:hardwallet/remove-listener-to-hardware-back-button
(fn [listener]
(fn [^js listener]
(.remove listener)))
(re-frame/reg-fx

View File

@ -82,7 +82,7 @@
(fx/defn recovery-phrase-learn-more-pressed
{:events [:keycard.onboarding.recovery-phrase.ui/learn-more-pressed]}
[_]
(.openURL react/linking "https://keycard.status.im"))
(.openURL ^js react/linking "https://keycard.status.im"))
(fx/defn recovery-phrase-next-pressed
{:events [:keycard.onboarding.recovery-phrase.ui/next-pressed

View File

@ -1,11 +1,11 @@
(ns status-im.hardwallet.real-keycard
(:require [status-im.react-native.js-dependencies :as js-dependencies]
[status-im.hardwallet.keycard :as keycard]
(:require ["react-native-status-keycard" :default status-keycard]
["react-native" :as rn]
[status-im.utils.types :as types]
[status-im.native-module.core :as status]
[status-im.utils.types :as types]))
[status-im.hardwallet.keycard :as keycard]))
(defonce status-keycard (.-default js-dependencies/status-keycard))
(defonce event-emitter (.-DeviceEventEmitter js-dependencies/react-native))
(defonce event-emitter (.-DeviceEventEmitter rn))
(defonce active-listeners (atom []))
(defn check-nfc-support [{:keys [on-success]}]
@ -23,24 +23,30 @@
(defn remove-event-listeners []
(doseq [event ["keyCardOnConnected" "keyCardOnDisconnected"]]
(.removeAllListeners event-emitter event)))
(.removeAllListeners ^js event-emitter event)))
(defn remove-event-listener [event]
(defn remove-event-listener
[^js event]
(.remove event))
(defn on-card-connected [callback]
(.addListener event-emitter "keyCardOnConnected" callback))
(defn on-card-connected
[callback]
(.addListener ^js event-emitter "keyCardOnConnected" callback))
(defn on-card-disconnected [callback]
(.addListener event-emitter "keyCardOnDisconnected" callback))
(defn on-card-disconnected
[callback]
(.addListener ^js event-emitter "keyCardOnDisconnected" callback))
(defn on-nfc-enabled [callback]
(.addListener event-emitter "keyCardOnNFCEnabled" callback))
(defn on-nfc-enabled
[callback]
(.addListener ^js event-emitter "keyCardOnNFCEnabled" callback))
(defn on-nfc-disabled [callback]
(.addListener event-emitter "keyCardOnNFCDisabled" callback))
(defn on-nfc-disabled
[callback]
(.addListener ^js event-emitter "keyCardOnNFCDisabled" callback))
(defn register-card-events [args]
(defn register-card-events
[args]
(doseq [listener @active-listeners]
(remove-event-listener listener))
(reset! active-listeners
@ -49,7 +55,8 @@
(on-nfc-enabled (:on-nfc-enabled args))
(on-nfc-disabled (:on-nfc-disabled args))]))
(defn get-application-info [{:keys [pairing on-success on-failure]}]
(defn get-application-info
[{:keys [pairing on-success on-failure]}]
(.. status-keycard
(getApplicationInfo (str pairing))
(then on-success)

View File

@ -116,7 +116,7 @@
{:events [:hardwallet/fetch-currency-decimals-on-success]}
[{:keys [db] :as cofx} decimals]
{:db (update-in db [:signing/sign :formatted-data :message]
#(assoc % :formatted-amount (.dividedBy (money/bignumber (:amount %))
#(assoc % :formatted-amount (.dividedBy ^js (money/bignumber (:amount %))
(money/bignumber (money/from-decimal decimals)))))})
(fx/defn store-hash-and-sign-typed

View File

@ -77,8 +77,8 @@
(defn get-application-info [{:keys [on-success]}]
(later #(on-success (get @state :application-info))))
(defn install-applet [args])
(defn install-cash-applet [args])
(defn install-applet [_])
(defn install-cash-applet [_])
(def kk1-password "6d9ZHjn94kFP4bPm")
@ -96,7 +96,7 @@
:puk "320612366918"
:pin pin})))
(defn install-applet-and-init-card [args])
(defn install-applet-and-init-card [_])
(def kk1-pair "ADEol+GCD67EO7zU6ko0DNK7XrNs9w2+h9GxcibNY4yf")
@ -134,20 +134,20 @@
:wallet-address (:address wallet)
:wallet-public-key (:public-key wallet)})))))
(defn unblock-pin [args])
(defn unblock-pin [_])
(defn verify-pin [{:keys [pin pairing on-success]}]
(when (and (= pairing kk1-pair)
(= pin (get @state :pin)))
(later #(on-success 3))))
(defn change-pin [args])
(defn unpair [args])
(defn delete [args])
(defn remove-key [args])
(defn remove-key-with-unpair [args])
(defn export-key [args])
(defn unpair-and-delete [args])
(defn change-pin [_])
(defn unpair [_])
(defn delete [_])
(defn remove-key [_])
(defn remove-key-with-unpair [_])
(defn export-key [_])
(defn unpair-and-delete [_])
(defn get-keys [{:keys [on-success pin]}]
;;TODO(rasom): verify password before callback
(later
@ -155,8 +155,8 @@
{:key-uid (get-in @state [:application-info :key-uid])
:encryption-public-key (ethereum/sha3 pin)})))
(defn sign [args])
(defn sign-typed-data [args])
(defn sign [_])
(defn sign-typed-data [_])
(defn save-multiaccount-and-login
[{:keys [multiaccount-data password settings node-config accounts-data]}]

View File

@ -1,27 +1,27 @@
(ns status-im.i18n
(:require
[status-im.react-native.js-dependencies :as rn-dependencies]
[clojure.string :as string]
["i18n-js" :as i18n]
[status-im.i18n-resources :as i18n-resources]
[status-im.goog.i18n-module :as goog.i18n]))
[status-im.goog.i18n :as goog.i18n]))
(set! (.-locale rn-dependencies/i18n) (name i18n-resources/default-device-language))
(set! (.-fallbacks rn-dependencies/i18n) true)
(set! (.-defaultSeparator rn-dependencies/i18n) "/")
(set! (.-locale i18n) (name i18n-resources/default-device-language))
(set! (.-fallbacks i18n) true)
(set! (.-defaultSeparator i18n) "/")
(set! (.-translations rn-dependencies/i18n)
(set! (.-translations i18n)
(clj->js i18n-resources/translations-by-locale))
(defn set-language [lang]
(i18n-resources/load-language lang)
(set! (.-locale rn-dependencies/i18n) lang))
(set! (.-locale i18n) lang))
;;:zh, :zh-hans-xx, :zh-hant-xx have been added until this bug will be fixed https://github.com/fnando/i18n-js/issues/460
(def delimeters
"This function is a hack: mobile Safari doesn't support toLocaleString(), so we need to pass
this map to WKWebView to make number formatting work."
(let [n (.toLocaleString (js/Number 1000.1))
(let [n (.toLocaleString ^js (js/Number 1000.1))
delimiter? (= (count n) 7)]
(if delimiter?
{:delimiter (subs n 1 2)
@ -32,7 +32,7 @@
(defn label-number [number]
(when number
(let [{:keys [delimiter separator]} delimeters]
(.toNumber rn-dependencies/i18n
(.toNumber i18n
(string/replace number #"," ".")
(clj->js {:precision 10
:strip_insignificant_zeros true
@ -48,17 +48,17 @@
(defn label
([path] (label path {}))
([path options]
(if (exists? rn-dependencies/i18n.t)
(if (exists? (.t i18n))
(let [options (update options :amount label-number)]
(.t rn-dependencies/i18n (name path) (clj->js (label-options options))))
(.t i18n (name path) (clj->js (label-options options))))
(name path))))
(defn label-pluralize [count path & options]
(if (exists? rn-dependencies/i18n.t)
(.p rn-dependencies/i18n count (name path) (clj->js options))
(if (exists? (.t i18n))
(.p i18n count (name path) (clj->js options))
(name path)))
(def locale
(.-locale rn-dependencies/i18n))
(.-locale i18n))
(def format-currency goog.i18n/format-currency)

View File

@ -1,11 +1,11 @@
(ns status-im.i18n-resources
(:require-macros [status-im.i18n :as i18n])
(:require [status-im.react-native.js-dependencies :as rn-dependencies]
[status-im.utils.types :as types]
[clojure.string :as string]))
(:require [status-im.utils.types :as types]
[clojure.string :as string]
["react-native-languages" :default react-native-languages]))
(def default-device-language
(keyword (.-language rn-dependencies/react-native-languages)))
(keyword (.-language react-native-languages)))
;; translations
(def translations-by-locale

View File

@ -5,21 +5,12 @@
[status-im.multiaccounts.login.core :as multiaccounts.login]
[status-im.native-module.core :as status]
[status-im.network.net-info :as network]
[status-im.react-native.js-dependencies :as rn-dependencies]
[status-im.ui.components.colors :as colors]
[status-im.ui.screens.db :refer [app-db]]
[status-im.utils.fx :as fx]
[status-im.utils.platform :as platform]
[status-im.utils.theme :as theme]))
(defn restore-native-settings! []
(when platform/desktop?
(.getValue rn-dependencies/desktop-config "logging_enabled"
#(re-frame/dispatch [:set-in [:desktop/desktop :logging-enabled]
(if (boolean? %)
%
(cljs.reader/read-string %))]))))
(fx/defn initialize-app-db
"Initialize db to initial state"
[{{:keys [hardwallet initial-props desktop/desktop
@ -67,7 +58,6 @@
{:get-supported-biometric-auth nil
::init-theme nil
::init-keystore nil
::restore-native-settings nil
::open-multiaccounts #(re-frame/dispatch [::initialize-multiaccounts % {:logout? false}])
:ui/listen-to-window-dimensions-change nil
::network/listen-to-network-info nil
@ -77,10 +67,6 @@
:hardwallet/retrieve-pairings nil}
(initialize-app-db)))
(re-frame/reg-fx
::restore-native-settings
restore-native-settings!)
(re-frame/reg-fx
::open-multiaccounts
(fn [callback]

Some files were not shown because too many files have changed in this diff Show More