Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
build(mobile): 安卓 AsyncStorage 数据库上限从 6 MiB 调到 64 MiB (#5405)
Dash1e7a3c5f873b
diff --git a/apps/mobile/app.json b/apps/mobile/app.jsonindex 4258fb7319..a53b0a4c85 100644--- a/apps/mobile/app.json+++ b/apps/mobile/app.json@@ -61,6 +61,7 @@"./plugins/with-third-party-notices","./plugins/with-google-signin-modular-headers","./plugins/with-wechat-opensdk-modulemap",+ "./plugins/with-async-storage-db-size",["expo-build-properties",{diff --git a/apps/mobile/plugins/with-async-storage-db-size.js b/apps/mobile/plugins/with-async-storage-db-size.jsnew file mode 100644index 0000000000..a3762372ce--- /dev/null+++ b/apps/mobile/plugins/with-async-storage-db-size.js@@ -0,0 +1,32 @@+const { withGradleProperties } = require("@expo/config-plugins");++// @react-native-async-storage/async-storage 的安卓后端是 SQLite,默认上限只有 6 MiB,+// 写满后发件箱 / 草稿写入报 SQLITE_FULL,与整机剩余空间无关(#5403)。上限只是允许增长到的+// 最大值,不预占空间。库读取根 gradle.properties 的 AsyncStorage_db_size_in_MB,+// 编译期写进 BuildConfig,所以只随新安装包生效,会改变 runtime fingerprint。+const PROPERTY_KEY = "AsyncStorage_db_size_in_MB";+const DATABASE_SIZE_MB = 64;++function setAsyncStorageDbSize(properties) {+ const value = String(DATABASE_SIZE_MB);+ const existing = properties.find(+ (item) => item.type === "property" && item.key === PROPERTY_KEY,+ );+ if (existing) {+ existing.value = value;+ return properties;+ }+ properties.push({ type: "property", key: PROPERTY_KEY, value });+ return properties;+}++function withAsyncStorageDbSize(config) {+ return withGradleProperties(config, (androidConfig) => {+ androidConfig.modResults = setAsyncStorageDbSize(androidConfig.modResults);+ return androidConfig;+ });+}++module.exports = withAsyncStorageDbSize;+module.exports.setAsyncStorageDbSize = setAsyncStorageDbSize;+module.exports.DATABASE_SIZE_MB = DATABASE_SIZE_MB;diff --git a/apps/mobile/src/__tests__/asyncStorageDbSizePlugin.test.ts b/apps/mobile/src/__tests__/asyncStorageDbSizePlugin.test.tsnew file mode 100644index 0000000000..0a044cf252--- /dev/null+++ b/apps/mobile/src/__tests__/asyncStorageDbSizePlugin.test.ts@@ -0,0 +1,56 @@+import { readFileSync } from "node:fs";+import { createRequire } from "node:module";+import { resolve } from "node:path";++import { describe, expect, it } from "vitest";++type PropertiesItem =+ | { type: "property"; key: string; value: string }+ | { type: "comment"; value: string };+const require = createRequire(import.meta.url);+const { setAsyncStorageDbSize, DATABASE_SIZE_MB } =+ require("../../plugins/with-async-storage-db-size.js") as {+ setAsyncStorageDbSize: (properties: PropertiesItem[]) => PropertiesItem[];+ DATABASE_SIZE_MB: number;+ };++describe("with-async-storage-db-size config plugin", () => {+ it("raises the Android AsyncStorage limit from the 6 MiB default to 64 MiB", () => {+ expect(DATABASE_SIZE_MB).toBe(64);+ const properties = setAsyncStorageDbSize([+ { type: "property", key: "newArchEnabled", value: "true" },+ ]);+ expect(properties).toEqual([+ { type: "property", key: "newArchEnabled", value: "true" },+ {+ type: "property",+ key: "AsyncStorage_db_size_in_MB",+ value: String(DATABASE_SIZE_MB),+ },+ ]);+ });++ it("overwrites an existing value instead of appending a duplicate on incremental prebuild", () => {+ const properties = setAsyncStorageDbSize([+ { type: "comment", value: "kept" },+ { type: "property", key: "AsyncStorage_db_size_in_MB", value: "6" },+ ]);+ expect(properties).toEqual([+ { type: "comment", value: "kept" },+ {+ type: "property",+ key: "AsyncStorage_db_size_in_MB",+ value: String(DATABASE_SIZE_MB),+ },+ ]);+ });++ it("is registered in app.json", () => {+ const appJson = JSON.parse(+ readFileSync(resolve(__dirname, "../../app.json"), "utf8"),+ );+ expect(appJson.expo.plugins).toContain(+ "./plugins/with-async-storage-db-size",+ );+ });+});