git pull made

This commit is contained in:
Eudes Inácio
2024-04-09 11:51:46 +01:00
8 changed files with 60 additions and 73 deletions
@@ -75,7 +75,7 @@
</div> </div>
</div> </div>
<div class="ion-item-container-no-border pt-10"> <div *ngIf="!intent" class="ion-item-container-no-border pt-10">
<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' "
@@ -90,7 +90,7 @@
</ion-label> </ion-label>
</div> </div>
<div class="ion-item-container-no-border pt-10"> <div *ngIf="!intent" class="ion-item-container-no-border pt-10">
<ion-label (click)="startVideoRecording()"> <ion-label (click)="startVideoRecording()">
<div class="attach-icon"> <div class="attach-icon">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " <ion-icon *ngIf="ThemeService.currentTheme == 'default' "
@@ -105,7 +105,7 @@
</ion-label> </ion-label>
</div> </div>
<div class="ion-item-container-no-border"> <div *ngIf="!intent" class="ion-item-container-no-border">
<ion-label (click)="loadVideo()" class="cursor-pointer"> <ion-label (click)="loadVideo()" class="cursor-pointer">
<div class="attach-icon"> <div class="attach-icon">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " <ion-icon *ngIf="ThemeService.currentTheme == 'default' "
@@ -14,7 +14,7 @@ import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ThemePalette } from '@angular/material/core'; import { ThemePalette } from '@angular/material/core';
import { formatDate } from 'src/plugin/momentG.js' import { formatDate } from 'src/plugin/momentG.js'
import { ThemeService } from 'src/app/services/theme.service'; import { ThemeService } from 'src/app/services/theme.service';
import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera'; import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
import { Filesystem, Directory, Encoding, FilesystemDirectory, FilesystemEncoding } from '@capacitor/filesystem'; import { Filesystem, Directory, Encoding, FilesystemDirectory, FilesystemEncoding } from '@capacitor/filesystem';
import { NgxImageCompressService } from "ngx-image-compress"; import { NgxImageCompressService } from "ngx-image-compress";
@@ -235,40 +235,9 @@ export class ViewPublicationsPage implements OnInit {
this.showLoader = true; this.showLoader = true;
const folderId = this.folderId const folderId = this.folderId
try { await this.publicationFolderService.getPublicationsIds(folderId)
const publicationIds = await this.publications.GetPublicationsList(folderId).toPromise();
this.createPublicationList(folderId) this.showLoader = false;
let loadLater = []
for (let publicationId of publicationIds) {
if (!this.publicationIsPresent(publicationId, folderId)) {
await this.loadPublication(publicationId, folderId)
} else {
loadLater.push(publicationId)
}
}
for (let publicationId of loadLater) {
await this.loadPublication(publicationId, folderId)
}
for (let localPublication of this.publicationFolderService.publicationList[folderId]) {
const apiPublication = publicationIds.includes(localPublication.DocumentId)
if (!apiPublication) {
this.publicationFolderService.deletePost(folderId, localPublication.DocumentId)
}
}
this.showLoader = false;
this.storage.set(folderId, this.publicationFolderService.publicationList[folderId]);
this.getpublication = this.publicationFolderService.publicationList[folderId];
} catch (error) {
this.showLoader = false;
}
} }
@@ -415,4 +384,3 @@ export class ViewPublicationsPage implements OnInit {
this.swiperIndex = this.swiperRef?.nativeElement.swiper.activeIndex; this.swiperIndex = this.swiperRef?.nativeElement.swiper.activeIndex;
} }
} }
@@ -64,7 +64,7 @@
</div> </div>
<ion-img *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'image'" <ion-img *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'image'"
name="image" ngDefaultControl [src]="'data:image/jpg;base64,' + seleted.Base64" style="height: 69px; width: 69px;"></ion-img> name="image" ngDefaultControl [src]="seleted.url" style="height: 69px; width: 69px;"></ion-img>
<video class="sdf" *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' " width="70" height="70" <video class="sdf" *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' " width="70" height="70"
preload="metadata" webkit-playsinline="webkit-playsinline"> preload="metadata" webkit-playsinline="webkit-playsinline">
@@ -321,7 +321,7 @@ export class NewPublicationPage implements OnInit {
FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/')) as any FileType: this.checkFileType.checkFileType( this.removeTextBeforeSlash(element.mimeType, '/')) as any
}) })
/* fileObject.needUpload() */ fileObject.needUpload()
this.PublicationFromMvService.form.Files.push(fileObject) this.PublicationFromMvService.form.Files.push(fileObject)
}) })
.catch((err) => console.error(err)); .catch((err) => console.error(err));
@@ -380,6 +380,7 @@ export class NewPublicationPage implements OnInit {
close() { close() {
this.PublicationFromMvService.form.cancel = true
if(this.PublicationFromMvService.form.send == false) { if(this.PublicationFromMvService.form.send == false) {
this.PublicationFromMvService.cancel() this.PublicationFromMvService.cancel()
this.PublicationFromMvService.ObjectMergeNotification.close() this.PublicationFromMvService.ObjectMergeNotification.close()
@@ -765,38 +766,48 @@ console.log(stringGerada);
return stringAleatoria; return stringAleatoria;
} }
async showCroppModal() { async showCroppModal() {
const modal = await this.modalController.create({
component: CropImagePage,
componentProps: {
base64ToCroppe: this.capturedImage
},
cssClass: 'modal modal-desktop'
});
modal.onDidDismiss().then((res) => { const modal = await this.modalController.create({
if (res) { component: CropImagePage,
this.capturedImage = res.data componentProps: {
this.filecontent = true; base64ToCroppe: this.capturedImage
this.photoOrVideo = false; },
cssClass: 'modal modal-desktop'
});
const newAttachment = new PublicationAttachmentEntity( modal.onDidDismiss().then((res) => {
{ if (res) {
base64: res.data.base64ToCroppe, this.capturedImage = res.data
extension: 'jpeg', this.filecontent = true;
OriginalFileName: "image", this.photoOrVideo = false;
FileType: 'image'
}
)
this.PublicationFromMvService.form.Files.push(newAttachment) const newAttachment = new PublicationAttachmentEntity(
} {
}, (error) => { base64: res.data.base64ToCroppe,
console.log(error) extension: 'jpeg',
}); OriginalFileName: "image",
FileType: 'image'
}
)
await modal.present(); this.PublicationFromMvService.form.Files.push(newAttachment)
} }
}, (error) => {
console.log(error)
});
await modal.present();
// let fileObject = new PublicationAttachmentEntity({
// base64: this.removeTextBeforeSlash(this.capturedImage, ',') ,
// extension: 'jpeg',
// OriginalFileName: 'video',
// FileType: 'image'
// })
// this.PublicationFromMvService.form.Files.push(fileObject)
}
} }
@@ -203,7 +203,7 @@ export class PublicationFromMvService {
publication.DocumentId = null; publication.DocumentId = null;
publication.ProcessId = this.folderId publication.ProcessId = this.folderId
if(this.form.cancel == false) { if(this.form.cancel == true) {
window['upload-header-set-remove'](this.id); window['upload-header-set-remove'](this.id);
return false return false
} }
@@ -211,7 +211,6 @@ export class PublicationFromMvService {
try { try {
await this.publications.CreatePublication(publication.ProcessId, publication).toPromise() await this.publications.CreatePublication(publication.ProcessId, publication).toPromise()
if (this.publicationType == '1') { if (this.publicationType == '1') {
this.httpErroHandle.httpsSucessMessagge('Criar publicação') this.httpErroHandle.httpsSucessMessagge('Criar publicação')
} else if (this.publicationType == '2') { } else if (this.publicationType == '2') {
+10 -1
View File
@@ -131,6 +131,15 @@ export class PublicationFolderService {
await this.loadPublication(publicationId, folderId) await this.loadPublication(publicationId, folderId)
} }
for (let localPublication of this.publicationList[folderId]) {
const apiPublication = publicationIds.includes(localPublication.DocumentId)
if (!apiPublication) {
this.deletePost(folderId, localPublication.DocumentId)
}
}
this.showLoader = false; this.showLoader = false;
this.storage.set(folderId, this.publicationList[folderId]); this.storage.set(folderId, this.publicationList[folderId]);
@@ -161,7 +170,7 @@ export class PublicationFolderService {
if (JSON.stringify(a) != JSON.stringify(b)) { if (JSON.stringify(a) != JSON.stringify(b)) {
// console.log({a, b}) console.log({a, b})
this.publicationList[folderId][findIndex] = publicationDetails this.publicationList[folderId][findIndex] = publicationDetails
} else { } else {
// console.log({publicationDetails}) // console.log({publicationDetails})
+1 -1
View File
@@ -4,4 +4,4 @@ import { environment as oaprProd } from './suport/oapr'
import { DevDev } from './suport/dev' import { DevDev } from './suport/dev'
export const environment: Environment = oaprProd; export const environment: Environment = DevDev;