Skip to content
Draft
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
3 changes: 2 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
}
}
],
"expo-status-bar"
"expo-status-bar",
"./plugins/withFileSystemProviderPaths"
],
"experiments": {
"typedRoutes": true,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"@babel/generator": "^7.29.7",
"@babel/preset-typescript": "^7.27.1",
"@biomejs/biome": "^2.4.15",
"@expo/config-plugins": "^57.0.6",
"@j178/prek": "^0.4.6",
"@react-native/jest-preset": "0.86.0",
"@types/jest": "^29.5.14",
Expand Down
35 changes: 35 additions & 0 deletions plugins/withFileSystemProviderPaths.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { withDangerousMod } from '@expo/config-plugins';
import * as path from 'path';
import * as fs from 'fs';

const PROVIDER_PATHS_XML = `<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path name="expo_files" path="." />
<cache-path name="cached_expo_files" path="." />
<external-path name="external" path="." />
<external-files-path name="external_files" path="." />
</paths>
`;

/**
* Ensures android/app/src/main/res/xml/file_system_provider_paths.xml
* includes <external-path> and <external-files-path>.
*
* Without these, @magrinj/expo-quick-look's FileProvider can't serve files from
* /storage/emulated/0/Pictures/ (e.g. screenshot previews), because
* expo-file-system's version of the same-named resource wins during Android
* resource merging and is missing those two entries.
*/
export default function withFileSystemProviderPaths(
config: import('@expo/config-plugins').ExpoConfig,

Check failure on line 24 in plugins/withFileSystemProviderPaths.ts

View workflow job for this annotation

GitHub Actions / build

Namespace '"/home/runner/work/cherry-studio-app/cherry-studio-app/node_modules/.pnpm/@expo+config-plugins@57.0.6_typescript@6.0.3/node_modules/@expo/config-plugins/build/index"' has no exported member 'ExpoConfig'.
): import('@expo/config-plugins').ExpoConfig {

Check failure on line 25 in plugins/withFileSystemProviderPaths.ts

View workflow job for this annotation

GitHub Actions / build

Namespace '"/home/runner/work/cherry-studio-app/cherry-studio-app/node_modules/.pnpm/@expo+config-plugins@57.0.6_typescript@6.0.3/node_modules/@expo/config-plugins/build/index"' has no exported member 'ExpoConfig'.
return withDangerousMod(config, [
'android',
(config) => {
const resXmlDir = path.join(config.modRequest.platformProjectRoot, 'app/src/main/res/xml');
fs.mkdirSync(resXmlDir, { recursive: true });
fs.writeFileSync(path.join(resXmlDir, 'file_system_provider_paths.xml'), PROVIDER_PATHS_XML);
return config;
},
]);
}
53 changes: 28 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading