djangoflow / flutter-djangoflow

Flutter modules for DjangoFlow
MIT License
8 stars 15 forks source link

Separate Firebase Notifications into separate package #2

Closed adar2378 closed 1 year ago

adar2378 commented 1 year ago

Currently, the firebase_cloud_messaging related logics are inside the djangoflow_app package. We need to separate the firebase_cloud_messsaging logics into a separate package.

The simplified purpose of this is to

Potential solution:

Bonus Task:

adar2378 commented 1 year ago

Create a new package with following requirements.

  1. The firebaseNotificationHandler widget should have callbacks, onMessage, onMessageTap
  2. Streams need to listen to FirebaseMessaging.onMessageOpenedApp, FirebaseMessaging.onMessage.
  3. FirebaseMessaging.instance.getInitialMessage() this we will need to call only once in app.
  4. We need to listen to onTokenRefresh from FirebaseMessaging.
  5. And there should a callBack which will return the token when it’s available. Even better if this callback can be triggered through a method something like DjangoflowFCMHanlder.getToken
  6. Request notification permission through FirebaseMessaging object’s requestPermission method

check this for reference https://pub.dev/packages/firebase_notifications_handler