mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
comment all capacitor code
This commit is contained in:
@@ -11,11 +11,11 @@ import { ExpedienteDetailPage } from '../../app/pages/gabinete-digital/expedient
|
||||
import { ViewEventPage } from '../../app/pages/agenda/view-event/view-event.page'
|
||||
import { ApproveEventModalPage } from '../../app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page';
|
||||
|
||||
import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed, Modals } from '@capacitor/core';
|
||||
/* import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed, Modals } from '@capacitor/core'; */
|
||||
import { Router } from '@angular/router';
|
||||
import { MethodCall } from '@angular/compiler';
|
||||
|
||||
const { PushNotifications, LocalNotifications, LocalNotificationAction } = Plugins;
|
||||
/* const { PushNotifications, LocalNotifications, LocalNotificationAction } = Plugins; */
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
@@ -34,7 +34,7 @@ export class HomePage implements OnInit {
|
||||
constructor(private ngZone: NgZone,private eventService: EventsService, private processesbackend: ProcessesService, private router: Router, private modalController: ModalController,) { }
|
||||
|
||||
ngOnInit() {
|
||||
//Initialize profile as mdgpr
|
||||
/* //Initialize profile as mdgpr
|
||||
|
||||
let date = new Date();
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
@@ -58,21 +58,6 @@ export class HomePage implements OnInit {
|
||||
this.processesbackend.GetTasksList("Expediente", true).subscribe(result => {
|
||||
this.totalExpediente = result;
|
||||
});
|
||||
/*
|
||||
(PushNotifications as any).requestPermission().then(result => {
|
||||
PushNotifications.register();
|
||||
});
|
||||
|
||||
PushNotifications.addListener(
|
||||
'registration',
|
||||
(token: PushNotificationToken) => {
|
||||
alert('Push registration success, token: ' + token.value);
|
||||
console.log('FIREBASE: ', token.value)
|
||||
this.storageService.store(this.username,token.value);
|
||||
},
|
||||
);
|
||||
|
||||
console.log(this.storageService.get(this.username)) */
|
||||
|
||||
PushNotifications.addListener('registrationError', (error: any) => {
|
||||
alert('Error on registration: ' + JSON.stringify(error));
|
||||
@@ -104,27 +89,6 @@ export class HomePage implements OnInit {
|
||||
console.log('Object: ', object);
|
||||
console.log('idObject: ', idObject);
|
||||
|
||||
/* if (service === "events") {
|
||||
this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
} else if (service === "agenda") {
|
||||
this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
} else if (service === "gabinete-digital" && object != "expediente") {*/
|
||||
// this.router.navigate(['/home/', service]);
|
||||
// }
|
||||
|
||||
//if (service != null) {
|
||||
|
||||
/*const routeValue = {
|
||||
"agenda": this.router.navigate(['/home/', service, idObject, 'home']),
|
||||
"gabinete-digital": this.router.navigate(['/home/', service]),
|
||||
"accoes": this.viewExpedientDetail(idObject),
|
||||
|
||||
}
|
||||
|
||||
const route = routeValue[service] && object ;
|
||||
|
||||
service = "agenda" ? this.router.navigate(['/home/', service, idObject, 'home']) : */
|
||||
|
||||
if (service === "agenda") {
|
||||
//this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
this.viewEventDetail(idObject)
|
||||
@@ -133,7 +97,7 @@ export class HomePage implements OnInit {
|
||||
this.viewExpedientDetail(idObject)
|
||||
}
|
||||
else if (service === "gabinete-digital" && object === "event-list") {
|
||||
/* this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', idObject])}) */
|
||||
// this.ngZone.run(() => {this.router.navigate(['/home/gabinete-digital/event-list', idObject])})
|
||||
this.openApproveModal(idObject);
|
||||
}
|
||||
else if (service === "accoes" && object === "accao") {
|
||||
@@ -143,61 +107,8 @@ export class HomePage implements OnInit {
|
||||
this.viewPublicationDetail(idObject)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*switch (service) {
|
||||
case "events":
|
||||
this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
break;
|
||||
case "agenda":
|
||||
this.router.navigate(['/home/', service, idObject, 'home']);
|
||||
break;
|
||||
case "gabinete-digital":
|
||||
this.router.navigate(['/home/', service]);
|
||||
break;
|
||||
case "gabinete-digital-expediente":
|
||||
this.router.navigate(['/home/gabinete-digital/', object, idObject, 'home']);
|
||||
break;
|
||||
case "": {
|
||||
|
||||
if(publicationId && processId != null) {
|
||||
this.viewPublicationDetail(publicationId,processId)
|
||||
}
|
||||
if (folder.ProcessId != null) {
|
||||
this.viewPublications(folder)
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
this.router.navigate(['/home/']);
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
async localNotificationPresent(notification) {
|
||||
|
||||
LocalNotificationAction.
|
||||
|
||||
LocalNotifications.schedule({
|
||||
notifications: [
|
||||
{
|
||||
title: notification.title,
|
||||
body: notification.body,
|
||||
id: 1,
|
||||
schedule: { at: new Date(Date.now() + 1000) },
|
||||
sound: null,
|
||||
attachments: null,
|
||||
actionTypeId: "",
|
||||
extra: null,
|
||||
foreground: true,
|
||||
}
|
||||
]
|
||||
});
|
||||
); */
|
||||
}
|
||||
|
||||
async openApproveModal(eventSerialNumber){
|
||||
|
||||
@@ -87,9 +87,9 @@ export class EventsPage implements OnInit {
|
||||
this.profile = "mdgpr";
|
||||
console.log(this.profile);
|
||||
|
||||
this.storageService.get(AuthConnstants.USER).then(res=>{
|
||||
/* this.storageService.get(AuthConnstants.USER).then(res=>{
|
||||
console.log(res);
|
||||
});
|
||||
}); */
|
||||
|
||||
this.showGreeting();
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ import { NotificationsService } from 'src/app/services/notifications.service';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { Token } from '../../models/token.model';
|
||||
|
||||
import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed } from '@capacitor/core';
|
||||
/* import { Plugins, PushNotification, PushNotificationToken, PushNotificationActionPerformed } from '@capacitor/core';
|
||||
|
||||
const { PushNotifications } = Plugins;
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -70,7 +70,7 @@ export class LoginPage implements OnInit {
|
||||
}
|
||||
this.authService.loginChat(postData).subscribe((res: any) => {
|
||||
console.log(res.data);
|
||||
this.storageService.store(AuthConnstants.AUTH, res.data);
|
||||
//this.storageService.store(AuthConnstants.AUTH, res.data);
|
||||
console.log('Login to Rocket chat OK');
|
||||
}, (error: any) => {
|
||||
console.log('Network error');
|
||||
@@ -78,7 +78,7 @@ export class LoginPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
storeUserIdANdToken() {
|
||||
/* storeUserIdANdToken() {
|
||||
|
||||
(PushNotifications as any).requestPermission().then(result => {
|
||||
PushNotifications.register();
|
||||
@@ -102,10 +102,6 @@ export class LoginPage implements OnInit {
|
||||
this.http.post<Token>('https://equilibrium.dyndns.info/GabineteDigital.Services/V4/api/notifications/token', body,{headers}).subscribe(data => {
|
||||
console.log('TOKEN USER MIDLE', data);
|
||||
})
|
||||
/*this.http.get<Token>('http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V4/api/notifications/user/'+res).subscribe(data => {
|
||||
console.log('TOKEN USER MIDLE',data);
|
||||
})*/
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -113,7 +109,7 @@ export class LoginPage implements OnInit {
|
||||
},
|
||||
);
|
||||
|
||||
};
|
||||
}; */
|
||||
|
||||
|
||||
async Login() {
|
||||
@@ -129,7 +125,7 @@ export class LoginPage implements OnInit {
|
||||
}
|
||||
if (await this.authService.login(this.userattempt)) {
|
||||
this.loginRocketChat();
|
||||
this.storeUserIdANdToken();
|
||||
//this.storeUserIdANdToken();
|
||||
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export class AuthService {
|
||||
if (result)
|
||||
{
|
||||
this.ValidatedUser = user;
|
||||
this.storageService.store(AuthConnstants.USER, response);
|
||||
//this.storageService.store(AuthConnstants.USER, response);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -70,29 +70,29 @@ export class AuthService {
|
||||
|
||||
//Get user data from RocketChat | global object
|
||||
getUserData(){
|
||||
this.storageService.get(AuthConnstants.AUTH).then(res=>{
|
||||
/* this.storageService.get(AuthConnstants.AUTH).then(res=>{
|
||||
this.userData$.next(res);
|
||||
});
|
||||
}); */
|
||||
}
|
||||
//Get user Id | global object
|
||||
getUserId(){
|
||||
this.storageService.get(AuthConnstants.USER).then(res=>{
|
||||
/* this.storageService.get(AuthConnstants.USER).then(res=>{
|
||||
this.userId$.next(res);
|
||||
});
|
||||
}); */
|
||||
}
|
||||
|
||||
getProfile(){
|
||||
this.storageService.get(AuthConnstants.PROFILE).then(res=>{
|
||||
/* this.storageService.get(AuthConnstants.PROFILE).then(res=>{
|
||||
return res;
|
||||
});
|
||||
}); */
|
||||
}
|
||||
|
||||
logoutChat(){
|
||||
//this.storageService.clear();
|
||||
this.storageService.removeStorageItem(AuthConnstants.AUTH).then(res =>{
|
||||
/* this.storageService.removeStorageItem(AuthConnstants.AUTH).then(res =>{
|
||||
this.userData$.next('');
|
||||
this.router.navigate(['']);
|
||||
})
|
||||
}) */
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Plugins } from '@capacitor/core';
|
||||
const { Storage } = Plugins;
|
||||
/* import { Plugins } from '@capacitor/core';
|
||||
const { Storage } = Plugins; */
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class StorageService {
|
||||
constructor() {}
|
||||
|
||||
// Store the value
|
||||
/* // Store the value
|
||||
async store(storageKey: string, value: any) {
|
||||
const encryptedValue = btoa(escape(JSON.stringify(value)));
|
||||
await Storage.set({
|
||||
@@ -29,5 +29,5 @@ const { Storage } = Plugins;
|
||||
// Clear storage
|
||||
async clear() {
|
||||
await Storage.clear();
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user