* feat(editor): add setting to turn off spellcheck underlines Add a device-local "Underline spelling mistakes" switch to the editing preferences. The rich-text editor and the mobile plain-text editor now set spellcheck from this preference and update live when it changes. Defaults to enabled, so existing behavior is unchanged. Refs #468 * feat(i18n): add Polish as an in-app locale Add Polish (pl) across clients, mirroring how Japanese was added: - Shared: full pl catalog, locale matching for pl/pl-*, Polish memo templates and factory AI prompts, mobile editor strings, and Polish as an AI translation target and selection-translate chip. - Web: "Polski" in the language picker; the catalog is lazy-loaded in its own i18n-pl chunk and kept out of the PWA precache like ja. - Android: pl locale option, mobile-only strings, web-clip labels. Messages that only had an English branch now use English for every non-Chinese locale, so Japanese no longer falls back to Chinese there. - iOS: .polish UI language (pl-PL), pl argument for every t() call, pl in CFBundleLocalizations and Localizable.xcstrings. - Companion: accepts locale "pl" and detects Polish requests. - Browser extension: _locales/pl messages. - Marketing site: /pl/ pages, hreflang, sitemap, language switcher. - Google Play listing copy for pl-PL (manual publish only). * fix(ios): show the note editor in Polish and Japanese The iOS editor received every interface language except English as Chinese, so with Polish or Japanese selected its toolbar and image gallery controls were labeled in Chinese. Pass Polish and Japanese through to the embedded editor, label its toolbar and the shared image gallery controls in both languages, and rebuild the checked-in EditorBundle. The Android editor uses the same gallery labels. Also translate the last iOS strings that had no Polish text: the follow-system language label, note created/updated times and the current-device marker. Refs #473 * fix(companion): recognize Polish typed without diacritics Requests in Latin letters without Polish diacritics were always treated as English, so with a Polish interface "Napisz plan na jutro" got an English reply. With a Polish interface, such text is now told apart by common English and Polish words; when it is still unclear, the recent conversation and then the interface language decide. Other interface languages keep treating Latin text as English. Refs #473 * chore(ios): regenerate the Xcode project for Polish Run xcodegen so the shipped Info.plist lists Polish in CFBundleLocalizations and the project knows the pl region. The hand-written AiDirectStream.swift entries are replaced by the IDs xcodegen generates. MARKETING_VERSION and CURRENT_PROJECT_VERSION stay in the project file because the release script and Xcode Cloud update them there. Refs #473 * i18n(pl): translate the sidebar shortcut, desktop menus and video scope Add Polish for features that reached main while this branch was open: the show/hide sidebar shortcut label, the desktop application and editing context menus, and the new "ai:generate" MCP scope. The desktop menus switch to Polish for pl and pl-* locales; other locales are unchanged. Refs #473
102 lines
5.7 KiB
TypeScript
102 lines
5.7 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { readFileSync } from "node:fs";
|
|
|
|
const readSource = (path: string) => readFileSync(new URL(path, import.meta.url), "utf8");
|
|
|
|
const androidAssistantSource = readSource("../apps/mobile/src/components/MobileAiAssistantModal.tsx");
|
|
const androidEditorSource = readSource("../apps/mobile/src/components/LocalTiptapEditor.tsx");
|
|
const androidDetailSource = readSource("../apps/mobile/src/screens/WorkspaceMemoDetail.tsx");
|
|
const androidWorkspaceSource = [
|
|
readSource("../apps/mobile/src/screens/WorkspaceScreen.tsx"),
|
|
readSource("../apps/mobile/src/screens/WorkspaceEditors.tsx"),
|
|
readSource("../apps/mobile/src/screens/WorkspacePickers.tsx"),
|
|
].join("\n");
|
|
const androidSessionSource = readSource("../apps/mobile/src/lib/session.tsx");
|
|
const iosAssistantSource = readSource("../apps/ios/EdgeEver/Features/Workspace/AiAssistantSheet.swift");
|
|
const iosDetailSource = readSource("../apps/ios/EdgeEver/Features/Workspace/MemoDetailView.swift");
|
|
const iosEditorSource = readSource("../apps/ios/EdgeEver/Features/Workspace/MemoEditView.swift");
|
|
const iosApiSource = readSource("../apps/ios/EdgeEver/Data/Network/APIClient.swift");
|
|
|
|
describe("native mobile AI note assistant", () => {
|
|
test("exposes all five first-version actions on Android and iOS", () => {
|
|
for (const action of [
|
|
"summarize",
|
|
"extract-key-points",
|
|
"extract-todos",
|
|
"rewrite-proofread",
|
|
"translate",
|
|
]) {
|
|
expect(androidAssistantSource).toContain(`"${action}"`);
|
|
}
|
|
|
|
for (const action of [
|
|
"case summarize",
|
|
'case extractKeyPoints = "extract-key-points"',
|
|
'case extractTodos = "extract-todos"',
|
|
'case rewriteProofread = "rewrite-proofread"',
|
|
"case translate",
|
|
]) {
|
|
expect(readSource("../apps/ios/EdgeEver/Data/Models/Models.swift")).toContain(action);
|
|
}
|
|
});
|
|
|
|
test("streams AI output from the shared workspace configuration on both clients", () => {
|
|
expect(androidAssistantSource).toContain("resolveAiAssistantOpenAction");
|
|
expect(androidAssistantSource).toContain("readMobileAiAssistantLastAction");
|
|
expect(androidEditorSource).toContain("readStoredAiAssistantLastActionPreference");
|
|
expect(androidEditorSource).toContain("resolveAiAssistantOpenAction");
|
|
expect(iosAssistantSource).toContain("lastAiAssistantAction");
|
|
expect(iosAssistantSource).toContain("applyStoredOrDefaultAction");
|
|
expect(readSource("../apps/ios/EdgeEver/Data/Preferences/PreferencesStore.swift")).toContain("edgeever.aiAssistant.lastAction");
|
|
|
|
expect(androidAssistantSource).toContain("client!.listAiPrompts(resolvedLocale)");
|
|
expect(androidAssistantSource).toContain("client.streamAiGeneration(");
|
|
expect(androidAssistantSource).toContain("promptId: selectedPrompt.id");
|
|
expect(androidWorkspaceSource).toContain("aiPromptsJson={aiPromptsJson}");
|
|
expect(androidEditorSource).toContain("...(promptId ? { promptId } : {})");
|
|
expect(androidSessionSource).toContain("fetch: expoFetch as typeof fetch");
|
|
expect(androidSessionSource).toContain("directAiGeneration: true");
|
|
expect(iosAssistantSource).toContain("env.session.client.listAiPrompts(locale: locale)");
|
|
expect(iosAssistantSource).toContain("client.streamAiGeneration(input)");
|
|
expect(iosAssistantSource).toContain("promptId: selectedPrompt?.id");
|
|
expect(iosApiSource).toContain('path: "/api/v1/ai/generate/prepare"');
|
|
expect(iosApiSource).toContain("streamDirectProvider");
|
|
expect(iosApiSource).toContain('makeURL(path: "/api/v1/ai/generate")');
|
|
expect(iosApiSource).toContain("for try await line in bytes.lines");
|
|
});
|
|
|
|
test("keeps AI output as a draft until append or replace is confirmed", () => {
|
|
expect(androidAssistantSource).toContain('apply("append")');
|
|
expect(androidAssistantSource).toContain('apply("replace")');
|
|
expect(androidWorkspaceSource).toContain("localUpdateMemoMutation.mutateAsync");
|
|
expect(androidWorkspaceSource).toContain("contentJson: markdownToDoc(contentMarkdown)");
|
|
|
|
expect(iosAssistantSource).toContain("apply(.append)");
|
|
expect(iosAssistantSource).toContain("apply(.replace)");
|
|
expect(iosDetailSource).toContain("createMemoEditSession(memoId: sourceMemo.id)");
|
|
expect(iosDetailSource).toContain("expectedRevision: sourceMemo.revision");
|
|
expect(iosDetailSource).toContain("expectedContentHash: sourceMemo.contentHash");
|
|
});
|
|
|
|
test("keeps the assistant reachable from each native note action menu", () => {
|
|
expect(androidDetailSource).toContain('label={resolvedLocale !== "zh-CN" ? "AI note assistant" : "AI 笔记助手"}');
|
|
expect(androidDetailSource).toContain("setAiAssistantOpen(true)");
|
|
expect(androidDetailSource).toContain("<MobileAiAssistantModal");
|
|
expect(iosDetailSource).toContain('env.preferences.t("AI 笔记助手", en: "AI note assistant"');
|
|
expect(iosDetailSource).toContain("AiAssistantSheet(memo: memo)");
|
|
});
|
|
|
|
test("suggests tags from native drafts and merges them without duplicates", () => {
|
|
expect(androidWorkspaceSource).toContain("client.suggestAiTags({");
|
|
expect(androidWorkspaceSource).toContain("contentMarkdown,");
|
|
expect(androidWorkspaceSource).toContain("currentTags: selectedTags");
|
|
expect(androidWorkspaceSource).toContain("onChange(Array.from(new Set([...selectedTags, ...additions])).slice(0, 24))");
|
|
|
|
expect(iosApiSource).toContain('path: "/api/v1/ai/tag-suggestions"');
|
|
expect(iosEditorSource).toContain("env.session.client.suggestAiTags(input)");
|
|
expect(iosEditorSource).toContain("contentMarkdown: contentMarkdown");
|
|
expect(iosEditorSource).toContain("currentTags: currentTags");
|
|
expect(iosEditorSource).toContain("tagsText = (currentTags + additions).joined(separator: \", \")");
|
|
});
|
|
});
|