From 8369afdddca7c973a963c594dfb0233fbcd7806e Mon Sep 17 00:00:00 2001 From: Oleg Kilimnik Date: Fri, 11 May 2018 02:46:39 +0300 Subject: [PATCH] Fixes #3417: App crashed when accessing camera view but access to camera denied for app [iOS] Signed-off-by: Julien Eluard --- src/status_im/ui/components/camera.cljs | 2 +- src/status_im/ui/screens/wallet/components/views.cljs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/status_im/ui/components/camera.cljs b/src/status_im/ui/components/camera.cljs index f562c83d3f..9dffd936eb 100644 --- a/src/status_im/ui/components/camera.cljs +++ b/src/status_im/ui/components/camera.cljs @@ -22,7 +22,7 @@ (defn request-access-ios [then else] (-> (.checkVideoAuthorizationStatus default-camera) - (.then then) + (.then (fn [allowed?] (if allowed? (then) (else)))) (.catch else))) (defn camera [props] diff --git a/src/status_im/ui/screens/wallet/components/views.cljs b/src/status_im/ui/screens/wallet/components/views.cljs index f87fa1f587..3af651be77 100644 --- a/src/status_im/ui/screens/wallet/components/views.cljs +++ b/src/status_im/ui/screens/wallet/components/views.cljs @@ -21,7 +21,8 @@ [status-im.utils.ethereum.core :as ethereum] [status-im.utils.ethereum.tokens :as tokens] [status-im.utils.platform :as platform] - [status-im.ui.components.tooltip.views :as tooltip])) + [status-im.ui.components.tooltip.views :as tooltip] + [status-im.utils.utils :as utils])) (defn view-asset [symbol] [react/view @@ -157,7 +158,9 @@ (defn- request-camera-permissions [] (re-frame/dispatch [:request-permissions {:permissions [:camera] - :on-allowed #(re-frame/dispatch [:navigate-to :recipient-qr-code])}])) + :on-allowed #(re-frame/dispatch [:navigate-to :recipient-qr-code]) + :on-denied #(utils/show-popup (i18n/label :t/error) + (i18n/label :t/camera-access-error))}])) (defn- on-choose-recipient [contact-only?] (list-selection/show {:title (i18n/label :t/wallet-choose-recipient)