mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
changes and changes
This commit is contained in:
@@ -42,7 +42,6 @@
|
|||||||
<!-- Depending on your project, you can add here the type of data you wish to receive -->
|
<!-- Depending on your project, you can add here the type of data you wish to receive -->
|
||||||
<data android:mimeType="text/plain" />
|
<data android:mimeType="text/plain" />
|
||||||
<data android:mimeType="image/*" />
|
<data android:mimeType="image/*" />
|
||||||
<data android:mimeType="application/*" />
|
|
||||||
<data android:mimeType="video/*" />
|
<data android:mimeType="video/*" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ export class HomePage implements OnInit {
|
|||||||
App.addListener('appStateChange', ({ isActive }) => {
|
App.addListener('appStateChange', ({ isActive }) => {
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
sendIntent.setRouteService(this.router)
|
sendIntent.setRouteService(this.router)
|
||||||
this.checkSendIntentReceived();
|
/* this.checkSendIntentReceived(); */
|
||||||
console.log('App is in the foreground');
|
console.log('App is in the foreground');
|
||||||
/* this.checkSendIntentReceived() */
|
/* this.checkSendIntentReceived() */
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -32,15 +32,25 @@
|
|||||||
|
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<ion-thumbnail slot="start">
|
<ion-thumbnail *ngFor="let seleted of seletedContent.slice(0, displayLimit), let i = index" lot="start">
|
||||||
|
|
||||||
<ion-img *ngIf="fileType == 'image/jpeg'" [(ngModel)]="capturedImage" name="image" ngDefaultControl [src]="capturedImage" (click)="imageSize(capturedImage)" ></ion-img>
|
<ion-img *ngIf="checkFileType.checkFileType(seleted.fileType) == 'image'" [(ngModel)]="capturedImage"
|
||||||
|
name="image" ngDefaultControl [src]="'data:image/jpg;base64,' + seleted.base64"
|
||||||
|
(click)="imageSize(capturedImage)"></ion-img>
|
||||||
|
|
||||||
<video *ngIf="fileType == 'video'" width="70" height="70" controls="controls" preload="metadata" autoplay="autoplay" webkit-playsinline="webkit-playsinline">
|
<video *ngIf="checkFileType.checkFileType(seleted.fileType) == 'video'" width="70" height="70"
|
||||||
<source type="video/mp4" [src]="capturedVideo">
|
controls="controls" preload="metadata" autoplay="autoplay" webkit-playsinline="webkit-playsinline">
|
||||||
|
<source type="video/mp4" [src]="'data:video/mp4;base64,' + capturedVideo">
|
||||||
</video>
|
</video>
|
||||||
|
|
||||||
</ion-thumbnail>
|
</ion-thumbnail>
|
||||||
|
<!-- Display the blurred image and count if there are more images -->
|
||||||
|
<ion-thumbnail *ngIf="seletedContent.length > displayLimit" lot="start">
|
||||||
|
<ion-img [src]="'data:image/jpg;base64,' + seletedContent[displayLimit - 1].base64"
|
||||||
|
style="filter: blur(5px);"></ion-img>
|
||||||
|
|
||||||
|
<p>mais {{ seletedContent.length - displayLimit }}</p>
|
||||||
|
</ion-thumbnail>
|
||||||
<ion-label class="pl-10">
|
<ion-label class="pl-10">
|
||||||
<p>{{capturedImageTitle}}</p>
|
<p>{{capturedImageTitle}}</p>
|
||||||
<p hidden>size</p>
|
<p hidden>size</p>
|
||||||
@@ -88,7 +98,7 @@
|
|||||||
<button id="container-multiselect" class="multiselect-button" (click)="startVideoRecording()">Video</button>
|
<button id="container-multiselect" class="multiselect-button" (click)="startVideoRecording()">Video</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div *ngIf="photoOrVideo" class="ion-item-container-no-border">
|
<!-- <div *ngIf="photoOrVideo" class="ion-item-container-no-border">
|
||||||
<ion-label (click)="takePicture()">
|
<ion-label (click)="takePicture()">
|
||||||
<div class="attach-icon">
|
<div class="attach-icon">
|
||||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' "
|
<ion-icon *ngIf="ThemeService.currentTheme == 'default' "
|
||||||
|
|||||||
@@ -66,9 +66,28 @@ ion-toolbar{
|
|||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
width: 40%;
|
width: 40%;
|
||||||
border: groove;
|
border: groove;
|
||||||
|
color: #000;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.blur-overlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background: rgba(255, 255, 255, 0.7); /* Adjust the opacity as needed */
|
||||||
|
}
|
||||||
|
|
||||||
|
.blur-overlay p {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
.container button:last-child {
|
.container button:last-child {
|
||||||
--border-radius: 50px;
|
--border-radius: 50px;
|
||||||
width: 40%;
|
width: 40%;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import { CaptureError, CaptureImageOptions, MediaCapture, MediaFile } from '@awe
|
|||||||
import { Capacitor } from '@capacitor/core';
|
import { Capacitor } from '@capacitor/core';
|
||||||
import { File } from '@ionic-native/file/ngx';
|
import { File } from '@ionic-native/file/ngx';
|
||||||
import { Media } from '@ionic-native/media/ngx';
|
import { Media } from '@ionic-native/media/ngx';
|
||||||
|
import { checkFileTypeService } from 'src/app/services/checkFileType.service';
|
||||||
const config = {
|
const config = {
|
||||||
quality: 0.5,
|
quality: 0.5,
|
||||||
maxWidth: 800,
|
maxWidth: 800,
|
||||||
@@ -111,6 +111,9 @@ export class NewPublicationPage implements OnInit {
|
|||||||
photoOrVideo: boolean = false;
|
photoOrVideo: boolean = false;
|
||||||
fileType = "";
|
fileType = "";
|
||||||
filecontent: boolean;
|
filecontent: boolean;
|
||||||
|
seletedContent: any[] = []
|
||||||
|
// Set a limit for the number of images to display
|
||||||
|
displayLimit = 4;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private modalController: ModalController,
|
private modalController: ModalController,
|
||||||
@@ -126,7 +129,8 @@ export class NewPublicationPage implements OnInit {
|
|||||||
public PublicationFolderService: PublicationFolderService,
|
public PublicationFolderService: PublicationFolderService,
|
||||||
private RouteService: RouteService,
|
private RouteService: RouteService,
|
||||||
public FileService: FileService,
|
public FileService: FileService,
|
||||||
private mediaCapture: MediaCapture
|
private mediaCapture: MediaCapture,
|
||||||
|
public checkFileType: checkFileTypeService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.publicationType = this.navParams.get('publicationType');
|
this.publicationType = this.navParams.get('publicationType');
|
||||||
@@ -142,7 +146,27 @@ export class NewPublicationPage implements OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (this.intent) {
|
if (this.intent) {
|
||||||
this.filecontent = true
|
this.filecontent = true
|
||||||
this.capturedImage = 'data:image/jpeg;base64,' + this.intent;
|
console.log(this.intent)
|
||||||
|
if (this.checkFileType.checkFileType(this.intent.type) == 'image') {
|
||||||
|
this.fileType = 'image'
|
||||||
|
let resultUrl = decodeURIComponent(this.intent.url);
|
||||||
|
Filesystem.readFile({ path: resultUrl }).then(async (content) => {
|
||||||
|
this.capturedImage = 'data:image/jpeg;base64,' + content.data;
|
||||||
|
console.log(this.capturedImage)
|
||||||
|
})
|
||||||
|
} else if (this.checkFileType.checkFileType(this.intent.type) == 'video') {
|
||||||
|
this.fileType = 'video'
|
||||||
|
let resultUrl = decodeURIComponent(this.intent.url);
|
||||||
|
Filesystem.readFile({ path: resultUrl }).then(async (content) => {
|
||||||
|
this.capturedVideo = "data:video/mp4;base64," + content.data;
|
||||||
|
console.log(this.capturedVideo)
|
||||||
|
})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.httpErrorHandle.validationMessagge('filetype');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setTitle();
|
this.setTitle();
|
||||||
@@ -171,7 +195,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
|
|
||||||
this.capturedImage = 'data:image/jpeg;base64,' + capturedImage.base64String;
|
this.capturedImage = 'data:image/jpeg;base64,' + capturedImage.base64String;
|
||||||
this.capturedImageTitle = 'foto';
|
this.capturedImageTitle = 'foto';
|
||||||
this.fileType = "image/jpeg"
|
this.fileType = "image"
|
||||||
|
|
||||||
const compressedImage = await this.compressImageBase64(
|
const compressedImage = await this.compressImageBase64(
|
||||||
this.capturedImage,
|
this.capturedImage,
|
||||||
@@ -211,7 +235,7 @@ export class NewPublicationPage implements OnInit {
|
|||||||
|
|
||||||
async startVideoRecording() {
|
async startVideoRecording() {
|
||||||
try {
|
try {
|
||||||
let options: CaptureImageOptions = { limit: 1 }
|
let options: CaptureImageOptions = { limit: 5 }
|
||||||
const data = await this.mediaCapture.captureVideo(options)
|
const data = await this.mediaCapture.captureVideo(options)
|
||||||
this.video = data[0];
|
this.video = data[0];
|
||||||
console.log(data)
|
console.log(data)
|
||||||
@@ -269,21 +293,31 @@ export class NewPublicationPage implements OnInit {
|
|||||||
({
|
({
|
||||||
multiple: true,
|
multiple: true,
|
||||||
});
|
});
|
||||||
let resultUrl = decodeURIComponent(result.files[0].path);
|
result.files.forEach(element => {
|
||||||
this.fileType = result.files[0].mimeType
|
|
||||||
Filesystem.readFile({ path: resultUrl })
|
|
||||||
|
|
||||||
.then(async (content) => {
|
let resultUrl = decodeURIComponent(element.path);
|
||||||
console.log(result)
|
this.fileType = element.mimeType
|
||||||
console.log(content)
|
Filesystem.readFile({ path: resultUrl })
|
||||||
this.filecontent = true;
|
|
||||||
if (this.fileType == "video/mp4") {
|
.then(async (content) => {
|
||||||
this.capturedVideo = "data:video/mp4;base64," + content.data;
|
console.log(result)
|
||||||
} else if (this.fileType == "image/jpg") {
|
console.log(content)
|
||||||
this.capturedVideo = "data:image/jpg;base64," + content.data;
|
this.filecontent = true;
|
||||||
}
|
let fileObject = {
|
||||||
})
|
base64: content.data,
|
||||||
.catch((err) => console.error(err));
|
fileType: this.fileType
|
||||||
|
}
|
||||||
|
this.seletedContent.push(fileObject)
|
||||||
|
|
||||||
|
if (this.fileType == "video") {
|
||||||
|
this.capturedVideo = "data:video/mp4;base64," + content.data;
|
||||||
|
} else if (this.fileType == "image") {
|
||||||
|
this.capturedVideo = "data:image/jpg;base64," + content.data;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => console.error(err));
|
||||||
|
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -208,7 +208,8 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async loadPublication(publicationId, folderId) {
|
async loadPublication(publicationId, folderId) {
|
||||||
let Publication = await this.publications.GetPublicationById(publicationId).toPromise();
|
let Publication = await this.publications.GetPublicationWithArrayOfFilesById(publicationId).toPromise();
|
||||||
|
console.log('Publications with array of file: ', Publication)
|
||||||
let publicationDetails: Publication = this.publicationPipe.itemList(Publication)
|
let publicationDetails: Publication = this.publicationPipe.itemList(Publication)
|
||||||
|
|
||||||
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
||||||
|
|||||||
@@ -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,7 +17,7 @@ export class HttpErrorHandle {
|
|||||||
) {
|
) {
|
||||||
case 0:
|
case 0:
|
||||||
const result = await this.backgroundService.offline()
|
const result = await this.backgroundService.offline()
|
||||||
if(result) {
|
if (result) {
|
||||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ export class HttpErrorHandle {
|
|||||||
) {
|
) {
|
||||||
case 0:
|
case 0:
|
||||||
const result = await this.backgroundService.offline()
|
const result = await this.backgroundService.offline()
|
||||||
if(result) {
|
if (result) {
|
||||||
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -93,12 +93,15 @@ export class HttpErrorHandle {
|
|||||||
case 'diplomaAsDraft':
|
case 'diplomaAsDraft':
|
||||||
this.toastService._badRequest('Este diploma não contem um draft para ser assinado!')
|
this.toastService._badRequest('Este diploma não contem um draft para ser assinado!')
|
||||||
break;
|
break;
|
||||||
|
case 'filetype':
|
||||||
|
this.toastService._badRequest('Formato de ficheiro inválido!')
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
this.toastService._badRequest('')
|
this.toastService._badRequest('')
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
httpsSucessMessagge(service: string, callback?: any) {
|
httpsSucessMessagge(service: string, callback?: any) {
|
||||||
switch (service) {
|
switch (service) {
|
||||||
@@ -210,7 +213,7 @@ export class HttpErrorHandle {
|
|||||||
case 'Draft Concluído':
|
case 'Draft Concluído':
|
||||||
this.toastService._successMessage('Documento Concluído!');
|
this.toastService._successMessage('Documento Concluído!');
|
||||||
break;
|
break;
|
||||||
case 'new event to aprove':
|
case 'new event to aprove':
|
||||||
this.toastService._successMessage('Enviado para os eventos para aprovação!');
|
this.toastService._successMessage('Enviado para os eventos para aprovação!');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -150,6 +150,19 @@ export class PublicationsService {
|
|||||||
return this.http.get<any>(`${geturl}`, options);
|
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
|
// my own tries
|
||||||
|
|
||||||
GetPublicationByIdNext( publicationId:any){
|
GetPublicationByIdNext( publicationId:any){
|
||||||
|
|||||||
@@ -36,13 +36,9 @@ export class SendIntentService {
|
|||||||
|
|
||||||
|
|
||||||
private onReceive = this.callbackScheduler.function<any>((result)=> {
|
private onReceive = this.callbackScheduler.function<any>((result)=> {
|
||||||
let resultUrl = decodeURIComponent(result.url);
|
this.Router.navigateByUrl("/home/publications");
|
||||||
Filesystem.readFile({path: resultUrl}).then(async (content) => {
|
|
||||||
|
|
||||||
this.Router.navigateByUrl("/home/publications");
|
window["sharedContent"] = result;
|
||||||
|
|
||||||
window["sharedContent"] = content.data;
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ export class PublicationFolderService {
|
|||||||
|
|
||||||
|
|
||||||
async loadPublication(publicationId, folderId) {
|
async loadPublication(publicationId, folderId) {
|
||||||
let Publication = await this.publications.GetPublicationById(publicationId).toPromise();
|
let Publication = await this.publications.GetPublicationWithArrayOfFilesById(publicationId).toPromise();
|
||||||
let publicationDetails: Publication = this.publicationPipe.itemList(Publication)
|
let publicationDetails: Publication = this.publicationPipe.itemList(Publication)
|
||||||
|
|
||||||
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
const findIndex = this.publicationFindIndex(publicationId, folderId)
|
||||||
|
|||||||
Reference in New Issue
Block a user