mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
66 lines
1.4 KiB
TypeScript
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
|
|
|
|
}
|
|
}
|
|
|
|
}
|