mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
changes and changes
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { checkFileTypeService } from './checkFileType.service';
|
||||
|
||||
describe('checkFileTypeService', () => {
|
||||
let service: checkFileTypeService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(checkFileTypeService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class checkFileTypeService {
|
||||
|
||||
constructor(private router: Router) {
|
||||
|
||||
}
|
||||
|
||||
checkFileType(fileType) {
|
||||
// Convert to lowercase to handle case-insensitivity
|
||||
const lowerCaseType = fileType.toLowerCase();
|
||||
|
||||
// Define image and video extensions/types
|
||||
const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp','tiff','tif',
|
||||
'image/jpg', 'image/jpeg', 'image/png', 'image/gif', 'image/bmp','image/tiff','image/tif', 'image/*']; // Add more if needed
|
||||
const videoExtensions = ['mp4', 'webm', 'mpg', 'mpeg', 'ogg',
|
||||
'video/mp4', 'video/webm', 'video/mpg', 'video/mpeg', 'video/ogg', 'video/*']; // Add more if needed
|
||||
|
||||
// Check if it's an image
|
||||
if (imageExtensions.includes(lowerCaseType)) {
|
||||
return 'image';
|
||||
}
|
||||
|
||||
// Check if it's a video
|
||||
if (videoExtensions.includes(lowerCaseType)) {
|
||||
return 'video';
|
||||
}
|
||||
|
||||
// If it's neither image nor video
|
||||
return 'null';
|
||||
}
|
||||
}
|
||||
@@ -17,12 +17,12 @@ export class HttpErrorHandle {
|
||||
) {
|
||||
case 0:
|
||||
const result = await this.backgroundService.offline()
|
||||
if(result) {
|
||||
if (result) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 400:
|
||||
this.toastService._badRequest('Lamentamos, mas houve um problema com sua solicitação. Por favor, tente novamente')
|
||||
@@ -55,12 +55,12 @@ export class HttpErrorHandle {
|
||||
) {
|
||||
case 0:
|
||||
const result = await this.backgroundService.offline()
|
||||
if(result) {
|
||||
if (result) {
|
||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 400:
|
||||
this.toastService._badRequest('Lamentamos, mas houve um problema com sua solicitação. Por favor, tente novamente')
|
||||
@@ -93,12 +93,15 @@ export class HttpErrorHandle {
|
||||
case 'diplomaAsDraft':
|
||||
this.toastService._badRequest('Este diploma não contem um draft para ser assinado!')
|
||||
break;
|
||||
|
||||
default:
|
||||
this.toastService._badRequest('')
|
||||
break;
|
||||
}
|
||||
case 'filetype':
|
||||
this.toastService._badRequest('Formato de ficheiro inválido!')
|
||||
break;
|
||||
|
||||
default:
|
||||
this.toastService._badRequest('')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
httpsSucessMessagge(service: string, callback?: any) {
|
||||
switch (service) {
|
||||
@@ -210,7 +213,7 @@ export class HttpErrorHandle {
|
||||
case 'Draft Concluído':
|
||||
this.toastService._successMessage('Documento Concluído!');
|
||||
break;
|
||||
case 'new event to aprove':
|
||||
case 'new event to aprove':
|
||||
this.toastService._successMessage('Enviado para os eventos para aprovação!');
|
||||
break;
|
||||
|
||||
|
||||
@@ -149,6 +149,19 @@ export class PublicationsService {
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
GetPublicationWithArrayOfFilesById( publicationId:any){
|
||||
const geturl = environment.apiURL + 'presidentialActions/v2/posts/'+ publicationId;
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("id", publicationId);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
// my own tries
|
||||
|
||||
|
||||
@@ -36,13 +36,9 @@ export class SendIntentService {
|
||||
|
||||
|
||||
private onReceive = this.callbackScheduler.function<any>((result)=> {
|
||||
let resultUrl = decodeURIComponent(result.url);
|
||||
Filesystem.readFile({path: resultUrl}).then(async (content) => {
|
||||
this.Router.navigateByUrl("/home/publications");
|
||||
|
||||
this.Router.navigateByUrl("/home/publications");
|
||||
|
||||
window["sharedContent"] = content.data;
|
||||
})
|
||||
window["sharedContent"] = result;
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user