Skip to content

Instantly share code, notes, and snippets.

@indexzero
Last active May 10, 2019 01:20
Show Gist options
  • Save indexzero/b428200556fcc0f9c6bd8d45ba9c7f25 to your computer and use it in GitHub Desktop.
Save indexzero/b428200556fcc0f9c6bd8d45ba9c7f25 to your computer and use it in GitHub Desktop.
Draft proposal for Push Notifications and PushNotificationiOS

Proposal for Push Notifications and PushNotificationiOS

@salakar, @ashoat, @indexzero, @swaagie, @3rdeden, and @msluther met today to discuss this. This is the draft proposal written up during that meeting. We plan to iterate on this over the next week and then post it into a new proposal in react-native-community.

A recording of that meeting can be found below in MP4 format.

Prior art

  • Push Notification packages
    • react-native-push-notification
    • react-native-notifications
      • Fork of iOS work used in react-native-fire
    • react-native-firebase
  • React Native Firebase
    • src/messaging
    • src/notifications
  • Messaging vs. Notifications
    • Message (aka "data message")
    • Notification always notifies presents a visual notification

Proposal

  1. Formally deprecate existing PushNotficiationiOS Move source code for PushNotificationiOS into it's own repo (e.g. push-notification-ios living at react-native-community/push-notification-ios).

    • This module will be immediately deprecated. Having a final installable resting place for the code is still important to support the React Native community as they upgrade to newer versions. For example: assume PushNotificationiOS is removed in [email protected]. If push-notification-ios does not exist in user-land React Natiive consumers will be blocked from upgrading until they migrate to the new user-land module. With the deprecated code in a blessed location they can decouple that upgrade from the migration.
  2. Create a new PushNotification "kernel" Replicate, extract, or copy messaging and notifications code from react-native-firebase into a new codebase (e.g. react-native-community/react-native-push if not taken already).

    • Please see "Requirements" below.
    • The final future API for this library is TBD – we want input from the community to help finalize it.
    • By separating this from react-native-firebase more folks can contribute to it without needing to fully understand all of the additional features react-native-firebase offers.

Implications for react-native core

  • Formally deprecate PushNotificationiOS in [email protected]
  • Remove PushNotificationiOS in [email protected]
  • Provide guidance for receiving a notification while the JS runtime is off.
    • Only supported by Android currently.
    • Was brought up as having JSI implications for React Native by @ashoat
  • Also see other "Open Questions" below.

Requirements

Further reading

Open Questions

  • How can we support other services? (e.g. OneSignal, Expo, etc.)
    • These should all desugar to FCM or APN under the covers
  • Surface requirements around JSI to React Native core team (e.g. receiving a notification while the JS runtime is off).
    • Only supported by Android currently
This file has been truncated, but you can view the full file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment