diff --git a/CLAUDE.md b/CLAUDE.md index 091fa73..d919c35 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -11,7 +11,7 @@ same domain as the backend (see `fmc_pocketbase/README.md`). App: the store at the root, three shelves under one "Store" tab — watchfaces (`/`, with `?mine` for the signed-in user's own shelf; `/my` redirects there; `/market/[id]` — a face's showcase page), apps (`/apps`, `/apps/[id]` — -`.wp2app` packages published from cmf-tech-community/apps, built with the wp2-apps SDK) and firmware (`/firmware`, +`.wp2app` packages published from fmctools/apps, built with the wp2-apps SDK) and firmware (`/firmware`, `/firmware/[id]` — OTA images), plus a Community section (`/community`, links out; the old `/?community` redirects there); creator profiles (`/user/[id]`), watchface editor (`/editor`, with a BLE connection to the CMF Watch Pro 2) and auth (`/login`, `/register`). @@ -205,9 +205,9 @@ and `frames` sections; `PropsPanel.svelte` is the container and owns the shared desktop, the swipeable sheet on the phone — no portal/floating-ui deps. Button & co. don't forward arbitrary attrs; for `title` tooltips wrap in a `` (see `tool-slot` in editor.svelte). -- Icons are Material Symbols Rounded, the whole set from Google Fonts (`app.html`). `name` IS +- Icons are Material Symbols Rounded, the full font bundled in `static/fonts/material-symbols.woff2`. `name` IS the ligature — ``, any name from fonts.google.com/icons works with - no map to edit and no build step. A name the font doesn't know renders as its own word, so + no map to edit and no build step. Keep the font local and preserve the load guard and fixed icon slot; do not reintroduce the external Google Fonts icon stylesheet. A name the font doesn't know is invalid, so `tests/ui-icon.browser.test.ts` measures every name the app spells. - Phone first for the store: the watchface grid is two dials across on a phone (`watchface-list`), a detail page is one column with a single ink button (the action that @@ -261,3 +261,7 @@ and `frames` sections; `PropsPanel.svelte` is the container and owns the shared - **English everywhere in the repo and around it**: code, identifiers, comments, docs, commit messages, PR titles and descriptions, issue text, CI/workflow files. Chat with the user can be in any language — anything that lands in git or on GitHub is English. + +## Watch identity and preview overrides + +`docs/watch-identity.md` records the Nothing X model/color formats and browser limitations. Keep factory identity separate from preview overrides. Unknown SKU values stay unknown, advertisement observation is optional and bounded, and recovery skips the extra PID query. The preview selectors must never feed firmware or package compatibility checks. No physical-device claim follows from fixture tests. diff --git a/README.md b/README.md index d03052f..b497133 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# FMC Watchfaces Frontend +# FMC Frontend -Watchface editor + marketplace for the CMF Watch Pro 2 / Pro 3. SvelteKit (Svelte 5) SPA, +Watch faces, apps, firmware and browser tools for CMF watches. SvelteKit (Svelte 5) SPA, static build (`@sveltejs/adapter-static`). Backend — [`fmc_pocketbase`](../fmc_pocketbase) (PocketBase), must be running for auth/marketplace to work. @@ -52,3 +52,13 @@ pnpm test # round-trip test of the .bin parser/compiler against watchfaces/fi [AGPL-3.0](LICENSE). The bundled Geist fonts are under the SIL Open Font License — see [`static/fonts/OFL.txt`](static/fonts/OFL.txt). + +Material Symbols Rounded is bundled locally under the [Apache 2.0 license](static/fonts/LICENSE-Material-Symbols.txt). Icons do not require Google Fonts requests. + +## Branding assets + +The original community logo is `static/branding/fmc-community.svg`. Navigation preserves the full artwork, including “by COMMUNITY”. Transparent SVG favicons adapt to the system light/dark preference. A stable 96px PNG and ICO provide non-themed fallbacks, with a contrasting edge for light and dark host surfaces. Installed-app icons keep a solid background for platform masking. + +Run `pnpm brand-assets` to regenerate the icons and `pnpm og-card` to regenerate the default share card. These scripts use Playwright Chromium; set `PLAYWRIGHT_CHANNEL=msedge` to use an installed Edge instead. Keep device-specific support descriptions on their relevant pages. + +Keep `/favicon.png` stable for crawlers; do not rotate favicon URLs on every build. Browser and third-party caches refresh independently. Search results may take days to weeks to recrawl, and favicon changes are not guaranteed to appear immediately. diff --git a/docs/watch-identity.md b/docs/watch-identity.md new file mode 100644 index 0000000..6969f69 --- /dev/null +++ b/docs/watch-identity.md @@ -0,0 +1,116 @@ +# Watch model and color identification + +CMF watches identify their product model and factory color in Bluetooth +advertisements. Nothing X combines these values into a catalog key to select the +corresponding product artwork. A factory color identifies a product variant; it +does not describe replacement straps or bezels. + +## Product identifiers + +A product ID contains four bytes. Its catalog representation is eight hexadecimal +digits in the same byte order, with leading zeroes preserved. + +| Product ID | Watch | +| ---------- | ----------- | +| `82D5BB72` | Watch Pro | +| `34F72851` | Watch Pro 2 | +| `335BBD62` | Watch 3 Pro | + +The factory color is a separate byte, represented by two hexadecimal digits. +The catalog key is the product ID followed by the color code. For example, +`335BBD62` and `23` form `335BBD6223`, an orange Watch 3 Pro entry. +The catalog calls this combined key `fastPairId`; it is a product/SKU identifier, +not a unique identifier for an individual watch. + +The [artwork reference](https://cmf.arnv.dev/reference/watch-artwork/) lists the known color codes. +Several codes can share the same image. Their individual regional or retail +meanings have not been established. + +## Advertisement normalization + +The field offsets below refer to the byte sequence reconstructed by Nothing X's +watch parser, not the complete Bluetooth advertising packet. + +Android and Web Bluetooth expose manufacturer-specific data with the two-byte +company identifier separated from its payload. In Nothing X 3.10.0: + +- Company ID `0x0CCB` (3275 decimal) uses the supplied payload unchanged. +- For other company IDs passed to the watch parser, `2C BE` is prepended to the + supplied payload before the fields are read. + +This second rule describes the parser's normalization branch; it does not mean +that arbitrary manufacturers identify CMF watches. The parser also checks the +watch marker and validates the embedded address through its vendor-address check. + +## Advertisement layouts + +Nothing X uses a legacy layout for normalized data of at least 18 bytes, and a +compact layout for 14-17 bytes. Shorter data does not contain the complete fields. + +| Field | Legacy layout | Compact layout | +| -------------------------- | -------------------- | --------------- | +| Embedded Bluetooth address | Bytes 0-5 | Bytes 0-5 | +| Watch marker | Bytes 6-11: `JX-IWD` | Bytes 6-7: `JX` | +| Product ID | Bytes 12-15 | Bytes 8-11 | +| Factory color code | Byte 16 | Byte 12 | +| State | Byte 17 | Byte 13 | + +The address bytes are formatted in their existing order. The product and color +bytes are converted to uppercase hexadecimal without reversing them. +Nothing X exposes them as `PRODUCT_ID`, `COLOR_ID` and the combined +`PRODUCT_COLOR_ID` / `FAST_PAIRED_ID`. + +The parser sets `IS_PAIRED` for state bytes `00`, `01` or `02`. This is the app's +interpretation of an advertising state; it does not establish an authenticated +GATT session. Advertised identity is not proof of device ownership. + +## QR and shell identifiers + +The stock onboarding QR uses product field `P` and color field `C`. The QR color +is decimal, whereas the catalog uses hexadecimal. For example, decimal `35` +corresponds to catalog color `23`. Comparing the strings without this conversion +can select the wrong SKU. + +Watch Pro 2 and Watch 3 Pro firmware analysis identifies the `APP_PID` property and +the read-only `AT GETPID` query. Its response format is: + +```text +GETPID:34F72851,OK +``` + +This query reports the product ID only. It does not report the factory color. +Shell-service availability and command support depend on the firmware; the query +is separate from the encrypted control-channel authentication protocol. A shell +reply may arrive over several Bluetooth notifications. + +## Browser access + +Web Bluetooth distinguishes access to GATT services from access to advertisements. +A successful connection alone does not provide the manufacturer-data color byte. +Where supported, `BluetoothDevice.watchAdvertisements()` delivers advertisements +for an authorized device. API support, permissions and the watch's advertising +state determine whether those bytes are available. + +A missing advertisement or unknown color code leaves the factory color unknown. +An advertised device name can help identify a model, but does not establish a +factory color. A user-selected frame is a display preference, not detected hardware +metadata or evidence that a firmware package is compatible. + +See the [Web Bluetooth specification](https://bluetooth.spec.whatwg.org/) and +[BluetoothDevice API reference](https://developer.mozilla.org/en-US/docs/Web/API/BluetoothDevice) +for the browser interfaces and availability. + +## Evidence and scope + +The advertisement layouts and state handling come from Nothing X 3.10.0's +`com.nothing.link.bluetooth.sdk.scan.parser.NothingWatchParser`, including +`getTotalManufacture()` and `parser()`. `NtBlePlugin` consumes the resulting +`PRODUCT_ID` and `COLOR_ID`; Flutter's +`BluetoothHelper.getDeviceInfoByBluetoothDevice` resolves them against the +`DeviceInfoTable` SKU catalog. + +The QR and `APP_PID` findings come from stock Watch Pro 2 and Watch 3 Pro firmware +analysis. The artwork associations come from the Nothing X product catalog and +its recorded image URLs. These findings establish the documented formats and +known catalog mappings, not universal advertisement or shell-command availability +across every firmware and browser. diff --git a/package.json b/package.json index 54361f7..63e4deb 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "dev": "vite dev --host", "build": "vite build && node scripts/seo.ts", "og-card": "node scripts/og-card.ts", + "brand-assets": "node scripts/brand-assets.ts", "preview": "vite preview", "prepare": "svelte-kit sync || echo ''", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", diff --git a/scripts/brand-assets.ts b/scripts/brand-assets.ts new file mode 100644 index 0000000..3e93697 --- /dev/null +++ b/scripts/brand-assets.ts @@ -0,0 +1,67 @@ +import { readFile, writeFile } from "node:fs/promises"; +import { chromium } from "playwright"; +const browser = await chromium.launch({ channel: process.env.PLAYWRIGHT_CHANNEL }); +const page = await browser.newPage(); +const mark = await readFile("static/branding/fmc-community.svg", "utf8"); + +await writeFile("static/icons/icon.svg", mark); +// Keep every part of the supplied mark; remove only its tile and tighten the surrounding canvas. +const transparentMark = mark.replace(/]*\/>/, ""); +const freeMark = transparentMark.replace('viewBox="0 0 512 512"', 'viewBox="44 44 424 424"'); + +for (const [name, foreground] of [ + ["light", "#010101"], + ["dark", "#FAFAFA"], + ["neutral", "#202020"], +]) { + if (name !== "neutral") + await writeFile( + `static/branding/fmc-community-${name}.svg`, + transparentMark.replaceAll('fill="#FAFAFA"', 'fill="' + foreground + '"'), + ); + let variant = freeMark.replaceAll('fill="#FAFAFA"', 'fill="' + foreground + '"'); + // The non-themed fallback needs an edge that survives both light and dark host surfaces. + if (name === "neutral") + variant = variant.replace( + /(]*>)([\s\S]*)(<\/svg>)/, + '$1$2$2$3', + ); + await writeFile(`static/icons/favicon-${name}.svg`, variant); +} + +// Run from the repository root: node scripts/brand-assets.ts. +for (const [name, size, pad] of [ + ["icon-192.png", 192, 0], + ["icon-512.png", 512, 0], + ["icon-maskable-512.png", 512, 32], + ["apple-touch-icon.png", 180, 0], + ["favicon-32.png", 32, 0], + ["favicon-96.png", 96, 0], +] as const) { + await page.setViewportSize({ width: size, height: size }); + const artwork = name.startsWith("favicon-") + ? await readFile("static/icons/favicon-neutral.svg", "utf8") + : mark; + + await page.setContent( + `${artwork}`, + ); + if (name === "favicon-32.png") { + const png = await page.screenshot({ omitBackground: true }); + const header = Buffer.alloc(22); + + header.writeUInt16LE(1, 2); + header.writeUInt16LE(1, 4); + header[6] = header[7] = 32; + header.writeUInt16LE(1, 10); + header.writeUInt16LE(32, 12); + header.writeUInt32LE(png.length, 14); + header.writeUInt32LE(22, 18); + await writeFile("static/favicon.ico", Buffer.concat([header, png])); + } else if (name === "favicon-96.png") { + await page.screenshot({ path: "static/favicon.png", omitBackground: true }); + } else { + await page.screenshot({ path: `static/icons/${name}` }); + } +} +await browser.close(); diff --git a/scripts/og-card.ts b/scripts/og-card.ts index a2cab97..b923683 100644 --- a/scripts/og-card.ts +++ b/scripts/og-card.ts @@ -1,54 +1,85 @@ -// Renders static/og-default.png — the 1200x630 card a link unfurls to when the page behind it -// isn't one watchface. Committed output; this only exists so it can be redrawn when the mark or -// the pitch changes: `pnpm run og-card`. -// -// The mark itself comes from static/icons/icon.svg, so the card can't drift from the app icon. -// Chromium is the one playwright already installs for the browser tests — no new dependency. import { readFile, writeFile } from "node:fs/promises"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { chromium } from "playwright"; -import { DEVICE } from "../src/lib/shared/seo/copy.ts"; const STATIC = join(dirname(fileURLToPath(import.meta.url)), "..", "static"); +const inline = async (path: string, mime: string) => + `data:${mime};base64,${(await readFile(join(STATIC, path))).toString("base64")}`; +const source = (await readFile(join(STATIC, "branding/fmc-community.svg"), "utf8")) + .replace(/]*\/>/, "") + .replace(/\s(?:width|height)="512"/g, ""); +const color = process.env.OG_WATCH_COLOR ?? "dark-grey"; -// the dark-scheme pair from tokens.css, spelled out — a PNG can't read a custom property -const INK = "#131313"; -const PAPER = "#f2f2f2"; - -const mark = await readFile(join(STATIC, "icons", "icon.svg"), "utf8"); - -const html = ` - - - - - -
${mark}
-

Watchfaces for the ${DEVICE}

-

Browse, edit and install — straight from the browser, no phone app

-`; - -const browser = await chromium.launch(); -const page = await browser.newPage({ viewport: { width: 1200, height: 630 } }); - -await page.setContent(html, { waitUntil: "load" }); -await page.evaluate(() => document.fonts.ready); -const png = await page.screenshot({ type: "png" }); - -await browser.close(); -await writeFile(join(STATIC, "og-default.png"), png); -console.log(`static/og-default.png — ${(png.length / 1024).toFixed(1)} kB`); +if (!["dark-grey", "orange", "green"].includes(color)) + throw new Error("Unsupported OG watch color"); +const output = process.env.OG_OUTPUT ?? join(STATIC, "og-default.png"); +const browser = await chromium.launch({ channel: process.env.PLAYWRIGHT_CHANNEL }); + +try { + const page = await browser.newPage({ + viewport: { width: 1200, height: 630 }, + deviceScaleFactor: 1, + }); + + await page.setContent(source); + const bounds = await page.locator("svg").evaluate((svg) => { + const { x, y, width, height } = (svg as SVGSVGElement).getBBox(); + + return `${x - 2} ${y - 2} ${width + 4} ${height + 4}`; + }); + const mark = source.replace(/viewBox="[^"]+"/, `viewBox="${bounds}"`); + const [font, watch] = await Promise.all([ + inline("fonts/geist.woff2", "font/woff2"), + inline(`frames/watch-3-pro-${color}.webp`, "image/webp"), + ]); + + await page.setContent( + ` +
+
${mark}
+

Watch faces.
Apps & firmware.

+

Explore, create and install.

