| #
096a701b |
| 27-May-2020 |
Stanisław Chmiela <[email protected]> |
[expo-notifications][expo-permissions] Move notification permission requesters to notifications package (#8486)
# Why
Fixes https://github.com/unimodules/react-native-unimodules/issues/136. This
[expo-notifications][expo-permissions] Move notification permission requesters to notifications package (#8486)
# Why
Fixes https://github.com/unimodules/react-native-unimodules/issues/136. This is what we wanted to do anyway—move code responsible for permissions to respective modules.
# How
- removed `EXUserNotificationPermissionRequester` as it was left only as a fallback for when `expo-notifications` is not installed. Now that in Expo Client `expo-notifications` will be installed, this class would never be used.
- moved remote notification permission requester from `expo-permissions` to `expo-notifications`, effectively removing support for calling `askAsync(Permissions.NOTIFICATIONS)` from `expo-permission` if `expo-notifications` is not installed
- while moving I write a way for the requester to receive callbacks about permission being accepted or declined. I used a `UIApplicationDelegate` singleton module to which requesters can register to receive callbacks.
- since new notification permission requesters now may return `null` inside the permission response I had to either:
- add support for `NSNull` in `EXPermissionsManager` (it is returned by the user notifications permissions requester)
- exclude `notifications` and `userFacingNotifications` from being saved to kernel service since we don't scope them even so (thanks @lukmccall for the tip!)
We decided to stick to the second idea.
# Test Plan
- [x] Ran Expo Client on an ExpoClient-less device, fetched and asked for both notification-related permissions.
show more ...
|