mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
open file improve
This commit is contained in:
@@ -55,6 +55,7 @@ import { LastMessage } from '../../utils/lastMessage';
|
||||
import { File } from '@awesome-cordova-plugins/file/ngx';
|
||||
import { Filesystem, Directory } from '@capacitor/filesystem';
|
||||
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||
import { FileSystemMobileService } from 'src/app/infra/file-system/mobile/file-system-mobile.service';
|
||||
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
@@ -172,6 +173,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
private messageLocalDataSourceService: MessageLocalDataSourceService,
|
||||
private file: File,
|
||||
private fileOpener: FileOpener,
|
||||
private fileSystemMobileService: FileSystemMobileService
|
||||
) {
|
||||
|
||||
|
||||
@@ -1385,15 +1387,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
console.log(pathFile)
|
||||
console.log(contentFile)
|
||||
this.file
|
||||
.writeFile(pathFile, fileName, contentFile, { replace: true })
|
||||
.then(success => {
|
||||
this.fileOpener
|
||||
.open(pathFile + fileName, fileType)
|
||||
.then(() => console.log('File is opened'))
|
||||
.catch(e => console.log('Error opening file', e));
|
||||
})
|
||||
.catch(e => console.log('Error writing file', e))
|
||||
const writeResult = await this.fileSystemMobileService.writeFile(pathFile, fileName, contentFile, { replace: true })
|
||||
|
||||
if(writeResult.isOk()) {
|
||||
const openResult = await this.fileSystemMobileService.fileOpener(pathFile + fileName, fileType)
|
||||
}
|
||||
}
|
||||
|
||||
removeTextBeforeSlash(inputString, controlString) {
|
||||
|
||||
Reference in New Issue
Block a user