+
+ +
`, + { waitUntil: "load" }, + ); + await page.evaluate(async () => { + await document.fonts.ready; + await Promise.all([...document.images].map((image) => image.decode())); + }); + await page.evaluate( + () => + new Promise((resolve) => + requestAnimationFrame(() => requestAnimationFrame(() => resolve())), + ), + ); + + const textFits = await page + .locator("h1") + .evaluate((element) => element.scrollWidth <= element.clientWidth); + + if (!textFits) throw new Error("OG headline overflows its column"); + const png = await page.screenshot({ type: "png" }); + + await writeFile(output, png); + console.log( + `static/og-default.png: 1200x630, ${(png.length / 1024).toFixed(1)} kB; local fonts and artwork only`, + ); +} finally { + await browser.close(); +} diff --git a/scripts/seo.ts b/scripts/seo.ts index 93231a7..0372b35 100644 --- a/scripts/seo.ts +++ b/scripts/seo.ts @@ -19,7 +19,6 @@ import { fileURLToPath } from "node:url"; import { creatorDesc, creatorTitle, - DEVICE, faceDesc, faceTitle, siteDesc, @@ -35,7 +34,7 @@ const SITE = (process.env.SITE_URL || "https://fmc.tools").replace(/\/$/, ""); const PB = (process.env.PB_URL || SITE).replace(/\/$/, ""); const DEFAULT_IMAGE = `${SITE}/og-default.png`; -const DEFAULT_ALT = `${SITE_NAME} — watchfaces for the ${DEVICE}`; +const DEFAULT_ALT = `${SITE_NAME} — watch faces, apps and firmware for CMF watches`; // ---- the meta block ---- diff --git a/src/app.html b/src/app.html index 6adf9b6..57a59e2 100644 --- a/src/app.html +++ b/src/app.html @@ -2,28 +2,48 @@ + - + + + - + + %sveltekit.head% diff --git a/src/lib/modules/auth/i18n.ts b/src/lib/modules/auth/i18n.ts index 09f369f..d3df782 100644 --- a/src/lib/modules/auth/i18n.ts +++ b/src/lib/modules/auth/i18n.ts @@ -3,8 +3,8 @@ import { dict } from "$lib/shared/i18n"; export const t = dict( { // pages - loginTitle: "Sign in — FMC Watchfaces", - registerTitle: "Sign up — FMC Watchfaces", + loginTitle: "Sign in — FMC", + registerTitle: "Sign up — FMC", welcomeBack: "Welcome back", createYourAccount: "Create your account", // login-form / signup-form @@ -37,8 +37,8 @@ export const t = dict( }, { ru: { - loginTitle: "Вход — FMC Watchfaces", - registerTitle: "Регистрация — FMC Watchfaces", + loginTitle: "Вход — FMC", + registerTitle: "Регистрация — FMC", welcomeBack: "С возвращением", createYourAccount: "Создайте аккаунт", loginWithGoogle: "Войти через Google", @@ -67,8 +67,8 @@ export const t = dict( save: "Сохранить", }, uk: { - loginTitle: "Вхід — FMC Watchfaces", - registerTitle: "Реєстрація — FMC Watchfaces", + loginTitle: "Вхід — FMC", + registerTitle: "Реєстрація — FMC", welcomeBack: "З поверненням", createYourAccount: "Створіть акаунт", loginWithGoogle: "Увійти через Google", @@ -97,8 +97,8 @@ export const t = dict( save: "Зберегти", }, es: { - loginTitle: "Entrar — FMC Watchfaces", - registerTitle: "Registro — FMC Watchfaces", + loginTitle: "Entrar — FMC", + registerTitle: "Registro — FMC", welcomeBack: "Hola de nuevo", createYourAccount: "Crea tu cuenta", loginWithGoogle: "Entrar con Google", @@ -127,8 +127,8 @@ export const t = dict( save: "Guardar", }, hi: { - loginTitle: "साइन इन — FMC Watchfaces", - registerTitle: "साइन अप — FMC Watchfaces", + loginTitle: "साइन इन — FMC", + registerTitle: "साइन अप — FMC", welcomeBack: "फिर से स्वागत है", createYourAccount: "अपना खाता बनाएं", loginWithGoogle: "Google से साइन इन करें", diff --git a/src/lib/modules/device/components/watch-frame-dialog.svelte b/src/lib/modules/device/components/watch-frame-dialog.svelte new file mode 100644 index 0000000..be3a0c1 --- /dev/null +++ b/src/lib/modules/device/components/watch-frame-dialog.svelte @@ -0,0 +1,123 @@ + + + framePanelClosed()}> +
+ {$t.appearanceAuto} + +
+
+ {#each ["watch_pro_2", "watch_3_pro"] as v} + + {/each} +
+
+ {#each $appearance.colors as v} + + {/each} +
+
+ + diff --git a/src/lib/modules/device/i18n.ts b/src/lib/modules/device/i18n.ts index b0eea9d..02e1ea0 100644 --- a/src/lib/modules/device/i18n.ts +++ b/src/lib/modules/device/i18n.ts @@ -7,6 +7,17 @@ import helpHi from "./pages/troubleshooting.hi.md?raw"; export const t = dict( { + appearanceColors: { + "dark-grey": "Dark Grey", + "light-grey": "Light Grey", + orange: "Orange", + blue: "Blue", + green: "Green", + }, + watchAppearance: "Watch Frame", + appearanceModel: "Model", + appearanceColor: "Color", + appearanceAuto: "Automatic", // watch-sheet connectYourWatch: "Connect your watch", overWebBluetooth: "CMF Watch Pro 2 / Pro 3 over Web Bluetooth.", @@ -124,6 +135,18 @@ export const t = dict( }, { ru: { + appearanceColors: { + "dark-grey": "Тёмно-серый", + "light-grey": "Светло-серый", + orange: "Оранжевый", + blue: "Синий", + green: "Зелёный", + }, + watchAppearance: "Корпус часов", + appearanceModel: "Модель", + appearanceColor: "Цвет", + appearanceAuto: "Автоматически", + connectYourWatch: "Подключите часы", overWebBluetooth: "CMF Watch Pro 2 / Pro 3 через Web Bluetooth.", connecting: "Подключение…", @@ -231,6 +254,18 @@ export const t = dict( backToFaces: "К циферблатам", }, uk: { + appearanceColors: { + "dark-grey": "Темно-сірий", + "light-grey": "Світло-сірий", + orange: "Помаранчевий", + blue: "Синій", + green: "Зелений", + }, + watchAppearance: "Корпус годинника", + appearanceModel: "Модель", + appearanceColor: "Колір", + appearanceAuto: "Автоматично", + connectYourWatch: "Підключіть годинник", overWebBluetooth: "CMF Watch Pro 2 / Pro 3 через Web Bluetooth.", connecting: "Підключення…", @@ -340,6 +375,18 @@ export const t = dict( backToFaces: "До циферблатів", }, es: { + appearanceColors: { + "dark-grey": "Gris oscuro", + "light-grey": "Gris claro", + orange: "Naranja", + blue: "Azul", + green: "Verde", + }, + watchAppearance: "Marco del reloj", + appearanceModel: "Modelo", + appearanceColor: "Color", + appearanceAuto: "Automático", + connectYourWatch: "Conecta tu reloj", overWebBluetooth: "CMF Watch Pro 2 / Pro 3 por Web Bluetooth.", connecting: "Conectando…", @@ -450,6 +497,18 @@ export const t = dict( backToFaces: "Volver a las esferas", }, hi: { + appearanceColors: { + "dark-grey": "गहरा स्लेटी", + "light-grey": "हल्का स्लेटी", + orange: "नारंगी", + blue: "नीला", + green: "हरा", + }, + watchAppearance: "घड़ी का फ्रेम", + appearanceModel: "मॉडल", + appearanceColor: "रंग", + appearanceAuto: "अपने आप", + connectYourWatch: "अपनी घड़ी कनेक्ट करें", overWebBluetooth: "CMF Watch Pro 2 / Pro 3, Web Bluetooth से।", connecting: "कनेक्ट हो रहा है…", diff --git a/src/lib/modules/device/lib/ble.ts b/src/lib/modules/device/lib/ble.ts index 4c5f798..b58fa92 100644 --- a/src/lib/modules/device/lib/ble.ts +++ b/src/lib/modules/device/lib/ble.ts @@ -3,6 +3,7 @@ // upload watchfaces. The wire format it speaks lives in ble-protocol.ts. // Chromium only (no Web Bluetooth in Firefox/Safari); requires a user gesture and // localhost or HTTPS. +import { MANUFACTURERS, observeIdentity, productReply, type WatchIdentity } from "./watch-identity"; import { dialLabel, flashedOn, unclaimDial } from "./catalog-names"; import { cat, @@ -40,11 +41,12 @@ import { } from "./wp2"; export interface WatchInfo { - /** The advertised name ("CMF Watch Pro 2 …", "CMF Watch Pro 3 …") — the only model id we get */ + /** The advertised name ("CMF Watch Pro 2 …", "CMF Watch Pro 3 …") ; factory identity is optional */ name: string | null; battery: number | null; firmware: string | null; serial: string | null; + identity?: WatchIdentity | null; } // ponytail: flat list of installed dial ids — this firmware reports everything before the // §9.5g gallery sentinel, so the builtin/downloaded split always left one side empty. @@ -163,9 +165,11 @@ export class Watch { handlers = new Map void | Promise>(); rx: Promise = Promise.resolve(); // serializes inbound notifications, see subscribe() shellWaiter: ((s: string) => void) | null = null; + identity: WatchIdentity | null = null; + private identityReply: ((s: string) => void) | null = null; shellService: string | null = null; // where shellBlast found the shell, for its next try device: BluetoothDevice | null = null; - name: string | null = null; // advertised — the only model id there is + name: string | null = null; // advertised name; factory identity is separate battery: number | null = null; firmware: string | null = null; serial: string | null = null; @@ -217,6 +221,7 @@ export class Watch { { manufacturerData: [{ companyIdentifier: 0x0ccb }] }, ], optionalServices: SERVICES, + optionalManufacturerData: MANUFACTURERS, }); } catch (e) { dbg("requestDevice failed:", errText(e)); @@ -358,6 +363,9 @@ export class Watch { let device = again && this.device ? this.device : await this.pick(); this.device = device; + this.identity = null; + let advertisedIdentity = rescue ? Promise.resolve(null) : observeIdentity(device); + this.name = device.name ?? null; this.capacity = capacityOf(this.name); this.headerCount = null; @@ -423,6 +431,10 @@ export class Watch { if (!/not offered to this origin/i.test((e as Error).message)) throw e; this.status("re-picking device…"); device = await this.pick(); + this.device = device; + this.name = device.name ?? null; + this.capacity = capacityOf(this.name); + advertisedIdentity = rescue ? Promise.resolve(null) : observeIdentity(device); await Promise.race([discover(), timeout(15000, what)]); } }; @@ -535,7 +547,16 @@ export class Watch { await subscribe(["shellRead"]); await this.pair(pairMs); } - if (!rescue) await this.fetchInfo(); + if (!rescue) { + await this.fetchInfo(); + const advertised = await advertisedIdentity; + const reported = await this.readProductIdentity(); + // A conflicting factory PID cannot borrow the advertisement's colour. + this.identity = + reported && advertised && reported.productId !== advertised.productId + ? reported + : (advertised ?? reported); + } } catch (e) { // without this a failed pair()/authenticate() leaves the physical GATT link hanging: // the watch thinks it's busy with us, and the next Connect won't see the shell service again @@ -552,6 +573,7 @@ export class Watch { battery: this.battery, firmware: this.firmware, serial: this.serial, + identity: this.identity, }; } @@ -560,6 +582,7 @@ export class Watch { const s = new TextDecoder().decode(bytes); dbg("shell:", s.trim()); + this.identityReply?.(s); if (this.shellWaiter && s.includes("GETSECRET:")) { this.shellWaiter(s); this.shellWaiter = null; @@ -1245,6 +1268,34 @@ export class Watch { } } + /** Optional factory product ID. No writes to settings or flash; rescue never calls this. */ + private async readProductIdentity(): Promise { + const write = this.chars[UUID.shellWrite]; + + if (!write || !this.chars[UUID.shellRead]) return null; + let timer: ReturnType | undefined; + let buffer = ""; + const response = new Promise((resolve) => { + timer = setTimeout(() => resolve(null), 1200); + this.identityReply = (chunk) => { + buffer = (buffer + chunk).replaceAll("\0", "").slice(-256); + const result = productReply(buffer.trim()); + + if (result) resolve(result); + }; + }); + + try { + await within(write.writeValue(utf8("AT GETPID") as BufferSource), 1200, () => new Error()); + return await response; + } catch { + return null; + } finally { + clearTimeout(timer); + this.identityReply = null; + } + } + async fetchInfo() { const now = Math.floor(Date.now() / 1000), tz = -new Date().getTimezoneOffset() * 60; diff --git a/src/lib/modules/device/lib/watch-identity.ts b/src/lib/modules/device/lib/watch-identity.ts new file mode 100644 index 0000000..51d370f --- /dev/null +++ b/src/lib/modules/device/lib/watch-identity.ts @@ -0,0 +1,100 @@ +import skus from "./watch-skus.json"; +export const MANUFACTURERS = [0x0ccb, 0x2cbe, 0xbe2c, 0xffff]; +export const WATCH_MODELS = { + "82D5BB72": "watch_pro", + "34F72851": "watch_pro_2", + "335BBD62": "watch_3_pro", +} as const; + +export type WatchModel = (typeof WATCH_MODELS)[keyof typeof WATCH_MODELS]; +export interface WatchIdentity { + productId: string; + model: WatchModel | null; + colorId: string | null; + color: string | null; + source: "advertisement" | "shell"; +} +export function identity( + productId: string, + colorId: string | null, + source: WatchIdentity["source"], +): WatchIdentity { + const pid = productId.toUpperCase(), + color = colorId?.toUpperCase() ?? null; + + return { + productId: pid, + model: WATCH_MODELS[pid as keyof typeof WATCH_MODELS] ?? null, + colorId: color, + color: color ? ((skus as Record)[pid + color] ?? null) : null, + source, + }; +} +/** Manufacturer data excludes its company-ID bytes. Do not retain the embedded MAC address. */ +export function advertisementIdentity(company: number, data: DataView): WatchIdentity | null { + if (!MANUFACTURERS.includes(company)) return null; + const bytes = new Uint8Array(data.buffer, data.byteOffset, data.byteLength); + const normalized = company === 0x0ccb ? bytes : new Uint8Array([0x2c, 0xbe, ...bytes]); + let offset: number; + + if (normalized.length >= 18 && new TextDecoder().decode(normalized.slice(6, 12)) === "JX-IWD") + offset = 12; + else if (normalized.length >= 14 && normalized[6] === 0x4a && normalized[7] === 0x58) offset = 8; + else return null; + const hex = (a: Uint8Array) => + [...a] + .map((v) => v.toString(16).padStart(2, "0")) + .join("") + .toUpperCase(); + + return identity( + hex(normalized.slice(offset, offset + 4)), + hex(normalized.slice(offset + 4, offset + 5)), + "advertisement", + ); +} +export function productReply(reply: string): WatchIdentity | null { + const match = reply.match(/(?:^|[\r\n])(?:AT )?GETPID:([0-9a-f]{8}),OK(?:$|[\r\n])/i); + + return match ? identity(match[1], null, "shell") : null; +} +/** Best effort only: unsupported/denied advertisement watching must never block GATT connection. */ +export async function observeIdentity(device: BluetoothDevice): Promise { + const d = device as BluetoothDevice & { + watchAdvertisements?: (o: { signal: AbortSignal }) => Promise; + }; + + if (!d.watchAdvertisements) return null; + return new Promise((resolve) => { + const controller = new AbortController(); + let done = false; + const finish = (v: WatchIdentity | null) => { + if (done) return; + done = true; + clearTimeout(timer); + device.removeEventListener("advertisementreceived", receive); + controller.abort(); + resolve(v); + }; + const receive = (e: Event) => { + const event = e as Event & { manufacturerData: Map }; + + for (const [id, data] of event.manufacturerData ?? []) { + const value = advertisementIdentity(id, data); + + if (value) { + finish(value); + return; + } + } + }; + const timer = setTimeout(() => finish(null), 1200); + + device.addEventListener("advertisementreceived", receive); + try { + d.watchAdvertisements({ signal: controller.signal }).catch(() => finish(null)); + } catch { + finish(null); + } + }); +} diff --git a/src/lib/modules/device/lib/watch-skus.json b/src/lib/modules/device/lib/watch-skus.json new file mode 100644 index 0000000..68cff96 --- /dev/null +++ b/src/lib/modules/device/lib/watch-skus.json @@ -0,0 +1,28 @@ +{ + "82D5BB7207": "dark-grey", + "82D5BB7205": "orange", + "82D5BB7202": "silver", + "82D5BB7201": "dark-grey", + "34F7285111": "light-grey", + "34F7285113": "orange", + "34F7285115": "blue", + "34F7285109": "dark-grey", + "335BBD6219": "dark-grey", + "335BBD6223": "orange", + "335BBD6221": "light-grey", + "335BBD6220": "dark-grey", + "335BBD6222": "light-grey", + "335BBD6224": "orange", + "335BBD6225": "green", + "335BBD6226": "green", + "82D5BB7203": "dark-grey", + "82D5BB7204": "silver", + "82D5BB7206": "orange", + "82D5BB7208": "dark-grey", + "335BBD6201": "dark-grey", + "34F7285110": "dark-grey", + "34F7285112": "light-grey", + "34F7285114": "orange", + "34F7285116": "blue", + "34F7285101": "dark-grey" +} diff --git a/src/lib/modules/device/lib/wp2.ts b/src/lib/modules/device/lib/wp2.ts index 685dcca..33cce60 100644 --- a/src/lib/modules/device/lib/wp2.ts +++ b/src/lib/modules/device/lib/wp2.ts @@ -1,4 +1,4 @@ -// What the App Loader firmware (cmf-tech-community/cmf-watch-sdk) keeps on the watch, as its stub reports +// What the App Loader firmware (fmctools/cmf-watch-sdk) keeps on the watch, as its stub reports // it — the stub's own release and the package in each slot — and the checks a package passes // before Watch.installPackage sends it (the same ones the stub runs when it lands). // diff --git a/src/lib/modules/device/model/index.ts b/src/lib/modules/device/model/index.ts index e53027f..fd8e33e 100644 --- a/src/lib/modules/device/model/index.ts +++ b/src/lib/modules/device/model/index.ts @@ -1,3 +1,4 @@ export * as bleModel from "./ble.model"; export * as rescueModel from "./rescue.model"; export * as devModel from "./dev.model"; +export * as watchAppearanceModel from "./watch-appearance.model"; diff --git a/src/lib/modules/device/model/watch-appearance.model.ts b/src/lib/modules/device/model/watch-appearance.model.ts new file mode 100644 index 0000000..e853e69 --- /dev/null +++ b/src/lib/modules/device/model/watch-appearance.model.ts @@ -0,0 +1,69 @@ +import { combine, createEvent, createStore, sample } from "effector"; +import { $bleInfo, connected } from "./ble.model"; +const configurationPicked = createEvent<{ model: string; color: string }>(); +export const automaticChanged = createEvent(); +export const previewModelPicked = createEvent(); +export const previewColorPicked = createEvent(); +export const $previewModel = createStore("auto") + .on(configurationPicked, (_, v) => v.model) + .on(previewModelPicked, (_, v) => + ["auto", "watch_pro_2", "watch_3_pro"].includes(v) ? v : "auto", + ) + .reset(connected); +export const $previewColor = createStore("auto") + .on(configurationPicked, (_, v) => v.color) + .on(previewColorPicked, (_, v) => + ["auto", "dark-grey", "light-grey", "orange", "blue", "green"].includes(v) ? v : "auto", + ) + .reset(previewModelPicked, connected); +export const $watchAppearance = combine( + $bleInfo, + $previewModel, + $previewColor, + (info, modelOverride, colorOverride) => { + const detected = info?.identity; + const nameModel = /watch (3 pro|pro 3)/i.test(info?.name ?? "") ? "watch_3_pro" : "watch_pro_2"; + const model = + modelOverride === "auto" + ? detected?.model === "watch_3_pro" + ? "watch_3_pro" + : detected?.model === "watch_pro_2" + ? "watch_pro_2" + : nameModel + : modelOverride; + const colors = + model === "watch_3_pro" + ? ["dark-grey", "light-grey", "orange", "green"] + : ["dark-grey", "light-grey", "orange", "blue"]; + const autoColor = + detected?.model === model && detected.color && colors.includes(detected.color) + ? detected.color + : "dark-grey"; + const color = + colorOverride !== "auto" && colors.includes(colorOverride) ? colorOverride : autoColor; + + return { + model, + color, + colors, + frame: `/frames/${model.replaceAll("_", "-")}-${color}.webp`, + detectedColor: detected?.color ?? null, + }; + }, +); + +export const framePanelOpened = createEvent(); +export const framePanelClosed = createEvent(); +export const $framePanelOpen = createStore(false) + .on(framePanelOpened, () => true) + .reset(framePanelClosed); + +sample({ + clock: automaticChanged, + source: $watchAppearance, + fn: (appearance, automatic) => ({ + model: automatic ? "auto" : appearance.model, + color: automatic ? "auto" : appearance.color, + }), + target: configurationPicked, +}); diff --git a/src/lib/modules/device/pages/rescue.svelte b/src/lib/modules/device/pages/rescue.svelte index 5e67b41..c505ea9 100644 --- a/src/lib/modules/device/pages/rescue.svelte +++ b/src/lib/modules/device/pages/rescue.svelte @@ -7,7 +7,7 @@ import { Textarea } from "$lib/shared/components/textarea"; import { t } from "../i18n"; - const ISSUES = "https://github.com/freethinkel/fmc/issues"; + const ISSUES = "https://github.com/fmctools/fmc/issues"; const { resetRequested, diff --git a/src/lib/modules/device/pages/troubleshooting.es.md b/src/lib/modules/device/pages/troubleshooting.es.md index 1958575..9f33aea 100644 --- a/src/lib/modules/device/pages/troubleshooting.es.md +++ b/src/lib/modules/device/pages/troubleshooting.es.md @@ -7,7 +7,7 @@ FMC habla con tu reloj directamente desde el navegador, sin una app del teléfon - **Instala esferas con el instalador del propio reloj.** La carga sigue los mismos pasos que la app oficial. FMC inicia una instalación, describe el archivo, lo envía por partes y termina. El reloj responde a cada paso y puede rechazar el archivo. Cuando lo hace, FMC te muestra el rechazo y se detiene. - **El firmware es la parte arriesgada.** Desde el estante de firmware, FMC instala imágenes no oficiales de forma inalámbrica, y una imagen mala puede dejar un reloj inservible. FMC ofrece una imagen solo a un Watch Pro 2 con 50 % de batería o más, comprueba las sumas de verificación de la imagen y que se hizo para ese reloj, y espera a que marques que aceptas el riesgo. - **Las esferas también pueden fallar.** Normalmente el reloj rechaza el archivo, o lo instala y se ve mal, y lo borras en el reloj. Una vez, una esfera con una imagen mucho más grande que la pantalla hizo que un Watch 3 Pro se reiniciara en bucle. Mira «El reloj se reinicia en bucle» más abajo. -- **No te vamos a decir que nada puede salir mal.** Hacemos y probamos FMC en un CMF Watch Pro 2. Un firmware que no hemos visto puede comportarse de otra forma, y no podemos prometer nada sobre él. Si algo se rompe, [cuéntanos](https://github.com/freethinkel/fmc/issues). La solución para Nothing X de abajo existe porque alguien lo hizo. +- **No te vamos a decir que nada puede salir mal.** Hacemos y probamos FMC en un CMF Watch Pro 2. Un firmware que no hemos visto puede comportarse de otra forma, y no podemos prometer nada sobre él. Si algo se rompe, [cuéntanos](https://github.com/fmctools/fmc/issues). La solución para Nothing X de abajo existe porque alguien lo hizo. ## Solo una app puede tener el reloj a la vez @@ -24,7 +24,7 @@ Parece un reloj inservible, pero no lo es. El teléfono tiene un conflicto de em 3. Olvida el reloj en los ajustes de Bluetooth del teléfono. 4. Pon el reloj en modo de emparejamiento y agrégalo de nuevo en Nothing X. -

Un usuario lo informó en el issue #27. Otro usuario respondió con estos pasos unas horas después, y nadie ha necesitado un restablecimiento de fábrica.

+

Un usuario lo informó en el issue #27. Otro usuario respondió con estos pasos unas horas después, y nadie ha necesitado un restablecimiento de fábrica.

## Borrar una esfera en el reloj @@ -50,7 +50,7 @@ Si tu reloj ya está atrapado en el bucle, todavía no tenemos una solución con 4. Deja que la batería se agote por completo, luego cárgala y vuelve a intentarlo. 5. Si nada de eso funciona, contacta con el soporte de Nothing. Una esfera no toca el firmware, así que es una reparación que pueden hacer. -

Si uno de estos pasos te funcionó, u otra cosa, por favor cuéntanos para ponerlo al principio de esta lista.

+

Si uno de estos pasos te funcionó, u otra cosa, por favor cuéntanos para ponerlo al principio de esta lista.

## Cuando el reloj rechaza una carga @@ -71,8 +71,8 @@ Safari no tiene Web Bluetooth, y todos los demás navegadores de iPhone usan el Cuando termines, cierra la pestaña y la otra app podrá recuperar el reloj. -

Si aún no conecta, pulsa Copiar registro en el panel del reloj y pégalo en un issue.

+

Si aún no conecta, pulsa Copiar registro en el panel del reloj y pégalo en un issue.

--- -¿Tu reloj hizo algo que esta página no describe? [Abre un issue](https://github.com/freethinkel/fmc/issues) con tu navegador, el modelo del reloj y la versión de firmware que muestra el panel del reloj. Con eso nos basta para reproducirlo. +¿Tu reloj hizo algo que esta página no describe? [Abre un issue](https://github.com/fmctools/fmc/issues) con tu navegador, el modelo del reloj y la versión de firmware que muestra el panel del reloj. Con eso nos basta para reproducirlo. diff --git a/src/lib/modules/device/pages/troubleshooting.hi.md b/src/lib/modules/device/pages/troubleshooting.hi.md index 1edad1b..95da73f 100644 --- a/src/lib/modules/device/pages/troubleshooting.hi.md +++ b/src/lib/modules/device/pages/troubleshooting.hi.md @@ -7,7 +7,7 @@ FMC आपकी घड़ी से सीधे ब्राउज़र स - **यह वॉचफ़ेस घड़ी के अपने इंस्टॉलर से इंस्टॉल करता है।** अपलोड वही कदम अपनाता है जो आधिकारिक ऐप अपनाता है। FMC इंस्टॉल शुरू करता है, फ़ाइल का ब्योरा देता है, उसे टुकड़ों में भेजता है और खत्म करता है। घड़ी हर कदम का जवाब देती है और फ़ाइल को मना कर सकती है। ऐसा होने पर FMC आपको मना करने की वजह दिखाता है और रुक जाता है। - **फ़र्मवेयर जोखिम वाला हिस्सा है।** फ़र्मवेयर शेल्फ़ से FMC अनौपचारिक इमेज वायरलेस तरीके से फ़्लैश करता है, और एक खराब इमेज घड़ी को हमेशा के लिए खराब (ब्रिक) कर सकती है। FMC इमेज सिर्फ़ उसी Watch Pro 2 को देता है जिसकी बैटरी 50% या ज़्यादा हो, इमेज के चेकसम और यह जांचता है कि वह उसी घड़ी के लिए बनी है, और तब तक रुकता है जब तक आप टिक करके जोखिम स्वीकार न करें। - **वॉचफ़ेस में भी गड़बड़ हो सकती है।** आम तौर पर घड़ी फ़ाइल को मना कर देती है, या इंस्टॉल कर लेती है पर वह ठीक नहीं दिखता, और आप उसे घड़ी पर हटा देते हैं। एक बार स्क्रीन से कहीं बड़ी इमेज वाले वॉचफ़ेस ने Watch 3 Pro को बार-बार रीस्टार्ट होने पर मजबूर कर दिया। नीचे "घड़ी बार-बार रीस्टार्ट होती है" देखें। -- **हम यह नहीं कहेंगे कि कुछ गलत हो ही नहीं सकता।** हम FMC को CMF Watch Pro 2 पर बनाते और टेस्ट करते हैं। जो फ़र्मवेयर हमने नहीं देखा, वह अलग तरह से बर्ताव कर सकता है, और उसके बारे में हम कोई वादा नहीं कर सकते। अगर कुछ टूट जाए, तो [हमें बताएं](https://github.com/freethinkel/fmc/issues)। नीचे दिया Nothing X का हल इसीलिए है क्योंकि किसी ने बताया था। +- **हम यह नहीं कहेंगे कि कुछ गलत हो ही नहीं सकता।** हम FMC को CMF Watch Pro 2 पर बनाते और टेस्ट करते हैं। जो फ़र्मवेयर हमने नहीं देखा, वह अलग तरह से बर्ताव कर सकता है, और उसके बारे में हम कोई वादा नहीं कर सकते। अगर कुछ टूट जाए, तो [हमें बताएं](https://github.com/fmctools/fmc/issues)। नीचे दिया Nothing X का हल इसीलिए है क्योंकि किसी ने बताया था। ## एक समय में सिर्फ़ एक ऐप घड़ी से जुड़ सकता है @@ -24,7 +24,7 @@ FMC आपकी घड़ी से सीधे ब्राउज़र स 3. फ़ोन की Bluetooth सेटिंग्स में घड़ी को भूलें। 4. घड़ी को पेयरिंग मोड में डालें और Nothing X में फिर से जोड़ें। -

एक यूज़र ने यह issue #27 में बताया। कुछ घंटों बाद दूसरे यूज़र ने ये कदम बताए, और किसी को फ़ैक्टरी रीसेट की ज़रूरत नहीं पड़ी।

+

एक यूज़र ने यह issue #27 में बताया। कुछ घंटों बाद दूसरे यूज़र ने ये कदम बताए, और किसी को फ़ैक्टरी रीसेट की ज़रूरत नहीं पड़ी।

## घड़ी पर वॉचफ़ेस हटाना @@ -50,7 +50,7 @@ Watch Pro 2 में {WF_CAPACITY} वॉचफ़ेस आते हैं, W 4. बैटरी को पूरी तरह खत्म होने दें, फिर चार्ज करके दोबारा कोशिश करें। 5. अगर कुछ भी काम न करे, तो Nothing सपोर्ट से संपर्क करें। वॉचफ़ेस फ़र्मवेयर को नहीं छूता, इसलिए यह मरम्मत वे कर सकते हैं। -

अगर इनमें से किसी कदम ने, या किसी और चीज़ ने आपकी मदद की, तो कृपया हमें बताएं ताकि हम उसे इस सूची में सबसे ऊपर रख सकें।

+

अगर इनमें से किसी कदम ने, या किसी और चीज़ ने आपकी मदद की, तो कृपया हमें बताएं ताकि हम उसे इस सूची में सबसे ऊपर रख सकें।

## जब घड़ी अपलोड मना कर दे @@ -71,8 +71,8 @@ Safari में Web Bluetooth नहीं है, और iPhone के बा काम पूरा होने पर टैब बंद करें, और दूसरा ऐप घड़ी वापस ले सकता है। -

अगर फिर भी कनेक्ट न हो, तो घड़ी पैनल में लॉग कॉपी करें दबाएं और उसे एक issue में पेस्ट करें।

+

अगर फिर भी कनेक्ट न हो, तो घड़ी पैनल में लॉग कॉपी करें दबाएं और उसे एक issue में पेस्ट करें।

--- -आपकी घड़ी ने कुछ ऐसा किया जो इस पेज पर नहीं है? अपने ब्राउज़र, घड़ी के मॉडल और घड़ी पैनल में दिखे फ़र्मवेयर वर्ज़न के साथ [एक issue खोलें](https://github.com/freethinkel/fmc/issues)। इतना हमारे लिए उसे दोहराने को काफ़ी है। +आपकी घड़ी ने कुछ ऐसा किया जो इस पेज पर नहीं है? अपने ब्राउज़र, घड़ी के मॉडल और घड़ी पैनल में दिखे फ़र्मवेयर वर्ज़न के साथ [एक issue खोलें](https://github.com/fmctools/fmc/issues)। इतना हमारे लिए उसे दोहराने को काफ़ी है। diff --git a/src/lib/modules/device/pages/troubleshooting.md b/src/lib/modules/device/pages/troubleshooting.md index 2be652a..4942051 100644 --- a/src/lib/modules/device/pages/troubleshooting.md +++ b/src/lib/modules/device/pages/troubleshooting.md @@ -7,7 +7,7 @@ FMC talks to your watch straight from the browser, with no phone app in between. - **It installs watchfaces through the watch's own installer.** The upload follows the same steps the official app takes. FMC starts an install, describes the file, sends it in chunks and finishes. The watch answers every step and can refuse the file. When it does, FMC shows you the refusal and stops. - **Firmware is the risky part.** From the firmware shelf, FMC flashes unofficial images over the air, and a bad one can brick a watch. FMC offers an image only to a Watch Pro 2 at 50% battery or more, checks the image's checksums and that it was built for that watch, and waits for you to tick that you accept the risk. - **Watchfaces can go wrong too.** Usually the watch refuses the file, or installs it and it looks wrong, and you delete it on the watch. Once, a face with an image far larger than the screen made a Watch 3 Pro restart in a loop. See "The watch restarts in a loop" below. -- **We won't tell you nothing can go wrong.** We build and test FMC on a CMF Watch Pro 2. Firmware we haven't seen may behave differently, and we can't promise anything about it. If something breaks, [tell us](https://github.com/freethinkel/fmc/issues). The Nothing X fix below exists because someone did. +- **We won't tell you nothing can go wrong.** We build and test FMC on a CMF Watch Pro 2. Firmware we haven't seen may behave differently, and we can't promise anything about it. If something breaks, [tell us](https://github.com/fmctools/fmc/issues). The Nothing X fix below exists because someone did. ## Only one app can hold the watch at a time @@ -24,7 +24,7 @@ This one looks like a bricked watch. It isn't. The phone has a Bluetooth pairing 3. Forget the watch in the phone's Bluetooth settings. 4. Put the watch in pairing mode and add it again in Nothing X. -

A user reported this in issue #27. Another user replied with these steps a few hours later, and nobody has needed a factory reset.

+

A user reported this in issue #27. Another user replied with these steps a few hours later, and nobody has needed a factory reset.

## Deleting a watchface on the watch @@ -50,7 +50,7 @@ If your watch is already stuck in the loop, we don't have a confirmed fix yet. T 4. Let the battery run out completely, then charge it and try again. 5. If none of that works, contact Nothing support. A watchface doesn't touch the firmware, so this is a repair they can do. -

If one of these steps worked for you, or something else did, please tell us so we can put it at the top of this list.

+

If one of these steps worked for you, or something else did, please tell us so we can put it at the top of this list.

## When the watch refuses an upload @@ -71,8 +71,8 @@ Safari has no Web Bluetooth, and every other iPhone browser runs on the same eng When you're done, close the tab, and the other app can have the watch back. -

If it still doesn't connect, press Copy log in the watch panel and paste it into an issue.

+

If it still doesn't connect, press Copy log in the watch panel and paste it into an issue.

--- -Did your watch do something this page doesn't describe? [Open an issue](https://github.com/freethinkel/fmc/issues) with your browser, the watch model and the firmware version shown in the watch panel. That's enough for us to reproduce it. +Did your watch do something this page doesn't describe? [Open an issue](https://github.com/fmctools/fmc/issues) with your browser, the watch model and the firmware version shown in the watch panel. That's enough for us to reproduce it. diff --git a/src/lib/modules/device/pages/troubleshooting.ru.md b/src/lib/modules/device/pages/troubleshooting.ru.md index 55907e9..f35a7e4 100644 --- a/src/lib/modules/device/pages/troubleshooting.ru.md +++ b/src/lib/modules/device/pages/troubleshooting.ru.md @@ -7,7 +7,7 @@ FMC связывается с часами прямо из браузера, б - **Он ставит циферблаты через штатный установщик часов.** Загрузка идёт теми же шагами, что и в официальном приложении. FMC начинает установку, описывает файл, отправляет его частями и завершает. Часы отвечают на каждый шаг и могут отклонить файл. Тогда FMC показывает отказ и останавливается. - **Прошивка — рискованная часть.** С полки прошивок FMC устанавливает неофициальные образы по воздуху, и плохой образ может превратить часы в кирпич. FMC предлагает образ только Watch Pro 2 с зарядом от 50%, проверяет контрольные суммы образа и то, что он собран для этих часов, и ждёт, пока вы отметите, что принимаете риск. - **С циферблатами тоже бывают проблемы.** Обычно часы отклоняют файл или ставят его, но он выглядит не так, и вы удаляете его на часах. Однажды циферблат с картинкой намного больше экрана заставил Watch 3 Pro перезагружаться по кругу. См. «Часы перезагружаются по кругу» ниже. -- **Мы не скажем, что ничего не может пойти не так.** Мы делаем и тестируем FMC на CMF Watch Pro 2. Прошивка, которую мы не видели, может вести себя иначе, и мы ничего не можем за неё обещать. Если что-то сломалось, [напишите нам](https://github.com/freethinkel/fmc/issues). Решение для Nothing X ниже появилось потому, что кто-то написал. +- **Мы не скажем, что ничего не может пойти не так.** Мы делаем и тестируем FMC на CMF Watch Pro 2. Прошивка, которую мы не видели, может вести себя иначе, и мы ничего не можем за неё обещать. Если что-то сломалось, [напишите нам](https://github.com/fmctools/fmc/issues). Решение для Nothing X ниже появилось потому, что кто-то написал. ## Часы держит только одно приложение за раз @@ -24,7 +24,7 @@ FMC связывается с часами прямо из браузера, б 3. Забудьте часы в настройках Bluetooth телефона. 4. Переведите часы в режим сопряжения и добавьте их заново в Nothing X. -

Пользователь сообщил об этом в issue #27. Другой пользователь через несколько часов ответил этими шагами, и сброс до заводских никому не понадобился.

+

Пользователь сообщил об этом в issue #27. Другой пользователь через несколько часов ответил этими шагами, и сброс до заводских никому не понадобился.

## Удаление циферблата на часах @@ -50,7 +50,7 @@ Watch Pro 2 вмещает {WF_CAPACITY} циферблатов, Watch 3 Pro — 4. Дайте батарее полностью разрядиться, потом зарядите и попробуйте снова. 5. Если ничего не помогло, обратитесь в поддержку Nothing. Циферблат не трогает прошивку, так что это ремонт, который они могут сделать. -

Если вам помог один из этих шагов или что-то другое, пожалуйста, напишите нам, чтобы мы поставили это в начало списка.

+

Если вам помог один из этих шагов или что-то другое, пожалуйста, напишите нам, чтобы мы поставили это в начало списка.

## Когда часы отклоняют загрузку @@ -71,8 +71,8 @@ FMC показывает, что ответили часы. Обычно час Когда закончите, закройте вкладку, и другое приложение снова получит часы. -

Если подключиться всё равно не выходит, нажмите Скопировать лог в панели часов и вставьте его в issue.

+

Если подключиться всё равно не выходит, нажмите Скопировать лог в панели часов и вставьте его в issue.

--- -Часы сделали что-то, чего нет на этой странице? [Создайте issue](https://github.com/freethinkel/fmc/issues), указав браузер, модель часов и версию прошивки из панели часов. Этого нам хватит, чтобы воспроизвести проблему. +Часы сделали что-то, чего нет на этой странице? [Создайте issue](https://github.com/fmctools/fmc/issues), указав браузер, модель часов и версию прошивки из панели часов. Этого нам хватит, чтобы воспроизвести проблему. diff --git a/src/lib/modules/device/pages/troubleshooting.uk.md b/src/lib/modules/device/pages/troubleshooting.uk.md index 2ad41d6..ab56ab9 100644 --- a/src/lib/modules/device/pages/troubleshooting.uk.md +++ b/src/lib/modules/device/pages/troubleshooting.uk.md @@ -7,7 +7,7 @@ FMC зв’язується з годинником просто з браузе - **Він встановлює циферблати через власний інсталятор годинника.** Завантаження йде тими самими кроками, що й в офіційному застосунку. FMC починає встановлення, описує файл, надсилає його частинами й завершує. Годинник відповідає на кожен крок і може відхилити файл. Тоді FMC показує відмову й зупиняється. - **Прошивка — ризикована частина.** З полиці прошивок FMC встановлює неофіційні образи бездротово, і поганий образ може перетворити годинник на цеглину. FMC пропонує образ лише Watch Pro 2 із зарядом від 50%, перевіряє контрольні суми образу й те, що його зібрано для цього годинника, і чекає, поки ви позначите, що приймаєте ризик. - **З циферблатами теж буває не все гаразд.** Зазвичай годинник відхиляє файл або встановлює його, але він виглядає не так, і ви видаляєте його на годиннику. Одного разу циферблат із зображенням, значно більшим за екран, змусив Watch 3 Pro перезавантажуватися по колу. Див. «Годинник перезавантажується по колу» нижче. -- **Ми не скажемо, що нічого не може піти не так.** Ми робимо й тестуємо FMC на CMF Watch Pro 2. Прошивка, якої ми не бачили, може поводитися інакше, і ми нічого не можемо за неї обіцяти. Якщо щось зламалося, [напишіть нам](https://github.com/freethinkel/fmc/issues). Рішення для Nothing X нижче з’явилося тому, що хтось написав. +- **Ми не скажемо, що нічого не може піти не так.** Ми робимо й тестуємо FMC на CMF Watch Pro 2. Прошивка, якої ми не бачили, може поводитися інакше, і ми нічого не можемо за неї обіцяти. Якщо щось зламалося, [напишіть нам](https://github.com/fmctools/fmc/issues). Рішення для Nothing X нижче з’явилося тому, що хтось написав. ## Годинник тримає лише один застосунок водночас @@ -24,7 +24,7 @@ FMC зв’язується з годинником просто з браузе 3. Забудьте годинник у налаштуваннях Bluetooth телефона. 4. Переведіть годинник у режим сполучення й додайте його знову в Nothing X. -

Користувач повідомив про це в issue #27. Інший користувач за кілька годин відповів цими кроками, і скидання до заводських нікому не знадобилося.

+

Користувач повідомив про це в issue #27. Інший користувач за кілька годин відповів цими кроками, і скидання до заводських нікому не знадобилося.

## Видалення циферблата на годиннику @@ -50,7 +50,7 @@ Watch Pro 2 вміщує {WF_CAPACITY} циферблатів, Watch 3 Pro — { 4. Дайте батареї повністю розрядитися, потім зарядіть і спробуйте знову. 5. Якщо нічого не допомогло, зверніться до підтримки Nothing. Циферблат не торкається прошивки, тож це ремонт, який вони можуть зробити. -

Якщо вам допоміг один із цих кроків або щось інше, будь ласка, напишіть нам, щоб ми поставили це на початок списку.

+

Якщо вам допоміг один із цих кроків або щось інше, будь ласка, напишіть нам, щоб ми поставили це на початок списку.

## Коли годинник відхиляє завантаження @@ -71,8 +71,8 @@ FMC показує, що відповів годинник. Зазвичай г Коли закінчите, закрийте вкладку, і інший застосунок знову отримає годинник. -

Якщо під’єднатися все одно не вдається, натисніть Скопіювати лог у панелі годинника й вставте його в issue.

+

Якщо під’єднатися все одно не вдається, натисніть Скопіювати лог у панелі годинника й вставте його в issue.

--- -Годинник зробив щось, чого немає на цій сторінці? [Створіть issue](https://github.com/freethinkel/fmc/issues), вказавши браузер, модель годинника й версію прошивки з панелі годинника. Цього нам вистачить, щоб відтворити проблему. +Годинник зробив щось, чого немає на цій сторінці? [Створіть issue](https://github.com/fmctools/fmc/issues), вказавши браузер, модель годинника й версію прошивки з панелі годинника. Цього нам вистачить, щоб відтворити проблему. diff --git a/src/lib/modules/editor/i18n.ts b/src/lib/modules/editor/i18n.ts index 8482b19..1101f0a 100644 --- a/src/lib/modules/editor/i18n.ts +++ b/src/lib/modules/editor/i18n.ts @@ -23,6 +23,7 @@ export const t = dict( nameHint: "Watchface name — the watch's own list shows the first 15 characters", undoHint: "Undo (⌘Z)", redoHint: "Redo (⇧⌘Z)", + watchFrame: "Watch frame", foreignHint: "Someone else's watchface — edit and flash it freely, but it can't be re-uploaded under your name. Export the .bin and open that file to start your own from it.", updatePublishedHint: "Update the published watchface (⌘S)", @@ -151,6 +152,7 @@ export const t = dict( "Step out to the parent": "Step out to the parent", "Move by 1px (⇧ — 10px)": "Move by 1px (⇧ — 10px)", "Resize by 1px (⇧ — 10px)": "Resize by 1px (⇧ — 10px)", + "Toggle watch frame": "Toggle watch frame", "Properties tab": "Properties tab", "Simulator tab": "Simulator tab", "Main screen": "Main screen", @@ -208,6 +210,7 @@ export const t = dict( nameHint: "Название циферблата — в списке на часах видны первые 15 символов", undoHint: "Отменить (⌘Z)", redoHint: "Повторить (⇧⌘Z)", + watchFrame: "Корпус часов", foreignHint: "Чужой циферблат — его можно менять и заливать на часы, но не выложить под своим именем. Экспортируйте .bin и откройте этот файл, чтобы сделать свой на его основе.", updatePublishedHint: "Обновить опубликованный циферблат (⌘S)", @@ -325,6 +328,7 @@ export const t = dict( "Step out to the parent": "Выйти к родителю", "Move by 1px (⇧ — 10px)": "Сдвиг на 1px (⇧ — 10px)", "Resize by 1px (⇧ — 10px)": "Размер на 1px (⇧ — 10px)", + "Toggle watch frame": "Показать или скрыть корпус часов", "Properties tab": "Вкладка «Свойства»", "Simulator tab": "Вкладка «Симулятор»", "Main screen": "Основной экран", @@ -376,6 +380,7 @@ export const t = dict( nameHint: "Назва циферблата — у списку на годиннику видно перші 15 символів", undoHint: "Скасувати (⌘Z)", redoHint: "Повторити (⇧⌘Z)", + watchFrame: "Корпус годинника", foreignHint: "Чужий циферблат — його можна змінювати й заливати на годинник, але не викласти під своїм іменем. Експортуйте .bin і відкрийте цей файл, щоб зробити свій на його основі.", updatePublishedHint: "Оновити опублікований циферблат (⌘S)", @@ -493,6 +498,7 @@ export const t = dict( "Step out to the parent": "Вийти до батьківського", "Move by 1px (⇧ — 10px)": "Зсув на 1px (⇧ — 10px)", "Resize by 1px (⇧ — 10px)": "Розмір на 1px (⇧ — 10px)", + "Toggle watch frame": "Показати або приховати корпус годинника", "Properties tab": "Вкладка «Властивості»", "Simulator tab": "Вкладка «Симулятор»", "Main screen": "Основний екран", @@ -544,6 +550,7 @@ export const t = dict( nameHint: "Nombre de la esfera: la lista del reloj muestra los primeros 15 caracteres", undoHint: "Deshacer (⌘Z)", redoHint: "Rehacer (⇧⌘Z)", + watchFrame: "Marco del reloj", foreignHint: "Esfera de otra persona: puedes editarla e instalarla en tu reloj, pero no volver a subirla con tu nombre. Exporta el .bin y abre ese archivo para crear la tuya a partir de ella.", updatePublishedHint: "Actualizar la esfera publicada (⌘S)", @@ -661,6 +668,7 @@ export const t = dict( "Step out to the parent": "Salir al padre", "Move by 1px (⇧ — 10px)": "Mover 1px (⇧ — 10px)", "Resize by 1px (⇧ — 10px)": "Redimensionar 1px (⇧ — 10px)", + "Toggle watch frame": "Mostrar u ocultar el marco del reloj", "Properties tab": "Pestaña Propiedades", "Simulator tab": "Pestaña Simulador", "Main screen": "Pantalla principal", @@ -712,6 +720,7 @@ export const t = dict( nameHint: "वॉच फ़ेस का नाम — घड़ी की सूची में पहले 15 अक्षर दिखते हैं", undoHint: "पूर्ववत (⌘Z)", redoHint: "फिर से करें (⇧⌘Z)", + watchFrame: "घड़ी का फ़्रेम", foreignHint: "यह किसी और का वॉच फ़ेस है — इसे बदलें और घड़ी पर डालें, पर अपने नाम से दोबारा अपलोड नहीं कर सकते। .bin एक्सपोर्ट करें और उस फ़ाइल को खोलकर उससे अपना बनाएं।", updatePublishedHint: "प्रकाशित वॉच फ़ेस अपडेट करें (⌘S)", @@ -829,6 +838,7 @@ export const t = dict( "Step out to the parent": "पैरेंट पर लौटें", "Move by 1px (⇧ — 10px)": "1px खिसकाएं (⇧ — 10px)", "Resize by 1px (⇧ — 10px)": "1px आकार बदलें (⇧ — 10px)", + "Toggle watch frame": "घड़ी का फ़्रेम दिखाएँ या छिपाएँ", "Properties tab": "गुण टैब", "Simulator tab": "सिम्युलेटर टैब", "Main screen": "मुख्य स्क्रीन", diff --git a/src/lib/modules/editor/model/ui.model.ts b/src/lib/modules/editor/model/ui.model.ts index f0407b3..56b0e16 100644 --- a/src/lib/modules/editor/model/ui.model.ts +++ b/src/lib/modules/editor/model/ui.model.ts @@ -32,3 +32,6 @@ sample({ fn: (on) => !on, target: $lockAspect, }); + +export const watchFrameToggled = createEvent(); +export const $showWatchFrame = createStore(true).on(watchFrameToggled, (shown) => !shown); diff --git a/src/lib/modules/editor/pages/editor.svelte b/src/lib/modules/editor/pages/editor.svelte index 2440caa..699df81 100644 --- a/src/lib/modules/editor/pages/editor.svelte +++ b/src/lib/modules/editor/pages/editor.svelte @@ -115,6 +115,8 @@ buildCurrentBin, previewBlob, previewThumb, + $showWatchFrame: showWatchFrame, + watchFrameToggled, $rightPanel: rightPanel, rightPanelSet, $loading: loading, @@ -469,6 +471,7 @@ panel: (tab) => rightPanelSet(tab), // picking AOD with no AOD screen creates one — the same thing the tab does screen: (kind) => (kind === "aod" && !hasAOD ? aodAdded() : screenSet(kind)), + watchFrame: () => watchFrameToggled(), help: () => (helpOpen = true), }; @@ -687,7 +690,7 @@
- + {#if $doc} -
- - - -
-
    -
  • {$t.hintClick} {$t.hintSelect}
  • -
  • {$t.hintDrag} {$t.hintMove}
  • -
  • {$t.hintAltDrag} {$t.hintMoveNoSnap}
  • -
  • {$t.hintCorners} {$t.hintResize}
  • -
  • {$t.hintDot} {$t.hintRotate}
  • -
- -
-
+
+ +
+ + + +
+
    +
  • {$t.hintClick} {$t.hintSelect}
  • +
  • {$t.hintDrag} {$t.hintMove}
  • +
  • {$t.hintAltDrag} {$t.hintMoveNoSnap}
  • +
  • {$t.hintCorners} {$t.hintResize}
  • +
  • {$t.hintDot} {$t.hintRotate}
  • +
+ +
+
+
{/if} @@ -1214,18 +1230,27 @@ } /* a round "?" floating in the canvas's corner; its card opens above it */ - .hint { - display: none; + .canvas-tools { position: absolute; inset-inline-end: 0.75rem; bottom: 0.75rem; z-index: 2; + display: flex; + align-items: center; + gap: 0.5rem; + } + .hint { + display: none; + position: relative; } .hint-key { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; + border: none; + padding: 0; + cursor: pointer; border-radius: 50%; color: oklch(from var(--color-text) l c h / 70%); background: oklch(from var(--color-text) l c h / 8%); @@ -1241,10 +1266,24 @@ } } } + .hint-key:focus-visible { + outline: 2px solid var(--color-text); + outline-offset: 2px; + } + .hint-key[aria-pressed="true"], .hint[open] .hint-key { color: var(--color-background); background: var(--color-text); } + @media (max-width: 767px) { + .canvas-tools { + bottom: 4.75rem; + } + .hint-key { + width: 2.75rem; + height: 2.75rem; + } + } .hint-card { position: absolute; inset-inline-end: 0; diff --git a/src/lib/modules/editor/shared/shortcuts.ts b/src/lib/modules/editor/shared/shortcuts.ts index 297d5da..f271764 100644 --- a/src/lib/modules/editor/shared/shortcuts.ts +++ b/src/lib/modules/editor/shared/shortcuts.ts @@ -36,6 +36,7 @@ export interface ShortcutActions { flash(): void; panel(tab: "props" | "sim"): void; screen(kind: "main" | "aod"): void; + watchFrame(): void; help(): void; } @@ -324,6 +325,14 @@ export const SHORTCUTS: readonly Shortcut[] = [ }, // ---- View ---- + { + combos: ["shift+f"], + keys: "Shift+F", + label: "Toggle watch frame", + group: "View", + when: hasDoc, + run: (a) => a.watchFrame(), + }, { combos: ["1"], keys: "1", diff --git a/src/lib/modules/market/i18n.ts b/src/lib/modules/market/i18n.ts index 6da4a6f..2ca72b8 100644 --- a/src/lib/modules/market/i18n.ts +++ b/src/lib/modules/market/i18n.ts @@ -90,7 +90,7 @@ export const t = dict( "Where the apps, firmware and tools are built. Findings, ideas, device testing.", }, github: { - title: "cmf-tech-community on GitHub", + title: "FMC on GitHub", description: "The source of FMC, the app loader and SDK, and the firmware tools.", }, } as Record, @@ -190,7 +190,7 @@ export const t = dict( "Здесь создаются приложения, прошивки и инструменты. Находки, идеи, тесты на часах.", }, github: { - title: "cmf-tech-community на GitHub", + title: "FMC на GitHub", description: "Исходный код FMC, App Loader и SDK, инструменты для прошивок.", }, }, @@ -288,7 +288,7 @@ export const t = dict( "Тут створюють застосунки, прошивки й інструменти. Знахідки, ідеї, тести на годинниках.", }, github: { - title: "cmf-tech-community на GitHub", + title: "FMC на GitHub", description: "Вихідний код FMC, App Loader і SDK, інструменти для прошивок.", }, }, @@ -382,7 +382,7 @@ export const t = dict( "Donde se crean las apps, el firmware y las herramientas. Hallazgos, ideas, pruebas en relojes.", }, github: { - title: "cmf-tech-community en GitHub", + title: "FMC en GitHub", description: "El código de FMC, el App Loader y el SDK, y las herramientas de firmware.", }, }, @@ -472,7 +472,7 @@ export const t = dict( description: "जहां ऐप, फ़र्मवेयर और टूल बनते हैं। खोजें, आइडिया, घड़ी पर टेस्टिंग।", }, github: { - title: "GitHub पर cmf-tech-community", + title: "GitHub पर FMC", description: "FMC, App Loader और SDK का सोर्स कोड, और फ़र्मवेयर टूल।", }, }, diff --git a/src/lib/modules/market/lib/community.ts b/src/lib/modules/market/lib/community.ts index 7c0bc7a..525e086 100644 --- a/src/lib/modules/market/lib/community.ts +++ b/src/lib/modules/market/lib/community.ts @@ -53,14 +53,14 @@ export const COMMUNITY_LINKS: readonly CommunityLink[] = [ }, { id: "github", - title: "cmf-tech-community on GitHub", + title: "FMC on GitHub", description: "The source of FMC, the app loader and SDK, and the firmware tools.", icon: "code", brand: { path: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12", color: null, }, - url: "https://github.com/cmf-tech-community", + url: "https://github.com/fmctools", }, ]; diff --git a/src/lib/modules/store/lib/links.ts b/src/lib/modules/store/lib/links.ts index fdc6e8f..09bafdf 100644 --- a/src/lib/modules/store/lib/links.ts +++ b/src/lib/modules/store/lib/links.ts @@ -1,6 +1,6 @@ // Where the store sends people outside FMC: the community apps repository (which is also how an // app gets onto the shelf), and the community's flashing docs. -export const APPS_REPO = "https://github.com/cmf-tech-community/apps"; +export const APPS_REPO = "https://github.com/fmctools/apps"; // the README's how-to: create an app with cmf-watch-sdk, then publish it with a pull request export const MAKE_AN_APP = `${APPS_REPO}#make-your-own-app`; export const WATCH_UTILS_DOCS = "https://cmf.arnv.dev/"; diff --git a/src/lib/modules/store/pages/apps.svelte b/src/lib/modules/store/pages/apps.svelte index 156fbc3..6b1de5c 100644 --- a/src/lib/modules/store/pages/apps.svelte +++ b/src/lib/modules/store/pages/apps.svelte @@ -85,7 +85,7 @@ {:else}
  • {$t.noApps}
  • {/each} -
  • diff --git a/src/lib/shared/components/app-nav/app-nav.svelte b/src/lib/shared/components/app-nav/app-nav.svelte index 06cd1ee..b374772 100644 --- a/src/lib/shared/components/app-nav/app-nav.svelte +++ b/src/lib/shared/components/app-nav/app-nav.svelte @@ -12,6 +12,10 @@ import { Icon, type IconName } from "$lib/shared/components/icon"; import { Menu, MenuItem } from "$lib/shared/components/menu"; + import { watchAppearanceModel } from "$lib/modules/device/model"; + import { t as deviceText } from "$lib/modules/device/i18n"; + import WatchFrameDialog from "$lib/modules/device/components/watch-frame-dialog.svelte"; + const { framePanelOpened } = watchAppearanceModel; const { $user: user, logout } = authModel; const { accentDialogOpened, languageDialogOpened } = appearanceModel; const path = $derived(page.url.pathname); @@ -38,7 +42,7 @@ const tabs = $derived<{ title: string; icon: IconName }[]>([ ...nav, { title: $t.watch, icon: "watch" }, - $user ? { title: $t.account, icon: "person" } : { title: $t.signIn, icon: "login" }, + { title: $t.account, icon: $user ? "person" : "settings" }, ]); // only pages hold the thumb: the watch panel and the account menu are overlays const activeAt = $derived( @@ -127,7 +131,12 @@ e.stopPropagation(); }} > - + {#each nav as item (item.url)} @@ -149,53 +158,40 @@ {/snippet} - {#if $user} - - {:else} - - - - - - {$t.signIn} - - - {/if} + {:else}{/if} + {$t.account} + + {/snippet} + {#if $user}{$t.profile} + {:else}{$t.signIn}{/if} + accentDialogOpened()} + >{$t.accentColor} + framePanelOpened()} + >{$deviceText.watchAppearance} + languageDialogOpened()} + >{$t.language} + {$t.reportIssue} + {#if $user} logout()} + >{$t.logOut}{/if} + + + @@ -306,6 +303,14 @@ display: none; } .logo { + height: auto; + min-height: 0; + & img { + display: block; + width: 4rem; + height: 4rem; + object-fit: contain; + } display: none; flex: none; color: var(--color-text); @@ -336,7 +341,8 @@ display: flex; align-items: center; justify-content: center; - padding-block: 0.5rem 0.75rem; + padding-block: 0.625rem; + width: 100%; } /* the account sits at the far end of the rail, away from the pages */ .account { diff --git a/src/lib/shared/components/icon/icon.svelte b/src/lib/shared/components/icon/icon.svelte index bca88ef..67d9af8 100644 --- a/src/lib/shared/components/icon/icon.svelte +++ b/src/lib/shared/components/icon/icon.svelte @@ -16,11 +16,32 @@ onclick?: (event: MouseEvent) => void; } + import { onMount } from "svelte"; + + let ready = $state(false); + + onMount(() => { + let active = true; + + document.fonts + .load('24px "Material Symbols Rounded"') + .then((fonts) => { + if (active) ready = fonts.length > 0; + }) + .catch(() => { + /* Keep the icon slot empty when the font is unavailable. */ + }); + return () => { + active = false; + }; + }); + const { name, size = 24, color, fill = false, class: cls, onclick }: Props = $props(); interface Props { checked?: boolean; + label?: string; disabled?: boolean; onChange?: (checked: boolean) => void; } - let { checked = $bindable(false), disabled, onChange }: Props = $props(); + let { checked = $bindable(false), disabled, label, onChange }: Props = $props();