Skip to content

Commit

Permalink
Camera fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy Vlasov committed Aug 29, 2019
1 parent e8f686a commit 14cab36
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
22 changes: 11 additions & 11 deletions src/status_im/ui/components/camera.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@

(defn default-camera [] (.-RNCamera (js-dependencies/camera)))

; (defn constants [t]
; (-> (default-camera)
; (object/get "Constants")
; (object/get t)
; (js->clj)
; (walk/keywordize-keys)))
(defn constants [t]
(-> (default-camera)
(object/get "Constants")
(object/get t)
(js->clj)
(walk/keywordize-keys)))

; (def aspects (constants "Orientation"))
; (def capture-targets (constants "CaptureTarget"))
;(def torch-modes (constants "FlashMode"))
(def aspects (constants "Orientation"))
(def capture-targets (constants "CaptureTarget"))
(def torch-modes (constants "FlashMode"))

; (defn set-torch [state]
; (set! (.-flashMode (default-camera)) (get torch-modes state)))
(defn set-torch [state]
(set! (.-flashMode (default-camera)) (get torch-modes state)))

(defn request-access-ios [then else]
(-> (.checkVideoAuthorizationStatus (default-camera))
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/ui/screens/profile/photo_capture/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[status-im.ui.components.icons.vector-icons :as icons]))

(defn image-captured [data]
(let [path (.-path data)
(let [path (.-uri data)
_ (log/debug "Captured image: " path)
on-success (fn [base64]
(log/debug "Captured success: " base64)
Expand All @@ -39,7 +39,7 @@
[react/view styles/button
[react/touchable-highlight {:on-press (fn []
(let [camera @camera-ref]
(-> (.capture camera)
(-> (.takePictureAsync camera)
(.then image-captured)
(.catch #(log/debug "Error capturing image: " %)))))}
[react/view
Expand Down
1 change: 0 additions & 1 deletion src/status_im/ui/screens/qr_scanner/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
(do (reset! barcode-read? true)
(on-barcode-read identifier %))))
:ref #(reset! camera-initialized? true)
:captureAudio false
:style styles/barcode-scanner}])
[react/view styles/rectangle-container
[react/view styles/rectangle
Expand Down
2 changes: 0 additions & 2 deletions src/status_im/ui/screens/wallet/choose_recipient/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
[react/with-activity-indicator
{}
[camera/camera {:style styles/preview
:aspect :fill
:captureAudio false
;:torchMode (camera/set-torch camera-flashlight)
:onBarCodeRead #(when-not @read-once?
(reset! read-once? true)
Expand Down

0 comments on commit 14cab36

Please sign in to comment.