mirror of
https://github.com/status-im/status-react.git
synced 2025-01-11 03:26:31 +00:00
fix no request for permission for push notifications when you enable them in app settings (#20531)
This commit is contained in:
parent
9d825ee04e
commit
141252e5a0
@ -6,6 +6,7 @@
|
||||
[legacy.status-im.ui.components.react :as react]
|
||||
[quo.core :as quo]
|
||||
[react-native.platform :as platform]
|
||||
[taoensso.timbre :as log]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
@ -57,7 +58,15 @@
|
||||
:accessibility-label :local-notifications-settings-button
|
||||
:subtitle (i18n/label :t/local-notifications-subtitle)
|
||||
:active notifications-enabled?
|
||||
:on-press #(rf/dispatch [:push-notifications/switch (not notifications-enabled?)])
|
||||
:on-press (fn []
|
||||
(when-not notifications-enabled?
|
||||
(rf/dispatch
|
||||
[:request-permissions
|
||||
{:permissions [:post-notifications]
|
||||
:on-allowed #(log/info "push notification permissions were allowed")
|
||||
:on-denied #(log/error
|
||||
"user denied push notification permissions")}]))
|
||||
(rf/dispatch [:push-notifications/switch (not notifications-enabled?)]))
|
||||
:accessory :switch}]]))
|
||||
|
||||
(defn notifications-settings
|
||||
|
@ -2,7 +2,6 @@
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[react-native.core :as rn]
|
||||
[react-native.platform :as platform]
|
||||
[react-native.safe-area :as safe-area]
|
||||
[status-im.common.resources :as resources]
|
||||
[status-im.contexts.onboarding.enable-notifications.style :as style]
|
||||
@ -36,7 +35,7 @@
|
||||
{:permissions [:post-notifications]
|
||||
:on-allowed #(log/info "push notification permissions were allowed")
|
||||
:on-denied #(log/error "user denied push notification permissions")}])
|
||||
(rf/dispatch [:push-notifications/switch true platform/ios?])
|
||||
(rf/dispatch [:push-notifications/switch true])
|
||||
(rf/dispatch [:navigate-to-within-stack
|
||||
[:screen/onboarding.welcome
|
||||
:screen/onboarding.enable-notifications]]))
|
||||
|
Loading…
x
Reference in New Issue
Block a user