mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
solved
This commit is contained in:
+1
-1
@@ -62,7 +62,7 @@
|
||||
"@capacitor/push-notifications": "^5.1.0",
|
||||
"@capacitor/share": "^4.1.0",
|
||||
"@capacitor/storage": "^1.2.5",
|
||||
"@capawesome/capacitor-file-picker": "^5.1.1",
|
||||
"@capawesome/capacitor-file-picker": "^5.3.0",
|
||||
"@fortawesome/angular-fontawesome": "^0.9.0",
|
||||
"@fortawesome/fontawesome-free": "^5.15.3",
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.35",
|
||||
|
||||
+2
@@ -479,6 +479,8 @@ export class DiplomaAssinarPage implements OnInit {
|
||||
try {
|
||||
const resd = await this.processes.GetDraftByID(strg).toPromise();
|
||||
|
||||
console.log('DRAFT FFF',resd)
|
||||
|
||||
let object = {
|
||||
"ApplicationId": "",
|
||||
"Assunto": resd.data.description,
|
||||
|
||||
@@ -537,6 +537,7 @@ export class DiplomaPage implements OnInit {
|
||||
console.log('List of ids', strg)
|
||||
const resd = await this.processes.GetDraftByID(strg).toPromise()
|
||||
|
||||
console.log('DRAFT FFF',resd)
|
||||
let object = {
|
||||
"ApplicationId": "",
|
||||
"Assunto": resd.data.description,
|
||||
|
||||
@@ -195,7 +195,8 @@ export class NewPublicationPage implements OnInit {
|
||||
this.photoOrVideo = false;
|
||||
let fileObject = {
|
||||
FileBase64: this.removeTextBeforeSlash(picture, ','),
|
||||
FileExtension: capturedImage.format
|
||||
FileExtension: capturedImage.format,
|
||||
OriginalFileName: 'image'
|
||||
}
|
||||
this.seletedContent.push(fileObject)
|
||||
|
||||
@@ -253,7 +254,7 @@ export class NewPublicationPage implements OnInit {
|
||||
let fileObject = {
|
||||
FileBase64: content.data,
|
||||
FileExtension: 'mp4',
|
||||
OriginalFileName: 'record'
|
||||
OriginalFileName: 'video'
|
||||
}
|
||||
this.seletedContent.push(fileObject)
|
||||
})
|
||||
@@ -293,7 +294,8 @@ export class NewPublicationPage implements OnInit {
|
||||
this.filecontent = true;
|
||||
let fileObject = {
|
||||
FileBase64: content.data,
|
||||
FileExtension: this.removeTextBeforeSlash(element.mimeType, '/')
|
||||
FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
||||
OriginalFileName: 'video'
|
||||
}
|
||||
this.seletedContent.push(fileObject)
|
||||
})
|
||||
@@ -485,7 +487,7 @@ export class NewPublicationPage implements OnInit {
|
||||
Title: this.pub.Title,
|
||||
Message: this.pub.Message,
|
||||
DatePublication: date,
|
||||
OriginalFileName: this.capturedImageTitle,
|
||||
OriginalFileName: this.capturedImageTitle || 'foto',
|
||||
Files: this.seletedContent,
|
||||
/* FileExtension: 'jpeg', */
|
||||
}
|
||||
@@ -513,6 +515,7 @@ export class NewPublicationPage implements OnInit {
|
||||
this.close();
|
||||
this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
|
||||
window["sharedContent"] = null;
|
||||
window["endSharedContent"] = null;
|
||||
|
||||
this.close();
|
||||
} catch (error) {
|
||||
|
||||
@@ -81,7 +81,7 @@ export class PublicationsPage implements OnInit {
|
||||
) {
|
||||
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
||||
|
||||
this.intent = window["sharedContent"]
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -218,6 +218,8 @@ GetIdsPublicationNext(id:any){
|
||||
//my last tries
|
||||
|
||||
CreatePublication(folderId:any,body:any){
|
||||
|
||||
|
||||
console.log('body publi', body)
|
||||
const geturl = environment.apiURL + 'presidentialActions/'+folderId+'/v2/posts';
|
||||
let params = new HttpParams();
|
||||
@@ -226,6 +228,17 @@ GetIdsPublicationNext(id:any){
|
||||
headers: this.headers,
|
||||
/* params: params */
|
||||
};
|
||||
|
||||
/* this.http.post<any>(`${geturl}`, body, options).subscribe(
|
||||
(resposta) => {
|
||||
console.log('Resposta da solicitação POST:', resposta);
|
||||
},
|
||||
(erro) => {
|
||||
console.error('Erro na solicitação POST:', erro);
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
return this.http.post<any>(`${geturl}`, body, options)
|
||||
}
|
||||
|
||||
|
||||
@@ -70,11 +70,16 @@
|
||||
></mat-progress-bar>
|
||||
</div> -->
|
||||
|
||||
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video'" width="70" height="70"
|
||||
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' && checkDesktop() == true" width="70" height="70"
|
||||
preload="metadata" webkit-playsinline="webkit-playsinline">
|
||||
<source type="video/mp4" [src]="seleted.FileBase64">
|
||||
</video>
|
||||
|
||||
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' && checkTableDivice() == true" width="70" height="70"
|
||||
preload="metadata" webkit-playsinline="webkit-playsinline">
|
||||
<source type="video/mp4" [src]="'data:video/mp4;base64,' +seleted.FileBase64">
|
||||
</video>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
@@ -102,7 +107,7 @@
|
||||
|
||||
|
||||
|
||||
<div style="display: flex;">
|
||||
<div *ngIf="checkTableDivice()" style="display: flex;">
|
||||
<div (click)="chossePhotoOrVideo()">
|
||||
<div class="attach-icon">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' "
|
||||
@@ -122,7 +127,21 @@
|
||||
<button id="container-multiselect" class="multiselect-button" (click)="startVideoRecording()">Video</button>
|
||||
</div>
|
||||
|
||||
<div >
|
||||
|
||||
<div *ngIf="checkTableDivice()" >
|
||||
<ion-label (click)="loadVideoTablet()" class="cursor-pointer">
|
||||
<div class="attach-icon">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-add-photos.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' "
|
||||
src="assets/images/theme/gov/icons-add-photos.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="attach-document cursor-pointer">
|
||||
<ion-label>Galeria</ion-label>
|
||||
</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
|
||||
<div *ngIf="checkDesktop()" >
|
||||
<ion-label (click)="loadVideo()" class="cursor-pointer">
|
||||
<div class="attach-icon">
|
||||
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-add-photos.svg"></ion-icon>
|
||||
|
||||
@@ -19,6 +19,7 @@ import { CMAPIService } from "src/app/shared/repository/CMAPI/cmapi.service";
|
||||
import { CaptureError, CaptureImageOptions, MediaCapture, MediaFile } from '@awesome-cordova-plugins/media-capture/ngx';
|
||||
import { Filesystem, Directory, Encoding, FilesystemDirectory } from '@capacitor/filesystem';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { Capacitor } from '@capacitor/core';
|
||||
|
||||
enum ActionType {
|
||||
newRapid = "1",
|
||||
@@ -184,7 +185,8 @@ export class NewPublicationPage implements OnInit {
|
||||
this.photoOrVideo = false;
|
||||
let fileObject = {
|
||||
FileBase64: picture,
|
||||
FileExtension: this.removeTextBeforeSlash('jpeg', '/')
|
||||
FileExtension: this.removeTextBeforeSlash('jpeg', '/'),
|
||||
OriginalFileName: 'imagem'
|
||||
}
|
||||
|
||||
const FileExtension = this.removeTextBeforeSlash('jpeg', '/')
|
||||
@@ -228,7 +230,8 @@ export class NewPublicationPage implements OnInit {
|
||||
).then((picture) => {
|
||||
let fileObject = {
|
||||
FileBase64: picture,
|
||||
FileExtension: this.removeTextBeforeSlash('jpeg', '/')
|
||||
FileExtension: this.removeTextBeforeSlash('jpeg', '/'),
|
||||
OriginalFileName: 'image'
|
||||
}
|
||||
|
||||
const FileExtension = this.removeTextBeforeSlash('jpeg', '/')
|
||||
@@ -260,9 +263,22 @@ export class NewPublicationPage implements OnInit {
|
||||
result.files.forEach(async blobFile => {
|
||||
console.log(blobFile)
|
||||
if (this.checkFileType.checkFileType(blobFile.mimeType) == 'image' || this.checkFileType.checkFileType(blobFile.mimeType) == 'video') {
|
||||
console.log()
|
||||
/* console.log('converte new way',this.getBase64(blobFile)) */
|
||||
|
||||
/* const blob = await fetch(
|
||||
Capacitor.convertFileSrc(blobFile.path)
|
||||
).then(r => r.blob()); */
|
||||
|
||||
/* console.log(await blob.arrayBuffer());
|
||||
|
||||
|
||||
|
||||
console.log("base64 :data:video/mp4;base64,",this.arrayBufferToBase64(await blob.arrayBuffer())) */
|
||||
|
||||
this.convertBlobToBase64(blobFile.blob).then((value) => {
|
||||
|
||||
console.log(value)
|
||||
|
||||
this.filesSizeSum = this.filesSizeSum + blobFile.size
|
||||
if (this.fileSizeToMB(this.filesSizeSum) <= 20) {
|
||||
|
||||
@@ -290,6 +306,8 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
this.httpErroHandle.validationMessagge('filessize');
|
||||
}
|
||||
}).catch((erro) => {
|
||||
console.log(erro)
|
||||
})
|
||||
} else {
|
||||
this.httpErroHandle.validationMessagge('filetype');
|
||||
@@ -297,6 +315,9 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
/* this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String;
|
||||
this.capturedImageTitle = 'foto';
|
||||
|
||||
@@ -320,6 +341,49 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
};
|
||||
|
||||
async loadVideoTablet() {
|
||||
|
||||
const result = await FilePicker.pickMedia
|
||||
({
|
||||
multiple: true,
|
||||
});
|
||||
console.log(result.files)
|
||||
result.files.forEach(element => {
|
||||
|
||||
this.filesSizeSum = this.filesSizeSum + element.size
|
||||
if (this.fileSizeToMB(this.filesSizeSum) <= 20) {
|
||||
if (this.checkFileType.checkFileType(element.mimeType) == 'image' || this.checkFileType.checkFileType(element.mimeType) == 'video') {
|
||||
let resultUrl = decodeURIComponent(element.path);
|
||||
try {
|
||||
Filesystem.readFile({ path: resultUrl })
|
||||
|
||||
.then(async (content) => {
|
||||
console.log(result)
|
||||
console.log(content)
|
||||
this.filecontent = true;
|
||||
let fileObject = new PublicationAttachmentEntity ({
|
||||
base64: content.data,
|
||||
extension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
||||
OriginalFileName: 'video',
|
||||
FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/'))
|
||||
})
|
||||
this.seletedContent.push(fileObject)
|
||||
})
|
||||
.catch((err) => console.error(err));
|
||||
} catch (error) {
|
||||
console.log('upload video error: ', error)
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if (this.seletedContent.length === 0)
|
||||
this.filesSizeSum = 0
|
||||
|
||||
this.httpErrorHandle.validationMessagge('filessize')
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
runValidation() {
|
||||
this.validateFrom = true
|
||||
@@ -551,9 +615,18 @@ export class NewPublicationPage implements OnInit {
|
||||
resolve(reader.result)
|
||||
}
|
||||
reader.readAsDataURL(blob)
|
||||
})
|
||||
},)
|
||||
}
|
||||
|
||||
getBase64(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = () => resolve(reader.result);
|
||||
reader.onerror = error => reject(error);
|
||||
});
|
||||
}
|
||||
|
||||
removeTextBeforeSlash(inputString, mark) {
|
||||
if (inputString.includes(mark)) {
|
||||
const parts = inputString.split(mark);
|
||||
@@ -957,6 +1030,11 @@ export class NewPublicationPage implements OnInit {
|
||||
if (!this.platform.is('desktop'))
|
||||
return true;
|
||||
}
|
||||
|
||||
checkDesktop() {
|
||||
if (this.platform.is('desktop'))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// class UploadFileUseCase {
|
||||
|
||||
Reference in New Issue
Block a user