Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions src/app/shared/ui/file-change/file-change.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { FILE_PATH } from '../../../app-routing.module';
import { LangService } from '../../data-access/lang.service';
import { isPlatformServer } from '@angular/common';

type LaunchParams = {
files: FileSystemHandle[];
targetURL: string
}

@Component({
selector: 'app-file-change',
templateUrl: './file-change.component.html',
Expand All @@ -29,14 +34,22 @@ export class FileChangeComponent implements OnInit {
this.initFileInput();

if ("launchQueue" in window) {
(window as any).launchQueue.setConsumer(async (launchParams: FileSystemFileHandle) => {
console.log((launchParams as any).files[0]);

const file: File = await launchParams.getFile();
console.log("FileSystemFileHandle.getFile() ->", file)
console.log("FileSystemFileHandle", launchParams)
// const file: File = (launchParams as any).files[0] as File;
this.fileHandler(file)
(window as any).launchQueue.setConsumer(async (launchParams: LaunchParams) => {

if (!launchParams.files?.length) return;

for (const handle of launchParams.files) {

if (handle.kind === "file") {
const fileHandle = handle as FileSystemFileHandle;
console.log("fileHandle", fileHandle)
const file = await fileHandle.getFile();
console.log("File:", file.name);

this.fileHandler(file);
return;
}
}
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="Chytanka">
<meta name="mobile-web-app-capable" content="yes">
<script type="application/ld+json">
{
"@context": "https://schema.org",
Expand All @@ -43,7 +44,6 @@
}
}
</script>
<meta name="google-site-verification" content="qezVCOaci5qsNJ2OPgMpxnjNfai8LVt4bPJXqQPmijM" />
<meta name="interactive-widget" content="resizes-visual">
</head>

Expand Down
Loading