mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
notification
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { CapacitorConfig } from '@capacitor/cli';
|
||||
import { LocalNotifications } from '@capacitor/local-notifications';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class NativeNotificationService {
|
||||
|
||||
constructor(private platform: Platform,) {
|
||||
this.askForPermission()
|
||||
}
|
||||
|
||||
askForPermission() {
|
||||
|
||||
LocalNotifications.requestPermissions()
|
||||
|
||||
}
|
||||
|
||||
sendNotificationChat({title = 'User', icon = '', message = 'hello'}) {
|
||||
|
||||
LocalNotifications.schedule({
|
||||
notifications:[
|
||||
{
|
||||
title : 'tile',
|
||||
body : 'df',
|
||||
id : 55
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
isDesktop() {
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user