mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
improve socket
This commit is contained in:
@@ -40,19 +40,23 @@
|
||||
|
||||
|
||||
<ion-img *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'image'" [(ngModel)]="capturedImage"
|
||||
name="image" ngDefaultControl [src]="'data:image/jpg;base64,' + seleted.FileBase64"
|
||||
name="image" ngDefaultControl [src]="'data:image/jpg;base64,' + seleted.Base64"
|
||||
(click)="imageSize(capturedImage)" style="height: 69px;"></ion-img>
|
||||
|
||||
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video'" width="70" height="70"
|
||||
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' && publicationTitle == ActionType.edit" width="70" height="70"
|
||||
controls="controls" preload="metadata" autoplay="autoplay" webkit-playsinline="webkit-playsinline">
|
||||
<source type="video/mp4" [src]="'data:video/mp4;base64,' + seleted.FileBase64">
|
||||
<source type="video/mp4" [src]="'data:video/mp4;base64,' + seleted.Base64">
|
||||
</video>
|
||||
|
||||
<video *ngIf="checkFileType.checkFileType(seleted.FileExtension) == 'video' && publicationTitle != ActionType.edit" width="70" height="70"
|
||||
controls="controls" preload="metadata" autoplay="autoplay" webkit-playsinline="webkit-playsinline">
|
||||
<source type="video/mp4" [src]="seleted.url">
|
||||
</video>
|
||||
|
||||
</div>
|
||||
<!-- 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"
|
||||
<ion-img [src]="'data:image/jpg;base64,' + seletedContent[displayLimit - 1].Base64"
|
||||
style="filter: blur(5px);"></ion-img>
|
||||
|
||||
<p>mais {{ seletedContent.length - displayLimit }}</p>
|
||||
|
||||
@@ -31,6 +31,7 @@ import { File } from '@ionic-native/file/ngx';
|
||||
import { Media } from '@ionic-native/media/ngx';
|
||||
import { checkFileTypeService } from 'src/app/services/checkFileType.service';
|
||||
import { FileValidatorService } from "src/app/services/file/file-validator.service"
|
||||
import { PublicationAttachmentEntity } from 'src/app/shared/publication/upload/upload-streaming.service';
|
||||
const config = {
|
||||
quality: 0.5,
|
||||
maxWidth: 800,
|
||||
@@ -92,6 +93,13 @@ export class NewPublicationPage implements OnInit {
|
||||
publicationTitle: string;
|
||||
imgUrl: any;
|
||||
|
||||
|
||||
ActionType = {
|
||||
newRapid : "1",
|
||||
new: "2",
|
||||
edit: "3"
|
||||
}
|
||||
|
||||
Defaultimage: any = '';
|
||||
|
||||
photo: SafeResourceUrl;
|
||||
@@ -112,7 +120,7 @@ export class NewPublicationPage implements OnInit {
|
||||
photoOrVideo: boolean = false;
|
||||
fileType = "";
|
||||
filecontent: boolean;
|
||||
seletedContent: any[] = []
|
||||
seletedContent: PublicationAttachmentEntity[] = []
|
||||
// Set a limit for the number of images to display
|
||||
displayLimit = 4;
|
||||
filesSizeSum = 0;
|
||||
@@ -142,6 +150,18 @@ export class NewPublicationPage implements OnInit {
|
||||
if (this.publication) {
|
||||
this.seletedContent = this.publication.Files;
|
||||
this.filecontent = true;
|
||||
|
||||
this.seletedContent = this.publication.Files.map(e => {
|
||||
return new PublicationAttachmentEntity(
|
||||
{
|
||||
base64: e.FileBase64,
|
||||
extension: e.FileExtension,
|
||||
OriginalFileName: e.OriginalFileName,
|
||||
FileType: this.checkFileType.checkFileType(e.FileExtension) as any
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
}
|
||||
console.log('Edit', this.publication)
|
||||
this.publicationTitle = 'Nova Publicação';
|
||||
@@ -161,12 +181,16 @@ export class NewPublicationPage implements OnInit {
|
||||
recursive: true
|
||||
});
|
||||
|
||||
document.addEventListener("click", clickOutside, false);
|
||||
function clickOutside(e) {
|
||||
const inside = document.getElementById('container-multiselect').contains(e.target);
|
||||
this.photoOrVideo = false;
|
||||
console.log(this.photoOrVideo)
|
||||
}
|
||||
try {
|
||||
document.addEventListener("click", clickOutside, false);
|
||||
function clickOutside(e) {
|
||||
const inside = document.getElementById('container-multiselect').contains(e.target);
|
||||
this.photoOrVideo = false;
|
||||
console.log(this.photoOrVideo)
|
||||
}
|
||||
} catch (error) {}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// in use
|
||||
@@ -193,11 +217,14 @@ export class NewPublicationPage implements OnInit {
|
||||
console.log('take picture', this.removeTextBeforeSlash(picture, ','),)
|
||||
this.filecontent = true;
|
||||
this.photoOrVideo = false;
|
||||
let fileObject = {
|
||||
FileBase64: this.removeTextBeforeSlash(picture, ','),
|
||||
FileExtension: capturedImage.format,
|
||||
|
||||
const fileObject = new PublicationAttachmentEntity({
|
||||
base64: this.removeTextBeforeSlash(picture, ','),
|
||||
extension: capturedImage.format,
|
||||
FileType: 'image',
|
||||
OriginalFileName: 'image'
|
||||
}
|
||||
})
|
||||
|
||||
this.seletedContent.push(fileObject)
|
||||
|
||||
|
||||
@@ -251,11 +278,14 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
.then(async (content) => {
|
||||
this.filecontent = true;
|
||||
let fileObject = {
|
||||
FileBase64: 'data:video/mp4;base64,'+content.data,
|
||||
FileExtension: 'mp4',
|
||||
OriginalFileName: 'video'
|
||||
}
|
||||
let fileObject = new PublicationAttachmentEntity({
|
||||
base64: 'data:video/mp4;base64,'+content.data,
|
||||
extension: 'mp4',
|
||||
OriginalFileName: 'record',
|
||||
FileType: 'video'
|
||||
|
||||
})
|
||||
|
||||
this.seletedContent.push(fileObject)
|
||||
})
|
||||
.catch((err) => console.error(err));
|
||||
@@ -294,19 +324,30 @@ export class NewPublicationPage implements OnInit {
|
||||
this.filecontent = true;
|
||||
let fileObject;
|
||||
if(this.removeTextBeforeSlash(element.mimeType, '/') == "mp4") {
|
||||
fileObject = {
|
||||
FileBase64: 'data:video/mp4;base64,'+ content.data,
|
||||
FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
||||
OriginalFileName: 'video'
|
||||
}
|
||||
|
||||
const extension = this.removeTextBeforeSlash(element.mimeType, '/')
|
||||
|
||||
fileObject = new PublicationAttachmentEntity({
|
||||
base64: content.data,
|
||||
extension: extension,
|
||||
OriginalFileName: 'video',
|
||||
FileType: 'video'
|
||||
})
|
||||
|
||||
} else {
|
||||
fileObject = {
|
||||
FileBase64: content.data,
|
||||
FileExtension: this.removeTextBeforeSlash(element.mimeType, '/'),
|
||||
OriginalFileName: 'image'
|
||||
}
|
||||
|
||||
const extension = this.removeTextBeforeSlash(element.mimeType, '/')
|
||||
|
||||
fileObject = new PublicationAttachmentEntity({
|
||||
base64: content.data,
|
||||
extension: extension,
|
||||
OriginalFileName: 'image',
|
||||
FileType: 'image'
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.seletedContent.push(fileObject)
|
||||
})
|
||||
.catch((err) => console.error(err));
|
||||
@@ -353,24 +394,24 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
/* // in use
|
||||
async laodPicture() {
|
||||
|
||||
|
||||
const capturedImage = await Camera.getPhoto({
|
||||
quality: 90,
|
||||
// allowEditing: true,
|
||||
resultType: CameraResultType.Uri,
|
||||
source: CameraSource.Photos
|
||||
});
|
||||
|
||||
|
||||
const response = await fetch(capturedImage.webPath!);
|
||||
const blob = await response.blob();
|
||||
|
||||
|
||||
this.convertBlobToBase64Worker.postMessage(blob);
|
||||
this.convertBlobToBase64Worker.onmessage = async (oEvent)=> {
|
||||
this.capturedImage = oEvent.data
|
||||
this.capturedImageTitle = 'foto'
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
} */
|
||||
|
||||
|
||||
@@ -497,7 +538,7 @@ export class NewPublicationPage implements OnInit {
|
||||
OriginalFileName: "video",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return e
|
||||
}) */
|
||||
|
||||
@@ -533,8 +574,6 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
try {
|
||||
|
||||
|
||||
|
||||
await this.publications.CreatePublication(this.folderId, this.publication).toPromise();
|
||||
this.close();
|
||||
this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
|
||||
@@ -740,12 +779,16 @@ export class NewPublicationPage implements OnInit {
|
||||
if (this.checkFileType.checkFileType(FileExtension) == 'image' || this.checkFileType.checkFileType(FileExtension) == 'video') {
|
||||
let resultUrl = decodeURIComponent(element.url);
|
||||
Filesystem.readFile({ path: resultUrl }).then(async (content) => {
|
||||
console.log('shared base', content.data)
|
||||
let fileObject = {
|
||||
FileBase64: this.removeTextBeforeSlash(content.data, ','),
|
||||
FileExtension: FileExtension,
|
||||
OriginalFileName: 'shared',
|
||||
}
|
||||
|
||||
let fileObject = new PublicationAttachmentEntity(
|
||||
{
|
||||
base64: this.removeTextBeforeSlash(content.data, ','),
|
||||
extension: FileExtension,
|
||||
OriginalFileName: "share-content",
|
||||
FileType: this.checkFileType.checkFileType(FileExtension) as any
|
||||
}
|
||||
)
|
||||
|
||||
this.seletedContent.push(fileObject)
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -98,6 +98,7 @@ export class PublicationsPage implements OnInit {
|
||||
|
||||
this.hideRefreshButton();
|
||||
this.intent = window["sharedContent"]
|
||||
window["refreshPublication"] = this.refreshing
|
||||
|
||||
}
|
||||
|
||||
@@ -124,7 +125,7 @@ export class PublicationsPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
refreshing() {
|
||||
refreshing = () => {
|
||||
setTimeout(() => {
|
||||
this.getActions();
|
||||
}, 1500);
|
||||
|
||||
Reference in New Issue
Block a user