mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Merge branch 'feature/PushNotification_COrdova' into developer
This commit is contained in:
@@ -11,6 +11,7 @@ import { PhotoService } from 'src/app/services/photo.service';
|
||||
import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { Token } from '../../models/token.model';
|
||||
import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx';
|
||||
|
||||
/* import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed } from '@capacitor/core';
|
||||
|
||||
@@ -38,7 +39,8 @@ export class LoginPage implements OnInit {
|
||||
private storageService: StorageService,
|
||||
private toastService: ToastService,
|
||||
private photoService: PhotoService,
|
||||
public alertController: AlertController) { }
|
||||
public alertController: AlertController,
|
||||
private fcm: FCM) { }
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@@ -78,40 +80,9 @@ export class LoginPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/* storeUserIdANdToken() {
|
||||
|
||||
(PushNotifications as any).requestPermission().then(result => {
|
||||
PushNotifications.register();
|
||||
});
|
||||
|
||||
PushNotifications.addListener(
|
||||
'registration',
|
||||
(token: PushNotificationToken) => {
|
||||
console.log('FIREBASE TOKEN', token.value)
|
||||
this.storageService.store(this.username, token.value);
|
||||
this.storageService.get(this.username).then(value => {
|
||||
console.log('STORAGE TOKEN', value)
|
||||
this.storageService.get(AuthConnstants.USER).then(res => {
|
||||
console.log('USERID', res);
|
||||
const headers = { 'Authorization': 'Basic cGF1bG8ucGludG9AZ2FiaW5ldGVkaWdpdGFsLmxvY2FsOnRhYnRlc3RlQDAwNg==' };
|
||||
const body = {
|
||||
UserId: res,
|
||||
TokenId: token.value,
|
||||
Status: 1,
|
||||
Service: 1
|
||||
};
|
||||
|
||||
this.http.post<Token>('https://equilibrium.dyndns.info/GabineteDigital.Services/V4/api/notifications/token', body, { headers }).subscribe(data => {
|
||||
console.log('TOKEN USER MIDLE', data);
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
);
|
||||
|
||||
}; */
|
||||
getToken() {
|
||||
this.notificatinsservice.getAndpostToken(this.username);
|
||||
}
|
||||
|
||||
|
||||
async Login() {
|
||||
@@ -127,7 +98,7 @@ export class LoginPage implements OnInit {
|
||||
}
|
||||
if (await this.authService.login(this.userattempt)) {
|
||||
this.loginRocketChat();
|
||||
//this.storeUserIdANdToken();
|
||||
this.getToken();
|
||||
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user