file chunk share content

This commit is contained in:
Peter Maquiran
2024-04-01 12:18:25 +01:00
parent c785326803
commit 44a4c30e64
5 changed files with 40 additions and 23 deletions
@@ -374,7 +374,10 @@ export class NewPublicationPage implements OnInit {
if (this.PublicationFromMvService.form.Files.length != 0) {
this.close();
if (!window["sharedContent"]) {
this.close();
}
this.PublicationFromMvService.setFolderId(this.folderId)
await this.PublicationFromMvService.save()
@@ -394,10 +397,6 @@ export class NewPublicationPage implements OnInit {
this.modalController.dismiss(this.PublicationFromMvService.form).then(() => {
this.showLoader = true;
});
if (window["sharedContent"]) {
this.closeApp();
}
}
clear() {
@@ -631,14 +630,6 @@ export class NewPublicationPage implements OnInit {
this.PublicationFromMvService.form.Files.splice(index, 1)
}
closeApp() {
if (this.platform.is('android')) {
App.exitApp()
} else {
window["sharedContent"] = null
}
}
async recordevideoIos(fullPath, element) {
@@ -785,6 +776,9 @@ export class NewPublicationPage implements OnInit {
}
async shareContentIso(fullPath, FileExtension, filename) {
console.log({fullPath, FileExtension, filename})
try {
if (this.checkFileType.checkFileType(FileExtension) == 'image') {
@@ -865,11 +859,12 @@ export class NewPublicationPage implements OnInit {
shareContentAndroid(resultUrl, FileExtension) {
console.log({resultUrl, FileExtension})
Filesystem.readFile({ path: resultUrl }).then(async (content) => {
let newAttachment: PublicationAttachmentEntity;
try {
if (this.checkFileType.checkFileType(FileExtension) == 'image') {
const newAttachment = new PublicationAttachmentEntity(
let newAttachment = new PublicationAttachmentEntity(
{
base64: 'data:image/jpeg;base64,' + this.removeTextBeforeSlash(content.data, ','),
extension: FileExtension,
@@ -879,22 +874,24 @@ export class NewPublicationPage implements OnInit {
)
this.PublicationFromMvService.form.Files.push(newAttachment)
} else if (this.checkFileType.checkFileType(FileExtension) == 'video') {
const newAttachment = new PublicationAttachmentEntity(
let newAttachment = new PublicationAttachmentEntity(
{
base64: 'data:video/mp4;base64,' + this.removeTextBeforeSlash(content.data, ','),
base64: content.data,
extension: 'mp4',
FileType: this.checkFileType.checkFileType('mp4') as any,
OriginalFileName: 'shared'
}
)
newAttachment.needUpload()
this.PublicationFromMvService.form.Files.push(newAttachment)
}
console.log('shared base', content.data)
this.PublicationFromMvService.form.Files.push(newAttachment)
} catch (error) {
console.log('error shared filesystem', error)
}