Add the native app's skeleton, built and gated
native/ is Base on the Mac and iPhone, laid out as Equipo's (00d09aa7): BaseKit, the BaseMac executable bundled by the kit's bundle-mac.py, and an xcodegen iPhone project. works.oficina.base, Base's keychain group then Oficina ID's, the App Groups and webcredentials as the other apps. rastrillo/native at main (0254817), swift-cmark at Equipo's pin, and KeyboardShortcuts 3.1.0 for the Mac's shortcut. The fonts are copied into BaseKit by scripts/fonts-into-bundle.sh: Timeless Sans when make fonts has fetched it (never committed), DM Sans always; a release refuses to build without the pinned Timeless file. The string catalog holds copy review's ids and texts, and check-strings.py holds the catalog to them and keeps copy out of the code. The icon is Base's mark on the sky (scripts/make-icon.swift). check-native.sh runs the catalog check, swift test, the Mac build and an iPhone Simulator build; .amadan/ci.d runs it beside make ci.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 files changed,
+1,197
−1
.amadan/ci.d/10-gate+6 −0.amadan/ci.d/20-native+13 −0Makefile+6 −1native/.gitignore+11 −0native/PrivacyInfo.xcprivacy+26 −0native/apple/Package.resolved+39 −0native/apple/Package.swift+53 −0native/apple/Sources/BaseKit/BaseApp.swift+14 −0native/apple/Sources/BaseKit/BaseText.swift+23 −0native/apple/Sources/BaseKit/Resources/Fonts/.keep+0 −0native/apple/Sources/BaseKit/Resources/Localizable.xcstrings+570 −0native/apple/Sources/BaseMac/BaseMacApp.swift+30 −0native/apple/Sources/BasePhone/BasePhoneApp.swift+9 −0native/apple/Tests/BaseKitTests/CatalogTests.swift+10 −0native/apple/Tests/BaseKitTests/Fixtures/.keep+0 −0native/apple/Tests/BaseSnapshots/BaseSnapshots.swift+9 −0native/ios/Assets.xcassets/AppIcon.appiconset/AppIcon.pngbinarynative/ios/Assets.xcassets/AppIcon.appiconset/Contents.json+4 −0native/ios/Assets.xcassets/Contents.json+1 −0native/ios/BasePhone.entitlements+18 −0native/ios/project.yml+103 −0native/mac-updates.json+11 −0native/macos/DeveloperID.entitlements+21 −0native/scripts/build-iphone.sh+18 −0native/scripts/build-mac.sh+18 −0native/scripts/check-native.sh+31 −0native/scripts/check-strings.py+71 −0native/scripts/fonts-into-bundle.sh+24 −0native/scripts/make-icon.swift+58 −0
diff --git a/.amadan/ci.d/10-gate b/.amadan/ci.d/10-gate| new file mode 100755 |
| index 0000000..b488f81 |
| --- /dev/null |
| +++ b/.amadan/ci.d/10-gate |
| @@ -0,0 +1,6 @@ |
| +#!/usr/bin/env bash |
| +# The Go gate, the same `make ci` you run before pushing. (Base had no |
| +# .amadan/ci.d until the native app; with one, a runner runs only what is |
| +# listed here, so the Go gate is listed first.) |
| +set -euo pipefail |
| +make ci |
diff --git a/.amadan/ci.d/20-native b/.amadan/ci.d/20-native| new file mode 100755 |
| index 0000000..74fafc2 |
| --- /dev/null |
| +++ b/.amadan/ci.d/20-native |
| @@ -0,0 +1,13 @@ |
| +#!/usr/bin/env bash |
| +set -euo pipefail |
| +# The native app's gate (native/scripts/check-native.sh): the string catalog, |
| +# BaseKit's tests, the Mac app and an iPhone Simulator build on a Mac; the |
| +# catalog alone elsewhere. The screenshot gate (native/scripts/snapshots.sh) |
| +# is not run here: its baselines are exact only on the macOS, Xcode and |
| +# simulator runtime that drew them. swift test builds its tests and skips |
| +# them without RASTRILLO_SNAPSHOTS. |
| +if [[ "$(uname -s)" == Darwin ]]; then |
| + native/scripts/check-native.sh |
| +else |
| + native/scripts/check-native.sh --core-only |
| +fi |
diff --git a/Makefile b/Makefile| index 3552802..12b0b6f 100644 |
| --- a/Makefile |
| +++ b/Makefile |
| @@ -12,7 +12,7 @@ RELEASE_VERSION = $(shell git rev-parse --short HEAD) |
| # One target at a time, even under make -j. |
| .NOTPARALLEL: |
| -.PHONY: script-test fonts build release test browser vet fmt-check staticcheck govulncheck gitleaks budget ci |
| +.PHONY: script-test fonts build release test browser vet fmt-check staticcheck govulncheck gitleaks budget ci native-check |
| RASTRILLO := go run amadan.net/rastrillo/rastrillo/cmd/rastrillo |
| @@ -86,3 +86,8 @@ ci: build vet fmt-check staticcheck govulncheck gitleaks budget script-test test |
| # Fetches Timeless Sans, which the licence keeps out of the repository. |
| fonts: |
| ./hack/fonts.sh |
| + |
| +# The native app's gate (native/): the string catalog, BaseKit's tests, the |
| +# Mac app and an iPhone Simulator build. Needs a Mac with Xcode. |
| +native-check: |
| + native/scripts/check-native.sh |
diff --git a/native/.gitignore b/native/.gitignore| new file mode 100644 |
| index 0000000..e35bf5d |
| --- /dev/null |
| +++ b/native/.gitignore |
| @@ -0,0 +1,11 @@ |
| +.build/ |
| +.swiftpm/ |
| +DerivedData/ |
| +build/ |
| +*.xcodeproj/ |
| +*.log |
| +ios/Info.plist |
| +# The faces are copied in by scripts/fonts-into-bundle.sh: Timeless Sans's |
| +# licence keeps it out of the repository, and DM Sans is committed once, |
| +# under internal/look/static/fonts. |
| +apple/Sources/BaseKit/Resources/Fonts/*.woff2 |
diff --git a/native/PrivacyInfo.xcprivacy b/native/PrivacyInfo.xcprivacy| new file mode 100644 |
| index 0000000..1f4ad6e |
| --- /dev/null |
| +++ b/native/PrivacyInfo.xcprivacy |
| @@ -0,0 +1,26 @@ |
| +<?xml version="1.0" encoding="UTF-8"?> |
| +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| +<plist version="1.0"> |
| +<dict> |
| + <key>NSPrivacyTracking</key> |
| + <false/> |
| + <key>NSPrivacyTrackingDomains</key> |
| + <array/> |
| + <key>NSPrivacyCollectedDataTypes</key> |
| + <array/> |
| + <key>NSPrivacyAccessedAPITypes</key> |
| + <array> |
| + <dict> |
| + <!-- The kit's Oficina ID records in the App Group, and the Mac's |
| + settings (menu-bar item, where Oficina apps open). --> |
| + <key>NSPrivacyAccessedAPIType</key> |
| + <string>NSPrivacyAccessedAPICategoryUserDefaults</string> |
| + <key>NSPrivacyAccessedAPITypeReasons</key> |
| + <array> |
| + <string>CA92.1</string> |
| + <string>1C8F.1</string> |
| + </array> |
| + </dict> |
| + </array> |
| +</dict> |
| +</plist> |
diff --git a/native/apple/Package.resolved b/native/apple/Package.resolved| new file mode 100644 |
| index 0000000..726c27e |
| --- /dev/null |
| +++ b/native/apple/Package.resolved |
| @@ -0,0 +1,39 @@ |
| +{ |
| + "originHash" : "55be33bf272bf9c9fe2194d79bfbf31b311f59b21e0fc400d3996d6b9e5504f4", |
| + "pins" : [ |
| + { |
| + "identity" : "keyboardshortcuts", |
| + "kind" : "remoteSourceControl", |
| + "location" : "https://github.com/sindresorhus/KeyboardShortcuts", |
| + "state" : { |
| + "revision" : "772133d9dbe800fdac0473226822994c5c162c58" |
| + } |
| + }, |
| + { |
| + "identity" : "native", |
| + "kind" : "remoteSourceControl", |
| + "location" : "https://amadan.net/rastrillo/native", |
| + "state" : { |
| + "revision" : "0254817dc9dd118ab271f1120cd2b03c1270a1f9" |
| + } |
| + }, |
| + { |
| + "identity" : "sparkle", |
| + "kind" : "remoteSourceControl", |
| + "location" : "https://github.com/sparkle-project/Sparkle", |
| + "state" : { |
| + "revision" : "ac2def288cbff5cfc7df3ffef6abdf45b72bcb0a", |
| + "version" : "2.9.6" |
| + } |
| + }, |
| + { |
| + "identity" : "swift-cmark", |
| + "kind" : "remoteSourceControl", |
| + "location" : "https://github.com/swiftlang/swift-cmark", |
| + "state" : { |
| + "revision" : "08ddb528923cc1a6527e02b7a1aee9e516ca749a" |
| + } |
| + } |
| + ], |
| + "version" : 3 |
| +} |
diff --git a/native/apple/Package.swift b/native/apple/Package.swift| new file mode 100644 |
| index 0000000..74a71d9 |
| --- /dev/null |
| +++ b/native/apple/Package.swift |
| @@ -0,0 +1,53 @@ |
| +// swift-tools-version: 6.2 |
| +import PackageDescription |
| +import Foundation |
| + |
| +// rastrillo/native at main (0254817). Task 1's additions (assertion(for:), |
| +// OficinaApp.base, the ://open handler) arrive with the next pin; nothing |
| +// here depends on them yet. OFICINA_NATIVE_PACKAGE_PATH points at a local |
| +// checkout instead, for work on the kit itself. |
| +let sharedNative: Package.Dependency = ProcessInfo.processInfo.environment["OFICINA_NATIVE_PACKAGE_PATH"].map { .package(name: "native", path: $0) } |
| + ?? .package(url: "https://amadan.net/rastrillo/native", revision: "0254817dc9dd118ab271f1120cd2b03c1270a1f9") |
| + |
| +let package = Package( |
| + name: "BaseNative", |
| + defaultLocalization: "en", |
| + platforms: [.macOS(.v26), .iOS(.v26)], |
| + products: [ |
| + .library(name: "BaseKit", targets: ["BaseKit"]), |
| + .executable(name: "BaseMac", targets: ["BaseMac"]), |
| + ], |
| + dependencies: [ |
| + sharedNative, |
| + // Equipo's pin (00d09aa7): the chat's Markdown is Equipo's parser. |
| + .package(url: "https://github.com/swiftlang/swift-cmark", revision: "08ddb528923cc1a6527e02b7a1aee9e516ca749a"), |
| + // The Mac's shortcut for Ask Base (P11), 3.1.0. MIT; in the Colophon. |
| + .package(url: "https://github.com/sindresorhus/KeyboardShortcuts", revision: "772133d9dbe800fdac0473226822994c5c162c58"), |
| + ], |
| + targets: [ |
| + // The look, the API client, Ask and Home, for both apps. Fonts/ is |
| + // filled by scripts/fonts-into-bundle.sh before any build. |
| + .target(name: "BaseKit", |
| + dependencies: [.product(name: "cmark-gfm", package: "swift-cmark"), |
| + .product(name: "RastrilloApple", package: "native")], |
| + resources: [.process("Resources/Localizable.xcstrings"), .copy("Resources/Fonts")]), |
| + .executableTarget(name: "BaseMac", |
| + dependencies: ["BaseKit", |
| + .product(name: "RastrilloApple", package: "native"), |
| + .product(name: "RastrilloMacUpdates", package: "native", condition: .when(platforms: [.macOS])), |
| + .product(name: "KeyboardShortcuts", package: "KeyboardShortcuts", condition: .when(platforms: [.macOS]))], |
| + path: "Sources/BaseMac"), |
| + .testTarget(name: "BaseKitTests", |
| + dependencies: ["BaseKit", .product(name: "RastrilloApple", package: "native"), |
| + .product(name: "RastrilloTestSupport", package: "native")], |
| + resources: [.copy("Fixtures")]), |
| + // The screenshot gate's Mac half; scripts/snapshots.sh runs it, plain |
| + // `swift test` skips it. ios/project.yml builds the same files as |
| + // BasePhoneSnapshots for the iPhone half. |
| + .testTarget(name: "BaseSnapshots", |
| + dependencies: ["BaseKit", .product(name: "RastrilloSnapshots", package: "native"), |
| + .product(name: "RastrilloApple", package: "native"), |
| + .product(name: "RastrilloTestSupport", package: "native")], |
| + exclude: ["__Snapshots__"]), |
| + ] |
| +) |
diff --git a/native/apple/Sources/BaseKit/BaseApp.swift b/native/apple/Sources/BaseKit/BaseApp.swift| new file mode 100644 |
| index 0000000..eaa3c40 |
| --- /dev/null |
| +++ b/native/apple/Sources/BaseKit/BaseApp.swift |
| @@ -0,0 +1,14 @@ |
| +import SwiftUI |
| + |
| +/// Base's plain name inside the app (D2): "Base". Finder, the Dock and the |
| +/// Home Screen say "Oficina Base" (bundle-mac.py, ios/project.yml). |
| +public enum BaseApp { |
| + public static let bundleID = "works.oficina.base" |
| + public static let version = "0.1.0" |
| +} |
| + |
| +/// The window's content until the app is drawn (Tasks 12 to 14). |
| +public struct BaseRootPlaceholder: View { |
| + public init() {} |
| + public var body: some View { Color.clear } |
| +} |
diff --git a/native/apple/Sources/BaseKit/BaseText.swift b/native/apple/Sources/BaseKit/BaseText.swift| new file mode 100644 |
| index 0000000..b2b51ab |
| --- /dev/null |
| +++ b/native/apple/Sources/BaseKit/BaseText.swift |
| @@ -0,0 +1,23 @@ |
| +import Foundation |
| + |
| +/// Every word Base shows, from `Resources/Localizable.xcstrings`. The keys |
| +/// are copy review's ids (copy-review/strings.json) and the web's approved |
| +/// copy (`ask.*`, from internal/web/templates/partials/chat.html and |
| +/// ask.js); scripts/check-strings.py holds the catalog to both. Nothing in |
| +/// the app hard-codes copy: a view shows `BaseText.text("…")`, or |
| +/// `Text(verbatim:)` for what the server or the person wrote. |
| +public enum BaseText { |
| + /// The catalog's text for `key`. |
| + public static func text(_ key: String) -> String { |
| + Bundle.module.localizedString(forKey: key, value: nil, table: nil) |
| + } |
| + |
| + /// The catalog's text for `key` with each `{name}` filled in. Copy |
| + /// review writes placeholders as `{email}`, `{team}`; the catalog keeps |
| + /// them so, and the values are never looked up themselves. |
| + public static func format(_ key: String, _ values: [String: String]) -> String { |
| + var out = text(key) |
| + for (name, value) in values { out = out.replacingOccurrences(of: "{\(name)}", with: value) } |
| + return out |
| + } |
| +} |
diff --git a/native/apple/Sources/BaseKit/Resources/Fonts/.keep b/native/apple/Sources/BaseKit/Resources/Fonts/.keep| new file mode 100644 |
| index 0000000..e69de29 |
diff --git a/native/apple/Sources/BaseKit/Resources/Localizable.xcstrings b/native/apple/Sources/BaseKit/Resources/Localizable.xcstrings| new file mode 100644 |
| index 0000000..4bfdaa7 |
| --- /dev/null |
| +++ b/native/apple/Sources/BaseKit/Resources/Localizable.xcstrings |
| @@ -0,0 +1,570 @@ |
| +{ |
| + "sourceLanguage": "en", |
| + "strings": { |
| + "native.account.signout": { |
| + "comment": "Same menu.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Sign out" |
| + } |
| + } |
| + } |
| + }, |
| + "native.account.switch": { |
| + "comment": "In the menu under the person's name at the foot of the sidebar (Mac) and behind their avatar (iPhone).", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Switch team" |
| + } |
| + } |
| + } |
| + }, |
| + "native.account.web": { |
| + "comment": "Same menu. Opens Base in the browser.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Open Base on the web" |
| + } |
| + } |
| + } |
| + }, |
| + "native.ask.not_linked": { |
| + "comment": "Shown in place of the conversation when this person isn't on the Equipo team behind Ask. Close to the web's approved 'Ask Base isn't set up for you yet' line.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Ask Base isn't set up for you yet. Finish setting it up in Equipo, then come back." |
| + } |
| + } |
| + } |
| + }, |
| + "native.colophon": { |
| + "comment": "Under the Help menu on the Mac: the list of open-source parts and fonts the app uses, with their licences. Same word as the other Oficina apps.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Colophon" |
| + } |
| + } |
| + } |
| + }, |
| + "native.job.started": { |
| + "comment": "Bottom of a job's view, e.g. 'Started yesterday at 16:20' or 'Started 5 minutes ago'. The web uses the same copy; reuse the web's approved form. (Keep {when})", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Started {when}" |
| + } |
| + } |
| + } |
| + }, |
| + "native.menubar.open": { |
| + "comment": "Top right of the small Ask panel that drops from Base's mark in the menu bar. Brings the main window forward.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Open Base" |
| + } |
| + } |
| + } |
| + }, |
| + "native.menubar.shortcut_hint": { |
| + "comment": "At the foot of the panel, only when the person has chosen a shortcut. {shortcut} is drawn as keys, like ⌃ Space. (Keep {shortcut})", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "{shortcut} opens this anywhere" |
| + } |
| + } |
| + } |
| + }, |
| + "native.offline": { |
| + "comment": "A thin banner across the top of the window or screen when the network drops. Messages can't be sent meanwhile.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "You're offline. Base will catch up when you're back." |
| + } |
| + } |
| + } |
| + }, |
| + "native.phone.account_a11y": { |
| + "comment": "The round button top right, with the person's initials, that opens the account menu.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Account" |
| + } |
| + } |
| + } |
| + }, |
| + "native.phone.apps.close_a11y": { |
| + "comment": "The round X on the apps sheet.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Close" |
| + } |
| + } |
| + } |
| + }, |
| + "native.phone.apps_a11y": { |
| + "comment": "The round button top left of the Ask screen that opens the sheet of apps.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Apps" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.account.signed_in_as": { |
| + "comment": "Account tab: the label beside the person's name and email.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Oficina ID" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.account.team": { |
| + "comment": "Account tab: beside the team's name, with a Switch team button.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Team" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.appearance": { |
| + "comment": "Row with three choices: System, Light, Dark (the web's approved words). Changing it also changes Base on the web.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Appearance" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.ask.connected": { |
| + "comment": "Ask Base tab: shown when Ask works.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Connected" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.ask.disconnect": { |
| + "comment": "Ask Base tab, beside Connected. Same action as Disconnect in Settings on the web.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Disconnect" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.login": { |
| + "comment": "A switch, off by default.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Open Base when you log in" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.menubar": { |
| + "comment": "A switch, on by default.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Show Base in the menu bar" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.menubar.detail": { |
| + "comment": "Smaller line under 'Show Base in the menu bar'.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Ask Base from any app" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.open_in": { |
| + "comment": "Two choices beside it: 'The app' and 'The browser'.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Open Oficina apps in" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.open_in.app": { |
| + "comment": "One of the two choices above.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "The app" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.open_in.browser": { |
| + "comment": "The other choice.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "The browser" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.open_in.detail": { |
| + "comment": "Smaller line under 'Open Oficina apps in', naming the Oficina apps installed on this Mac, e.g. 'Docs, Sheets and Calls are on this Mac'. (Keep {apps}; one app: 'Docs is on this Mac')", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "{apps} are on this Mac" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.shortcut": { |
| + "comment": "Beside it, a box where the person presses the keys they want.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Shortcut for Ask Base" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.shortcut.detail": { |
| + "comment": "Smaller line under the shortcut row while no shortcut is set.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Off until you choose one" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.tab.account": { |
| + "comment": "Second tab: the Oficina ID, team, Switch team and Sign out.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Account" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.tab.ask": { |
| + "comment": "Third tab: whether Ask is connected, and Disconnect.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Ask Base" |
| + } |
| + } |
| + } |
| + }, |
| + "native.settings.tab.general": { |
| + "comment": "First tab of the Mac app's Settings window.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "General" |
| + } |
| + } |
| + } |
| + }, |
| + "native.sidebar.apps": { |
| + "comment": "Heads the list of the team's apps in the sidebar.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Apps" |
| + } |
| + } |
| + } |
| + }, |
| + "native.sidebar.ask": { |
| + "comment": "The first row of the sidebar, selected by default: the conversation with the Assistant. A small badge beside it counts jobs that are waiting on the person.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Ask Base" |
| + } |
| + } |
| + } |
| + }, |
| + "native.sidebar.ask.badge_a11y": { |
| + "comment": "Read by VoiceOver for the badge on the Ask Base row. (Keep {count}; singular form: 1 job needs you)", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "{count} jobs need you" |
| + } |
| + } |
| + } |
| + }, |
| + "native.sidebar.steps": { |
| + "comment": "A small card in the sidebar listing the three first steps, shown until all are done. The steps themselves are the web's approved ones: Signed in, Invite your team, Install your first app.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Getting started" |
| + } |
| + } |
| + } |
| + }, |
| + "native.sidebar.team": { |
| + "comment": "Heads Store and People in the sidebar: the team's name, such as 'Fennel & Rye'. (Not copy, just the name; listed so nobody adds a word)", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "{team}" |
| + } |
| + } |
| + } |
| + }, |
| + "native.sidebar.toggle_a11y": { |
| + "comment": "The button at the right of the Ask bar that hides and shows the sidebar. Its label flips to 'Show sidebar'.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Hide sidebar" |
| + } |
| + } |
| + } |
| + }, |
| + "native.signin.code.lede": { |
| + "comment": "Under 'Check your email'. {email} is the address they typed. (Keep {email})", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "We sent a code to {email}" |
| + } |
| + } |
| + } |
| + }, |
| + "native.signin.code.passkey_next": { |
| + "comment": "Small print at the bottom of the code screen.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Next time, sign in with a passkey: Base offers to make one once you're in." |
| + } |
| + } |
| + } |
| + }, |
| + "native.signin.code.resend": { |
| + "comment": "Under the code boxes, for when the email didn't arrive or the code expired.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Send a new code" |
| + } |
| + } |
| + } |
| + }, |
| + "native.signin.code.title": { |
| + "comment": "Replaces the sign-in heading once the code is sent. Under it are six boxes for the code.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Check your email" |
| + } |
| + } |
| + } |
| + }, |
| + "native.signin.email.label": { |
| + "comment": "Above the email field on the sign-in card.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Email" |
| + } |
| + } |
| + } |
| + }, |
| + "native.signin.email.send": { |
| + "comment": "The main button on the sign-in card. It sends a six-digit code to the address in the field.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Email me a code" |
| + } |
| + } |
| + } |
| + }, |
| + "native.signin.lede": { |
| + "comment": "Under the heading. It tells people which account this is, so they don't make a new one.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Use your Oficina ID, the same one as Docs, Sheets and Calls." |
| + } |
| + } |
| + } |
| + }, |
| + "native.signin.or": { |
| + "comment": "Between the email button and the passkey button.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "or" |
| + } |
| + } |
| + } |
| + }, |
| + "native.signin.passkey": { |
| + "comment": "The second button on the sign-in card, for people who already made a passkey for their Oficina ID.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Sign in with a passkey" |
| + } |
| + } |
| + } |
| + }, |
| + "native.signin.title": { |
| + "comment": "The heading of the first screen of the Mac and iPhone app, shown only when no Oficina ID is on the device yet. Most people never see it: with an Oficina ID already there (from Docs, Sheets, Calls or Equipo) the app signs straight in.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Sign in to Base" |
| + } |
| + } |
| + } |
| + }, |
| + "native.signin.unknown": { |
| + "comment": "Shown when the Oficina ID is real but Base doesn't know this person yet: they have to sign in to Base in a browser once, which links their Oficina ID to their place in the team. Rare; most people never see it.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Sign in to Base on the web once with your Oficina ID, then come back." |
| + } |
| + } |
| + } |
| + }, |
| + "native.signin.unknown.button": { |
| + "comment": "Under the message above. Opens Base's sign-in page in the browser.", |
| + "extractionState": "manual", |
| + "localizations": { |
| + "en": { |
| + "stringUnit": { |
| + "state": "translated", |
| + "value": "Open Base on the web" |
| + } |
| + } |
| + } |
| + } |
| + }, |
| + "version": "1.0" |
| +} |
diff --git a/native/apple/Sources/BaseMac/BaseMacApp.swift b/native/apple/Sources/BaseMac/BaseMacApp.swift| new file mode 100644 |
| index 0000000..4c12c4e |
| --- /dev/null |
| +++ b/native/apple/Sources/BaseMac/BaseMacApp.swift |
| @@ -0,0 +1,30 @@ |
| +#if canImport(RastrilloMacUpdates) |
| +import RastrilloMacUpdates |
| +#endif |
| +import BaseKit |
| +import RastrilloApple |
| +import SwiftUI |
| + |
| +/// Base for the Mac. One window (B): the sky, a floating sidebar and Ask |
| +/// (Task 13). Until then, an empty window. |
| +@main struct BaseMacApp: App { |
| + #if canImport(RastrilloMacUpdates) |
| + // Quiet, as the other Oficina apps: a scheduled check never opens a |
| + // window; an update downloads in the background and installs on quit. |
| + @State private var updater = NativeUpdater(policy: .quiet) |
| + #endif |
| + |
| + var body: some Scene { |
| + Window(BaseText.text("native.sidebar.ask"), id: "main") { |
| + BaseRootPlaceholder().frame(minWidth: 860, minHeight: 560) |
| + } |
| + .defaultSize(width: 1280, height: 800) |
| + .commands { |
| + // First: About, Hide and Quit say "Base", not the Finder name. |
| + PlainAppNameCommands() |
| + #if canImport(RastrilloMacUpdates) |
| + NativeUpdateCommands(updater: updater) |
| + #endif |
| + } |
| + } |
| +} |
diff --git a/native/apple/Sources/BasePhone/BasePhoneApp.swift b/native/apple/Sources/BasePhone/BasePhoneApp.swift| new file mode 100644 |
| index 0000000..d7cbdeb |
| --- /dev/null |
| +++ b/native/apple/Sources/BasePhone/BasePhoneApp.swift |
| @@ -0,0 +1,9 @@ |
| +import BaseKit |
| +import SwiftUI |
| + |
| +/// Base for the iPhone: Ask first, the apps one tap away (Task 14). |
| +@main struct BasePhoneApp: App { |
| + var body: some Scene { |
| + WindowGroup { BaseRootPlaceholder() } |
| + } |
| +} |
diff --git a/native/apple/Tests/BaseKitTests/CatalogTests.swift b/native/apple/Tests/BaseKitTests/CatalogTests.swift| new file mode 100644 |
| index 0000000..75ff0ed |
| --- /dev/null |
| +++ b/native/apple/Tests/BaseKitTests/CatalogTests.swift |
| @@ -0,0 +1,10 @@ |
| +@testable import BaseKit |
| +import XCTest |
| + |
| +final class CatalogTests: XCTestCase { |
| + /// The catalog is in the bundle and answers by copy review's ids. |
| + func testCatalogAnswersByID() { |
| + XCTAssertEqual(BaseText.text("native.signin.title"), "Sign in to Base") |
| + XCTAssertEqual(BaseText.format("native.signin.code.lede", ["email": "ana@fennel.ie"]), "We sent a code to ana@fennel.ie") |
| + } |
| +} |
diff --git a/native/apple/Tests/BaseKitTests/Fixtures/.keep b/native/apple/Tests/BaseKitTests/Fixtures/.keep| new file mode 100644 |
| index 0000000..e69de29 |
diff --git a/native/apple/Tests/BaseSnapshots/BaseSnapshots.swift b/native/apple/Tests/BaseSnapshots/BaseSnapshots.swift| new file mode 100644 |
| index 0000000..c2fecf9 |
| --- /dev/null |
| +++ b/native/apple/Tests/BaseSnapshots/BaseSnapshots.swift |
| @@ -0,0 +1,9 @@ |
| +import XCTest |
| + |
| +/// The screenshot gate (Task 9 draws its screens). scripts/snapshots.sh runs |
| +/// it; plain `swift test` skips it. |
| +final class BaseSnapshots: XCTestCase { |
| + func testKeyScreens() throws { |
| + try XCTSkipUnless(ProcessInfo.processInfo.environment["RASTRILLO_SNAPSHOTS"] != nil, "Run with native/scripts/snapshots.sh") |
| + } |
| +} |
diff --git a/native/ios/Assets.xcassets/AppIcon.appiconset/AppIcon.png b/native/ios/Assets.xcassets/AppIcon.appiconset/AppIcon.png| new file mode 100644 |
| index 0000000..01bab26 |
| Binary files /dev/null and b/native/ios/Assets.xcassets/AppIcon.appiconset/AppIcon.png differ |
diff --git a/native/ios/Assets.xcassets/AppIcon.appiconset/Contents.json b/native/ios/Assets.xcassets/AppIcon.appiconset/Contents.json| new file mode 100644 |
| index 0000000..da294ba |
| --- /dev/null |
| +++ b/native/ios/Assets.xcassets/AppIcon.appiconset/Contents.json |
| @@ -0,0 +1,4 @@ |
| +{ |
| + "images" : [ { "filename" : "AppIcon.png", "idiom" : "universal", "platform" : "ios", "size" : "1024x1024" } ], |
| + "info" : { "author" : "xcode", "version" : 1 } |
| +} |
diff --git a/native/ios/Assets.xcassets/Contents.json b/native/ios/Assets.xcassets/Contents.json| new file mode 100644 |
| index 0000000..46cba7d |
| --- /dev/null |
| +++ b/native/ios/Assets.xcassets/Contents.json |
| @@ -0,0 +1 @@ |
| +{ "info" : { "author" : "xcode", "version" : 1 } } |
diff --git a/native/ios/BasePhone.entitlements b/native/ios/BasePhone.entitlements| new file mode 100644 |
| index 0000000..dd59e67 |
| --- /dev/null |
| +++ b/native/ios/BasePhone.entitlements |
| @@ -0,0 +1,18 @@ |
| +<?xml version="1.0" encoding="UTF-8"?> |
| +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| +<plist version="1.0"> |
| +<dict> |
| + <!-- Oficina ID: Base's own keychain group first, then the shared one; |
| + group.works.oficina; webcredentials:id.oficina.works for passkeys. |
| + No push until slice 2. --> |
| + <key>keychain-access-groups</key> |
| + <array> |
| + <string>9U4A84C4WK.works.oficina.base</string> |
| + <string>9U4A84C4WK.works.oficina.id</string> |
| + </array> |
| + <key>com.apple.security.application-groups</key> |
| + <array><string>group.works.oficina</string></array> |
| + <key>com.apple.developer.associated-domains</key> |
| + <array><string>webcredentials:id.oficina.works</string></array> |
| +</dict> |
| +</plist> |
diff --git a/native/ios/project.yml b/native/ios/project.yml| new file mode 100644 |
| index 0000000..697c775 |
| --- /dev/null |
| +++ b/native/ios/project.yml |
| @@ -0,0 +1,103 @@ |
| +name: BasePhone |
| +options: |
| + bundleIdPrefix: works.oficina |
| + deploymentTarget: |
| + iOS: '26.0' |
| +packages: |
| + BaseNative: |
| + path: ../apple |
| + RastrilloNative: |
| + url: https://amadan.net/rastrillo/native |
| + revision: 0254817dc9dd118ab271f1120cd2b03c1270a1f9 |
| +settings: |
| + base: |
| + SWIFT_VERSION: '6.0' |
| + CODE_SIGN_STYLE: Automatic |
| + MARKETING_VERSION: 0.1.0 |
| + CURRENT_PROJECT_VERSION: '1' |
| +targets: |
| + BasePhone: |
| + type: application |
| + platform: iOS |
| + sources: |
| + - ../apple/Sources/BasePhone |
| + - Assets.xcassets |
| + - path: ../PrivacyInfo.xcprivacy |
| + buildPhase: resources |
| + dependencies: |
| + - package: BaseNative |
| + product: BaseKit |
| + - package: RastrilloNative |
| + product: RastrilloApple |
| + settings: |
| + base: |
| + ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon |
| + PROVISIONING_PROFILE_SPECIFIER: $(OFICINA_PROVISIONING_PROFILE) |
| + PRODUCT_BUNDLE_IDENTIFIER: works.oficina.base |
| + # Oficina ID (rastrillo/native APPLE.md, "Oficina ID, slice A"): |
| + # Base's own keychain group first, then the shared one; |
| + # group.works.oficina; webcredentials:id.oficina.works for passkeys. |
| + CODE_SIGN_ENTITLEMENTS: BasePhone.entitlements |
| + TARGETED_DEVICE_FAMILY: '1' |
| + GENERATE_INFOPLIST_FILE: true |
| + # "Oficina Base" on the Home Screen and in Spotlight; "Base" inside |
| + # the app (the native level-up's D2). |
| + INFOPLIST_KEY_CFBundleDisplayName: Oficina Base |
| + INFOPLIST_KEY_UILaunchScreen_Generation: true |
| + INFOPLIST_KEY_UISupportedInterfaceOrientations: UIInterfaceOrientationPortrait |
| + # HTTPS only, through the system: exempt from export documentation. |
| + INFOPLIST_KEY_ITSAppUsesNonExemptEncryption: false |
| + info: |
| + path: Info.plist |
| + properties: |
| + CFBundleShortVersionString: $(MARKETING_VERSION) |
| + CFBundleVersion: $(CURRENT_PROJECT_VERSION) |
| + CFBundleName: Base |
| + # Interface text is English in slice 1; dates and numbers follow the |
| + # reader's locale through Foundation's format styles. |
| + CFBundleLocalizations: |
| + - en |
| + # The kit's sign-in callback, and (Task 1) works.oficina.base://open. |
| + CFBundleURLTypes: |
| + - CFBundleURLName: works.oficina.base |
| + CFBundleURLSchemes: |
| + - works.oficina.base |
| + CFBundleTypeRole: Editor |
| + # P12: Calls and Equipo open natively by their schemes. |
| + LSApplicationQueriesSchemes: |
| + - oficina-calls |
| + - works.oficina.equipo |
| + # The screenshot gate's iPhone half: the Mac half's catalog files, run as |
| + # a logic test in the simulator by native/scripts/snapshots.sh. |
| + BasePhoneSnapshots: |
| + type: bundle.unit-test |
| + platform: iOS |
| + sources: |
| + - path: ../apple/Tests/BaseSnapshots |
| + excludes: |
| + - __Snapshots__ |
| + dependencies: |
| + - package: BaseNative |
| + product: BaseKit |
| + - package: RastrilloNative |
| + product: RastrilloApple |
| + - package: RastrilloNative |
| + product: RastrilloSnapshots |
| + - package: RastrilloNative |
| + product: RastrilloTestSupport |
| + settings: |
| + base: |
| + GENERATE_INFOPLIST_FILE: true |
| + PRODUCT_BUNDLE_IDENTIFIER: works.oficina.base.snapshots |
| +schemes: |
| + BasePhone: |
| + build: |
| + targets: |
| + BasePhone: all |
| + BasePhoneSnapshots: |
| + build: |
| + targets: |
| + BasePhoneSnapshots: [test] |
| + test: |
| + targets: |
| + - BasePhoneSnapshots |
diff --git a/native/mac-updates.json b/native/mac-updates.json| new file mode 100644 |
| index 0000000..d334bb4 |
| --- /dev/null |
| +++ b/native/mac-updates.json |
| @@ -0,0 +1,11 @@ |
| +{ |
| + "bundle_id": "works.oficina.base", |
| + "install": "automatic", |
| + "url_schemes": ["works.oficina.base"], |
| + "localizations": ["en"], |
| + "entitlements": "macos/DeveloperID.entitlements", |
| + "provisioning_profile": "~/private_keys/oficina/profiles/Oficina-Base-macOS-Developer-ID.provisionprofile", |
| + "feed_url": "https://raw.amadan.net/oficina/native-releases/main/base/appcast.xml", |
| + "public_ed_key": "/FxO7cZnM7P5c9ZrUPUJvpCnR65sNmrzte+I5vHarE8=", |
| + "keychain_account": "oficina" |
| +} |
diff --git a/native/macos/DeveloperID.entitlements b/native/macos/DeveloperID.entitlements| new file mode 100644 |
| index 0000000..ddfb0c5 |
| --- /dev/null |
| +++ b/native/macos/DeveloperID.entitlements |
| @@ -0,0 +1,21 @@ |
| +<?xml version="1.0" encoding="UTF-8"?> |
| +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| +<plist version="1.0"> |
| +<dict> |
| + <!-- Oficina ID (rastrillo/native APPLE.md, "Oficina ID, slice A"): |
| + Base's own group first, so a query with no group never lands its |
| + sessions in the shared one; then the shared identities. A Developer |
| + ID app may carry these only with the embedded Developer ID profile |
| + for works.oficina.base (mac-updates.json names it); an ad hoc build |
| + drops the restricted grants (bundle-mac.py). No push until slice 2. --> |
| + <key>keychain-access-groups</key> |
| + <array> |
| + <string>9U4A84C4WK.works.oficina.base</string> |
| + <string>9U4A84C4WK.works.oficina.id</string> |
| + </array> |
| + <key>com.apple.security.application-groups</key> |
| + <array><string>9U4A84C4WK.works.oficina</string></array> |
| + <key>com.apple.developer.associated-domains</key> |
| + <array><string>webcredentials:id.oficina.works</string></array> |
| +</dict> |
| +</plist> |
diff --git a/native/scripts/build-iphone.sh b/native/scripts/build-iphone.sh| new file mode 100755 |
| index 0000000..a4643da |
| --- /dev/null |
| +++ b/native/scripts/build-iphone.sh |
| @@ -0,0 +1,18 @@ |
| +#!/bin/sh |
| +# The iPhone app. "simulator" builds unsigned for the iOS Simulator; |
| +# "device" signs for a phone with OFICINA_DEVELOPMENT_TEAM set. |
| +set -eu |
| +cd "$(dirname "$0")/.." |
| +scripts/fonts-into-bundle.sh |
| +cd ios |
| +xcodegen generate --quiet |
| +case "${1:-simulator}" in |
| + simulator) |
| + xcodebuild -project BasePhone.xcodeproj -scheme BasePhone -configuration Debug -sdk iphonesimulator \ |
| + -destination 'generic/platform=iOS Simulator' -derivedDataPath ../build/Phone CODE_SIGNING_ALLOWED=NO build ;; |
| + device) |
| + : "${OFICINA_DEVELOPMENT_TEAM:?set OFICINA_DEVELOPMENT_TEAM to sign for a device}" |
| + xcodebuild -project BasePhone.xcodeproj -scheme BasePhone -configuration Debug -sdk iphoneos \ |
| + -destination 'generic/platform=iOS' -derivedDataPath ../build/Phone DEVELOPMENT_TEAM="$OFICINA_DEVELOPMENT_TEAM" -allowProvisioningUpdates build ;; |
| + *) echo "usage: build-iphone.sh [simulator|device]" >&2; exit 2 ;; |
| +esac |
diff --git a/native/scripts/build-mac.sh b/native/scripts/build-mac.sh| new file mode 100755 |
| index 0000000..70eff5c |
| --- /dev/null |
| +++ b/native/scripts/build-mac.sh |
| @@ -0,0 +1,18 @@ |
| +#!/bin/sh |
| +# The Mac app, bundled by rastrillo/native's bundle-mac.py: works.oficina.base, |
| +# "Oficina Base" in Finder and the Dock, "Base" in its menus, Sparkle |
| +# configured from mac-updates.json. Signs ad hoc unless --sign-identity says |
| +# otherwise; never notarises or publishes. |
| +# --provisioning-profile PATH and --entitlements PATH override mac-updates.json. |
| +# The pinned kit embeds the profile at Contents/embedded.provisionprofile |
| +# before signing. Ad hoc builds omit restricted grants and never open a profile. |
| +# --configuration release refuses to build without Timeless Sans (P8). |
| +set -eu |
| +cd "$(dirname "$0")/.." |
| +case " $* " in |
| + *" --configuration release "*|*" --configuration=release "*) scripts/fonts-into-bundle.sh --release ;; |
| + *) scripts/fonts-into-bundle.sh ;; |
| +esac |
| +swift package --package-path apple resolve |
| +shared_native="${OFICINA_NATIVE_PACKAGE_PATH:-apple/.build/checkouts/native}" |
| +python3 "$shared_native/tools/bundle-mac.py" . Base --updates-config mac-updates.json "$@" |
diff --git a/native/scripts/check-native.sh b/native/scripts/check-native.sh| new file mode 100755 |
| index 0000000..e4f3d0e |
| --- /dev/null |
| +++ b/native/scripts/check-native.sh |
| @@ -0,0 +1,31 @@ |
| +#!/bin/sh |
| +# The native gate: the string catalog, BaseKit's tests, the Mac app and an |
| +# unsigned iPhone Simulator build. --release first refuses to go on without |
| +# the pinned Timeless Sans (P8). --core-only (off a Mac) checks the catalog |
| +# alone: everything else needs Xcode. The screenshot gate (snapshots.sh) is |
| +# not run here: its baselines are exact only on the OS that drew them. |
| +set -eu |
| +cd "$(dirname "$0")/.." |
| +release=0 core_only=0 |
| +for argument in "$@"; do |
| + case "$argument" in |
| + --release) release=1 ;; |
| + --core-only) core_only=1 ;; |
| + *) echo "usage: $0 [--release] [--core-only]" >&2; exit 2 ;; |
| + esac |
| +done |
| +python3 scripts/check-strings.py |
| +[ "$core_only" = 1 ] && exit 0 |
| +if [ "$(uname -s)" != Darwin ]; then |
| + echo "the Apple checks need macOS; use --core-only elsewhere" >&2; exit 2 |
| +fi |
| +if [ "$release" = 1 ]; then scripts/fonts-into-bundle.sh --release; else scripts/fonts-into-bundle.sh; fi |
| +logs=build/logs; mkdir -p "$logs" |
| +swift package --package-path apple resolve |
| +swift test --package-path apple > "$logs/swift-test.log" 2>&1 || { tail -40 "$logs/swift-test.log"; exit 1; } |
| +# XCTest's summary for the whole run, and swift-testing's. |
| +grep -A1 "Test Suite 'All tests' passed" "$logs/swift-test.log" | tail -1 | sed 's/^[[:space:]]*/swift test: /' |
| +swift build --package-path apple --product BaseMac > "$logs/mac-build.log" 2>&1 || { grep -E 'error' "$logs/mac-build.log" | head -20; exit 1; } |
| +echo "BaseMac builds" |
| +scripts/build-iphone.sh simulator > "$logs/phone-build.log" 2>&1 || { grep -E 'error' "$logs/phone-build.log" | head -20; exit 1; } |
| +echo "BasePhone builds for the iOS Simulator" |
diff --git a/native/scripts/check-strings.py b/native/scripts/check-strings.py| new file mode 100755 |
| index 0000000..feb1ed8 |
| --- /dev/null |
| +++ b/native/scripts/check-strings.py |
| @@ -0,0 +1,71 @@ |
| +#!/usr/bin/env python3 |
| +"""The string catalog's gate. |
| + |
| +1. Every entry in apple/Sources/BaseKit/Resources/Localizable.xcstrings has |
| + its English text. |
| +2. Every key a Swift source asks for (BaseText.text / BaseText.format) is in |
| + the catalog, and every catalog entry is asked for somewhere or listed as |
| + waiting for a later task (WAITING below). |
| +3. No view hard-codes copy: Text, Button, Label and friends take catalog |
| + text or `verbatim:`, never a bare literal. |
| +4. With copy review's file (copy-review/strings.json, git-ignored, in the |
| + main checkout; or $BASE_COPY_REVIEW), every id there is in the catalog |
| + with exactly its text. Without it, this step says so and is skipped. |
| +""" |
| +import json, os, pathlib, re, sys |
| + |
| +native = pathlib.Path(__file__).resolve().parent.parent |
| +repo = native.parent |
| +catalog_path = native / "apple/Sources/BaseKit/Resources/Localizable.xcstrings" |
| +sources = native / "apple/Sources" |
| +failures = [] |
| + |
| +catalog = json.loads(catalog_path.read_text()) |
| +if catalog.get("sourceLanguage") != "en": |
| + failures.append("the catalog's source language is not en") |
| +texts = {} |
| +for key, entry in catalog["strings"].items(): |
| + value = entry.get("localizations", {}).get("en", {}).get("stringUnit", {}).get("value") |
| + variations = entry.get("localizations", {}).get("en", {}).get("variations") |
| + if value is None and variations is None: |
| + failures.append(f"{key}: no English text") |
| + texts[key] = value |
| + |
| +# Strings copy review approved for screens later tasks draw (Tasks 12 to |
| +# 14). They stay in the catalog so the review's text is the app's text. |
| +WAITING = re.compile(r"^native\.(signin|sidebar|account|menubar|settings|phone|colophon|offline|ask|job)\b") |
| + |
| +used = set() |
| +for path in sources.rglob("*.swift"): |
| + text = path.read_text() |
| + for match in re.finditer(r'BaseText\.(?:text|format)\(\s*"([^"]+)"', text): |
| + if match.group(1) != "…": used.add(match.group(1)) |
| + for match in re.finditer(r'(?:baseKey|textKey):\s*"([^"]+)"', text): |
| + used.add(match.group(1)) |
| + for n, line in enumerate(text.splitlines(), 1): |
| + if re.search(r'\b(Text|Button|Label|Toggle|Section|LabeledContent|Picker|TextField|Link|Menu)\(\s*"(?!")', line) and "verbatim" not in line: |
| + failures.append(f"{path.relative_to(native)}:{n}: copy hard-coded outside the catalog: {line.strip()}") |
| + |
| +for key in sorted(used - texts.keys()): |
| + failures.append(f"{key}: used in Swift but not in the catalog") |
| +for key in sorted(texts.keys() - used): |
| + if not WAITING.match(key): |
| + failures.append(f"{key}: in the catalog but never used") |
| + |
| +review = os.environ.get("BASE_COPY_REVIEW") |
| +candidates = [pathlib.Path(review)] if review else [repo / "copy-review/strings.json", repo.parent / "base/copy-review/strings.json"] |
| +found = next((p for p in candidates if p.is_file()), None) |
| +if found: |
| + for item in json.loads(found.read_text()): |
| + if item["id"] not in texts: |
| + failures.append(f"{item['id']}: in copy review but not in the catalog") |
| + elif texts[item["id"]] != item["text"]: |
| + failures.append(f"{item['id']}: the catalog says {texts[item['id']]!r}, copy review {item['text']!r}") |
| + print(f"strings: the catalog matches copy review ({found})") |
| +else: |
| + print("strings: copy review's strings.json is not here (git-ignored); its comparison skipped") |
| + |
| +if failures: |
| + print("\n".join(failures), file=sys.stderr) |
| + sys.exit(1) |
| +print(f"strings: {len(texts)} in the catalog, {len(used)} used") |
diff --git a/native/scripts/fonts-into-bundle.sh b/native/scripts/fonts-into-bundle.sh| new file mode 100755 |
| index 0000000..b7b47b3 |
| --- /dev/null |
| +++ b/native/scripts/fonts-into-bundle.sh |
| @@ -0,0 +1,24 @@ |
| +#!/bin/sh |
| +# Copies Base's faces into BaseKit's resources (P8): Timeless Sans, fetched |
| +# by `make fonts` (git-ignored: its licence forbids committing it), and DM |
| +# Sans, the committed OFL fallback the web uses too. Every build runs this |
| +# first. Without Timeless Sans a dev build is set in DM Sans, as the web is; |
| +# --release refuses to go on without the pinned file (hack/fonts.sh check). |
| +set -eu |
| +cd "$(dirname "$0")/../.." |
| +fonts=native/apple/Sources/BaseKit/Resources/Fonts |
| +timeless=internal/look/static/fonts/timeless/1.094/TimelessSansVF.woff2 |
| +dmsans=internal/look/static/fonts/dm-sans/4.004/DMSans-VF.woff2 |
| +if [ "${1:-}" = --release ]; then |
| + hack/fonts.sh check |
| +elif [ -n "${1:-}" ]; then |
| + echo "usage: $0 [--release]" >&2; exit 2 |
| +fi |
| +mkdir -p "$fonts" |
| +cp "$dmsans" "$fonts/DMSans-VF.woff2" |
| +if [ -f "$timeless" ]; then |
| + cp "$timeless" "$fonts/TimelessSansVF.woff2" |
| +else |
| + rm -f "$fonts/TimelessSansVF.woff2" |
| + echo "fonts: no Timeless Sans (make fonts fetches it); this build is set in DM Sans" |
| +fi |
diff --git a/native/scripts/make-icon.swift b/native/scripts/make-icon.swift| new file mode 100644 |
| index 0000000..26ab635 |
| --- /dev/null |
| +++ b/native/scripts/make-icon.swift |
| @@ -0,0 +1,58 @@ |
| +// Draws Base's app icon, ios/Assets.xcassets/AppIcon.appiconset/AppIcon.png: |
| +// Base's mark (the wordmark's rounded square, --mark-1 into --mark-2, with |
| +// its bright edge) on the dark sky (--sky-1 to --sky-3 at 165°), lit as the |
| +// web is: the warm beam from above and the teal and violet fog below. A |
| +// square 1024 px master; bundle-mac.py derives the Mac's padded icon. |
| +// |
| +// swift native/scripts/make-icon.swift native/ios/Assets.xcassets/AppIcon.appiconset/AppIcon.png |
| +import AppKit |
| + |
| +let size: CGFloat = 1024 |
| +let out = URL(fileURLWithPath: CommandLine.arguments[1]) |
| +func rgba(_ r: CGFloat, _ g: CGFloat, _ b: CGFloat, _ a: CGFloat = 1) -> CGColor { |
| + CGColor(srgbRed: r / 255, green: g / 255, blue: b / 255, alpha: a) |
| +} |
| +let space = CGColorSpace(name: CGColorSpace.sRGB)! |
| +guard let ctx = CGContext(data: nil, width: Int(size), height: Int(size), bitsPerComponent: 8, bytesPerRow: 0, |
| + space: space, bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue) else { fatalError("no context") } |
| +// CoreGraphics' origin is the bottom left: y runs up. |
| +// The sky: 165° (towards the bottom, a little left), --sky-1 0%, --sky-2 62%, --sky-3 100%. |
| +let sky = CGGradient(colorsSpace: space, colors: [rgba(44, 52, 112), rgba(26, 31, 69), rgba(22, 25, 58)] as CFArray, locations: [0, 0.62, 1])! |
| +let angle = 165.0 * Double.pi / 180 |
| +let dx = CGFloat(sin(angle)), dy = CGFloat(-cos(angle)) |
| +let half = (abs(dx) + abs(dy)) * size / 2 |
| +let mid = CGPoint(x: size / 2, y: size / 2) |
| +ctx.drawLinearGradient(sky, start: CGPoint(x: mid.x - dx * half, y: mid.y + dy * half), |
| + end: CGPoint(x: mid.x + dx * half, y: mid.y - dy * half), options: [.drawsBeforeStartLocation, .drawsAfterEndLocation]) |
| +// Fog: soft radial glows of --lagoon and --orchid low down, and the warm beam from above. |
| +func glow(_ color: CGColor, at center: CGPoint, radius: CGFloat) { |
| + let g = CGGradient(colorsSpace: space, colors: [color, color.copy(alpha: 0)!] as CFArray, locations: [0, 1])! |
| + ctx.drawRadialGradient(g, startCenter: center, startRadius: 0, endCenter: center, endRadius: radius, options: []) |
| +} |
| +glow(rgba(47, 198, 192, 0.42), at: CGPoint(x: size * 0.18, y: size * 0.12), radius: size * 0.62) |
| +glow(rgba(139, 92, 246, 0.42), at: CGPoint(x: size * 0.86, y: size * 0.22), radius: size * 0.6) |
| +glow(rgba(244, 114, 182, 0.18), at: CGPoint(x: size * 0.6, y: size * 0.02), radius: size * 0.36) |
| +glow(rgba(255, 214, 170, 0.30), at: CGPoint(x: size * 0.42, y: size * 1.02), radius: size * 0.62) |
| +// The mark: a rounded square (16 px with 5 px corners on the web), 40% of the icon. |
| +let side = size * 0.40 |
| +let rect = CGRect(x: (size - side) / 2, y: (size - side) / 2, width: side, height: side) |
| +let path = CGPath(roundedRect: rect, cornerWidth: side * 5 / 16, cornerHeight: side * 5 / 16, transform: nil) |
| +ctx.saveGState() |
| +ctx.setShadow(offset: CGSize(width: 0, height: -side * 0.06), blur: side * 0.22, color: rgba(8, 12, 22, 0.55)) |
| +ctx.addPath(path); ctx.setFillColor(rgba(238, 242, 248, 0.5)); ctx.fillPath() |
| +ctx.restoreGState() |
| +ctx.saveGState() |
| +ctx.addPath(path); ctx.clip() |
| +// 160°: from the top, a little left, to the bottom: #FFFFFF into rgba(238,242,248,.35) over the sky. |
| +let markAngle = 160.0 * Double.pi / 180 |
| +let mdx = CGFloat(sin(markAngle)), mdy = CGFloat(-cos(markAngle)) |
| +let mhalf = (abs(mdx) + abs(mdy)) * side / 2 |
| +let mc = CGPoint(x: rect.midX, y: rect.midY) |
| +let mark = CGGradient(colorsSpace: space, colors: [rgba(255, 255, 255), rgba(238, 242, 248, 0.35)] as CFArray, locations: [0, 1])! |
| +ctx.drawLinearGradient(mark, start: CGPoint(x: mc.x - mdx * mhalf, y: mc.y + mdy * mhalf), |
| + end: CGPoint(x: mc.x + mdx * mhalf, y: mc.y - mdy * mhalf), options: []) |
| +// Its edge: inset 0 0 0 1px rgba(255,255,255,.5), scaled. |
| +ctx.addPath(path); ctx.setStrokeColor(rgba(255, 255, 255, 0.5)); ctx.setLineWidth(side / 24); ctx.strokePath() |
| +ctx.restoreGState() |
| +guard let image = ctx.makeImage(), let png = NSBitmapImageRep(cgImage: image).representation(using: .png, properties: [:]) else { fatalError("no png") } |
| +try png.write(to: out) |