fix: send user to settings if audio permission is rejected (#16049)
This commit is contained in:
parent
437cfa9a77
commit
60a8b944d9
|
@ -1,5 +1,5 @@
|
|||
(ns react-native.permissions
|
||||
(:require ["react-native-permissions" :refer (check requestMultiple PERMISSIONS RESULTS)]
|
||||
(:require ["react-native-permissions" :refer (check openSettings requestMultiple PERMISSIONS RESULTS)]
|
||||
[react-native.platform :as platform]))
|
||||
|
||||
(def permissions-map
|
||||
|
@ -38,3 +38,5 @@
|
|||
(-> (check (get permissions-map permission))
|
||||
(.then #(on-result (not (#{(.-BLOCKED RESULTS) (.-DENIED RESULTS)} %))))
|
||||
(.catch #(on-error %))))
|
||||
|
||||
(def open-settings openSettings)
|
||||
|
|
|
@ -5,17 +5,25 @@
|
|||
|
||||
(defn show-popup
|
||||
([title content]
|
||||
(show-popup title content nil))
|
||||
(show-popup title content nil nil))
|
||||
([title content on-dismiss]
|
||||
(show-popup title content on-dismiss nil))
|
||||
([title content on-dismiss action-button]
|
||||
(let [dismiss-button
|
||||
(merge {:text "OK"
|
||||
:style "cancel"
|
||||
:accessibility-label :cancel-button}
|
||||
(when on-dismiss {:onPress on-dismiss}))]
|
||||
(rn/alert
|
||||
title
|
||||
content
|
||||
(vector (merge {:text "OK"
|
||||
:style "cancel"
|
||||
:accessibility-label :cancel-button}
|
||||
(when on-dismiss {:onPress on-dismiss})))
|
||||
(if action-button
|
||||
(vector
|
||||
action-button
|
||||
dismiss-button)
|
||||
dismiss-button)
|
||||
(when on-dismiss
|
||||
{:cancelable false}))))
|
||||
{:cancelable false})))))
|
||||
|
||||
(re-frame/reg-fx
|
||||
:utils/show-popup
|
||||
|
|
|
@ -138,7 +138,11 @@
|
|||
(alert/show-popup
|
||||
(i18n/label :t/audio-recorder-error)
|
||||
(i18n/label
|
||||
:t/audio-recorder-permissions-error)))
|
||||
:t/audio-recorder-permissions-error)
|
||||
nil
|
||||
{:text (i18n/label :t/settings)
|
||||
:accessibility-label :settings-button
|
||||
:onPress (fn [] (permissions/open-settings))}))
|
||||
50)}]))}]]))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue