Files
doneit-web/src/app/services/native-notification.service.ts
T

66 lines
1.4 KiB
TypeScript
Raw Normal View History

2022-01-26 17:28:55 +01:00
import { Injectable } from '@angular/core';
import { Platform } from '@ionic/angular';
import { CapacitorConfig } from '@capacitor/cli';
2023-10-19 16:51:12 +01:00
/* import { LocalNotifications, LocalNotificationSchema } from '@capacitor/local-notifications'; */
2022-01-26 17:28:55 +01:00
@Injectable({
providedIn: 'root'
})
export class NativeNotificationService {
constructor(private platform: Platform,) {
this.askForPermission()
}
askForPermission() {
/* LocalNotifications.requestPermissions()
2022-01-26 17:28:55 +01:00
2022-01-28 17:33:26 +01:00
LocalNotifications.checkPermissions().then((data)=>{
2022-04-28 09:32:27 +01:00
//
2022-01-28 17:33:26 +01:00
}).catch((data)=>{
2022-04-28 09:32:27 +01:00
//
}) */
2022-01-28 17:33:26 +01:00
2022-01-26 17:28:55 +01:00
}
foregroundNotification() {
2023-05-26 14:23:37 +01:00
/* LocalNotifications.addListener('localNotificationReceived', (notification) => {
2023-05-26 14:23:37 +01:00
}) */
}
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
}); */
}
2022-01-26 17:28:55 +01:00
sendNotificationChat({title = 'User', icon = '', message = 'hello'}) {
/* LocalNotifications.schedule({
2022-01-26 17:28:55 +01:00
notifications:[
{
2022-01-28 17:33:26 +01:00
title : title,
body : message,
id : new Date().getTime()
2022-01-26 17:28:55 +01:00
}
]
}); */
2022-01-26 17:28:55 +01:00
}
isDesktop() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
return true
} else {
return false
}
}
}