mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
merge
This commit is contained in:
@@ -1151,7 +1151,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
async openFile(pdfString, filename, type) {
|
||||
const modal = await this.modalController.create({
|
||||
/* const modal = await this.modalController.create({
|
||||
component: ViewDocumentSecondOptionsPage,
|
||||
componentProps: {
|
||||
fileUrl: pdfString,
|
||||
@@ -1159,8 +1159,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
await modal.present();
|
||||
/* const blob = this.b64toBlob(pdfString, type)
|
||||
await modal.present(); */
|
||||
const blob = this.b64toBlob(pdfString, type)
|
||||
let pathFile = ''
|
||||
const fileName = filename
|
||||
const contentFile = blob
|
||||
@@ -1170,17 +1170,23 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
pathFile = this.file.externalRootDirectory
|
||||
}
|
||||
|
||||
console.log('file data', pdfString)
|
||||
console.log(pathFile)
|
||||
|
||||
let removePre = this.removeTextBeforeSlash(pdfString,',')
|
||||
console.log('file data remove ', removePre)
|
||||
|
||||
await Filesystem.writeFile({
|
||||
path: fileName,
|
||||
data: pdfString,
|
||||
directory: Directory.Data,
|
||||
data: removePre,
|
||||
directory: Directory.Cache,
|
||||
}).then((dir) => {
|
||||
console.log('DIR ', dir)
|
||||
this.fileOpener
|
||||
.open(dir.uri, type)
|
||||
.then(() => console.log())
|
||||
.catch(e => console.error(e))
|
||||
}); */
|
||||
});
|
||||
}
|
||||
|
||||
downloadFileMsg(msg: MessageService) {
|
||||
@@ -1317,6 +1323,16 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
reject(error);
|
||||
};
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
removeTextBeforeSlash(inputString, controlString) {
|
||||
if (inputString.includes(controlString)) {
|
||||
const parts = inputString.split(controlString);
|
||||
return parts.length > 1 ? parts[1] : inputString;
|
||||
} else {
|
||||
return inputString;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -848,7 +848,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
console.log('ios add file ')
|
||||
|
||||
const resultt = await FilePicker.pickFiles({
|
||||
types: ['application/pdf'],
|
||||
types: ['application/pdf', 'application/doc', 'application/docx','application/xls', 'application/xlsx', 'application/ppt',
|
||||
'application/pptx', 'application/txt'],
|
||||
multiple: false,
|
||||
readData: true,
|
||||
});
|
||||
@@ -856,6 +857,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
console.log('RESULT', resultt.files[0].data)
|
||||
|
||||
const blobb = this.fileService.base64toBlob(resultt.files[0].data, resultt.files[0].mimeType)
|
||||
const blob = new Blob([resultt.files[0].data], {type: resultt.files[0].mimeType});
|
||||
|
||||
const formDataa = new FormData();
|
||||
formDataa.append('blobFile', blobb);
|
||||
@@ -1109,7 +1111,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
console.log('url while open ',pdfString)
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
/* const modal = await this.modalController.create({
|
||||
component: ViewDocumentSecondOptionsPage,
|
||||
componentProps: {
|
||||
fileUrl: pdfString,
|
||||
@@ -1119,6 +1121,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
await modal.present();
|
||||
/*
|
||||
await modal.present(); */
|
||||
|
||||
var blob = new Blob([pdfString], { type: 'application/pdf' });
|
||||
|
||||
console.log('blob blob', blob)
|
||||
@@ -1147,7 +1151,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
path: fileName,
|
||||
data: removePre,
|
||||
directory: Directory.Cache,
|
||||
encoding: Encoding.UTF8
|
||||
}).then((dir) => {
|
||||
console.log('DIR ', dir)
|
||||
this.fileOpener
|
||||
@@ -1156,7 +1159,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
.catch(e => console.error(e))
|
||||
}).catch((error) => {
|
||||
console.log('error writing the file', error)
|
||||
}); */
|
||||
});
|
||||
}
|
||||
|
||||
removeTextBeforeSlash(inputString, controlString) {
|
||||
|
||||
Reference in New Issue
Block a user