download file chat solved

This commit is contained in:
Eudes Inácio
2023-08-20 22:05:46 +01:00
parent cb0c4459a7
commit 2dea55c7f0
4 changed files with 28 additions and 25 deletions
+1
View File
@@ -13,4 +13,5 @@
</application> </application>
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest> </manifest>
@@ -1060,7 +1060,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
return blob; return blob;
} }
openFile(pdfString, filename, type) { async openFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, 'application/pdf') const blob = this.b64toBlob(pdfString, 'application/pdf')
let pathFile = '' let pathFile = ''
const fileName = filename const fileName = filename
@@ -1071,17 +1071,17 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
pathFile = this.file.externalRootDirectory pathFile = this.file.externalRootDirectory
} }
await Filesystem.writeFile({
path: fileName,
this.file data: pdfString,
.writeFile(pathFile, fileName, contentFile, { replace: true }) directory: Directory.Documents,
.then(success => { }).then((dir) => {
this.fileOpener console.log('DIR ', dir)
.open(pathFile + fileName, 'application/pdf') this.fileOpener
.open(dir.uri, type)
.then(() => console.log()) .then(() => console.log())
.catch(e => console.error(e)) .catch(e => console.error(e))
}) });
.catch(e => console.error(e))
} }
downloadFileMsg(msg: MessageService) { downloadFileMsg(msg: MessageService) {
+10 -8
View File
@@ -1001,7 +1001,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
return blob; return blob;
} }
openFile(pdfString, filename, type) { async openFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, type) const blob = this.b64toBlob(pdfString, type)
console.log(blob) console.log(blob)
let pathFile = '' let pathFile = ''
@@ -1015,15 +1015,17 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
console.log(pathFile) console.log(pathFile)
this.file await Filesystem.writeFile({
.writeFile(pathFile, fileName, contentFile, { replace: true }) path: fileName,
.then(success => { data: pdfString,
this.fileOpener directory: Directory.Documents,
.open(pathFile + fileName, type) }).then((dir) => {
console.log('DIR ', dir)
this.fileOpener
.open(dir.uri, type)
.then(() => console.log()) .then(() => console.log())
.catch(e => console.error(e)) .catch(e => console.error(e))
}) });
.catch(e => console.error(e))
} }
downloadFileFromBrowser(fileName: string, data: any): void { downloadFileFromBrowser(fileName: string, data: any): void {
+6 -6
View File
@@ -1,12 +1,12 @@
export let versionData = { export let versionData = {
"shortSHA": "1e4321d29", "shortSHA": "cb0c4459a",
"SHA": "1e4321d2946ee8ef98f0547f002ea74402b95c3a", "SHA": "cb0c4459a704510a0666480af4aaf9841079a29c",
"branch": "developer", "branch": "developer",
"lastCommitAuthor": "'Eudes Inácio'", "lastCommitAuthor": "'Eudes Inácio'",
"lastCommitTime": "'Sat Aug 19 22:25:12 2023 +0100'", "lastCommitTime": "'Sun Aug 20 18:09:10 2023 +0100'",
"lastCommitMessage": "mock profile picture added", "lastCommitMessage": "update badge das notificações",
"lastCommitNumber": "5175", "lastCommitNumber": "5178",
"change": "", "change": "",
"changeStatus": "On branch developer\nYour branch and 'origin/developer' have diverged,\nand have 6 and 5 different commits each, respectively.\n (use \"git pull\" to merge the remote branch into yours)\n\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/app/models/beast-orm.ts\n\tmodified: src/app/models/chatMethod.ts\n\tmodified: src/app/pages/agenda/new-event/new-event.page.ts\n\tmodified: src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html\n\tmodified: src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts\n\tmodified: src/app/pages/chat/messages/contacts/contacts.page.html\n\tmodified: src/app/pages/chat/messages/messages.page.ts\n\tmodified: src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html\n\tmodified: src/app/pages/publications/new-publication/new-publication.page.ts\n\tmodified: src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts\n\tmodified: src/app/pages/publications/view-publications/view-publications.page.html\n\tmodified: src/app/pages/publications/view-publications/view-publications.page.ts\n\tmodified: src/app/pipes/filter.pipe.ts\n\tmodified: src/app/services/chat/chat-system.service.ts\n\tmodified: src/app/services/chat/message.service.ts\n\tmodified: src/app/services/events.service.ts\n\tmodified: src/app/services/task.service.ts\n\tmodified: src/app/shared/agenda/new-event/new-event.page.ts\n\tmodified: src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html\n\tmodified: src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts\n\tmodified: src/app/shared/chat/messages/messages.page.html\n\tmodified: src/app/shared/header/header.page.html\n\tmodified: src/app/shared/popover/opts-expediente/opts-expediente.page.html\n\tmodified: src/app/shared/popover/opts-expediente/opts-expediente.page.scss\n\tmodified: src/app/shared/publication/new-publication/new-publication.page.ts\n\tmodified: src/app/shared/publication/view-publications/publication-detail/publication-detail.page.html\n\tmodified: src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts\n\tmodified: src/app/shared/publication/view-publications/view-publications.page.html\n\tmodified: src/app/store/publication-folder.service.ts\n\tmodified: src/theme/variables.scss", "changeStatus": "On branch developer\nYour branch and 'origin/developer' have diverged,\nand have 9 and 5 different commits each, respectively.\n (use \"git pull\" to merge the remote branch into yours)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: android/app/src/main/AndroidManifest.xml\n\tmodified: src/app/pages/chat/group-messages/group-messages.page.ts\n\tmodified: src/app/pages/chat/messages/messages.page.ts",
"changeAuthor": "eudes.inacio" "changeAuthor": "eudes.inacio"
} }