mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +00:00
Merge
This commit is contained in:
@@ -64,7 +64,7 @@ export class EventsPage implements OnInit {
|
||||
// shared data
|
||||
toDayEventStorage = ToDayEventStorage
|
||||
expedienteGdStore = ExpedienteGdStore
|
||||
|
||||
|
||||
expedienteTaskPipe = new ExpedienteTaskPipe()
|
||||
|
||||
@Output() openExpedientListPage:EventEmitter<any> = new EventEmitter<any>();
|
||||
@@ -352,12 +352,13 @@ export class EventsPage implements OnInit {
|
||||
}
|
||||
|
||||
goToExpediente(SerialNumber:any) {
|
||||
if(this.loggeduser.Profile == 'MDGPR'){
|
||||
this.router.navigate(['/home/events/expediente', SerialNumber, 'events']);
|
||||
/* if(this.loggeduser.Profile == 'MDGPR'){
|
||||
this.router.navigate(['/home/events/expediente', SerialNumber, 'events']);
|
||||
}
|
||||
else if(this.loggeduser.Profile == 'PR'){
|
||||
this.router.navigate(['/home/events/expedientes-pr', SerialNumber, 'events']);
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
viewExpedientListPage(){
|
||||
|
||||
@@ -2,14 +2,14 @@ import { Injectable } from '@angular/core';
|
||||
import { FileLoaderService } from '../file/file-loader.service';
|
||||
import { FileToBase64Service } from '../file/file-to-base64.service';
|
||||
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
||||
//Cordova
|
||||
import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
|
||||
|
||||
import { ChatService } from '../chat.service';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { SearchPage } from 'src/app/pages/search/search.page';
|
||||
import { SearchList } from 'src/app/models/search-document';
|
||||
import { ProcessesService } from '../processes.service';
|
||||
import { ToastService } from '../toast.service';
|
||||
import { Camera, CameraResultType, CameraSource, Photo} from '@capacitor/camera';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -22,9 +22,9 @@ export class FileService {
|
||||
showLoader: boolean;
|
||||
|
||||
files: Set<File>;
|
||||
photos: any[] = [];
|
||||
|
||||
constructor(
|
||||
private camera: Camera,
|
||||
private fileLoaderService: FileLoaderService,
|
||||
private fileToBase64Service: FileToBase64Service,
|
||||
private iab: InAppBrowser,
|
||||
@@ -34,26 +34,25 @@ export class FileService {
|
||||
private toastService: ToastService,
|
||||
) { }
|
||||
|
||||
takePicture() {
|
||||
const options: CameraOptions = {
|
||||
quality: 50,
|
||||
destinationType: this.camera.DestinationType.DATA_URL,
|
||||
encodingType: this.camera.EncodingType.JPEG,
|
||||
mediaType: this.camera.MediaType.PICTURE,
|
||||
targetWidth: 720,
|
||||
targetHeight: 720,
|
||||
}
|
||||
async takePicture() {
|
||||
const capturedImage = await Camera.getPhoto({
|
||||
quality: 90,
|
||||
// allowEditing: true,
|
||||
resultType: CameraResultType.Uri,
|
||||
source: CameraSource.Camera
|
||||
|
||||
this.camera.getPicture(options).then((imageData) => {
|
||||
// imageData is either a base64 encoded string or a file URI
|
||||
// If it's base64 (DATA_URL): m
|
||||
//let base64Image = 'data:image/jpeg;base64,' + imageData;
|
||||
|
||||
this.capturedImage = 'data:image/png;base64,'+imageData;
|
||||
this.capturedImageTitle = new Date().getTime() + '.jpeg';
|
||||
}, (err) => {
|
||||
/* console.log(err); */
|
||||
});
|
||||
const response = await fetch(capturedImage.webPath!);
|
||||
const blob = await response.blob();
|
||||
|
||||
this.photos.unshift({
|
||||
filepath: "soon...",
|
||||
webviewPath: capturedImage.webPath
|
||||
});
|
||||
|
||||
this.capturedImage = await this.convertBlobToBase64(blob);
|
||||
this.capturedImageTitle = new Date().getTime() + '.jpeg';
|
||||
|
||||
let data = {
|
||||
image:this.capturedImage,
|
||||
name: this.capturedImageTitle
|
||||
@@ -62,6 +61,15 @@ export class FileService {
|
||||
return data;
|
||||
}
|
||||
|
||||
convertBlobToBase64 = (blob: Blob) => new Promise((resolve, reject) => {
|
||||
const reader = new FileReader;
|
||||
reader.onerror = reject;
|
||||
reader.onload = () => {
|
||||
resolve(reader.result);
|
||||
};
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
|
||||
loadPicture() {
|
||||
const input = this.fileLoaderService.createInput({
|
||||
accept: ['image/apng', 'image/jpeg', 'image/png']
|
||||
@@ -85,19 +93,24 @@ export class FileService {
|
||||
};
|
||||
}
|
||||
|
||||
addCameraPictureToChat(roomId){
|
||||
async addCameraPictureToChat(roomId){
|
||||
|
||||
const options: CameraOptions = {
|
||||
quality: 50,
|
||||
destinationType: this.camera.DestinationType.DATA_URL,
|
||||
encodingType: this.camera.EncodingType.JPEG,
|
||||
mediaType: this.camera.MediaType.PICTURE,
|
||||
targetWidth: 720,
|
||||
targetHeight: 720,
|
||||
}
|
||||
const capturedImage = await Camera.getPhoto({
|
||||
quality: 90,
|
||||
// allowEditing: true,
|
||||
resultType: CameraResultType.Uri,
|
||||
source: CameraSource.Camera
|
||||
|
||||
this.camera.getPicture(options).then((imageData) => {
|
||||
this.capturedImage = 'data:image/png;base64,'+imageData;
|
||||
});
|
||||
const response = await fetch(capturedImage.webPath!);
|
||||
const blob = await response.blob();
|
||||
|
||||
this.photos.unshift({
|
||||
filepath: "soon...",
|
||||
webviewPath: capturedImage.webPath
|
||||
});
|
||||
|
||||
this.capturedImage = await this.convertBlobToBase64(blob);
|
||||
this.capturedImageTitle = new Date().getTime() + '.jpeg';
|
||||
|
||||
let body = {
|
||||
@@ -121,29 +134,26 @@ export class FileService {
|
||||
this.toastService.badRequest("Não foi possível adicionar a fotografia!");
|
||||
});
|
||||
|
||||
}, (err) => {
|
||||
this.toastService.badRequest("Não foi possível adicionar a fotografia!");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
addPictureToChatMobile(roomId) {
|
||||
alert('Here')
|
||||
async addPictureToChatMobile(roomId) {
|
||||
|
||||
const options: CameraOptions = {
|
||||
const capturedImage = await Camera.getPhoto({
|
||||
quality: 90,
|
||||
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
|
||||
destinationType: this.camera.DestinationType.DATA_URL,
|
||||
encodingType: this.camera.EncodingType.JPEG,
|
||||
mediaType: this.camera.MediaType.PICTURE,
|
||||
targetWidth: 720,
|
||||
targetHeight: 720,
|
||||
correctOrientation: true
|
||||
}
|
||||
// allowEditing: true,
|
||||
resultType: CameraResultType.Uri,
|
||||
source: CameraSource.Photos
|
||||
|
||||
this.camera.getPicture(options).then((imageData) => {
|
||||
let base64Image = 'data:image/jpeg;base64,' + imageData;
|
||||
this.capturedImage = imageData;
|
||||
});
|
||||
const response = await fetch(capturedImage.webPath!);
|
||||
const blob = await response.blob();
|
||||
|
||||
this.photos.unshift({
|
||||
filepath: "soon...",
|
||||
webviewPath: capturedImage.webPath
|
||||
});
|
||||
|
||||
this.capturedImage = await this.convertBlobToBase64(blob);
|
||||
this.capturedImageTitle = new Date().getTime() + '.jpeg';
|
||||
|
||||
//const loader = this.toastService.loading();
|
||||
@@ -161,21 +171,12 @@ export class FileService {
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
console.log(this.capturedImage)
|
||||
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
//loader.remove();
|
||||
//console.log(res);
|
||||
},(error) => {
|
||||
//loader.remove();
|
||||
});
|
||||
|
||||
|
||||
}, (err) => {
|
||||
//console.log(err);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
addPictureToChat(roomId) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { BehaviorSubject, Observable } from 'rxjs'
|
||||
import { Platform } from '@ionic/angular'
|
||||
import { Network } from '@capacitor/network';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -9,20 +10,19 @@ import { Platform } from '@ionic/angular'
|
||||
export class NetworkConnectionService {
|
||||
online: boolean = true;
|
||||
|
||||
constructor(){}
|
||||
|
||||
checkOnline() {
|
||||
window.addEventListener('online', (on) => {
|
||||
this.online === true;
|
||||
console.log('Became online');
|
||||
constructor(){
|
||||
Network.addListener('networkStatusChange', status => {
|
||||
console.log('Network status changed', status);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
checkOffline() {
|
||||
window.addEventListener('offline', (off) => {
|
||||
this.online === false;
|
||||
console.log('Became offline')
|
||||
});
|
||||
}
|
||||
|
||||
logCurrentNetworkStatus = async () => {
|
||||
const status = await Network.getStatus();
|
||||
|
||||
return status;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -162,220 +162,59 @@ export class NotificationsService {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
async onReceviNotification() {
|
||||
this.fcm.onNotification().subscribe(data => {
|
||||
if (data.click_action) {
|
||||
console.log("Received in background: ", data);
|
||||
|
||||
this.notificatinsRoutes(data)
|
||||
|
||||
} else {
|
||||
console.log("Received in foreground: ", data);
|
||||
|
||||
console.log(data.Service)
|
||||
console.log(data.Object)
|
||||
console.log(data.IdObject)
|
||||
|
||||
this.DataArray.push(data)
|
||||
console.log("On ReceiveNotification", this.DataArray)
|
||||
this.storageService.store("Notifications", this.DataArray)
|
||||
|
||||
|
||||
};
|
||||
});
|
||||
} */
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
/* getTokenByUserIdAndId(user, userID) {
|
||||
const geturl = environment.apiURL + 'notifications/user/' + userID;
|
||||
|
||||
return this.http.get<Token[]>(`${geturl}`);
|
||||
}
|
||||
*/
|
||||
/* getAndpostToken(username) {
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
//console.log('Notifications not supported')
|
||||
} else {
|
||||
|
||||
const geturl = environment.apiURL + 'notifications/token';
|
||||
if(window['WLAuthorizationManager']) {
|
||||
if(window['WLAuthorizationManager'].obtainAccessToken) {
|
||||
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
|
||||
(token) => {
|
||||
console.log('Push Notification: Success ' + token);
|
||||
|
||||
window['MFPPush'].initialize(
|
||||
function (successResponse) {
|
||||
console.log("Push notification Successfully Service intialized: " + successResponse);
|
||||
},
|
||||
function (failureResponse) {
|
||||
console.log("Push notification failure Service intialized: " + failureResponse);
|
||||
}
|
||||
);
|
||||
|
||||
window['MFPPush'].registerDevice(null, async (successResponse) => {
|
||||
console.log("Successfully registered: " + JSON.stringify(successResponse));
|
||||
console.log('token: ', successResponse.deviceId)
|
||||
await this.storageService.store(username, successResponse.deviceId).then((tokennoti) => {
|
||||
console.log('token store',tokennoti)
|
||||
});
|
||||
await this.storageService.get(username).then(value => {
|
||||
console.log('STORAGE TOKEN', value)
|
||||
this.storageService.get(AuthConnstants.USER).then(res => {
|
||||
console.log('USERID', res);
|
||||
const headers = { 'Authorization': SessionStore.user.BasicAuthKey };
|
||||
const body = {
|
||||
UserId: res.UserId,
|
||||
TokenId: successResponse.deviceId,
|
||||
Status: 1,
|
||||
Service: 1
|
||||
};
|
||||
this.http.post<Token>(`${geturl}`, body, { headers }).subscribe(data => {
|
||||
console.log('TOKEN USER MIDLE', data);
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
},
|
||||
function (failureResponse) {
|
||||
console.log("Successfully failue: " + JSON.stringify(failureResponse));
|
||||
}
|
||||
);
|
||||
}, (error) => {
|
||||
console.log('Push notification recived: failure ' + error.responseText);
|
||||
console.log(JSON.stringify(error));
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} */
|
||||
|
||||
tempClearArray() {
|
||||
this.DataArray = new Array;
|
||||
}
|
||||
|
||||
/* async onReceviNotification() {
|
||||
|
||||
if(window['WLAuthorizationManager']) {
|
||||
if(window['WLAuthorizationManager'].obtainAccessToken) {
|
||||
window['WLAuthorizationManager'].obtainAccessToken("push.mobileclient").then(
|
||||
(token) => {
|
||||
console.log('Push Notification: Success ' + token);
|
||||
window['MFPPush'].initialize(
|
||||
function (successResponse) {
|
||||
console.log("Push notification Successfully intialized: " + successResponse);
|
||||
window['MFPPush'].registerNotificationsCallback(notificationReceived);
|
||||
},
|
||||
function (failureResponse) {
|
||||
console.log("Push notification failure intialized: " + failureResponse);
|
||||
}
|
||||
);
|
||||
var notificationReceived = (message) => {
|
||||
//this.jsonstore.createCollection('Notifications',message);
|
||||
this.DataArray.push(message)
|
||||
console.log("On ReceiveNotification", this.DataArray)
|
||||
this.storageService.store("Notifications",this.DataArray)
|
||||
|
||||
console.log(message);
|
||||
this.eventtrigger.publishSomeData({
|
||||
notification: "recive"
|
||||
})
|
||||
var data = JSON.parse(message.payload);
|
||||
|
||||
//synchro.$send(data)
|
||||
|
||||
console.log('data.Service', data.Service); // module
|
||||
console.log('data.IdObject', data.IdObject); // Object id
|
||||
console.log('data.Object', data.Object); // details
|
||||
|
||||
if(message.actionName){
|
||||
this.notificatinsRoutes(data);
|
||||
} else {
|
||||
/* this.toastService.notificationMessage(message.alert,this.notificatinsRoutes, data);
|
||||
//this.notificatinsRoutes(data);
|
||||
console.log(data)
|
||||
}
|
||||
|
||||
this.callbacks.forEach( e=> {
|
||||
if(e.type == data.Object || e.type == "any") {
|
||||
e.funx()
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}, (error) => {
|
||||
console.log('Push notification recived: failure ' + error.responseText);
|
||||
console.log(JSON.stringify(error));
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} */
|
||||
|
||||
notificatinsRoutes = (notification) => {
|
||||
if (notification.data.Service === "agenda") {
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda', notification.data.IdObject, 'agenda']));
|
||||
}
|
||||
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "expediente") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.data.Service === "agenda" && notification.data.Object === "event-list") {
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', notification.data.IdObject, 'agenda']));
|
||||
} else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "despachos") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', notification.data.IdObject, 'gabinete-digital'], { replaceUrl: true }));
|
||||
}
|
||||
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "parecer") {
|
||||
console.log('Push action performed 2222: ' + JSON.stringify(notification.data));
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.data.IdObject, 'gabinete-digital']));
|
||||
if (notification.notification.data.Service === "agenda" && notification.notification.data.IdObject.length > 10) {
|
||||
console.log("Id Lenght", notification.notification.data.IdObject.length)
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda', notification.notification.data.IdObject, 'agenda']));
|
||||
}
|
||||
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "deferimento") {
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expediente") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.notification.data.Service === "agenda" && notification.notification.data.Object === "event-list") {
|
||||
//this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'agenda']));
|
||||
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', notification.notification.data.IdObject, 'agenda']));
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "despachos-pr") {
|
||||
} else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', notification.data.IdObject, 'gabinete-digital']));
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', notification.notification.data.IdObject, 'gabinete-digital'], { replaceUrl: true }));
|
||||
}
|
||||
else if (notification.data.Service === "accoes" && notification.data.Object === "accao") {
|
||||
this.zone.run(() => this.router.navigate(['/home/publications', notification.data.IdObject]));
|
||||
}
|
||||
else if (notification.data.Service === "accoes" && notification.data.Object === "publicacao") {
|
||||
this.zone.run(() => this.router.navigate(['/home/publications/view-publications', notification.data.FolderId, notification.data.IdObject]));
|
||||
}
|
||||
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "diplomas") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "diplomas-assinar") {
|
||||
let navigationExtras: NavigationExtras = {
|
||||
queryParams: {
|
||||
"serialNumber": notification.data.IdObject,
|
||||
}
|
||||
};
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar/diploma-assinar'], navigationExtras));
|
||||
}
|
||||
else if (notification.data.Service === "gabinete-digital" && notification.data.Object === "expedientes-pr") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
}
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "parecer") {
|
||||
|
||||
platformVerify() {
|
||||
|
||||
if (this.platform.is('cordova')) {
|
||||
} else {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "deferimento") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos-pr") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "accao") {
|
||||
this.zone.run(() => this.router.navigate(['/home/publications', notification.notification.data.IdObject]));
|
||||
}
|
||||
else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "publicacao") {
|
||||
this.zone.run(() => this.router.navigate(['/home/publications/view-publications', notification.notification.data.FolderId, notification.data.IdObject]));
|
||||
}
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas-assinar") {
|
||||
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes-pr") {
|
||||
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.IdObject, 'gabinete-digital']));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user