Skip to content

Commit bcf4192

Browse files
committed
fix refactor to use new file api
1 parent 1a704db commit bcf4192

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/app/shared/database/table/capacitor-filesystem-table/capacitor-filesystem-table.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class CapacitorFilesystemTable<T extends Tuple> implements Table<T> {
6161
directory: this.directory,
6262
path: '',
6363
});
64-
if (!dirs.files.includes(this.rootDir)) {
64+
if (!dirs.files.find(f => f.name.includes(this.rootDir))) {
6565
await this.filesystemPlugin.mkdir({
6666
directory: this.directory,
6767
path: this.rootDir,
@@ -72,7 +72,7 @@ export class CapacitorFilesystemTable<T extends Tuple> implements Table<T> {
7272
directory: this.directory,
7373
path: this.rootDir,
7474
});
75-
return files.files.includes(`${this.id}.json`);
75+
return files.files.find(f => f.name.includes(`${this.id}.json`));
7676
}
7777

7878
private async createEmptyJson() {

src/app/shared/media/media-store/media-store.service.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class MediaStore {
5151
directory: this.directory,
5252
path: '',
5353
});
54-
if (!dirs.files.includes(this.rootDir)) {
54+
if (!dirs.files.find(f => f.name.includes(this.rootDir))) {
5555
await this.filesystemPlugin.mkdir({
5656
directory: this.directory,
5757
path: this.rootDir,
@@ -143,7 +143,10 @@ export class MediaStore {
143143
path: `${this.rootDir}`,
144144
});
145145
const extension = await this.getExtension(index);
146-
return result.files.includes(`${index}.${extension}`);
146+
return (
147+
result.files.find(f => f.name.includes(`${index}.${extension}`)) !==
148+
undefined
149+
);
147150
}
148151

149152
getThumbnailUrl$(index: string, mimeType: MimeType) {

0 commit comments

Comments
 (0)