feat(iOS): support open file with Readest in Files App, closes #2334 (#2705)

This commit is contained in:
Huang Xin
2025-12-13 20:28:03 +08:00
committed by GitHub
parent 730fadb834
commit c1530cc5c4
10 changed files with 261 additions and 16 deletions
@@ -194,7 +194,7 @@ export const nativeFileSystem: FileSystem = {
let fname = name || getFilename(fp);
if (isValidURL(path)) {
return await new RemoteFile(path, fname).open();
} else if (isContentURI(path)) {
} else if (isContentURI(path) || (isFileURI(path) && OS_TYPE === 'ios')) {
fname = await basename(path);
if (path.includes('com.android.externalstorage')) {
// If the URI is from shared internal storage (like /storage/emulated/0),
@@ -202,6 +202,7 @@ export const nativeFileSystem: FileSystem = {
return await new NativeFile(fp, fname, baseDir ? baseDir : null).open();
} else {
// Otherwise, for content:// URIs (e.g. from MediaStore, Drive, or third-party apps),
// or file:// URIs is security scoped resource in iOS (e.g. from Files app),
// we cannot access the file directly — so we copy it to a temporary cache location.
const prefix = await this.getPrefix('Cache');
const dst = await join(prefix, fname);