Skip to content

Commit

Permalink
explicitly ask for permission during onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
siddarthkay committed Dec 5, 2023
1 parent fe1cdeb commit f23fb41
Showing 1 changed file with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
(:require
["react-native-image-crop-picker" :default image-picker]
[quo.core :as quo]
[react-native.permissions :as permissions]
[react-native.platform :as platform]
[taoensso.timbre :as log]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))

Expand Down Expand Up @@ -61,8 +64,26 @@
[[{:icon :i/camera
:accessibility-label :take-photo-button
:label (i18n/label :t/profile-pic-take)
:on-press #(take-pic update-profile-pic-callback)}
:on-press (fn []
(permissions/request-permissions
{:permissions [(if platform/is-below-android-13?
:read-external-storage
:read-media-images)
:write-external-storage]
:on-allowed (fn [] (take-pic update-profile-pic-callback))
:on-denied (fn []
(log/info
"user has denied permissions to click picture"))}))}
{:icon :i/image
:accessibility-label :select-from-gallery-button
:label (i18n/label :t/profile-pic-pick)
:on-press #(pick-pic update-profile-pic-callback)}]]])
:on-press (fn []
(permissions/request-permissions
{:permissions [(if platform/is-below-android-13?
:read-external-storage
:read-media-images)
:write-external-storage]
:on-allowed (fn [] (pick-pic update-profile-pic-callback))
:on-denied (fn []
(log/info "user has denied permissions to select picture"))
}))}]]])

0 comments on commit f23fb41

Please sign in to comment.