mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Firebase web notifications added
This commit is contained in:
@@ -9,6 +9,7 @@ import { InativityService } from "src/app/services/inativity.service";
|
||||
import { ThemeService } from 'src/app/services/theme.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { AngularFireMessaging } from '@angular/fire/messaging';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -38,12 +39,34 @@ export class AppComponent {
|
||||
private sqliteservice: SqliteService,
|
||||
private InativityService: InativityService,
|
||||
public ThemeService: ThemeService,
|
||||
private storage: Storage
|
||||
private storage: Storage,
|
||||
/* private afMessaging: AngularFireMessaging, */
|
||||
) {
|
||||
this.initializeApp();
|
||||
this.storage.set('version', environment.version).then(() => {})
|
||||
/* this.requestPermission();
|
||||
this.receiveMessages(); */
|
||||
}
|
||||
|
||||
/* requestPermission() {
|
||||
this.afMessaging.requestToken.subscribe(
|
||||
(token) => {
|
||||
// Save the token to your server for sending notifications
|
||||
console.log('Permission granted! Token:', token);
|
||||
},
|
||||
(error) => {
|
||||
console.error('Permission denied:', error);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
receiveMessages() {
|
||||
this.afMessaging.messages.subscribe((message) => {
|
||||
console.log('Received message:', message);
|
||||
// Handle the received message, e.g., show a notification
|
||||
});
|
||||
} */
|
||||
|
||||
initializeApp() {
|
||||
this.platform.ready().then(() => {
|
||||
this.statusBar.styleDefault();
|
||||
|
||||
Reference in New Issue
Block a user