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
|
(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]))
|
[react-native.platform :as platform]))
|
||||||
|
|
||||||
(def permissions-map
|
(def permissions-map
|
||||||
|
@ -38,3 +38,5 @@
|
||||||
(-> (check (get permissions-map permission))
|
(-> (check (get permissions-map permission))
|
||||||
(.then #(on-result (not (#{(.-BLOCKED RESULTS) (.-DENIED RESULTS)} %))))
|
(.then #(on-result (not (#{(.-BLOCKED RESULTS) (.-DENIED RESULTS)} %))))
|
||||||
(.catch #(on-error %))))
|
(.catch #(on-error %))))
|
||||||
|
|
||||||
|
(def open-settings openSettings)
|
||||||
|
|
|
@ -5,17 +5,25 @@
|
||||||
|
|
||||||
(defn show-popup
|
(defn show-popup
|
||||||
([title content]
|
([title content]
|
||||||
(show-popup title content nil))
|
(show-popup title content nil nil))
|
||||||
([title content on-dismiss]
|
([title content on-dismiss]
|
||||||
(rn/alert
|
(show-popup title content on-dismiss nil))
|
||||||
title
|
([title content on-dismiss action-button]
|
||||||
content
|
(let [dismiss-button
|
||||||
(vector (merge {:text "OK"
|
(merge {:text "OK"
|
||||||
:style "cancel"
|
:style "cancel"
|
||||||
:accessibility-label :cancel-button}
|
:accessibility-label :cancel-button}
|
||||||
(when on-dismiss {:onPress on-dismiss})))
|
(when on-dismiss {:onPress on-dismiss}))]
|
||||||
(when on-dismiss
|
(rn/alert
|
||||||
{:cancelable false}))))
|
title
|
||||||
|
content
|
||||||
|
(if action-button
|
||||||
|
(vector
|
||||||
|
action-button
|
||||||
|
dismiss-button)
|
||||||
|
dismiss-button)
|
||||||
|
(when on-dismiss
|
||||||
|
{:cancelable false})))))
|
||||||
|
|
||||||
(re-frame/reg-fx
|
(re-frame/reg-fx
|
||||||
:utils/show-popup
|
:utils/show-popup
|
||||||
|
|
|
@ -138,7 +138,11 @@
|
||||||
(alert/show-popup
|
(alert/show-popup
|
||||||
(i18n/label :t/audio-recorder-error)
|
(i18n/label :t/audio-recorder-error)
|
||||||
(i18n/label
|
(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)}]))}]]))
|
50)}]))}]]))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue