Files
doneit-web/src/app/services/native-notification.service.ts
Eudes Inácio 57f51903bc lot of changes
2023-10-19 16:51:12 +01:00

66 lines
1.4 KiB
TypeScript

import { Injectable } from '@angular/core';
import { Platform } from '@ionic/angular';
import { CapacitorConfig } from '@capacitor/cli';
/* import { LocalNotifications, LocalNotificationSchema } from '@capacitor/local-notifications'; */
@Injectable({
providedIn: 'root'
})
export class NativeNotificationService {
constructor(private platform: Platform,) {
this.askForPermission()
}
askForPermission() {
/* LocalNotifications.requestPermissions()
LocalNotifications.checkPermissions().then((data)=>{
//
}).catch((data)=>{
//
}) */
}
foregroundNotification() {
/* LocalNotifications.addListener('localNotificationReceived', (notification) => {
}) */
}
backgroundNotification() {
/* LocalNotifications.addListener('localNotificationActionPerformed', (action) => {
console.log('Local notification action performed (background):', action);
// Implemente a lógica para lidar com a ação da notificação em segundo plano
}); */
}
sendNotificationChat({title = 'User', icon = '', message = 'hello'}) {
/* LocalNotifications.schedule({
notifications:[
{
title : title,
body : message,
id : new Date().getTime()
}
]
}); */
}
isDesktop() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
return true
} else {
return false
}
}
}