Notification
Overview
The Notification module is designed to facilitate the sending of notifications to users within your application. It provides a comprehensive set of features to manage the delivery of notifications, including support for in-app notifications. Additionally, it includes assets, components/pages used in notification routes, common interfaces, and supports multiple providers such as Firebase, Supabase, and REST.
Key Features of Notification Module
- In-App Notifications: Real-time in-app notifications.
Module Composition
- Components: Provides components and pages used in notification routes.
- Common Interfaces: Defines common interfaces for notification.
- Multiple Providers: Supports Firebase, Supabase, and REST API for notification.
- Notification Hook: Provides hooks for notification.
Notification Providers
- Firebase: Provides notification using Firebase.
- Supabase: Provides notification using Supabase.
- REST: Provides notification using REST.
Notification Functions
- saveTokenInDatabase: Saves the Expo push notification token in the database.
- sendNotification: Sends a notification to the user.
Notification Hook
There are 2 custom hooks provided for notification. They are defined in modules/notifications/hooks
.
- The
useNotificationHandler
hook:- Subscribes to the notification channel.
- Handles the incoming notifications.
- The
usePushNotifications
hook:- Registers the device for push notifications.
- Requests permissions, gets the push token, and sets up the notification channel.
- Returns the push token.