text: import PushNotification from "react-native-push-notification";
  import NotificationHandler from "./NotificationHandler";
  
  export default class NotifService {
    constructor(onRegister, onNotification) {
      this.lastId = 0;
  
      NotificationHandler.attachRegister(onRegister);
      NotificationHandler.attachNotification(onNotification);
  
      // Clear badge number at start
      PushNotification.getApplicationIconBadgeNumber(function (number) {
        if (number > 0) {
          PushNotification.setApplicationIconBadgeNumber(0);
        }
      });
    }
  
    scheduleNotif() {
      this.lastId++;
      PushNotification.localNotificationSchedule({
        date: new Date(Date.now() + 70 * 1000),
  
        id: this.lastId, // (optional) Valid unique 32 bit integer specified as string. default: Autogenerated Unique ID
        color: "blue", // (optional) default: system default
        vibrate: true, // (optional) default: true
        vibration: 300, // vibration length in milliseconds, ignored if vibrate=false, default: 1000
  
        /* iOS only properties */
        alertAction: "view", // (optional) default: view
        category: "", // (optional) default: empty string
        userInfo: {}, // (optional) default: {} (using null throws a JSON value '<null>' error)
  
        title: "Open app",
        message: "Take care of your health",
        playSound: true,
        number: 1, // Number displayed on badge
      });
    }
  
    checkPermission(cbk) {
      return PushNotification.checkPermissions(cbk);
    }
  
    requestPermissions() {
      return PushNotification.requestPermissions();
    }
  
    cancelAll() {
      PushNotification.cancelAllLocalNotifications();
    }
  }
  