evennit / notifee-expo-plugin

This plugin will allow you to use Notifee with a notification service extension without needing to eject from Expo managed workflow.
https://www.npmjs.com/package/@evennit/notifee-expo-plugin
MIT License
12 stars 4 forks source link
expo notifee notifications push

πŸ”₯πŸ‘Ή Notifee-Expo-Plugin πŸ‘ΉπŸ”₯

Are YOU looking for a plugin that will magically do these things for you without needing to eject your Expo app?:

Well... you are at the right place!

🧩 Install 🧩

Assure you already have @notifee/react-native installed and then:

# npm
npm install @evennit/notifee-expo-plugin

#or

# yarn
yarn add @evennit/notifee-expo-plugin

πŸ› οΈ Config πŸ› οΈ

Add the plugin to your Expo config's plugin array like so:

app.config.js

{
  plugins: [
    [
      "@evennit/notifee-expo-plugin",
      {
        iosDeploymentTarget: "13.4", //<-- Must be the same as your main app target's iOS deployment target
        apsEnvMode: "development",
      },
    ],
  ];
}

app.config.json

{
  "expo": {
    "plugins": [
      [
        "@evennit/notifee-expo-plugin",
        {
          "iosDeploymentTarget": "13.4", //<-- Must be the same as your main app target's iOS deployment target
          "apsEnvMode": "development"
        }
      ]
    ]
  }
}

πŸ”¨ Rebuild your app πŸ”¨

After installing and adding the plugin to your project's Expo config plugin array, you need to rebuild your iOS and Android apps:

npx expo prebuild

Now you should be good to go!

Props

Property Description
apsEnvMode: string (required) Sets the APS Environment Entitlement. Determines whether to use the development or production Apple Push Notification service (APNs).
Values: "development" or "production"
iosDeploymentTarget: string (required) Sets the deployment target of the notification service extension for iOS. This should match the deployment target of the main app.
Ex: "13.4"
androidIcons?: NotifeeAndroidIcon[] Specifies Android icons to be added to the appropriate resource folders for notification purposes. Each icon should be defined with a name, path, and type (large or small).
Ex: [{ name: "ic_small_logo", path: "./assets/logo.png", type: "small" }]
enableCommunicationNotifications?: boolean Enables communication notifications, which adds the necessary configurations for communication notifications as mentioned in https://github.com/invertase/notifee/pull/526.
appleDevTeamId?: string Automatically signs the app and the notification service extension targets with the provided Apple developer team ID.
customNotificationServiceFilePath?: string Specifies the path to a custom notification service file, which should already include the necessary configurations for Notifee along with any additional customizations. You can build upon the default NotificationService.m file of this package.
Ex: "./assets/notifee/NotificationService.m".
backgroundModes?: string[] Specifies the background modes to enable for the app. If not provided, the default value will be: ["remote-notification"]. On the other hand, an empty array [] will signal to the plugin to skip the backgroundModes step completly. iOS only.
See possible values here: https://developer.apple.com/documentation/bundleresources/information_property_list/uibackgroundmodes

🀩 STARS 🀩

If this was of any use to you, feel OBLIGATED to give it a 🌟 :))))).

πŸ’Έ if (feelingGrateful && hasABuckToGive) πŸ’Έ

You can support me via ko-fi.

Shameless plug because I kinda need money for my startup. πŸ₯Ί

πŸ“œ License πŸ“œ

This package is made available under the MIT license.

Happy coding :)