miaoda-expo-devkit 0.1.1-beta.84 → 0.1.1-beta.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/babel/preset.js +7 -1
- package/dist/metro.d.mts +0 -5
- package/dist/metro.d.ts +0 -5
- package/dist/metro.js +1 -4
- package/dist/metro.mjs +1 -4
- package/dist/rules/no-unregistered-dynamic-tab-route.js +12 -4
- package/dist/stubs/expo-calendar-stub.js +51 -53
- package/dist/stubs/expo-contacts-stub.js +45 -46
- package/dist/stubs/expo-file-system-next-stub.js +10 -11
- package/dist/stubs/expo-file-system-stub.js +18 -19
- package/dist/stubs/expo-haptics-stub.js +8 -9
- package/dist/stubs/expo-image-picker-stub.js +8 -9
- package/dist/stubs/expo-media-library-stub.js +11 -12
- package/dist/stubs/expo-notifications-stub.js +35 -36
- package/dist/stubs/web-stub-dialog.js +6 -7
- package/package.json +1 -1
- package/dist/stubs/i18n/en.js +0 -195
- package/dist/stubs/i18n/index.js +0 -66
- package/dist/stubs/i18n/zh.js +0 -198
package/dist/babel/preset.js
CHANGED
|
@@ -43,7 +43,13 @@ function presetExpoDevkit(api, options = {}) {
|
|
|
43
43
|
["babel-preset-expo", {
|
|
44
44
|
jsxImportSource: "nativewind",
|
|
45
45
|
// 全平台禁止自动注入,由下方手动注入统一管理
|
|
46
|
-
worklets: false
|
|
46
|
+
worklets: false,
|
|
47
|
+
// babel-preset-expo 在 SDK 56 之前默认不转换 import.meta,
|
|
48
|
+
// 但部分 npm 包(如 zustand v5 的 devtools 中间件)的 ESM 构建
|
|
49
|
+
// 包含 import.meta.env,Metro 遇到会直接报错。
|
|
50
|
+
// 显式开启后,Babel 会在编译阶段将 import.meta.env 替换为
|
|
51
|
+
// process.env,所有平台均安全,SDK 56 升级后此选项会自动成为默认值。
|
|
52
|
+
unstable_transformImportMeta: true
|
|
47
53
|
}],
|
|
48
54
|
"nativewind/babel"
|
|
49
55
|
],
|
package/dist/metro.d.mts
CHANGED
|
@@ -141,11 +141,6 @@ interface DevkitOptions {
|
|
|
141
141
|
* 默认:'./src/global.css'
|
|
142
142
|
*/
|
|
143
143
|
input?: string;
|
|
144
|
-
/**
|
|
145
|
-
* stub 弹窗/提示文案的语言。
|
|
146
|
-
* 不设置时运行时自动检测(navigator.language / NativeModules)。
|
|
147
|
-
*/
|
|
148
|
-
locale?: 'zh' | 'en';
|
|
149
144
|
}
|
|
150
145
|
/**
|
|
151
146
|
* 一站式应用所有 devkit Metro wrapper。
|
package/dist/metro.d.ts
CHANGED
|
@@ -141,11 +141,6 @@ interface DevkitOptions {
|
|
|
141
141
|
* 默认:'./src/global.css'
|
|
142
142
|
*/
|
|
143
143
|
input?: string;
|
|
144
|
-
/**
|
|
145
|
-
* stub 弹窗/提示文案的语言。
|
|
146
|
-
* 不设置时运行时自动检测(navigator.language / NativeModules)。
|
|
147
|
-
*/
|
|
148
|
-
locale?: 'zh' | 'en';
|
|
149
144
|
}
|
|
150
145
|
/**
|
|
151
146
|
* 一站式应用所有 devkit Metro wrapper。
|
package/dist/metro.js
CHANGED
|
@@ -630,10 +630,7 @@ function withPersistentCache(config, options = {}) {
|
|
|
630
630
|
// src/metro/withDevkit.ts
|
|
631
631
|
function withDevkit(config, options = {}) {
|
|
632
632
|
const projectRoot = config.projectRoot ?? process.cwd();
|
|
633
|
-
const { input = "./src/global.css"
|
|
634
|
-
if (locale) {
|
|
635
|
-
process.env["DEVKIT_LOCALE"] = locale;
|
|
636
|
-
}
|
|
633
|
+
const { input = "./src/global.css" } = options;
|
|
637
634
|
config = withTransformLogger(config);
|
|
638
635
|
config = withPersistentCache(config);
|
|
639
636
|
config = withWorkspaceNodeModules(config);
|
package/dist/metro.mjs
CHANGED
|
@@ -581,10 +581,7 @@ function withPersistentCache(config, options = {}) {
|
|
|
581
581
|
// src/metro/withDevkit.ts
|
|
582
582
|
function withDevkit(config, options = {}) {
|
|
583
583
|
const projectRoot = config.projectRoot ?? process.cwd();
|
|
584
|
-
const { input = "./src/global.css"
|
|
585
|
-
if (locale) {
|
|
586
|
-
process.env["DEVKIT_LOCALE"] = locale;
|
|
587
|
-
}
|
|
584
|
+
const { input = "./src/global.css" } = options;
|
|
588
585
|
config = withTransformLogger(config);
|
|
589
586
|
config = withPersistentCache(config);
|
|
590
587
|
config = withWorkspaceNodeModules(config);
|
|
@@ -91,6 +91,11 @@ function collectRoutesNeedingHide(layoutDir) {
|
|
|
91
91
|
if (import_node_fs.default.existsSync(layoutDir)) scan(layoutDir);
|
|
92
92
|
return results;
|
|
93
93
|
}
|
|
94
|
+
function getJSXName(n) {
|
|
95
|
+
if (n.type === "JSXIdentifier") return n.name ?? "";
|
|
96
|
+
if (n.type === "JSXMemberExpression") return `${n.object?.name ?? ""}.${n.property?.name ?? ""}`;
|
|
97
|
+
return "";
|
|
98
|
+
}
|
|
94
99
|
function getStringAttr(attrs, attrName) {
|
|
95
100
|
for (const attr of attrs) {
|
|
96
101
|
if (attr.type !== "JSXAttribute") continue;
|
|
@@ -148,19 +153,22 @@ var noUnregisteredDynamicTabRouteRule = {
|
|
|
148
153
|
const layoutDir = import_node_path2.default.dirname(context.filename);
|
|
149
154
|
if (import_node_path2.default.relative(appDir, layoutDir).startsWith("..")) return {};
|
|
150
155
|
const hiddenNames = /* @__PURE__ */ new Set();
|
|
156
|
+
let hasTabsNavigator = false;
|
|
151
157
|
return {
|
|
152
158
|
JSXOpeningElement(node) {
|
|
153
|
-
const nameNode = node
|
|
154
|
-
|
|
155
|
-
|
|
159
|
+
const { name: nameNode, attributes: attrs } = node;
|
|
160
|
+
const jsxName = getJSXName(nameNode);
|
|
161
|
+
if (jsxName === "Tabs" || jsxName === "Tabs.Navigator") {
|
|
162
|
+
hasTabsNavigator = true;
|
|
156
163
|
}
|
|
157
|
-
|
|
164
|
+
if (jsxName !== "Tabs.Screen") return;
|
|
158
165
|
const screenName = getStringAttr(attrs, "name");
|
|
159
166
|
if (screenName && isHiddenTab(attrs)) {
|
|
160
167
|
hiddenNames.add(screenName);
|
|
161
168
|
}
|
|
162
169
|
},
|
|
163
170
|
"Program:exit"() {
|
|
171
|
+
if (!hasTabsNavigator) return;
|
|
164
172
|
const routes = collectRoutesNeedingHide(layoutDir);
|
|
165
173
|
for (const name of routes) {
|
|
166
174
|
if (!hiddenNames.has(name)) {
|
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var import_react_native = require("react-native");
|
|
3
3
|
var import_web_stub_dialog = require("./web-stub-dialog");
|
|
4
|
-
var import_i18n = require("./i18n");
|
|
5
4
|
if (import_react_native.Platform.OS !== "web") {
|
|
6
5
|
module.exports = require("expo-calendar");
|
|
7
6
|
} else {
|
|
8
|
-
let
|
|
9
|
-
return {
|
|
10
|
-
id: "stub-calendar",
|
|
11
|
-
title: (0, import_i18n.t)("calendar.previewCalendarTitle"),
|
|
12
|
-
color: "#1677FF",
|
|
13
|
-
entityType: "event",
|
|
14
|
-
source: { id: "stub", type: "local", name: (0, import_i18n.t)("calendar.sourceNameLocal") },
|
|
15
|
-
type: "local",
|
|
16
|
-
allowsModifications: true,
|
|
17
|
-
allowedAvailabilities: [],
|
|
18
|
-
allowedReminders: [],
|
|
19
|
-
allowedAttendeeTypes: [],
|
|
20
|
-
accessLevel: "owner"
|
|
21
|
-
};
|
|
22
|
-
}, showCalendarAlert = function(title, lines, isValid, errors) {
|
|
7
|
+
let showCalendarAlert = function(title, lines, isValid, errors) {
|
|
23
8
|
(0, import_web_stub_dialog.showWebStubDialog)({
|
|
24
9
|
title,
|
|
25
10
|
details: lines,
|
|
@@ -28,17 +13,17 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
28
13
|
}, validateId = function(id, label = "id") {
|
|
29
14
|
const errors = [];
|
|
30
15
|
if (typeof id !== "string" || id.trim().length === 0) {
|
|
31
|
-
errors.push(
|
|
16
|
+
errors.push(`${label} \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`);
|
|
32
17
|
}
|
|
33
18
|
return { ok: errors.length === 0, errors };
|
|
34
19
|
}, validateDate = function(value, label) {
|
|
35
20
|
const errors = [];
|
|
36
21
|
if (value == null) {
|
|
37
|
-
errors.push(
|
|
22
|
+
errors.push(`${label} \u4E0D\u80FD\u4E3A\u7A7A`);
|
|
38
23
|
} else if (!(value instanceof Date) && typeof value !== "string") {
|
|
39
|
-
errors.push(
|
|
24
|
+
errors.push(`${label} \u5FC5\u987B\u662F Date \u6216\u65E5\u671F\u5B57\u7B26\u4E32`);
|
|
40
25
|
} else if (value instanceof Date && isNaN(value.getTime())) {
|
|
41
|
-
errors.push(
|
|
26
|
+
errors.push(`${label} \u662F\u65E0\u6548\u7684 Date \u5BF9\u8C61`);
|
|
42
27
|
}
|
|
43
28
|
return errors;
|
|
44
29
|
}, formatDateArg = function(value) {
|
|
@@ -56,13 +41,26 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
56
41
|
const getPermission = useCallback(async () => GRANTED_PERMISSION, []);
|
|
57
42
|
return [permission, requestPermission, getPermission];
|
|
58
43
|
};
|
|
59
|
-
var
|
|
44
|
+
var showCalendarAlert2 = showCalendarAlert, validateId2 = validateId, validateDate2 = validateDate, formatDateArg2 = formatDateArg, useCalendarPermissions2 = useCalendarPermissions, useRemindersPermissions2 = useRemindersPermissions;
|
|
60
45
|
const GRANTED_PERMISSION = {
|
|
61
46
|
status: "granted",
|
|
62
47
|
granted: true,
|
|
63
48
|
canAskAgain: true,
|
|
64
49
|
expires: "never"
|
|
65
50
|
};
|
|
51
|
+
const STUB_CALENDAR = {
|
|
52
|
+
id: "stub-calendar",
|
|
53
|
+
title: "\u9884\u89C8\u65E5\u5386\uFF08Web\uFF09",
|
|
54
|
+
color: "#1677FF",
|
|
55
|
+
entityType: "event",
|
|
56
|
+
source: { id: "stub", type: "local", name: "\u672C\u5730" },
|
|
57
|
+
type: "local",
|
|
58
|
+
allowsModifications: true,
|
|
59
|
+
allowedAvailabilities: [],
|
|
60
|
+
allowedReminders: [],
|
|
61
|
+
allowedAttendeeTypes: [],
|
|
62
|
+
accessLevel: "owner"
|
|
63
|
+
};
|
|
66
64
|
const { useState, useCallback } = require("react");
|
|
67
65
|
const requestCalendarPermissionsAsync = async () => GRANTED_PERMISSION;
|
|
68
66
|
const getCalendarPermissionsAsync = async () => GRANTED_PERMISSION;
|
|
@@ -73,10 +71,10 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
73
71
|
const isAvailableAsync = async () => true;
|
|
74
72
|
const getCalendarsAsync = async (entityType) => {
|
|
75
73
|
void entityType;
|
|
76
|
-
return [
|
|
74
|
+
return [STUB_CALENDAR];
|
|
77
75
|
};
|
|
78
76
|
const getDefaultCalendarAsync = async () => {
|
|
79
|
-
showCalendarAlert(
|
|
77
|
+
showCalendarAlert("\u83B7\u53D6\u9ED8\u8BA4\u65E5\u5386", ["\u64CD\u4F5C: \u83B7\u53D6\u7CFB\u7EDF\u9ED8\u8BA4\u65E5\u5386", "\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u4E0D\u652F\u6301"], false, ["\u65E0\u6CD5\u8BBF\u95EE\u7CFB\u7EDF\u65E5\u5386"]);
|
|
80
78
|
return void 0;
|
|
81
79
|
};
|
|
82
80
|
const createCalendarAsync = async (details) => {
|
|
@@ -84,13 +82,13 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
84
82
|
const d = details && typeof details === "object" ? details : {};
|
|
85
83
|
const titleVal = d["title"];
|
|
86
84
|
if (typeof titleVal !== "string" || titleVal.trim().length === 0) {
|
|
87
|
-
errors.push(
|
|
85
|
+
errors.push("details.title \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32");
|
|
88
86
|
}
|
|
89
87
|
const isValid = errors.length === 0;
|
|
90
|
-
const titleDisplay = typeof titleVal === "string" ? titleVal : (
|
|
88
|
+
const titleDisplay = typeof titleVal === "string" ? titleVal : "(\u672A\u586B\u5199)";
|
|
91
89
|
showCalendarAlert(
|
|
92
|
-
|
|
93
|
-
[
|
|
90
|
+
"\u521B\u5EFA\u65E5\u5386",
|
|
91
|
+
[`\u540D\u79F0: ${titleDisplay}`, `\u989C\u8272: ${d["color"] ?? "(\u672A\u8BBE\u7F6E)"}`],
|
|
94
92
|
isValid,
|
|
95
93
|
isValid ? void 0 : errors
|
|
96
94
|
);
|
|
@@ -100,10 +98,10 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
100
98
|
const { ok: idOk, errors: idErrors } = validateId(id, "calendarId");
|
|
101
99
|
const d = details && typeof details === "object" ? details : {};
|
|
102
100
|
showCalendarAlert(
|
|
103
|
-
|
|
101
|
+
"\u66F4\u65B0\u65E5\u5386",
|
|
104
102
|
[
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
`\u65E5\u5386 ID: ${typeof id === "string" ? id : String(id)}`,
|
|
104
|
+
`\u66F4\u65B0\u5B57\u6BB5: ${Object.keys(d).join(", ") || "(\u65E0)"}`
|
|
107
105
|
],
|
|
108
106
|
idOk,
|
|
109
107
|
idOk ? void 0 : idErrors
|
|
@@ -113,8 +111,8 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
113
111
|
const deleteCalendarAsync = async (id) => {
|
|
114
112
|
const { ok, errors } = validateId(id, "calendarId");
|
|
115
113
|
showCalendarAlert(
|
|
116
|
-
|
|
117
|
-
[
|
|
114
|
+
"\u5220\u9664\u65E5\u5386",
|
|
115
|
+
[`\u65E5\u5386 ID: ${typeof id === "string" ? id : String(id)}`],
|
|
118
116
|
ok,
|
|
119
117
|
ok ? void 0 : errors
|
|
120
118
|
);
|
|
@@ -122,19 +120,19 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
122
120
|
const getEventsAsync = async (calendarIds, startDate, endDate) => {
|
|
123
121
|
const errors = [];
|
|
124
122
|
if (!Array.isArray(calendarIds) || calendarIds.length === 0) {
|
|
125
|
-
errors.push(
|
|
123
|
+
errors.push("calendarIds \u5FC5\u987B\u662F\u975E\u7A7A\u6570\u7EC4");
|
|
126
124
|
}
|
|
127
125
|
errors.push(...validateDate(startDate, "startDate"));
|
|
128
126
|
errors.push(...validateDate(endDate, "endDate"));
|
|
129
127
|
const isValid = errors.length === 0;
|
|
130
128
|
const idsStr = Array.isArray(calendarIds) ? `[${calendarIds.slice(0, 3).join(", ")}${calendarIds.length > 3 ? "\u2026" : ""}]` : String(calendarIds);
|
|
131
129
|
showCalendarAlert(
|
|
132
|
-
|
|
130
|
+
"\u67E5\u8BE2\u65E5\u5386\u4E8B\u4EF6",
|
|
133
131
|
[
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
`\u65E5\u5386 IDs: ${idsStr}`,
|
|
133
|
+
`\u5F00\u59CB\u65F6\u95F4: ${formatDateArg(startDate)}`,
|
|
134
|
+
`\u7ED3\u675F\u65F6\u95F4: ${formatDateArg(endDate)}`,
|
|
135
|
+
"\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u8FD4\u56DE\u7A7A\u5217\u8868"
|
|
138
136
|
],
|
|
139
137
|
isValid,
|
|
140
138
|
isValid ? void 0 : errors
|
|
@@ -144,8 +142,8 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
144
142
|
const getEventAsync = async (id) => {
|
|
145
143
|
const { ok, errors } = validateId(id, "eventId");
|
|
146
144
|
showCalendarAlert(
|
|
147
|
-
|
|
148
|
-
[
|
|
145
|
+
"\u83B7\u53D6\u65E5\u5386\u4E8B\u4EF6",
|
|
146
|
+
[`\u4E8B\u4EF6 ID: ${typeof id === "string" ? id : String(id)}`],
|
|
149
147
|
ok,
|
|
150
148
|
ok ? void 0 : errors
|
|
151
149
|
);
|
|
@@ -161,17 +159,17 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
161
159
|
errors.push(...validateDate(data["endDate"], "eventData.endDate"));
|
|
162
160
|
}
|
|
163
161
|
const titleVal = data["title"];
|
|
164
|
-
const titleDisplay = typeof titleVal === "string" ? titleVal : (
|
|
165
|
-
const startDisplay = data["startDate"] != null ? formatDateArg(data["startDate"]) : (
|
|
166
|
-
const endDisplay = data["endDate"] != null ? formatDateArg(data["endDate"]) : (
|
|
162
|
+
const titleDisplay = typeof titleVal === "string" ? titleVal : "(\u672A\u586B\u5199)";
|
|
163
|
+
const startDisplay = data["startDate"] != null ? formatDateArg(data["startDate"]) : "(\u672A\u8BBE\u7F6E)";
|
|
164
|
+
const endDisplay = data["endDate"] != null ? formatDateArg(data["endDate"]) : "(\u672A\u8BBE\u7F6E)";
|
|
167
165
|
const isValid = errors.length === 0;
|
|
168
166
|
showCalendarAlert(
|
|
169
|
-
|
|
167
|
+
"\u521B\u5EFA\u65E5\u5386\u4E8B\u4EF6",
|
|
170
168
|
[
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
`\u65E5\u5386 ID: ${typeof calendarId === "string" ? calendarId : String(calendarId)}`,
|
|
170
|
+
`\u6807\u9898: ${titleDisplay}`,
|
|
171
|
+
`\u5F00\u59CB: ${startDisplay}`,
|
|
172
|
+
`\u7ED3\u675F: ${endDisplay}`
|
|
175
173
|
],
|
|
176
174
|
isValid,
|
|
177
175
|
isValid ? void 0 : errors
|
|
@@ -182,10 +180,10 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
182
180
|
const { ok, errors } = validateId(id, "eventId");
|
|
183
181
|
const d = details && typeof details === "object" ? details : {};
|
|
184
182
|
showCalendarAlert(
|
|
185
|
-
|
|
183
|
+
"\u66F4\u65B0\u65E5\u5386\u4E8B\u4EF6",
|
|
186
184
|
[
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
`\u4E8B\u4EF6 ID: ${typeof id === "string" ? id : String(id)}`,
|
|
186
|
+
`\u66F4\u65B0\u5B57\u6BB5: ${Object.keys(d).join(", ") || "(\u65E0)"}`
|
|
189
187
|
],
|
|
190
188
|
ok,
|
|
191
189
|
ok ? void 0 : errors
|
|
@@ -195,8 +193,8 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
195
193
|
const deleteEventAsync = async (id) => {
|
|
196
194
|
const { ok, errors } = validateId(id, "eventId");
|
|
197
195
|
showCalendarAlert(
|
|
198
|
-
|
|
199
|
-
[
|
|
196
|
+
"\u5220\u9664\u65E5\u5386\u4E8B\u4EF6",
|
|
197
|
+
[`\u4E8B\u4EF6 ID: ${typeof id === "string" ? id : String(id)}`],
|
|
200
198
|
ok,
|
|
201
199
|
ok ? void 0 : errors
|
|
202
200
|
);
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
var import_react_native = require("react-native");
|
|
3
3
|
var import_expo = require("expo");
|
|
4
4
|
var import_web_stub_dialog = require("./web-stub-dialog");
|
|
5
|
-
var import_i18n = require("./i18n");
|
|
6
5
|
if (import_react_native.Platform.OS !== "web" && !(0, import_expo.isRunningInExpoGo)()) {
|
|
7
6
|
module.exports = require("expo-contacts");
|
|
8
7
|
} else {
|
|
@@ -16,20 +15,20 @@ if (import_react_native.Platform.OS !== "web" && !(0, import_expo.isRunningInExp
|
|
|
16
15
|
});
|
|
17
16
|
return;
|
|
18
17
|
}
|
|
19
|
-
const statusLine = hasErrors ?
|
|
20
|
-
const parts = [
|
|
18
|
+
const statusLine = hasErrors ? "\u274C \u53C2\u6570\u6709\u8BEF" : "\u2705 \u53C2\u6570\u5408\u89C4";
|
|
19
|
+
const parts = ["\u79D2\u54D2\u626B\u7801\u9884\u89C8\u4E0D\u652F\u6301\u8BBF\u95EE\u901A\u8BAF\u5F55", "", ...lines, "", statusLine];
|
|
21
20
|
if (hasErrors) {
|
|
22
|
-
parts.push(
|
|
21
|
+
parts.push(`\u95EE\u9898: ${errors.join(" / ")}`);
|
|
23
22
|
parts.push("");
|
|
24
|
-
parts.push(
|
|
23
|
+
parts.push("\u8BF7\u622A\u56FE\u53D1\u7ED9\u79D2\u54D2 Agent \u4FEE\u590D");
|
|
25
24
|
} else {
|
|
26
25
|
parts.push("");
|
|
27
|
-
parts.push(
|
|
26
|
+
parts.push("\u53D1\u5E03\u4E3A\u6B63\u5F0F App \u540E\u53EF\u6B63\u5E38\u4F7F\u7528");
|
|
28
27
|
}
|
|
29
|
-
import_react_native.Alert.alert(title, parts.join("\n"), [{ text:
|
|
28
|
+
import_react_native.Alert.alert(title, parts.join("\n"), [{ text: "\u77E5\u9053\u4E86" }]);
|
|
30
29
|
}, validateId = function(id, label = "id") {
|
|
31
30
|
if (typeof id !== "string" || id.trim().length === 0) {
|
|
32
|
-
return [
|
|
31
|
+
return [`${label} \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32`];
|
|
33
32
|
}
|
|
34
33
|
return [];
|
|
35
34
|
};
|
|
@@ -116,85 +115,85 @@ if (import_react_native.Platform.OS !== "web" && !(0, import_expo.isRunningInExp
|
|
|
116
115
|
};
|
|
117
116
|
const getPermissionsAsync = async () => DENIED_PERMISSION;
|
|
118
117
|
const requestPermissionsAsync = async () => {
|
|
119
|
-
showContactsAlert(
|
|
118
|
+
showContactsAlert("\u8BF7\u6C42\u901A\u8BAF\u5F55\u6743\u9650", ["\u64CD\u4F5C: requestPermissionsAsync()", "\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u4E0D\u652F\u6301\u8BBF\u95EE\u901A\u8BAF\u5F55"]);
|
|
120
119
|
return UNDETERMINED_PERMISSION;
|
|
121
120
|
};
|
|
122
121
|
const isAvailableAsync = async () => false;
|
|
123
122
|
const hasContactsAsync = async () => false;
|
|
124
123
|
const getContactsAsync = async (query) => {
|
|
125
|
-
const queryStr = query ? JSON.stringify(query) : (
|
|
126
|
-
showContactsAlert(
|
|
124
|
+
const queryStr = query ? JSON.stringify(query) : "(\u65E0\u8FC7\u6EE4)";
|
|
125
|
+
showContactsAlert("\u83B7\u53D6\u901A\u8BAF\u5F55\u8054\u7CFB\u4EBA", [
|
|
127
126
|
`query: ${queryStr}`,
|
|
128
|
-
|
|
127
|
+
"\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u8FD4\u56DE\u7A7A\u5217\u8868"
|
|
129
128
|
]);
|
|
130
129
|
return { data: [], hasNextPage: false, hasPreviousPage: false, total: 0 };
|
|
131
130
|
};
|
|
132
131
|
const getPagedContactsAsync = async (query) => {
|
|
133
|
-
const queryStr = query ? JSON.stringify(query) : (
|
|
134
|
-
showContactsAlert(
|
|
132
|
+
const queryStr = query ? JSON.stringify(query) : "(\u65E0\u8FC7\u6EE4)";
|
|
133
|
+
showContactsAlert("\u5206\u9875\u83B7\u53D6\u8054\u7CFB\u4EBA", [
|
|
135
134
|
`query: ${queryStr}`,
|
|
136
|
-
|
|
135
|
+
"\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u8FD4\u56DE\u7A7A\u5217\u8868"
|
|
137
136
|
]);
|
|
138
137
|
return { data: [], hasNextPage: false, hasPreviousPage: false, total: 0 };
|
|
139
138
|
};
|
|
140
139
|
const getContactByIdAsync = async (id) => {
|
|
141
140
|
const errors = validateId(id, "contactId");
|
|
142
|
-
showContactsAlert(
|
|
141
|
+
showContactsAlert("\u901A\u8FC7 ID \u83B7\u53D6\u8054\u7CFB\u4EBA", [`contactId: ${JSON.stringify(id)}`], errors.length ? errors : void 0);
|
|
143
142
|
return null;
|
|
144
143
|
};
|
|
145
144
|
const addContactAsync = async (contact) => {
|
|
146
|
-
const nameStr = contact?.name ?? (
|
|
147
|
-
showContactsAlert(
|
|
145
|
+
const nameStr = contact?.name ?? "(\u672A\u4F20\u59D3\u540D)";
|
|
146
|
+
showContactsAlert("\u6DFB\u52A0\u8054\u7CFB\u4EBA", [`name: ${nameStr}`]);
|
|
148
147
|
return "stub-contact-id";
|
|
149
148
|
};
|
|
150
149
|
const updateContactAsync = async (contact) => {
|
|
151
|
-
const idStr = contact?.id ?? (
|
|
150
|
+
const idStr = contact?.id ?? "(\u672A\u4F20 id)";
|
|
152
151
|
const errors = validateId(idStr, "contact.id");
|
|
153
|
-
showContactsAlert(
|
|
152
|
+
showContactsAlert("\u66F4\u65B0\u8054\u7CFB\u4EBA", [`id: ${idStr}`], errors.length ? errors : void 0);
|
|
154
153
|
return {};
|
|
155
154
|
};
|
|
156
155
|
const removeContactAsync = async (contactId) => {
|
|
157
156
|
const errors = validateId(contactId, "contactId");
|
|
158
|
-
showContactsAlert(
|
|
157
|
+
showContactsAlert("\u5220\u9664\u8054\u7CFB\u4EBA", [`contactId: ${JSON.stringify(contactId)}`], errors.length ? errors : void 0);
|
|
159
158
|
return {};
|
|
160
159
|
};
|
|
161
160
|
const shareContactAsync = async (contactId, message) => {
|
|
162
161
|
const errors = validateId(contactId, "contactId");
|
|
163
|
-
showContactsAlert(
|
|
162
|
+
showContactsAlert("\u5206\u4EAB\u8054\u7CFB\u4EBA", [
|
|
164
163
|
`contactId: ${JSON.stringify(contactId)}`,
|
|
165
|
-
`message: ${message != null ? JSON.stringify(message) : (
|
|
164
|
+
`message: ${message != null ? JSON.stringify(message) : "(\u65E0)"}`
|
|
166
165
|
], errors.length ? errors : void 0);
|
|
167
166
|
};
|
|
168
167
|
const writeContactToFileAsync = async (query) => {
|
|
169
|
-
showContactsAlert(
|
|
170
|
-
`query: ${query ? JSON.stringify(query) : (
|
|
171
|
-
|
|
168
|
+
showContactsAlert("\u5BFC\u51FA\u8054\u7CFB\u4EBA\u5230\u6587\u4EF6", [
|
|
169
|
+
`query: ${query ? JSON.stringify(query) : "(\u65E0)"}`,
|
|
170
|
+
"\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u4E0D\u652F\u6301\u6B64\u64CD\u4F5C"
|
|
172
171
|
]);
|
|
173
172
|
return "file://stub/contact.vcf";
|
|
174
173
|
};
|
|
175
174
|
const presentFormAsync = async (contactId) => {
|
|
176
|
-
showContactsAlert(
|
|
177
|
-
`contactId: ${contactId != null ? JSON.stringify(contactId) : (
|
|
178
|
-
|
|
175
|
+
showContactsAlert("\u663E\u793A\u8054\u7CFB\u4EBA\u8868\u5355", [
|
|
176
|
+
`contactId: ${contactId != null ? JSON.stringify(contactId) : "(\u65B0\u5EFA)"}`,
|
|
177
|
+
"Web \u5E73\u53F0\u4E0D\u652F\u6301\u7CFB\u7EDF\u8054\u7CFB\u4EBA\u8868\u5355"
|
|
179
178
|
]);
|
|
180
179
|
return {};
|
|
181
180
|
};
|
|
182
181
|
const presentContactPickerAsync = async () => {
|
|
183
|
-
showContactsAlert(
|
|
182
|
+
showContactsAlert("\u9009\u62E9\u8054\u7CFB\u4EBA", ["Web \u5E73\u53F0\u4E0D\u652F\u6301\u901A\u8BAF\u5F55\u9009\u62E9\u5668"]);
|
|
184
183
|
return null;
|
|
185
184
|
};
|
|
186
185
|
const createGroupAsync = async (name) => {
|
|
187
186
|
const errors = [];
|
|
188
|
-
if (typeof name !== "string" || !name.trim()) errors.push(
|
|
189
|
-
showContactsAlert(
|
|
187
|
+
if (typeof name !== "string" || !name.trim()) errors.push("name \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32");
|
|
188
|
+
showContactsAlert("\u521B\u5EFA\u8054\u7CFB\u4EBA\u5206\u7EC4", [`name: ${JSON.stringify(name)}`], errors.length ? errors : void 0);
|
|
190
189
|
return "stub-group-id";
|
|
191
190
|
};
|
|
192
191
|
const updateGroupNameAsync = async (groupName, groupId) => {
|
|
193
192
|
const errors = [
|
|
194
|
-
...typeof groupName !== "string" || !groupName.trim() ? [
|
|
193
|
+
...typeof groupName !== "string" || !groupName.trim() ? ["groupName \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32"] : [],
|
|
195
194
|
...validateId(groupId, "groupId")
|
|
196
195
|
];
|
|
197
|
-
showContactsAlert(
|
|
196
|
+
showContactsAlert("\u66F4\u65B0\u5206\u7EC4\u540D\u79F0", [
|
|
198
197
|
`groupName: ${JSON.stringify(groupName)}`,
|
|
199
198
|
`groupId: ${JSON.stringify(groupId)}`
|
|
200
199
|
], errors.length ? errors : void 0);
|
|
@@ -202,13 +201,13 @@ if (import_react_native.Platform.OS !== "web" && !(0, import_expo.isRunningInExp
|
|
|
202
201
|
};
|
|
203
202
|
const removeGroupAsync = async (groupId) => {
|
|
204
203
|
const errors = validateId(groupId, "groupId");
|
|
205
|
-
showContactsAlert(
|
|
204
|
+
showContactsAlert("\u5220\u9664\u5206\u7EC4", [`groupId: ${JSON.stringify(groupId)}`], errors.length ? errors : void 0);
|
|
206
205
|
return {};
|
|
207
206
|
};
|
|
208
207
|
const getGroupsAsync = async (query) => {
|
|
209
|
-
showContactsAlert(
|
|
210
|
-
`query: ${query ? JSON.stringify(query) : (
|
|
211
|
-
|
|
208
|
+
showContactsAlert("\u83B7\u53D6\u8054\u7CFB\u4EBA\u5206\u7EC4", [
|
|
209
|
+
`query: ${query ? JSON.stringify(query) : "(\u65E0)"}`,
|
|
210
|
+
"\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u8FD4\u56DE\u7A7A\u5217\u8868"
|
|
212
211
|
]);
|
|
213
212
|
return [];
|
|
214
213
|
};
|
|
@@ -217,7 +216,7 @@ if (import_react_native.Platform.OS !== "web" && !(0, import_expo.isRunningInExp
|
|
|
217
216
|
...validateId(contactId, "contactId"),
|
|
218
217
|
...validateId(groupId, "groupId")
|
|
219
218
|
];
|
|
220
|
-
showContactsAlert(
|
|
219
|
+
showContactsAlert("\u6DFB\u52A0\u8054\u7CFB\u4EBA\u5230\u5206\u7EC4", [
|
|
221
220
|
`contactId: ${JSON.stringify(contactId)}`,
|
|
222
221
|
`groupId: ${JSON.stringify(groupId)}`
|
|
223
222
|
], errors.length ? errors : void 0);
|
|
@@ -228,7 +227,7 @@ if (import_react_native.Platform.OS !== "web" && !(0, import_expo.isRunningInExp
|
|
|
228
227
|
...validateId(contactId, "contactId"),
|
|
229
228
|
...validateId(groupId, "groupId")
|
|
230
229
|
];
|
|
231
|
-
showContactsAlert(
|
|
230
|
+
showContactsAlert("\u4ECE\u5206\u7EC4\u79FB\u9664\u8054\u7CFB\u4EBA", [
|
|
232
231
|
`contactId: ${JSON.stringify(contactId)}`,
|
|
233
232
|
`groupId: ${JSON.stringify(groupId)}`
|
|
234
233
|
], errors.length ? errors : void 0);
|
|
@@ -239,21 +238,21 @@ if (import_react_native.Platform.OS !== "web" && !(0, import_expo.isRunningInExp
|
|
|
239
238
|
...validateId(groupId, "groupId"),
|
|
240
239
|
...validateId(containerId, "containerId")
|
|
241
240
|
];
|
|
242
|
-
showContactsAlert(
|
|
241
|
+
showContactsAlert("\u5C06\u5206\u7EC4\u6DFB\u52A0\u5230\u5BB9\u5668", [
|
|
243
242
|
`groupId: ${JSON.stringify(groupId)}`,
|
|
244
243
|
`containerId: ${JSON.stringify(containerId)}`
|
|
245
244
|
], errors.length ? errors : void 0);
|
|
246
245
|
return {};
|
|
247
246
|
};
|
|
248
247
|
const getContainersAsync = async (query) => {
|
|
249
|
-
showContactsAlert(
|
|
250
|
-
`query: ${query ? JSON.stringify(query) : (
|
|
251
|
-
|
|
248
|
+
showContactsAlert("\u83B7\u53D6\u8054\u7CFB\u4EBA\u5BB9\u5668", [
|
|
249
|
+
`query: ${query ? JSON.stringify(query) : "(\u65E0)"}`,
|
|
250
|
+
"\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u8FD4\u56DE\u7A7A\u5217\u8868"
|
|
252
251
|
]);
|
|
253
252
|
return [];
|
|
254
253
|
};
|
|
255
254
|
const getDefaultContainerIdAsync = async () => {
|
|
256
|
-
showContactsAlert(
|
|
255
|
+
showContactsAlert("\u83B7\u53D6\u9ED8\u8BA4\u5BB9\u5668 ID", ["\u79D2\u54D2\u9884\u89C8\u6A21\u5F0F\u4E0D\u652F\u6301\u6B64\u64CD\u4F5C"]);
|
|
257
256
|
return null;
|
|
258
257
|
};
|
|
259
258
|
const addContactsChangeListener = (_listener) => {
|
|
@@ -261,7 +260,7 @@ if (import_react_native.Platform.OS !== "web" && !(0, import_expo.isRunningInExp
|
|
|
261
260
|
} };
|
|
262
261
|
};
|
|
263
262
|
const presentAccessPickerAsync = async () => {
|
|
264
|
-
showContactsAlert(
|
|
263
|
+
showContactsAlert("\u9009\u62E9\u901A\u8BAF\u5F55\u8BBF\u95EE\u6743\u9650", ["Web \u5E73\u53F0\u4E0D\u652F\u6301\u6B64\u64CD\u4F5C"]);
|
|
265
264
|
return [];
|
|
266
265
|
};
|
|
267
266
|
const enums = {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var import_react_native = require("react-native");
|
|
3
3
|
var import_web_stub_dialog = require("./web-stub-dialog");
|
|
4
|
-
var import_i18n = require("./i18n");
|
|
5
4
|
if (import_react_native.Platform.OS !== "web") {
|
|
6
5
|
module.exports = require("expo-file-system");
|
|
7
6
|
} else {
|
|
@@ -34,10 +33,10 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
34
33
|
return false;
|
|
35
34
|
}
|
|
36
35
|
create(_options) {
|
|
37
|
-
(0, import_web_stub_dialog.showWebStubDialog)({ title:
|
|
36
|
+
(0, import_web_stub_dialog.showWebStubDialog)({ title: "\u521B\u5EFA\u76EE\u5F55", details: [`URI: ${this.uri}`] });
|
|
38
37
|
}
|
|
39
38
|
delete() {
|
|
40
|
-
(0, import_web_stub_dialog.showWebStubDialog)({ title:
|
|
39
|
+
(0, import_web_stub_dialog.showWebStubDialog)({ title: "\u5220\u9664\u76EE\u5F55", details: [`URI: ${this.uri}`] });
|
|
41
40
|
}
|
|
42
41
|
list() {
|
|
43
42
|
return [];
|
|
@@ -87,18 +86,18 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
87
86
|
}
|
|
88
87
|
copy(destination) {
|
|
89
88
|
(0, import_web_stub_dialog.showWebStubDialog)({
|
|
90
|
-
title:
|
|
91
|
-
details: [
|
|
89
|
+
title: "\u590D\u5236\u6587\u4EF6",
|
|
90
|
+
details: [`\u4ECE: ${this.uri}`, `\u5230: ${destination.uri}`]
|
|
92
91
|
});
|
|
93
92
|
}
|
|
94
93
|
move(destination) {
|
|
95
94
|
(0, import_web_stub_dialog.showWebStubDialog)({
|
|
96
|
-
title:
|
|
97
|
-
details: [
|
|
95
|
+
title: "\u79FB\u52A8\u6587\u4EF6",
|
|
96
|
+
details: [`\u4ECE: ${this.uri}`, `\u5230: ${destination.uri}`]
|
|
98
97
|
});
|
|
99
98
|
}
|
|
100
99
|
delete() {
|
|
101
|
-
(0, import_web_stub_dialog.showWebStubDialog)({ title:
|
|
100
|
+
(0, import_web_stub_dialog.showWebStubDialog)({ title: "\u5220\u9664\u6587\u4EF6", details: [`URI: ${this.uri}`] });
|
|
102
101
|
}
|
|
103
102
|
open() {
|
|
104
103
|
return null;
|
|
@@ -130,15 +129,15 @@ if (import_react_native.Platform.OS !== "web") {
|
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
131
|
File.downloadFileAsync = async (_url, destination) => {
|
|
133
|
-
(0, import_web_stub_dialog.showWebStubDialog)({ title:
|
|
132
|
+
(0, import_web_stub_dialog.showWebStubDialog)({ title: "\u4E0B\u8F7D\u6587\u4EF6", details: [`\u76EE\u6807: ${destination.uri}`] });
|
|
134
133
|
return new File(destination.uri);
|
|
135
134
|
};
|
|
136
135
|
File.pickFileAsync = async () => {
|
|
137
|
-
(0, import_web_stub_dialog.showWebStubDialog)({ title:
|
|
136
|
+
(0, import_web_stub_dialog.showWebStubDialog)({ title: "\u9009\u62E9\u6587\u4EF6", details: [] });
|
|
138
137
|
return new File("document:/stub-pick");
|
|
139
138
|
};
|
|
140
139
|
Directory.pickDirectoryAsync = async () => {
|
|
141
|
-
(0, import_web_stub_dialog.showWebStubDialog)({ title:
|
|
140
|
+
(0, import_web_stub_dialog.showWebStubDialog)({ title: "\u9009\u62E9\u76EE\u5F55", details: [] });
|
|
142
141
|
return new Directory("document:/stub-pick");
|
|
143
142
|
};
|
|
144
143
|
const Paths = {
|