Skip to content

Commit

Permalink
shadow-cljs for advanced cljs compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
rasom committed May 24, 2019
1 parent ee59f16 commit 731b2a0
Show file tree
Hide file tree
Showing 93 changed files with 829 additions and 542 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ prod-build:

prod-build-android: export TARGET_OS ?= android
prod-build-android:
lein prod-build-android
node ./node_modules/shadow-cljs/cli/runner.js release android && \
mv shadow-build/index.js index.android.js

prod-build-ios: export TARGET_OS ?= ios
prod-build-ios:
Expand Down
8 changes: 7 additions & 1 deletion ci/Jenkinsfile.android
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@ pipeline {
}
stage('Build') {
steps {
script { cmn.nix.shell('lein prod-build-android') }
script {
cmn.nix.shell('git clone --single-branch --branch status_1.10.520 git@github.com:rasom/clojurescript.git')
cmn.nix.shell('cd clojurescript; lein install')
cmn.nix.shell('rm -rf clojurescript')
cmn.nix.shell('node ./node_modules/shadow-cljs/cli/runner.js release android')
cmn.nix.shell('mv shadow-build/index.js index.android.js')
}
}
}
stage('Bundle') {
Expand Down
19 changes: 10 additions & 9 deletions components/src/status_im/ui/components/react.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
(def image-class (get-class "Image"))
(def picker-obj (lazy-get-react-property "Picker"))
(defn picker-class [] (adapt-class (picker-obj)))
(defn picker-item-class [] (adapt-class (.-Item (picker-obj))))
(defn picker-item-class [] (adapt-class (.-Item ^js (picker-obj))))

(defn valid-source? [source]
(or (not (map? source))
Expand Down Expand Up @@ -94,12 +94,12 @@
(def pan-responder (lazy-get-react-property "PanResponder"))
(def animated (lazy-get-react-property "Animated"))
(defn animated-view []
(reagent/adapt-react-class (.-View (animated))))
(reagent/adapt-react-class (.-View ^js (animated))))

(def dimensions (lazy-get-react-property "Dimensions"))
(def keyboard (lazy-get-react-property "Keyboard"))
(def linking (lazy-get-react-property "Linking"))
(def desktop-notification (.-DesktopNotification (.-NativeModules js-dependencies/react-native)))
(def desktop-notification (.-DesktopNotification (.-NativeModules ^js js-dependencies/react-native)))

(def max-font-size-multiplier 1.25)

Expand Down Expand Up @@ -198,23 +198,24 @@
([images-fn]
(show-image-picker images-fn nil))
([images-fn media-type]
(let [image-picker (.-default (image-picker-class))]
(-> image-picker
(let [image-picker (.-default ^js (image-picker-class))]
(-> ^js
image-picker
(.openPicker (clj->js {:multiple false :mediaType (or media-type "any")}))
(.then images-fn)
(.catch show-access-error)))))

;; Clipboard

(def sharing
(.-Share js-dependencies/react-native))
(.-Share ^js js-dependencies/react-native))

(defn copy-to-clipboard [text]
(.setString (.-Clipboard js-dependencies/react-native) text))
(.setString (.-Clipboard ^js js-dependencies/react-native) text))

(defn get-from-clipboard [clbk]
(let [clipboard-contents (.getString (.-Clipboard js-dependencies/react-native))]
(.then clipboard-contents #(clbk %))))
(let [clipboard-contents (.getString (.-Clipboard ^js js-dependencies/react-native))]
(.then ^js clipboard-contents #(clbk %))))

;; HTTP Bridge

Expand Down
3 changes: 3 additions & 0 deletions mobile_files/package.json.orig
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,8 @@
"url": "0.10.3",
"web3": "git+https://github.com/status-im/web3.js.git#0.20.2-status",
"web3-utils": "1.0.0-beta.36"
},
"devDependencies": {
"shadow-cljs": "^2.8.37"
}
}
Loading

0 comments on commit 731b2a0

Please sign in to comment.