add and view docments on chat solved

This commit is contained in:
Equilibrium ITO
2024-03-14 09:10:17 +01:00
parent 5b7224dbd6
commit 8cb9961bad
19 changed files with 230 additions and 25 deletions
@@ -35,6 +35,7 @@ import { RouteService } from 'src/app/services/route.service';
import { FileValidatorService } from "src/app/services/file/file-validator.service"
import { sanitize } from "sanitize-filename-ts";
import { FilePicker } from '@capawesome/capacitor-file-picker';
import { ViewDocumentSecondOptionsPage } from 'src/app/modals/view-document-second-options/view-document-second-options.page';
@Component({
selector: 'app-group-messages',
@@ -1160,7 +1161,16 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
async openFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, type)
const modal = await this.modalController.create({
component: ViewDocumentSecondOptionsPage,
componentProps: {
fileUrl: pdfString,
filename: filename
},
cssClass: 'modal modal-desktop'
});
await modal.present();
/* const blob = this.b64toBlob(pdfString, type)
let pathFile = ''
const fileName = filename
const contentFile = blob
@@ -1180,7 +1190,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
.open(dir.uri, type)
.then(() => console.log())
.catch(e => console.error(e))
});
}); */
}
downloadFileMsg(msg: MessageService) {
@@ -1242,7 +1252,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
});
modal.present();
} else {
this.openFile(str, msg.attachments[0].title, msg.file.type);
this.openFile(msg.attachments[0].image_url, msg.attachments[0].title, msg.file.type);
}
}
}