锁定移动壳文件导入失败响应

移动壳文本文件选择与读取失败返回稳定错误

移动壳文档文件读取失败返回稳定错误

移动壳音频文件读取失败返回稳定错误

移动壳配置检查补充文件导入失败边界反查
This commit is contained in:
2026-06-20 14:12:12 +08:00
parent 6bbf510102
commit cf3b02829c
3 changed files with 175 additions and 22 deletions
+15 -4
View File
@@ -420,7 +420,7 @@ function assertMobileDocumentPickerBoundary(
expectedTypeExpression,
) {
const functionBody = extractFunctionBody(hostBridgeSource, functionName);
if (!functionBody.includes('DocumentPicker.getDocumentAsync({')) {
if (!functionBody.includes('pickMobileDocumentFile(')) {
throw new Error(`mobile shell ${functionName} must use DocumentPicker`);
}
for (const requiredPickerOption of [
@@ -948,9 +948,9 @@ if (
}
for (const [functionName, readCall] of [
['importTextFile', 'file.text()'],
['importDocumentFile', 'file.base64()'],
['importAudioFile', 'file.base64()'],
['importTextFile', 'readMobileTextFile(file,'],
['importDocumentFile', 'readMobileBase64File(file,'],
['importAudioFile', 'readMobileBase64File(file,'],
]) {
const functionBody = extractFunctionBody(hostBridgeSource, functionName);
const sizeCheckIndex = functionBody.indexOf('assertImportedFileSizeWithinLimit(');
@@ -1993,6 +1993,9 @@ for (const snippet of [
'Sharing.shareAsync',
'assertMobileFileSharingAvailable',
'shareMobileFile',
'pickMobileDocumentFile',
'readMobileTextFile',
'readMobileBase64File',
'DocumentPicker.getDocumentAsync',
'Clipboard.getStringAsync',
'ImagePicker.launchImageLibraryAsync',
@@ -2112,8 +2115,16 @@ for (const snippet of [
"code: 'cancelled'",
'maps native sharing availability failures to stable export errors',
'maps native sharing sheet failures to stable export errors',
'maps native document picker failures to stable import errors',
'maps native text file read failures to stable import errors',
'maps native binary file read failures to stable import errors',
'maps native audio file read failures to stable import errors',
"message: 'file sharing unavailable'",
"message: 'file sharing failed'",
"message: 'text file picker unavailable'",
"message: 'text file unavailable'",
"message: 'document file unavailable'",
"message: 'audio file unavailable'",
'rejects image import before picker launch when library permission is denied',
'rejects image import before picker launch when library permission request fails',
'maps native image library launch failures to stable import errors',