Skip to content

armgit / boop

Public Imported from GitHub
0

A tiny, self-hosted notification inbox for developers. Something happened in one of your apps; Boop tells you on your phone.

HTML

iOS

Chris Gregori562828128b4e
diff --git a/.env.example b/.env.example
index 520a4e7..794fb4a 100644
--- a/.env.example
+++ b/.env.example
@@ -3,11 +3,19 @@ BOOP_BASE_URL=https://boop.example.com
BOOP_RETENTION_DAYS=30
BOOP_LOG_LEVEL=info
+# Protects the web UI and admin API with a single login. Leave both blank to run
+# without a login (only do that behind your own proxy/VPN). Password: 8+ characters.
+BOOP_ADMIN_USER=chris
+BOOP_ADMIN_PASSWORD=change-me-please
+
# Apple Push Notifications. Leave blank until you have created an APNs key;
# Boop runs without them, but pushes are skipped.
APNS_TEAM_ID=
APNS_KEY_ID=
APNS_BUNDLE_ID=
APNS_PRIVATE_KEY_PATH=/run/secrets/apns.p8
+# Or, instead of a mounted file (e.g. on Dokploy), paste the key here:
+# base64 -i AuthKey_XXXXXX.p8 | tr -d '\n'
+# APNS_PRIVATE_KEY=
# production or sandbox (use sandbox for Xcode debug builds)
APNS_ENVIRONMENT=production
diff --git a/README.md b/README.md
index a108a5b..0df1c76 100644
--- a/README.md
+++ b/README.md
@@ -107,7 +107,7 @@ All endpoints are under `/api/v1`. Errors are JSON: `{"error": "code", "message"
Credentials: project keys (`boop_proj_...`) can only create events; device credentials (`boop_dev_...`) can only read events and manage their own device. Only SHA-256 hashes are stored.
-**Admin auth.** v1 has no accounts (per the PRD). The web UI and the admin endpoints are unauthenticated and refuse project/device credentials, so a leaked client secret never grants admin rights. Put Boop behind your reverse proxy, Tailscale, or basic auth; do not expose the UI to the open internet as-is.
+**Admin auth.** Set `BOOP_ADMIN_USER` and `BOOP_ADMIN_PASSWORD` and the web UI shows a sign-in screen; admin endpoints then need the session cookie it sets (`POST /api/v1/auth/login`) or HTTP Basic credentials (`curl -u user:pass …`). Sessions last 30 days and live in memory, so a restart signs everyone out. Leave both unset and everything is open — only do that behind your own proxy, Tailscale, or VPN. Either way, project and device credentials are refused on admin endpoints, so a leaked client secret never grants admin rights.
## Configuration
@@ -118,10 +118,13 @@ Credentials: project keys (`boop_proj_...`) can only create events; device crede
| `BOOP_DATABASE_PATH` | `/data/boop.db` | WAL mode, migrations applied on start |
| `BOOP_RETENTION_DAYS` | `30` | Initial value; changeable in the UI. `0` = keep forever |
| `BOOP_LOG_LEVEL` | `info` | `debug`, `info`, `warn`, `error` |
+| `BOOP_ADMIN_USER` | | Web UI / admin API username; set together with the password |
+| `BOOP_ADMIN_PASSWORD` | | 8+ characters. Unset = no login |
| `APNS_TEAM_ID` | | Apple Developer team id |
| `APNS_KEY_ID` | | Id of the APNs auth key |
| `APNS_BUNDLE_ID` | | Bundle id of your Boop iOS build |
-| `APNS_PRIVATE_KEY_PATH` | | Path to the mounted `.p8` (preferred over `APNS_PRIVATE_KEY`) |
+| `APNS_PRIVATE_KEY_PATH` | | Path to the mounted `.p8` (preferred) |
+| `APNS_PRIVATE_KEY` | | Alternative: the `.p8` contents, as PEM text or base64 (`base64 -i key.p8 \| tr -d '\n'`) |
| `APNS_ENVIRONMENT` | `production` | `sandbox` for Xcode debug builds |
## Apple setup
@@ -134,6 +137,16 @@ Credentials: project keys (`boop_proj_...`) can only create events; device crede
6. Build the iOS app with the same bundle id, install it on your phone, open Devices → Pair iPhone, and scan the QR.
7. Settings → Send test notification.
+## Deploying with Dokploy (or any compose host)
+
+1. New **Compose** application → your repo, compose path `docker-compose.yml`.
+2. Change the data volume to a named one so it survives redeploys: replace `"./data:/data"` with `boop-data:/data` and add a top-level `volumes: { boop-data: {} }` (or set a persistent mount in Dokploy's **Mounts** tab pointing at `/data`).
+3. **Environment** tab: `BOOP_BASE_URL`, `BOOP_ADMIN_USER`, `BOOP_ADMIN_PASSWORD`, `APNS_TEAM_ID`, `APNS_KEY_ID`, `APNS_BUNDLE_ID`, `APNS_ENVIRONMENT`.
+4. The `.p8` key, either:
+ - `APNS_PRIVATE_KEY` = `base64 -i AuthKey_XXXXXX.p8 | tr -d '\n'` (one line, easiest), or
+ - Dokploy **Mounts → File mount**: paste the `.p8` contents, mount path `/run/secrets/apns.p8`, and set `APNS_PRIVATE_KEY_PATH=/run/secrets/apns.p8`.
+5. Add a domain with HTTPS in Dokploy pointing at port `8080`; deploy. Settings in the web UI should show **APNs · Configured**.
+
## Pairing
The web UI generates a one-time token (10 minutes, single use, revocable) and shows it as a QR code containing:
diff --git a/ios/Boop.xcodeproj/project.pbxproj b/ios/Boop.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..68051be
--- /dev/null
+++ b/ios/Boop.xcodeproj/project.pbxproj
@@ -0,0 +1,734 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 77;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 021583DF5827CD9A311ABA73 /* EventDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A125D20CA61763DBACF3EF2 /* EventDetailView.swift */; };
+ 03AA93539EA3755EBE4B333C /* QRScannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24071F31542EBB6E9AF56D3B /* QRScannerView.swift */; };
+ 05C3BF86490C9B9181AD8426 /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = E554071AD342FB99DF3BA5D0 /* Event.swift */; };
+ 07ED80B9C450CA9C9FC661A8 /* PushManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B66C8112F0031F188AD85583 /* PushManager.swift */; };
+ 0A08B271D7C101FEED6A3F9E /* Figtree-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 5A790977C54183FCA8A2CF4E /* Figtree-SemiBold.ttf */; };
+ 0A5E700A1862667E236E6005 /* APIClientTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5F4E385D82C57FCAE48CDDC /* APIClientTests.swift */; };
+ 0C58520673E80DA81F595DB1 /* ScreenshotUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78F17F7F004605058FFA2618 /* ScreenshotUITests.swift */; };
+ 0CE510E367D7351D023FB764 /* InboxView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8063BF0B2841D7A9E8DA3624 /* InboxView.swift */; };
+ 1454903D0DB084517DAA7359 /* FormattingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0129157CD73EBECB84F69C22 /* FormattingTests.swift */; };
+ 27522E38AFFAC900990BD52B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 75122E3FEFADBFE389DB9C21 /* Assets.xcassets */; };
+ 39CA13744418AB2612CFA8EF /* AppSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F353B682C78FF302FEAF522 /* AppSession.swift */; };
+ 3CCA87E797DC9852241C4D13 /* PairingFlowUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DECFDC77D38E3DB104B3B6E6 /* PairingFlowUITests.swift */; };
+ 40DAF9AD8EE9227AB85A4161 /* Device.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACD0500F93373A2432EC73D8 /* Device.swift */; };
+ 473ED299BCA5E62FB3BCC948 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E19A870C0CFD9BA00298449D /* SettingsView.swift */; };
+ 4B08B6BC0F6611CCFFFA507E /* NotificationTapUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 609791CD0E38060E89CCBFF6 /* NotificationTapUITests.swift */; };
+ 4B9FC07E7380A1D0D1780C87 /* Figtree-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = AC2789EE28600895E168A3DE /* Figtree-Bold.ttf */; };
+ 51C449052FF42A30B7B69DF2 /* DS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 642012CF305FC80DD79E1EE9 /* DS.swift */; };
+ 5B96FF0FC9128CBF085B34F3 /* Components.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58DD3023423348952188CABE /* Components.swift */; };
+ 5FE88931427EC015D8FB7FED /* PairingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABDD09C39E086828C3B7F7B8 /* PairingView.swift */; };
+ 60BB7FF986BB5AD43C26827F /* KeychainStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9D5F31603EA140B870E759A /* KeychainStore.swift */; };
+ 6BD0F44D0081D1C112A35286 /* Level.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DC224EA686BB5FE8B77B253 /* Level.swift */; };
+ 76ECCCF1BB162E57F2D9A9A4 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 762667ADB3E12735F13061EE /* RootView.swift */; };
+ 7D38875E1C25CF5F210CE31E /* JSONTreeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A6DFD4F3DE0BE4C3C517172 /* JSONTreeView.swift */; };
+ 8A478E244646BC70067B23D0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0727DAA2D68B5283AA8FF472 /* AppDelegate.swift */; };
+ A56E6785C64B08EDBD2EA85B /* Figtree-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CBFB36C2F43E768891C23AF6 /* Figtree-Regular.ttf */; };
+ B77F82FCC3B2DE3D93F03FC3 /* PairingPayload.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7CB15AD497B172787C42AAC /* PairingPayload.swift */; };
+ B9BD74FB187CA5C560B897A8 /* APIClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 117AE79DD532EB1BA1963F37 /* APIClient.swift */; };
+ C8EF442E2029DFA06AF9EACD /* EventTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB01E3425BF57186501B5B /* EventTests.swift */; };
+ CB5FE8B95AE1C857776CCAFF /* PairingPayloadTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C744AEF422D9779F59D6D9B /* PairingPayloadTests.swift */; };
+ CCB52AD25863617AEF10B183 /* BoopApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28C1391E032AE6F632E3CF80 /* BoopApp.swift */; };
+ D4A8AF3E6AEB42BEC66E3A4D /* JSONValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C780959D77481AA196BF961 /* JSONValue.swift */; };
+ DCEEBEADFA8C0BC736BFD319 /* Formatting.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88B0894F62AB1E64E25A027E /* Formatting.swift */; };
+ F6A184D98CA3DF0C48990DA0 /* ProjectIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = C17EDE92A930BB8F749FF023 /* ProjectIcon.swift */; };
+ FAB9084713A2A313274E6A65 /* Figtree-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 3186689D326577B56F291E27 /* Figtree-Medium.ttf */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ AA1C1E6C95462B31838C8FA7 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = D75B1A06897BCC5F7CE8A239 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = A8738A21A24E7E622C597C1C;
+ remoteInfo = Boop;
+ };
+ C993976AECBA5050EA6CD90A /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = D75B1A06897BCC5F7CE8A239 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = A8738A21A24E7E622C597C1C;
+ remoteInfo = Boop;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 0129157CD73EBECB84F69C22 /* FormattingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormattingTests.swift; sourceTree = "<group>"; };
+ 0727DAA2D68B5283AA8FF472 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
+ 0A125D20CA61763DBACF3EF2 /* EventDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventDetailView.swift; sourceTree = "<group>"; };
+ 0A743627697D04F4516567DD /* OFL.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = OFL.txt; sourceTree = "<group>"; };
+ 0DC224EA686BB5FE8B77B253 /* Level.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Level.swift; sourceTree = "<group>"; };
+ 117AE79DD532EB1BA1963F37 /* APIClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIClient.swift; sourceTree = "<group>"; };
+ 21A9F07E87F33B74A2C52C05 /* Boop.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = Boop.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 24071F31542EBB6E9AF56D3B /* QRScannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRScannerView.swift; sourceTree = "<group>"; };
+ 28C1391E032AE6F632E3CF80 /* BoopApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoopApp.swift; sourceTree = "<group>"; };
+ 3186689D326577B56F291E27 /* Figtree-Medium.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Figtree-Medium.ttf"; sourceTree = "<group>"; };
+ 58DD3023423348952188CABE /* Components.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Components.swift; sourceTree = "<group>"; };
+ 5A790977C54183FCA8A2CF4E /* Figtree-SemiBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Figtree-SemiBold.ttf"; sourceTree = "<group>"; };
+ 609791CD0E38060E89CCBFF6 /* NotificationTapUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationTapUITests.swift; sourceTree = "<group>"; };
+ 642012CF305FC80DD79E1EE9 /* DS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DS.swift; sourceTree = "<group>"; };
+ 75122E3FEFADBFE389DB9C21 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 762667ADB3E12735F13061EE /* RootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = "<group>"; };
+ 78F17F7F004605058FFA2618 /* ScreenshotUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenshotUITests.swift; sourceTree = "<group>"; };
+ 79BB01E3425BF57186501B5B /* EventTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventTests.swift; sourceTree = "<group>"; };
+ 7C744AEF422D9779F59D6D9B /* PairingPayloadTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PairingPayloadTests.swift; sourceTree = "<group>"; };
+ 8063BF0B2841D7A9E8DA3624 /* InboxView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InboxView.swift; sourceTree = "<group>"; };
+ 88B0894F62AB1E64E25A027E /* Formatting.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Formatting.swift; sourceTree = "<group>"; };
+ 8A6DFD4F3DE0BE4C3C517172 /* JSONTreeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONTreeView.swift; sourceTree = "<group>"; };
+ 8C780959D77481AA196BF961 /* JSONValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSONValue.swift; sourceTree = "<group>"; };
+ 8F353B682C78FF302FEAF522 /* AppSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppSession.swift; sourceTree = "<group>"; };
+ 9B907BE56D6580F0715211AA /* Boop.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Boop.entitlements; sourceTree = "<group>"; };
+ 9EF3C782D6E451C365D85AE5 /* BoopTests.xctest */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = BoopTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+ A7CB15AD497B172787C42AAC /* PairingPayload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PairingPayload.swift; sourceTree = "<group>"; };
+ ABDD09C39E086828C3B7F7B8 /* PairingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PairingView.swift; sourceTree = "<group>"; };
+ AC2789EE28600895E168A3DE /* Figtree-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Figtree-Bold.ttf"; sourceTree = "<group>"; };
+ ACD0500F93373A2432EC73D8 /* Device.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Device.swift; sourceTree = "<group>"; };
+ B66C8112F0031F188AD85583 /* PushManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushManager.swift; sourceTree = "<group>"; };
+ C17EDE92A930BB8F749FF023 /* ProjectIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectIcon.swift; sourceTree = "<group>"; };
+ C9D5F31603EA140B870E759A /* KeychainStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainStore.swift; sourceTree = "<group>"; };
+ CBFB36C2F43E768891C23AF6 /* Figtree-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Figtree-Regular.ttf"; sourceTree = "<group>"; };
+ DECFDC77D38E3DB104B3B6E6 /* PairingFlowUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PairingFlowUITests.swift; sourceTree = "<group>"; };
+ DF7CEEF38A16624007E14E93 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+ E19A870C0CFD9BA00298449D /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
+ E554071AD342FB99DF3BA5D0 /* Event.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Event.swift; sourceTree = "<group>"; };
+ F49CA3B7C9B215A290E252AF /* BoopUITests.xctest */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.cfbundle; path = BoopUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+ F5F4E385D82C57FCAE48CDDC /* APIClientTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIClientTests.swift; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXGroup section */
+ 0551420A5D35DF7B11C55E57 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ FB6A884FAD82A4DDB42ED005 /* Fonts */,
+ );
+ path = Resources;
+ sourceTree = "<group>";
+ };
+ 1176C791D5E10B4FEE7029DD /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 21A9F07E87F33B74A2C52C05 /* Boop.app */,
+ 9EF3C782D6E451C365D85AE5 /* BoopTests.xctest */,
+ F49CA3B7C9B215A290E252AF /* BoopUITests.xctest */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 2EBC1B59859E4A07AF4B257A /* Boop */ = {
+ isa = PBXGroup;
+ children = (
+ 75122E3FEFADBFE389DB9C21 /* Assets.xcassets */,
+ 9B907BE56D6580F0715211AA /* Boop.entitlements */,
+ DF7CEEF38A16624007E14E93 /* Info.plist */,
+ 4F6FF633EEBCA2A7B163D4AE /* App */,
+ 534B0D3B3AB33A19B86E1662 /* Components */,
+ 402DCB68CBCCB9A3564752C4 /* Design */,
+ F283455900375541F10F24AE /* Models */,
+ B1A3B1EAC582757D46F99295 /* Networking */,
+ 370EF1C7641E9E8489B97A6C /* Notifications */,
+ DE828B9FA2C25C3546F4110E /* Pairing */,
+ 0551420A5D35DF7B11C55E57 /* Resources */,
+ 74E4E98A6851A9DD3ED61286 /* Screens */,
+ );
+ path = Boop;
+ sourceTree = "<group>";
+ };
+ 3069089B1315C8F05F333E33 /* BoopTests */ = {
+ isa = PBXGroup;
+ children = (
+ F5F4E385D82C57FCAE48CDDC /* APIClientTests.swift */,
+ 79BB01E3425BF57186501B5B /* EventTests.swift */,
+ 0129157CD73EBECB84F69C22 /* FormattingTests.swift */,
+ 7C744AEF422D9779F59D6D9B /* PairingPayloadTests.swift */,
+ );
+ path = BoopTests;
+ sourceTree = "<group>";
+ };
+ 370EF1C7641E9E8489B97A6C /* Notifications */ = {
+ isa = PBXGroup;
+ children = (
+ B66C8112F0031F188AD85583 /* PushManager.swift */,
+ );
+ path = Notifications;
+ sourceTree = "<group>";
+ };
+ 402DCB68CBCCB9A3564752C4 /* Design */ = {
+ isa = PBXGroup;
+ children = (
+ 642012CF305FC80DD79E1EE9 /* DS.swift */,
+ );
+ path = Design;
+ sourceTree = "<group>";
+ };
+ 4F6FF633EEBCA2A7B163D4AE /* App */ = {
+ isa = PBXGroup;
+ children = (
+ 0727DAA2D68B5283AA8FF472 /* AppDelegate.swift */,
+ 28C1391E032AE6F632E3CF80 /* BoopApp.swift */,
+ );
+ path = App;
+ sourceTree = "<group>";
+ };
+ 534B0D3B3AB33A19B86E1662 /* Components */ = {
+ isa = PBXGroup;
+ children = (
+ 58DD3023423348952188CABE /* Components.swift */,
+ 88B0894F62AB1E64E25A027E /* Formatting.swift */,
+ 8A6DFD4F3DE0BE4C3C517172 /* JSONTreeView.swift */,
+ C17EDE92A930BB8F749FF023 /* ProjectIcon.swift */,
+ );
+ path = Components;
+ sourceTree = "<group>";
+ };
+ 74E4E98A6851A9DD3ED61286 /* Screens */ = {
+ isa = PBXGroup;
+ children = (
+ 0A125D20CA61763DBACF3EF2 /* EventDetailView.swift */,
+ 8063BF0B2841D7A9E8DA3624 /* InboxView.swift */,
+ ABDD09C39E086828C3B7F7B8 /* PairingView.swift */,
+ 762667ADB3E12735F13061EE /* RootView.swift */,
+ E19A870C0CFD9BA00298449D /* SettingsView.swift */,
+ );
+ path = Screens;
+ sourceTree = "<group>";
+ };
+ 7B111A58B4BDEE568FE8CC87 = {
+ isa = PBXGroup;
+ children = (
+ 2EBC1B59859E4A07AF4B257A /* Boop */,
+ 3069089B1315C8F05F333E33 /* BoopTests */,
+ D910B7B1AE503AB1CA23FB95 /* BoopUITests */,
+ 1176C791D5E10B4FEE7029DD /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ B1A3B1EAC582757D46F99295 /* Networking */ = {
+ isa = PBXGroup;
+ children = (
+ 117AE79DD532EB1BA1963F37 /* APIClient.swift */,
+ 8F353B682C78FF302FEAF522 /* AppSession.swift */,
+ );
+ path = Networking;
+ sourceTree = "<group>";
+ };
+ D910B7B1AE503AB1CA23FB95 /* BoopUITests */ = {
+ isa = PBXGroup;
+ children = (
+ 609791CD0E38060E89CCBFF6 /* NotificationTapUITests.swift */,
+ DECFDC77D38E3DB104B3B6E6 /* PairingFlowUITests.swift */,
+ 78F17F7F004605058FFA2618 /* ScreenshotUITests.swift */,
+ );
+ path = BoopUITests;
+ sourceTree = "<group>";
+ };
+ DE828B9FA2C25C3546F4110E /* Pairing */ = {
+ isa = PBXGroup;
+ children = (
+ C9D5F31603EA140B870E759A /* KeychainStore.swift */,
+ A7CB15AD497B172787C42AAC /* PairingPayload.swift */,
+ 24071F31542EBB6E9AF56D3B /* QRScannerView.swift */,
+ );
+ path = Pairing;
+ sourceTree = "<group>";
+ };
+ F283455900375541F10F24AE /* Models */ = {
+ isa = PBXGroup;
+ children = (
+ ACD0500F93373A2432EC73D8 /* Device.swift */,
+ E554071AD342FB99DF3BA5D0 /* Event.swift */,
+ 8C780959D77481AA196BF961 /* JSONValue.swift */,
+ 0DC224EA686BB5FE8B77B253 /* Level.swift */,
+ );
+ path = Models;
+ sourceTree = "<group>";
+ };
+ FB6A884FAD82A4DDB42ED005 /* Fonts */ = {
+ isa = PBXGroup;
+ children = (
+ AC2789EE28600895E168A3DE /* Figtree-Bold.ttf */,
+ 3186689D326577B56F291E27 /* Figtree-Medium.ttf */,
+ CBFB36C2F43E768891C23AF6 /* Figtree-Regular.ttf */,
+ 5A790977C54183FCA8A2CF4E /* Figtree-SemiBold.ttf */,
+ 0A743627697D04F4516567DD /* OFL.txt */,
+ );
+ path = Fonts;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 0F7CC37BAA4A164C74F66E10 /* BoopUITests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 65E6615BBFC8E407FFC9B9B7 /* Build configuration list for PBXNativeTarget "BoopUITests" */;
+ buildPhases = (
+ 79A1CB032A5A8142B061F121 /* Sources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 53DC373C2B292831FF5347CF /* PBXTargetDependency */,
+ );
+ name = BoopUITests;
+ packageProductDependencies = (
+ );
+ productName = BoopUITests;
+ productReference = F49CA3B7C9B215A290E252AF /* BoopUITests.xctest */;
+ productType = "com.apple.product-type.bundle.ui-testing";
+ };
+ 133AB7E3837B87BD56434B0E /* BoopTests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 82E5B0C74B662C24B841EE24 /* Build configuration list for PBXNativeTarget "BoopTests" */;
+ buildPhases = (
+ B887BD6FF663FBEBFAA02A9C /* Sources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 5C31BD053F9EE82D089AC429 /* PBXTargetDependency */,
+ );
+ name = BoopTests;
+ packageProductDependencies = (
+ );
+ productName = BoopTests;
+ productReference = 9EF3C782D6E451C365D85AE5 /* BoopTests.xctest */;
+ productType = "com.apple.product-type.bundle.unit-test";
+ };
+ A8738A21A24E7E622C597C1C /* Boop */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 4A456A2E67211555BB9D708B /* Build configuration list for PBXNativeTarget "Boop" */;
+ buildPhases = (
+ CA78EF33ADFE16A279159C50 /* Sources */,
+ 70545B44BD6C495CCF4CE230 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Boop;
+ packageProductDependencies = (
+ );
+ productName = Boop;
+ productReference = 21A9F07E87F33B74A2C52C05 /* Boop.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ D75B1A06897BCC5F7CE8A239 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ BuildIndependentTargetsInParallel = YES;
+ LastUpgradeCheck = 2600;
+ TargetAttributes = {
+ 0F7CC37BAA4A164C74F66E10 = {
+ DevelopmentTeam = "";
+ ProvisioningStyle = Automatic;
+ TestTargetID = A8738A21A24E7E622C597C1C;
+ };
+ 133AB7E3837B87BD56434B0E = {
+ DevelopmentTeam = "";
+ ProvisioningStyle = Automatic;
+ };
+ A8738A21A24E7E622C597C1C = {
+ DevelopmentTeam = "";
+ ProvisioningStyle = Automatic;
+ };
+ };
+ };
+ buildConfigurationList = D2C7A418F16CBD03DB918192 /* Build configuration list for PBXProject "Boop" */;
+ developmentRegion = en;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ Base,
+ en,
+ );
+ mainGroup = 7B111A58B4BDEE568FE8CC87;
+ minimizedProjectReferenceProxies = 1;
+ preferredProjectObjectVersion = 77;
+ productRefGroup = 1176C791D5E10B4FEE7029DD /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ A8738A21A24E7E622C597C1C /* Boop */,
+ 133AB7E3837B87BD56434B0E /* BoopTests */,
+ 0F7CC37BAA4A164C74F66E10 /* BoopUITests */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 70545B44BD6C495CCF4CE230 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 27522E38AFFAC900990BD52B /* Assets.xcassets in Resources */,
+ 4B9FC07E7380A1D0D1780C87 /* Figtree-Bold.ttf in Resources */,
+ FAB9084713A2A313274E6A65 /* Figtree-Medium.ttf in Resources */,
+ A56E6785C64B08EDBD2EA85B /* Figtree-Regular.ttf in Resources */,
+ 0A08B271D7C101FEED6A3F9E /* Figtree-SemiBold.ttf in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 79A1CB032A5A8142B061F121 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 4B08B6BC0F6611CCFFFA507E /* NotificationTapUITests.swift in Sources */,
+ 3CCA87E797DC9852241C4D13 /* PairingFlowUITests.swift in Sources */,
+ 0C58520673E80DA81F595DB1 /* ScreenshotUITests.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ B887BD6FF663FBEBFAA02A9C /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 0A5E700A1862667E236E6005 /* APIClientTests.swift in Sources */,
+ C8EF442E2029DFA06AF9EACD /* EventTests.swift in Sources */,
+ 1454903D0DB084517DAA7359 /* FormattingTests.swift in Sources */,
+ CB5FE8B95AE1C857776CCAFF /* PairingPayloadTests.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ CA78EF33ADFE16A279159C50 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ B9BD74FB187CA5C560B897A8 /* APIClient.swift in Sources */,
+ 8A478E244646BC70067B23D0 /* AppDelegate.swift in Sources */,
+ 39CA13744418AB2612CFA8EF /* AppSession.swift in Sources */,
+ CCB52AD25863617AEF10B183 /* BoopApp.swift in Sources */,
+ 5B96FF0FC9128CBF085B34F3 /* Components.swift in Sources */,
+ 51C449052FF42A30B7B69DF2 /* DS.swift in Sources */,
+ 40DAF9AD8EE9227AB85A4161 /* Device.swift in Sources */,
+ 05C3BF86490C9B9181AD8426 /* Event.swift in Sources */,
+ 021583DF5827CD9A311ABA73 /* EventDetailView.swift in Sources */,
+ DCEEBEADFA8C0BC736BFD319 /* Formatting.swift in Sources */,
+ 0CE510E367D7351D023FB764 /* InboxView.swift in Sources */,
+ 7D38875E1C25CF5F210CE31E /* JSONTreeView.swift in Sources */,
+ D4A8AF3E6AEB42BEC66E3A4D /* JSONValue.swift in Sources */,
+ 60BB7FF986BB5AD43C26827F /* KeychainStore.swift in Sources */,
+ 6BD0F44D0081D1C112A35286 /* Level.swift in Sources */,
+ B77F82FCC3B2DE3D93F03FC3 /* PairingPayload.swift in Sources */,
+ 5FE88931427EC015D8FB7FED /* PairingView.swift in Sources */,
+ F6A184D98CA3DF0C48990DA0 /* ProjectIcon.swift in Sources */,
+ 07ED80B9C450CA9C9FC661A8 /* PushManager.swift in Sources */,
+ 03AA93539EA3755EBE4B333C /* QRScannerView.swift in Sources */,
+ 76ECCCF1BB162E57F2D9A9A4 /* RootView.swift in Sources */,
+ 473ED299BCA5E62FB3BCC948 /* SettingsView.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 53DC373C2B292831FF5347CF /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = A8738A21A24E7E622C597C1C /* Boop */;
+ targetProxy = C993976AECBA5050EA6CD90A /* PBXContainerItemProxy */;
+ };
+ 5C31BD053F9EE82D089AC429 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = A8738A21A24E7E622C597C1C /* Boop */;
+ targetProxy = AA1C1E6C95462B31838C8FA7 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+ 1F7AB9551BC1D788ACF480CA /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ GENERATE_INFOPLIST_FILE = YES;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@loader_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.BoopUITests;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ TEST_TARGET_NAME = Boop;
+ };
+ name = Release;
+ };
+ 7B6690717F33B49F38AF7DA4 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_STYLE = Automatic;
+ COPY_PHASE_STRIP = NO;
+ CURRENT_PROJECT_VERSION = 1;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ DEVELOPMENT_TEAM = "";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_USER_SCRIPT_SANDBOXING = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu11;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 26.0;
+ MARKETING_VERSION = 0.1.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ MTL_FAST_MATH = YES;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = iphoneos;
+ SWIFT_COMPILATION_MODE = wholemodule;
+ SWIFT_OPTIMIZATION_LEVEL = "-O";
+ SWIFT_STRICT_CONCURRENCY = complete;
+ SWIFT_UPCOMING_FEATURE_EXISTENTIAL_ANY = YES;
+ SWIFT_VERSION = 6.0;
+ };
+ name = Release;
+ };
+ C98988CA0E29F9720A1773B1 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+ CODE_SIGN_ENTITLEMENTS = Boop/Boop.entitlements;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ INFOPLIST_FILE = Boop/Info.plist;
+ INFOPLIST_KEY_UILaunchScreen_Generation = YES;
+ INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.Boop;
+ SDKROOT = iphoneos;
+ SUPPORTS_MACCATALYST = NO;
+ TARGETED_DEVICE_FAMILY = 1;
+ };
+ name = Release;
+ };
+ E3089B4C65DB3BDA5378F35E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_STYLE = Automatic;
+ COPY_PHASE_STRIP = NO;
+ CURRENT_PROJECT_VERSION = 1;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ DEVELOPMENT_TEAM = "";
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ ENABLE_USER_SCRIPT_SANDBOXING = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu11;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "$(inherited)",
+ "DEBUG=1",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 26.0;
+ MARKETING_VERSION = 0.1.0;
+ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
+ MTL_FAST_MATH = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = iphoneos;
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_STRICT_CONCURRENCY = complete;
+ SWIFT_UPCOMING_FEATURE_EXISTENTIAL_ANY = YES;
+ SWIFT_VERSION = 6.0;
+ };
+ name = Debug;
+ };
+ E94022645CECA0946A55E9E6 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+ CODE_SIGN_ENTITLEMENTS = Boop/Boop.entitlements;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ INFOPLIST_FILE = Boop/Info.plist;
+ INFOPLIST_KEY_UILaunchScreen_Generation = YES;
+ INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.Boop;
+ SDKROOT = iphoneos;
+ SUPPORTS_MACCATALYST = NO;
+ TARGETED_DEVICE_FAMILY = 1;
+ };
+ name = Debug;
+ };
+ EEEE7BE6B266951587A5D39B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ GENERATE_INFOPLIST_FILE = YES;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@loader_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.BoopUITests;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ TEST_TARGET_NAME = Boop;
+ };
+ name = Debug;
+ };
+ F962742091DB3BF81DB28F6F /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ GENERATE_INFOPLIST_FILE = YES;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@loader_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.BoopTests;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Boop.app/Boop";
+ };
+ name = Debug;
+ };
+ FBD65E20113836143A07FC69 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ GENERATE_INFOPLIST_FILE = YES;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@loader_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.BoopTests;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Boop.app/Boop";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 4A456A2E67211555BB9D708B /* Build configuration list for PBXNativeTarget "Boop" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ E94022645CECA0946A55E9E6 /* Debug */,
+ C98988CA0E29F9720A1773B1 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
+ 65E6615BBFC8E407FFC9B9B7 /* Build configuration list for PBXNativeTarget "BoopUITests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ EEEE7BE6B266951587A5D39B /* Debug */,
+ 1F7AB9551BC1D788ACF480CA /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
+ 82E5B0C74B662C24B841EE24 /* Build configuration list for PBXNativeTarget "BoopTests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ F962742091DB3BF81DB28F6F /* Debug */,
+ FBD65E20113836143A07FC69 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
+ D2C7A418F16CBD03DB918192 /* Build configuration list for PBXProject "Boop" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ E3089B4C65DB3BDA5378F35E /* Debug */,
+ 7B6690717F33B49F38AF7DA4 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Debug;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = D75B1A06897BCC5F7CE8A239 /* Project object */;
+}
diff --git a/ios/Boop.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Boop.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..919434a
--- /dev/null
+++ b/ios/Boop.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:">
+ </FileRef>
+</Workspace>
diff --git a/ios/Boop.xcodeproj/xcshareddata/xcschemes/Boop.xcscheme b/ios/Boop.xcodeproj/xcshareddata/xcschemes/Boop.xcscheme
new file mode 100644
index 0000000..a83df47
--- /dev/null
+++ b/ios/Boop.xcodeproj/xcshareddata/xcschemes/Boop.xcscheme
@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "2600"
+ version = "1.7">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES"
+ runPostActionsOnFailure = "NO">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "A8738A21A24E7E622C597C1C"
+ BuildableName = "Boop.app"
+ BlueprintName = "Boop"
+ ReferencedContainer = "container:Boop.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "NO"
+ buildForProfiling = "NO"
+ buildForArchiving = "NO"
+ buildForAnalyzing = "NO">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "133AB7E3837B87BD56434B0E"
+ BuildableName = "BoopTests.xctest"
+ BlueprintName = "BoopTests"
+ ReferencedContainer = "container:Boop.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "NO"
+ buildForProfiling = "NO"
+ buildForArchiving = "NO"
+ buildForAnalyzing = "NO">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "0F7CC37BAA4A164C74F66E10"
+ BuildableName = "BoopUITests.xctest"
+ BlueprintName = "BoopUITests"
+ ReferencedContainer = "container:Boop.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ onlyGenerateCoverageForSpecifiedTargets = "NO">
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "A8738A21A24E7E622C597C1C"
+ BuildableName = "Boop.app"
+ BlueprintName = "Boop"
+ ReferencedContainer = "container:Boop.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ <Testables>
+ <TestableReference
+ skipped = "NO"
+ parallelizable = "NO">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "133AB7E3837B87BD56434B0E"
+ BuildableName = "BoopTests.xctest"
+ BlueprintName = "BoopTests"
+ ReferencedContainer = "container:Boop.xcodeproj">
+ </BuildableReference>
+ </TestableReference>
+ <TestableReference
+ skipped = "NO"
+ parallelizable = "NO">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "0F7CC37BAA4A164C74F66E10"
+ BuildableName = "BoopUITests.xctest"
+ BlueprintName = "BoopUITests"
+ ReferencedContainer = "container:Boop.xcodeproj">
+ </BuildableReference>
+ </TestableReference>
+ </Testables>
+ <CommandLineArguments>
+ </CommandLineArguments>
+ </TestAction>
+ <LaunchAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ debugServiceExtension = "internal"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "A8738A21A24E7E622C597C1C"
+ BuildableName = "Boop.app"
+ BlueprintName = "Boop"
+ ReferencedContainer = "container:Boop.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <CommandLineArguments>
+ </CommandLineArguments>
+ </LaunchAction>
+ <ProfileAction
+ buildConfiguration = "Release"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "A8738A21A24E7E622C597C1C"
+ BuildableName = "Boop.app"
+ BlueprintName = "Boop"
+ ReferencedContainer = "container:Boop.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
diff --git a/ios/Boop/App/AppDelegate.swift b/ios/Boop/App/AppDelegate.swift
new file mode 100644
index 0000000..b6dd532
--- /dev/null
+++ b/ios/Boop/App/AppDelegate.swift
@@ -0,0 +1,13 @@
+import UIKit
+
+final class AppDelegate: NSObject, UIApplicationDelegate {
+ static var push: PushManager?
+
+ func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
+ Self.push?.didRegister(deviceToken: deviceToken)
+ }
+
+ func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: any Error) {
+ Self.push?.didFailToRegister(error)
+ }
+}
diff --git a/ios/Boop/App/BoopApp.swift b/ios/Boop/App/BoopApp.swift
new file mode 100644
index 0000000..c5e00fc
--- /dev/null
+++ b/ios/Boop/App/BoopApp.swift
@@ -0,0 +1,29 @@
+import SwiftUI
+
+@main
+struct BoopApp: App {
+ @UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
+ @State private var session = AppSession()
+ @State private var push = PushManager()
+
+ init() {}
+
+ var body: some Scene {
+ WindowGroup {
+ RootView()
+ .environment(session)
+ .environment(push)
+ .tint(DS.Colors.accent)
+ .preferredColorScheme(.light)
+ .task {
+ push.attach(session: session)
+ AppDelegate.push = push
+ await push.refreshAuthorization()
+ if session.isPaired {
+ await push.requestAndRegister()
+ await session.checkConnection()
+ }
+ }
+ }
+ }
+}
diff --git a/ios/Boop/Assets.xcassets/AccentColor.colorset/Contents.json b/ios/Boop/Assets.xcassets/AccentColor.colorset/Contents.json
new file mode 100644
index 0000000..148addb
--- /dev/null
+++ b/ios/Boop/Assets.xcassets/AccentColor.colorset/Contents.json
@@ -0,0 +1,4 @@
+{
+ "colors" : [ { "color" : { "color-space" : "srgb", "components" : { "alpha" : "1.000", "blue" : "0.910", "green" : "0.514", "red" : "0.486" } }, "idiom" : "universal" } ],
+ "info" : { "author" : "xcode", "version" : 1 }
+}
diff --git a/ios/Boop/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Boop/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..fbd501a
--- /dev/null
+++ b/ios/Boop/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,4 @@
+{
+ "images" : [ { "filename" : "icon.png", "idiom" : "universal", "platform" : "ios", "size" : "1024x1024" } ],
+ "info" : { "author" : "xcode", "version" : 1 }
+}
diff --git a/ios/Boop/Assets.xcassets/AppIcon.appiconset/icon.png b/ios/Boop/Assets.xcassets/AppIcon.appiconset/icon.png
new file mode 100644
index 0000000..a5e5023
Binary files /dev/null and b/ios/Boop/Assets.xcassets/AppIcon.appiconset/icon.png differ
diff --git a/ios/Boop/Assets.xcassets/Contents.json b/ios/Boop/Assets.xcassets/Contents.json
new file mode 100644
index 0000000..46cba7d
--- /dev/null
+++ b/ios/Boop/Assets.xcassets/Contents.json
@@ -0,0 +1 @@
+{ "info" : { "author" : "xcode", "version" : 1 } }
diff --git a/ios/Boop/Assets.xcassets/Paper.colorset/Contents.json b/ios/Boop/Assets.xcassets/Paper.colorset/Contents.json
new file mode 100644
index 0000000..9164f0d
--- /dev/null
+++ b/ios/Boop/Assets.xcassets/Paper.colorset/Contents.json
@@ -0,0 +1,4 @@
+{
+ "colors" : [ { "color" : { "color-space" : "srgb", "components" : { "alpha" : "1.000", "blue" : "0.996", "green" : "0.992", "red" : "0.992" } }, "idiom" : "universal" } ],
+ "info" : { "author" : "xcode", "version" : 1 }
+}
diff --git a/ios/Boop/Boop.entitlements b/ios/Boop/Boop.entitlements
new file mode 100644
index 0000000..903def2
--- /dev/null
+++ b/ios/Boop/Boop.entitlements
@@ -0,0 +1,8 @@
+<?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>aps-environment</key>
+ <string>development</string>
+</dict>
+</plist>
diff --git a/ios/Boop/Components/Components.swift b/ios/Boop/Components/Components.swift
new file mode 100644
index 0000000..5dbf4ff
--- /dev/null
+++ b/ios/Boop/Components/Components.swift
@@ -0,0 +1,276 @@
+import SwiftUI
+
+/// Outlined card: hairline border, 14pt radius, paper fill, no shadow.
+struct Card<Content: View>: View {
+ var title: String?
+ var padding: CGFloat = DS.Space.s4
+ @ViewBuilder var content: Content
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: DS.Space.s3) {
+ if let title {
+ Text(title).font(DS.Text.setting).foregroundStyle(DS.Colors.ink)
+ }
+ content
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(padding)
+ .background(DS.Colors.bg, in: RoundedRectangle(cornerRadius: DS.Radius.card, style: .continuous))
+ .overlay(RoundedRectangle(cornerRadius: DS.Radius.card, style: .continuous).stroke(DS.Colors.borderHairline, lineWidth: 1))
+ }
+}
+
+/// 8pt dot + label, coloured by level.
+struct LevelBadge: View {
+ let level: Level
+ var showLabel = true
+
+ var body: some View {
+ HStack(spacing: 6) {
+ Circle()
+ .fill(level.strong)
+ .frame(width: 8, height: 8)
+ .modifier(CriticalPulse(active: level == .critical))
+ if showLabel {
+ Text(level.label).font(DS.Text.small).foregroundStyle(level.strong)
+ }
+ }
+ }
+}
+
+/// A slow, subtle pulse on critical dots only.
+private struct CriticalPulse: ViewModifier {
+ let active: Bool
+ @State private var on = false
+
+ func body(content: Content) -> some View {
+ content
+ .overlay {
+ if active {
+ Circle()
+ .stroke(DS.Colors.levelCriticalStrong.opacity(on ? 0 : 0.6), lineWidth: 2)
+ .scaleEffect(on ? 2.4 : 1)
+ .animation(.easeOut(duration: 1.4).repeatForever(autoreverses: false), value: on)
+ .onAppear { on = true }
+ }
+ }
+ }
+}
+
+/// Generic status line for settings.
+struct StatusDot: View {
+ enum Tone { case ok, warn, bad, muted }
+ let tone: Tone
+ let text: String
+
+ var color: Color {
+ switch tone {
+ case .ok: DS.Colors.ok
+ case .warn: DS.Colors.degradedStrong
+ case .bad: DS.Colors.outageStrong
+ case .muted: DS.Colors.textInactive
+ }
+ }
+
+ var body: some View {
+ HStack(spacing: 7) {
+ Circle().fill(color).frame(width: 8, height: 8)
+ Text(text).font(DS.Text.small).foregroundStyle(color)
+ }
+ }
+}
+
+/// Primary / secondary / ghost buttons on the 8pt control radius.
+struct BoopButtonStyle: ButtonStyle {
+ enum Variant { case primary, secondary, ghost, danger }
+ var variant: Variant = .primary
+ var expand = false
+
+ func makeBody(configuration: Configuration) -> some View {
+ configuration.label
+ .font(DS.Text.ui)
+ .foregroundStyle(foreground(pressed: configuration.isPressed))
+ .padding(.horizontal, 16)
+ .frame(maxWidth: expand ? .infinity : nil)
+ .frame(height: 40)
+ .background(background(pressed: configuration.isPressed), in: RoundedRectangle(cornerRadius: DS.Radius.control, style: .continuous))
+ .overlay {
+ if variant == .secondary || variant == .danger {
+ RoundedRectangle(cornerRadius: DS.Radius.control, style: .continuous).stroke(DS.Colors.borderControl, lineWidth: 1)
+ }
+ }
+ .animation(DS.Motion.gentle, value: configuration.isPressed)
+ }
+
+ private func foreground(pressed: Bool) -> Color {
+ switch variant {
+ case .primary: DS.Colors.textOnDark
+ case .secondary: DS.Colors.ink
+ case .ghost: pressed ? DS.Colors.accentHover : DS.Colors.accent
+ case .danger: pressed ? DS.Colors.outageStrong : DS.Colors.textSecondary
+ }
+ }
+
+ private func background(pressed: Bool) -> Color {
+ switch variant {
+ case .primary: pressed ? DS.Colors.accentHover : DS.Colors.accent
+ case .secondary, .danger: pressed ? DS.Colors.bgHover : DS.Colors.bg
+ case .ghost: pressed ? DS.Colors.accentTint : .clear
+ }
+ }
+}
+
+extension ButtonStyle where Self == BoopButtonStyle {
+ static var boopPrimary: BoopButtonStyle { BoopButtonStyle(variant: .primary, expand: true) }
+ static var boopSecondary: BoopButtonStyle { BoopButtonStyle(variant: .secondary, expand: true) }
+ static var boopGhost: BoopButtonStyle { BoopButtonStyle(variant: .ghost) }
+ static var boopDanger: BoopButtonStyle { BoopButtonStyle(variant: .danger, expand: true) }
+}
+
+/// Dark code surface, radius 10.
+struct CodeBlock: View {
+ let text: String
+
+ var body: some View {
+ ScrollView(.horizontal, showsIndicators: false) {
+ Text(text)
+ .font(DS.Text.code)
+ .foregroundStyle(DS.Colors.textOnDark)
+ .textSelection(.enabled)
+ .padding(14)
+ }
+ .background(DS.Colors.surfaceDark, in: RoundedRectangle(cornerRadius: DS.Radius.tooltip, style: .continuous))
+ }
+}
+
+struct EmptyState: View {
+ let title: String
+ var message: String?
+ var systemImage: String = "tray"
+
+ var body: some View {
+ VStack(spacing: 8) {
+ Image(systemName: systemImage)
+ .font(.system(size: 26, weight: .medium))
+ .foregroundStyle(DS.Colors.textInactive)
+ .padding(.bottom, 4)
+ Text(title).font(DS.Text.setting).foregroundStyle(DS.Colors.textSecondary)
+ if let message {
+ Text(message).font(DS.Text.meta).foregroundStyle(DS.Colors.textMuted).multilineTextAlignment(.center)
+ }
+ }
+ .frame(maxWidth: .infinity)
+ .padding(.vertical, DS.Space.s6)
+ .padding(.horizontal, DS.Space.s4)
+ }
+}
+
+/// Inline notice using the pastel + strong pair.
+struct Notice: View {
+ enum Tone { case info, warn, bad, good }
+ let tone: Tone
+ let text: String
+
+ var body: some View {
+ Text(text)
+ .font(DS.Text.meta)
+ .foregroundStyle(fg)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(12)
+ .background(bg, in: RoundedRectangle(cornerRadius: DS.Radius.tooltip, style: .continuous))
+ }
+
+ private var fg: Color {
+ switch tone {
+ case .info: DS.Colors.accentHover
+ case .warn: DS.Colors.degradedStrong
+ case .bad: DS.Colors.outageStrong
+ case .good: Color(hex: 0x2F8F6E)
+ }
+ }
+
+ private var bg: Color {
+ switch tone {
+ case .info: DS.Colors.accentTint
+ case .warn: DS.Colors.levelWarning
+ case .bad: DS.Colors.levelError
+ case .good: DS.Colors.levelSuccess
+ }
+ }
+}
+
+/// Key above value, used in fact grids.
+struct Fact: View {
+ let label: String
+ let value: String
+ var mono = false
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 2) {
+ Text(label).font(DS.Text.caption).foregroundStyle(DS.Colors.textMuted)
+ Text(value)
+ .font(mono ? DS.Text.code : DS.Text.meta)
+ .foregroundStyle(DS.Colors.ink)
+ .textSelection(.enabled)
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+}
+
+/// Settings row: label + hint on the left, control on the right, hairline on top.
+struct SettingRow<Control: View>: View {
+ let label: String
+ var hint: String?
+ @ViewBuilder var control: Control
+
+ var body: some View {
+ HStack(alignment: .center, spacing: DS.Space.s4) {
+ VStack(alignment: .leading, spacing: 3) {
+ Text(label).font(DS.Text.setting).foregroundStyle(DS.Colors.ink)
+ if let hint {
+ Text(hint).font(DS.Text.caption).foregroundStyle(DS.Colors.textMuted)
+ }
+ }
+ Spacer(minLength: 0)
+ control
+ }
+ .padding(.vertical, 12)
+ .overlay(alignment: .top) { Rectangle().fill(DS.Colors.borderHairline).frame(height: 1) }
+ }
+}
+
+/// Text field on the control radius with the accent focus ring.
+struct BoopTextField: View {
+ let placeholder: String
+ @Binding var text: String
+ var mono = false
+ @FocusState private var focused: Bool
+
+ var body: some View {
+ TextField(placeholder, text: $text)
+ .font(mono ? DS.Text.code : DS.Text.meta)
+ .foregroundStyle(DS.Colors.ink)
+ .textInputAutocapitalization(.never)
+ .autocorrectionDisabled()
+ .focused($focused)
+ .padding(.horizontal, 12)
+ .frame(height: 40)
+ .background(DS.Colors.bg, in: RoundedRectangle(cornerRadius: DS.Radius.control, style: .continuous))
+ .overlay(RoundedRectangle(cornerRadius: DS.Radius.control, style: .continuous).stroke(focused ? DS.Colors.accentLine : DS.Colors.borderControl, lineWidth: 1))
+ .animation(DS.Motion.gentle, value: focused)
+ }
+}
+
+/// Small wordmark lockup: periwinkle mark + "Boop".
+struct Wordmark: View {
+ var body: some View {
+ HStack(spacing: 8) {
+ ZStack {
+ Circle().fill(DS.Colors.accent)
+ Circle().fill(DS.Colors.bg).frame(width: 8, height: 8)
+ }
+ .frame(width: 20, height: 20)
+ Text("Boop").font(DS.Text.wordmark).tracking(0.4).foregroundStyle(DS.Colors.ink)
+ }
+ }
+}
diff --git a/ios/Boop/Components/Formatting.swift b/ios/Boop/Components/Formatting.swift
new file mode 100644
index 0000000..eedac5f
--- /dev/null
+++ b/ios/Boop/Components/Formatting.swift
@@ -0,0 +1,34 @@
+import Foundation
+
+enum Formatting {
+ /// "just now", "2m", "3h", "2d", or "Aug 12" — terse, abbreviated.
+ static func relative(_ date: Date, now: Date = .now) -> String {
+ let sec = now.timeIntervalSince(date)
+ if sec < 45 { return "now" }
+ let min = Int((sec / 60).rounded())
+ if min < 60 { return "\(min)m" }
+ let hr = Int((Double(min) / 60).rounded())
+ if hr < 24 { return "\(hr)h" }
+ let day = Int((Double(hr) / 24).rounded())
+ if day < 7 { return "\(day)d" }
+ return shortDate(date)
+ }
+
+ static func shortDate(_ date: Date) -> String {
+ date.formatted(.dateTime.month(.abbreviated).day())
+ }
+
+ /// "Wed, Aug 12 · 14:51:44"
+ static func full(_ date: Date) -> String {
+ let d = date.formatted(.dateTime.weekday(.abbreviated).month(.abbreviated).day())
+ let t = date.formatted(.dateTime.hour(.twoDigits(amPM: .omitted)).minute(.twoDigits).second(.twoDigits))
+ return "\(d) · \(t)"
+ }
+
+ /// "Today", "Yesterday", or a short date.
+ static func dayGroup(_ date: Date, now: Date = .now, calendar: Calendar = .current) -> String {
+ if calendar.isDate(date, inSameDayAs: now) { return "Today" }
+ if let y = calendar.date(byAdding: .day, value: -1, to: now), calendar.isDate(date, inSameDayAs: y) { return "Yesterday" }
+ return date.formatted(.dateTime.weekday(.abbreviated).month(.abbreviated).day())
+ }
+}
diff --git a/ios/Boop/Components/JSONTreeView.swift b/ios/Boop/Components/JSONTreeView.swift
new file mode 100644
index 0000000..0d1723a
--- /dev/null
+++ b/ios/Boop/Components/JSONTreeView.swift
@@ -0,0 +1,86 @@
+import SwiftUI
+
+/// Expandable JSON viewer for unrecognised event data.
+struct JSONTreeView: View {
+ let name: String?
+ let value: JSONValue
+ var depth = 0
+ @State private var expanded: Bool
+
+ init(name: String? = nil, value: JSONValue, depth: Int = 0, expanded: Bool? = nil) {
+ self.name = name
+ self.value = value
+ self.depth = depth
+ _expanded = State(initialValue: expanded ?? (depth < 1))
+ }
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 2) {
+ if value.isContainer {
+ Button {
+ withAnimation(DS.Motion.snappy) { expanded.toggle() }
+ } label: {
+ line {
+ Image(systemName: "chevron.right")
+ .font(.system(size: 9, weight: .bold))
+ .foregroundStyle(DS.Colors.textInactive)
+ .rotationEffect(.degrees(expanded ? 90 : 0))
+ .frame(width: 10)
+ if let name { key(name) }
+ Text(value.display).font(DS.Text.code).foregroundStyle(DS.Colors.textMuted)
+ }
+ }
+ .buttonStyle(.plain)
+ if expanded {
+ ForEach(children, id: \.0) { k, v in
+ JSONTreeView(name: k, value: v, depth: depth + 1)
+ }
+ .transition(.opacity.combined(with: .move(edge: .top)))
+ }
+ } else {
+ line {
+ Spacer().frame(width: 10)
+ if let name { key(name) }
+ Text(scalarText)
+ .font(DS.Text.code)
+ .foregroundStyle(scalarColor)
+ .textSelection(.enabled)
+ }
+ }
+ }
+ }
+
+ private var children: [(String, JSONValue)] {
+ if let o = value.objectValue { return o.sorted { $0.key < $1.key } }
+ if let a = value.arrayValue { return a.enumerated().map { (String($0.offset), $0.element) } }
+ return []
+ }
+
+ private var scalarText: String {
+ if case .string(let s) = value { return "\"\(s)\"" }
+ return value.display
+ }
+
+ private var scalarColor: Color {
+ switch value {
+ case .number, .bool: DS.Colors.accentHover
+ case .null: DS.Colors.textMuted
+ default: DS.Colors.ink
+ }
+ }
+
+ @ViewBuilder
+ private func line<C: View>(@ViewBuilder _ c: () -> C) -> some View {
+ HStack(alignment: .firstTextBaseline, spacing: 6) { c() }
+ .padding(.leading, CGFloat(depth) * 14)
+ .padding(.vertical, 2)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+
+ private func key(_ k: String) -> some View {
+ HStack(spacing: 2) {
+ Text(k).font(DS.Text.code).foregroundStyle(DS.Colors.textSecondary)
+ Text(":").font(DS.Text.code).foregroundStyle(DS.Colors.textFaint)
+ }
+ }
+}
diff --git a/ios/Boop/Components/ProjectIcon.swift b/ios/Boop/Components/ProjectIcon.swift
new file mode 100644
index 0000000..bcd5952
--- /dev/null
+++ b/ios/Boop/Components/ProjectIcon.swift
@@ -0,0 +1,100 @@
+import SwiftUI
+import UIKit
+
+/// Project icon: "<shape>:<color>" rendered as an abstract shape from the palette; other text shown as-is.
+/// Mirrors server/internal/projects/icons.go and the web ProjectIcon component.
+struct ProjectIcon: View {
+ let icon: String
+ var size: CGFloat = 16
+
+ static let colors: [String: Color] = [
+ "periwinkle": DS.Colors.accent,
+ "mint": DS.Colors.altMint,
+ "blush": DS.Colors.altBlush,
+ "amber": DS.Colors.altAmber,
+ "violet": DS.Colors.outage,
+ "slate": DS.Colors.textMuted,
+ ]
+
+ static func parse(_ icon: String) -> (shape: IconShape, color: Color)? {
+ guard let i = icon.firstIndex(of: ":") else { return nil }
+ guard let shape = IconShape(rawValue: String(icon[..<i])), let color = colors[String(icon[icon.index(after: i)...])] else { return nil }
+ return (shape, color)
+ }
+
+ var body: some View {
+ if let p = Self.parse(icon) {
+ p.shape.fill(p.color).frame(width: size, height: size)
+ } else if !icon.isEmpty {
+ Text(icon).font(.system(size: size * 0.9))
+ }
+ }
+}
+
+enum IconShape: String, CaseIterable {
+ case circle, ring, square, diamond, triangle, hexagon, pill, blob
+
+ @ViewBuilder
+ func fill(_ color: Color) -> some View {
+ switch self {
+ case .circle: Circle().fill(color).padding(1)
+ case .ring: Circle().strokeBorder(color, lineWidth: 3.2).padding(1.5)
+ case .square: RoundedRectangle(cornerRadius: 3, style: .continuous).fill(color).padding(1.5)
+ case .diamond: RoundedRectangle(cornerRadius: 2, style: .continuous).fill(color).rotationEffect(.degrees(45)).padding(3.5)
+ case .triangle: Triangle().fill(color).padding(1)
+ case .hexagon: Polygon(sides: 6).fill(color).padding(0.5)
+ case .pill: Capsule().fill(color).padding(.vertical, 4.5).padding(.horizontal, 0.5)
+ case .blob: Blob().fill(color).padding(1)
+ }
+ }
+
+ /// Small rendered image for places SwiftUI cannot colour shapes (menus).
+ @MainActor
+ func image(_ color: Color, size: CGFloat = 20) -> UIImage {
+ let renderer = ImageRenderer(content: fill(color).frame(width: size, height: size))
+ renderer.scale = 3
+ return renderer.uiImage?.withRenderingMode(.alwaysOriginal) ?? UIImage()
+ }
+}
+
+struct Triangle: Shape {
+ func path(in r: CGRect) -> Path {
+ var p = Path()
+ p.move(to: CGPoint(x: r.midX, y: r.minY + r.height * 0.06))
+ p.addLine(to: CGPoint(x: r.maxX - r.width * 0.04, y: r.maxY - r.height * 0.1))
+ p.addLine(to: CGPoint(x: r.minX + r.width * 0.04, y: r.maxY - r.height * 0.1))
+ p.closeSubpath()
+ return p.strokedPath(StrokeStyle(lineWidth: r.width * 0.12, lineJoin: .round)).union(p)
+ }
+}
+
+struct Polygon: Shape {
+ let sides: Int
+ func path(in r: CGRect) -> Path {
+ var p = Path()
+ let c = CGPoint(x: r.midX, y: r.midY)
+ let radius = min(r.width, r.height) / 2
+ for i in 0..<sides {
+ let a = (Double(i) / Double(sides)) * 2 * .pi - .pi / 2
+ let pt = CGPoint(x: c.x + radius * cos(a), y: c.y + radius * sin(a))
+ if i == 0 { p.move(to: pt) } else { p.addLine(to: pt) }
+ }
+ p.closeSubpath()
+ return p
+ }
+}
+
+struct Blob: Shape {
+ func path(in r: CGRect) -> Path {
+ let w = r.width, h = r.height
+ func pt(_ x: CGFloat, _ y: CGFloat) -> CGPoint { CGPoint(x: r.minX + x / 20 * w, y: r.minY + y / 20 * h) }
+ var p = Path()
+ p.move(to: pt(10.5, 2))
+ p.addCurve(to: pt(18, 9.5), control1: pt(15, 2), control2: pt(18.5, 5))
+ p.addCurve(to: pt(10, 18), control1: pt(17.6, 13.5), control2: pt(15, 18))
+ p.addCurve(to: pt(2, 10.5), control1: pt(5.5, 18), control2: pt(2, 15))
+ p.addCurve(to: pt(10.5, 2), control1: pt(2, 6), control2: pt(6, 2))
+ p.closeSubpath()
+ return p
+ }
+}
diff --git a/ios/Boop/Design/DS.swift b/ios/Boop/Design/DS.swift
new file mode 100644
index 0000000..2eed842
--- /dev/null
+++ b/ios/Boop/Design/DS.swift
@@ -0,0 +1,129 @@
+import SwiftUI
+
+/// Design tokens, ported from `Design System/tokens/*.css`.
+enum DS {
+ // MARK: Colors
+ enum Colors {
+ static let bg = Color(hex: 0xFDFDFE)
+ static let bgHover = Color(hex: 0xFAFAFC)
+ static let ink = Color(hex: 0x1A1B25)
+ static let surfaceDark = Color(hex: 0x17181F)
+
+ static let text = ink
+ static let textSecondary = Color(hex: 0x6B6D7C)
+ static let textMuted = Color(hex: 0x9C9EAB)
+ static let textInactive = Color(hex: 0xB4B6C2)
+ static let textFaint = Color(hex: 0xC2C4CE)
+ static let textOnDark = Color(hex: 0xFDFDFE)
+ static let textOnDarkMuted = Color(hex: 0xFDFDFE).opacity(0.55)
+
+ static let borderHairline = Color(hex: 0xF0F1F5)
+ static let borderControl = Color(hex: 0xE4E6EE)
+ static let dividerOnDark = Color(hex: 0xFDFDFE).opacity(0.12)
+
+ static let accent = Color(hex: 0x7C83E8)
+ static let accentHover = Color(hex: 0x5A62D4)
+ static let accentLine = Color(hex: 0x8B92EC)
+ static let accentTint = Color(hex: 0xEEF0FB)
+
+ static let operational = Color(hex: 0xDBDFF8)
+ static let operationalStrong = Color(hex: 0xA9ADD9)
+ static let degraded = Color(hex: 0xF5B266)
+ static let degradedStrong = Color(hex: 0xE0912F)
+ static let outage = Color(hex: 0x9B7BEA)
+ static let outageStrong = Color(hex: 0x8A63E0)
+
+ static let altMint = Color(hex: 0x5FBF9F)
+ static let altBlush = Color(hex: 0xE88CB0)
+ static let altAmber = Color(hex: 0xE8B34C)
+
+ // Boop event levels, mapped onto the pastel + strong pattern (same as the web UI).
+ static let levelInfo = operational
+ static let levelInfoStrong = operationalStrong
+ static let levelSuccess = Color(hex: 0xDDF3EA)
+ static let levelSuccessStrong = altMint
+ static let levelWarning = Color(hex: 0xFCE8D0)
+ static let levelWarningStrong = degradedStrong
+ static let levelError = Color(hex: 0xE8DFFA)
+ static let levelErrorStrong = outageStrong
+ static let levelCritical = outage
+ static let levelCriticalStrong = Color(hex: 0x6A45C4)
+
+ /// Healthy/ok status uses mint, per the maintainer's preference.
+ static let ok = altMint
+ }
+
+ // MARK: Radii
+ enum Radius {
+ static let bar: CGFloat = 2
+ static let cell: CGFloat = 3
+ static let row: CGFloat = 6
+ static let control: CGFloat = 8
+ static let tooltip: CGFloat = 10
+ static let card: CGFloat = 14
+ static let pill: CGFloat = 999
+ }
+
+ // MARK: Spacing
+ enum Space {
+ static let s1: CGFloat = 3
+ static let s2: CGFloat = 8
+ static let s3: CGFloat = 10
+ static let s4: CGFloat = 16
+ static let s5: CGFloat = 24
+ static let s6: CGFloat = 40
+ static let s7: CGFloat = 56
+ static let pagePad: CGFloat = 20
+ }
+
+ // MARK: Type scale (Figtree, hierarchy by weight + gray)
+ enum Text {
+ static var wordmark: Font { .figtree(20, .bold) }
+ static var metric: Font { .figtree(24, .bold) }
+ static var rowTitle: Font { .figtree(15, .semibold) }
+ static var statusLine: Font { .figtree(15, .medium) }
+ static var setting: Font { .figtree(14, .semibold) }
+ static var ui: Font { .figtree(13, .semibold) }
+ static var meta: Font { .figtree(13, .medium) }
+ static var small: Font { .figtree(12, .semibold) }
+ static var caption: Font { .figtree(11, .medium) }
+ static var code: Font { .system(size: 12, design: .monospaced) }
+ static var title: Font { .figtree(28, .bold) }
+ }
+
+ /// Restrained motion: the design system wants near-instant state changes.
+ enum Motion {
+ static let snappy = Animation.spring(response: 0.32, dampingFraction: 0.86)
+ static let gentle = Animation.easeOut(duration: 0.18)
+ static let settle = Animation.spring(response: 0.45, dampingFraction: 0.8)
+ }
+}
+
+extension Color {
+ init(hex: UInt32) {
+ self.init(
+ .sRGB,
+ red: Double((hex >> 16) & 0xFF) / 255,
+ green: Double((hex >> 8) & 0xFF) / 255,
+ blue: Double(hex & 0xFF) / 255,
+ opacity: 1
+ )
+ }
+}
+
+extension Font {
+ /// Figtree when the bundled font loaded, system font otherwise.
+ static func figtree(_ size: CGFloat, _ weight: Font.Weight = .regular) -> Font {
+ let name: String
+ switch weight {
+ case .bold, .heavy, .black: name = "Figtree-Bold"
+ case .semibold: name = "Figtree-SemiBold"
+ case .medium: name = "Figtree-Medium"
+ default: name = "Figtree-Regular"
+ }
+ if UIFont(name: name, size: size) != nil {
+ return .custom(name, size: size)
+ }
+ return .system(size: size, weight: weight)
+ }
+}
diff --git a/ios/Boop/Info.plist b/ios/Boop/Info.plist
new file mode 100644
index 0000000..b8a0805
--- /dev/null
+++ b/ios/Boop/Info.plist
@@ -0,0 +1,56 @@
+<?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>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>Boop</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>$(MARKETING_VERSION)</string>
+ <key>CFBundleVersion</key>
+ <string>$(CURRENT_PROJECT_VERSION)</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UILaunchScreen</key>
+ <dict>
+ <key>UIColorName</key>
+ <string>Paper</string>
+ </dict>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ </array>
+ <key>UIBackgroundModes</key>
+ <array>
+ <string>remote-notification</string>
+ </array>
+ <key>UIUserInterfaceStyle</key>
+ <string>Light</string>
+ <key>NSCameraUsageDescription</key>
+ <string>Boop uses the camera to scan the pairing code shown by your Boop server.</string>
+ <key>UIAppFonts</key>
+ <array>
+ <string>Figtree-Regular.ttf</string>
+ <string>Figtree-Medium.ttf</string>
+ <string>Figtree-SemiBold.ttf</string>
+ <string>Figtree-Bold.ttf</string>
+ </array>
+ <key>NSAppTransportSecurity</key>
+ <dict>
+ <!-- Allows http://<local-ip>:8080 during development. Production servers must use HTTPS. -->
+ <key>NSAllowsLocalNetworking</key>
+ <true/>
+ </dict>
+</dict>
+</plist>
diff --git a/ios/Boop/Models/Device.swift b/ios/Boop/Models/Device.swift
new file mode 100644
index 0000000..c092af5
--- /dev/null
+++ b/ios/Boop/Models/Device.swift
@@ -0,0 +1,31 @@
+import Foundation
+
+struct Device: Codable, Identifiable, Sendable, Equatable {
+ let id: String
+ var name: String
+ var pushRegistered: Bool
+ var platform: String
+ var appBundleID: String
+ var lastSeenAt: Date?
+ let createdAt: Date
+
+ enum CodingKeys: String, CodingKey {
+ case id, name, platform
+ case pushRegistered = "push_registered"
+ case appBundleID = "app_bundle_id"
+ case lastSeenAt = "last_seen_at"
+ case createdAt = "created_at"
+ }
+}
+
+struct PairingResult: Codable, Sendable {
+ let device: Device
+ let credential: String
+}
+
+struct Project: Codable, Identifiable, Sendable, Hashable {
+ let id: String
+ let name: String
+ let slug: String
+ let icon: String
+}
diff --git a/ios/Boop/Models/Event.swift b/ios/Boop/Models/Event.swift
new file mode 100644
index 0000000..2ad3f9e
--- /dev/null
+++ b/ios/Boop/Models/Event.swift
@@ -0,0 +1,153 @@
+import Foundation
+
+struct Event: Codable, Identifiable, Hashable, Sendable {
+ let id: String
+ var externalID: String?
+ let projectID: String
+ let projectName: String
+ let projectSlug: String
+ let projectIcon: String
+ let source: String
+ let type: String
+ let level: Level
+ let title: String
+ let body: String
+ let fingerprint: String
+ let data: JSONValue
+ let occurredAt: Date
+ let createdAt: Date
+
+ enum CodingKeys: String, CodingKey {
+ case id
+ case externalID = "external_id"
+ case projectID = "project_id"
+ case projectName = "project_name"
+ case projectSlug = "project_slug"
+ case projectIcon = "project_icon"
+ case source, type, level, title, body, fingerprint, data
+ case occurredAt = "occurred_at"
+ case createdAt = "created_at"
+ }
+
+ init(from decoder: any Decoder) throws {
+ let c = try decoder.container(keyedBy: CodingKeys.self)
+ id = try c.decode(String.self, forKey: .id)
+ externalID = try c.decodeIfPresent(String.self, forKey: .externalID)
+ projectID = try c.decode(String.self, forKey: .projectID)
+ projectName = try c.decodeIfPresent(String.self, forKey: .projectName) ?? ""
+ projectSlug = try c.decodeIfPresent(String.self, forKey: .projectSlug) ?? ""
+ projectIcon = try c.decodeIfPresent(String.self, forKey: .projectIcon) ?? ""
+ source = try c.decodeIfPresent(String.self, forKey: .source) ?? ""
+ type = try c.decodeIfPresent(String.self, forKey: .type) ?? ""
+ level = Level(lenient: try c.decodeIfPresent(String.self, forKey: .level) ?? "info")
+ title = try c.decode(String.self, forKey: .title)
+ body = try c.decodeIfPresent(String.self, forKey: .body) ?? ""
+ fingerprint = try c.decodeIfPresent(String.self, forKey: .fingerprint) ?? ""
+ data = try c.decodeIfPresent(JSONValue.self, forKey: .data) ?? .object([:])
+ occurredAt = try c.decode(Date.self, forKey: .occurredAt)
+ createdAt = try c.decode(Date.self, forKey: .createdAt)
+ }
+
+ init(id: String, projectID: String, projectName: String, projectIcon: String = "", source: String = "", type: String = "",
+ level: Level, title: String, body: String = "", fingerprint: String = "", data: JSONValue = .object([:]),
+ occurredAt: Date, createdAt: Date) {
+ self.id = id
+ self.externalID = nil
+ self.projectID = projectID
+ self.projectName = projectName
+ self.projectSlug = projectName.lowercased()
+ self.projectIcon = projectIcon
+ self.source = source
+ self.type = type
+ self.level = level
+ self.title = title
+ self.body = body
+ self.fingerprint = fingerprint
+ self.data = data
+ self.occurredAt = occurredAt
+ self.createdAt = createdAt
+ }
+
+ func hash(into hasher: inout Hasher) { hasher.combine(id) }
+ static func == (a: Event, b: Event) -> Bool { a.id == b.id && a.createdAt == b.createdAt }
+
+ /// Rich sections recognised from `data`; everything else is `rest`.
+ var sections: EventSections { EventSections(data: data) }
+}
+
+struct EventPage: Codable, Sendable {
+ let events: [Event]
+ let nextCursor: String?
+
+ enum CodingKeys: String, CodingKey {
+ case events
+ case nextCursor = "next_cursor"
+ }
+}
+
+/// Splits `data` into the sections the detail screen renders specially.
+struct EventSections: Sendable {
+ static let knownKeys: Set<String> = ["exception", "stacktrace", "tags", "context", "breadcrumbs"]
+
+ var exception: [String: JSONValue]?
+ var frames: [StackFrame]?
+ var tags: [(String, JSONValue)]?
+ var context: [(String, JSONValue)]?
+ var breadcrumbs: [Breadcrumb]?
+ var rest: [(String, JSONValue)]
+
+ init(data: JSONValue) {
+ let obj = data.objectValue ?? [:]
+ exception = obj["exception"]?.objectValue
+ frames = obj["stacktrace"]?.arrayValue?.map(StackFrame.init(json:))
+ tags = obj["tags"]?.objectValue.map { $0.sorted { $0.key < $1.key } }
+ context = obj["context"]?.objectValue.map { $0.sorted { $0.key < $1.key } }
+ breadcrumbs = obj["breadcrumbs"]?.arrayValue?.map(Breadcrumb.init(json:))
+ rest = obj.filter { !Self.knownKeys.contains($0.key) }.sorted { $0.key < $1.key }
+ }
+
+ var isEmpty: Bool {
+ exception == nil && frames == nil && tags == nil && context == nil && breadcrumbs == nil && rest.isEmpty
+ }
+}
+
+struct StackFrame: Identifiable, Sendable {
+ let id = UUID()
+ let function: String
+ let file: String
+ let line: String?
+ let inApp: Bool
+
+ init(json: JSONValue) {
+ if let o = json.objectValue {
+ function = o["function"]?.display ?? o["module"]?.display ?? "—"
+ file = o["file"]?.display ?? o["filename"]?.display ?? ""
+ line = o["line"]?.display
+ inApp = o["in_app"] == .bool(true)
+ } else {
+ function = json.display
+ file = ""
+ line = nil
+ inApp = false
+ }
+ }
+}
+
+struct Breadcrumb: Identifiable, Sendable {
+ let id = UUID()
+ let timestamp: String
+ let category: String
+ let message: String
+
+ init(json: JSONValue) {
+ if let o = json.objectValue {
+ timestamp = o["timestamp"]?.display ?? o["time"]?.display ?? ""
+ category = o["category"]?.display ?? o["type"]?.display ?? ""
+ message = o["message"]?.display ?? o["msg"]?.display ?? json.pretty
+ } else {
+ timestamp = ""
+ category = ""
+ message = json.display
+ }
+ }
+}
diff --git a/ios/Boop/Models/JSONValue.swift b/ios/Boop/Models/JSONValue.swift
new file mode 100644
index 0000000..80f08ba
--- /dev/null
+++ b/ios/Boop/Models/JSONValue.swift
@@ -0,0 +1,80 @@
+import Foundation
+
+/// A Codable representation of arbitrary JSON, used for the free-form `data` object on events.
+indirect enum JSONValue: Codable, Equatable, Sendable {
+ case string(String)
+ case number(Double)
+ case bool(Bool)
+ case null
+ case array([JSONValue])
+ case object([String: JSONValue])
+
+ init(from decoder: any Decoder) throws {
+ let c = try decoder.singleValueContainer()
+ if c.decodeNil() { self = .null; return }
+ if let b = try? c.decode(Bool.self) { self = .bool(b); return }
+ if let n = try? c.decode(Double.self) { self = .number(n); return }
+ if let s = try? c.decode(String.self) { self = .string(s); return }
+ if let a = try? c.decode([JSONValue].self) { self = .array(a); return }
+ if let o = try? c.decode([String: JSONValue].self) { self = .object(o); return }
+ throw DecodingError.dataCorruptedError(in: c, debugDescription: "Unsupported JSON value")
+ }
+
+ func encode(to encoder: any Encoder) throws {
+ var c = encoder.singleValueContainer()
+ switch self {
+ case .string(let s): try c.encode(s)
+ case .number(let n): try c.encode(n)
+ case .bool(let b): try c.encode(b)
+ case .null: try c.encodeNil()
+ case .array(let a): try c.encode(a)
+ case .object(let o): try c.encode(o)
+ }
+ }
+
+ var objectValue: [String: JSONValue]? {
+ if case .object(let o) = self { return o }
+ return nil
+ }
+
+ var arrayValue: [JSONValue]? {
+ if case .array(let a) = self { return a }
+ return nil
+ }
+
+ var stringValue: String? {
+ if case .string(let s) = self { return s }
+ return nil
+ }
+
+ var isContainer: Bool {
+ switch self {
+ case .array, .object: true
+ default: false
+ }
+ }
+
+ /// Compact single-line rendering for scalars; a summary for containers.
+ var display: String {
+ switch self {
+ case .string(let s): s
+ case .number(let n): n == n.rounded() && abs(n) < 1e15 ? String(Int(n)) : String(n)
+ case .bool(let b): b ? "true" : "false"
+ case .null: "null"
+ case .array(let a): "[\(a.count)]"
+ case .object(let o): "{\(o.count)}"
+ }
+ }
+
+ subscript(key: String) -> JSONValue? {
+ objectValue?[key]
+ }
+
+ /// Pretty-printed JSON text.
+ var pretty: String {
+ let enc = JSONEncoder()
+ enc.outputFormatting = [.prettyPrinted, .sortedKeys]
+ guard let data = try? enc.encode(self), let s = String(data: data, encoding: .utf8) else { return "" }
+ return s
+ }
+}
diff --git a/ios/Boop/Models/Level.swift b/ios/Boop/Models/Level.swift
new file mode 100644
index 0000000..216ee7c
--- /dev/null
+++ b/ios/Boop/Models/Level.swift
@@ -0,0 +1,42 @@
+import SwiftUI
+
+enum Level: String, Codable, CaseIterable, Sendable, Identifiable {
+ case info, success, warning, error, critical
+
+ var id: String { rawValue }
+
+ var label: String {
+ switch self {
+ case .info: "Info"
+ case .success: "Success"
+ case .warning: "Warning"
+ case .error: "Error"
+ case .critical: "Critical"
+ }
+ }
+
+ var fill: Color {
+ switch self {
+ case .info: DS.Colors.levelInfo
+ case .success: DS.Colors.levelSuccess
+ case .warning: DS.Colors.levelWarning
+ case .error: DS.Colors.levelError
+ case .critical: DS.Colors.levelCritical
+ }
+ }
+
+ var strong: Color {
+ switch self {
+ case .info: DS.Colors.levelInfoStrong
+ case .success: DS.Colors.levelSuccessStrong
+ case .warning: DS.Colors.levelWarningStrong
+ case .error: DS.Colors.levelErrorStrong
+ case .critical: DS.Colors.levelCriticalStrong
+ }
+ }
+
+ /// Unknown strings from the server decode as `.info` rather than failing.
+ init(lenient raw: String) {
+ self = Level(rawValue: raw.lowercased()) ?? .info
+ }
+}
diff --git a/ios/Boop/Networking/APIClient.swift b/ios/Boop/Networking/APIClient.swift
new file mode 100644
index 0000000..b9e2c10
--- /dev/null
+++ b/ios/Boop/Networking/APIClient.swift
@@ -0,0 +1,136 @@
+import Foundation
+
+struct APIError: Error, LocalizedError, Sendable, Equatable {
+ let status: Int
+ let code: String
+ let message: String
+
+ var errorDescription: String? { message }
+
+ static func transport(_ error: any Error) -> APIError {
+ APIError(status: 0, code: "unreachable", message: error.localizedDescription)
+ }
+
+ var isUnauthorized: Bool { status == 401 }
+ var isUnreachable: Bool { status == 0 }
+}
+
+/// Typed client for the Boop API. Stateless; the session owns the base URL and credential.
+struct APIClient: Sendable {
+ let baseURL: URL
+ var credential: String?
+ var session: URLSession = .shared
+
+ static let decoder: JSONDecoder = {
+ let d = JSONDecoder()
+ d.dateDecodingStrategy = .custom { decoder in
+ let s = try decoder.singleValueContainer().decode(String.self)
+ if let date = ISO8601.parse(s) { return date }
+ throw DecodingError.dataCorrupted(.init(codingPath: decoder.codingPath, debugDescription: "Bad date \(s)"))
+ }
+ return d
+ }()
+
+ // MARK: Endpoints
+
+ func health() async throws -> Bool {
+ struct H: Decodable { let status: String }
+ let h: H = try await request("GET", "/health", auth: false)
+ return h.status == "ok"
+ }
+
+ func exchangePairing(token: String, name: String) async throws -> PairingResult {
+ try await request("POST", "/api/v1/pairing/exchange", body: ["token": token, "name": name, "platform": "ios"], auth: false)
+ }
+
+ func registerDevice(token: String?, name: String?, bundleID: String) async throws -> Device {
+ var body: [String: String] = ["app_bundle_id": bundleID]
+ if let token { body["device_token"] = token }
+ if let name { body["name"] = name }
+ return try await request("POST", "/api/v1/devices", body: body)
+ }
+
+ func updateDevice(id: String, name: String) async throws -> Device {
+ try await request("PATCH", "/api/v1/devices/\(id)", body: ["name": name])
+ }
+
+ func deleteDevice(id: String) async throws {
+ let _: Empty = try await request("DELETE", "/api/v1/devices/\(id)")
+ }
+
+ func events(project: String? = nil, level: Level? = nil, before: String? = nil, limit: Int = 50) async throws -> EventPage {
+ var items = [URLQueryItem(name: "limit", value: String(limit))]
+ if let project, !project.isEmpty { items.append(.init(name: "project", value: project)) }
+ if let level { items.append(.init(name: "level", value: level.rawValue)) }
+ if let before { items.append(.init(name: "before", value: before)) }
+ return try await request("GET", "/api/v1/events", query: items)
+ }
+
+ func event(id: String) async throws -> Event {
+ try await request("GET", "/api/v1/events/\(id)")
+ }
+
+ // MARK: Plumbing
+
+ private struct Empty: Decodable {}
+ private struct ServerError: Decodable { let error: String; let message: String }
+
+ private func request<T: Decodable>(_ method: String, _ path: String, query: [URLQueryItem] = [], body: [String: String]? = nil, auth: Bool = true) async throws -> T {
+ var comps = URLComponents(url: baseURL.appending(path: path), resolvingAgainstBaseURL: false)!
+ if !query.isEmpty { comps.queryItems = query }
+ var req = URLRequest(url: comps.url!)
+ req.httpMethod = method
+ req.timeoutInterval = 15
+ req.setValue("application/json", forHTTPHeaderField: "Accept")
+ if auth, let credential { req.setValue("Bearer \(credential)", forHTTPHeaderField: "Authorization") }
+ if let body {
+ req.setValue("application/json", forHTTPHeaderField: "Content-Type")
+ req.httpBody = try JSONEncoder().encode(body)
+ }
+ let data: Data
+ let response: URLResponse
+ do {
+ (data, response) = try await session.data(for: req)
+ } catch {
+ throw APIError.transport(error)
+ }
+ let status = (response as? HTTPURLResponse)?.statusCode ?? 0
+ guard (200..<300).contains(status) else {
+ if let e = try? Self.decoder.decode(ServerError.self, from: data) {
+ throw APIError(status: status, code: e.error, message: e.message)
+ }
+ throw APIError(status: status, code: "http_\(status)", message: "Request failed (\(status))")
+ }
+ if T.self == Empty.self { return Empty() as! T }
+ do {
+ return try Self.decoder.decode(T.self, from: data)
+ } catch {
+ throw APIError(status: status, code: "decode", message: "Unexpected response from server")
+ }
+ }
+}
+
+enum ISO8601 {
+ nonisolated(unsafe) private static let fractional: ISO8601DateFormatter = {
+ let f = ISO8601DateFormatter()
+ f.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
+ return f
+ }()
+ nonisolated(unsafe) private static let plain: ISO8601DateFormatter = {
+ let f = ISO8601DateFormatter()
+ f.formatOptions = [.withInternetDateTime]
+ return f
+ }()
+
+ static func parse(_ s: String) -> Date? {
+ // The server emits nanosecond precision; ISO8601DateFormatter only accepts up to 3 fractional digits.
+ var t = s
+ if let dot = t.firstIndex(of: "."), let end = t[dot...].firstIndex(where: { $0 == "Z" || $0 == "+" || $0 == "-" }) {
+ let frac = t[t.index(after: dot)..<end]
+ if frac.count > 3 {
+ t.replaceSubrange(dot..<end, with: "." + frac.prefix(3))
+ }
+ }
+ return fractional.date(from: t) ?? plain.date(from: t)
+ }
+}
diff --git a/ios/Boop/Networking/AppSession.swift b/ios/Boop/Networking/AppSession.swift
new file mode 100644
index 0000000..f2aad35
--- /dev/null
+++ b/ios/Boop/Networking/AppSession.swift
@@ -0,0 +1,130 @@
+import Foundation
+import Observation
+import UIKit
+
+/// Owns the server URL, device credential and connection state.
+@MainActor
+@Observable
+final class AppSession {
+ enum Connection: Equatable {
+ case unknown, checking, connected, unreachable(String), unauthorized
+ }
+
+ private(set) var serverURL: URL?
+ private(set) var deviceID: String?
+ var deviceName: String
+ private(set) var connection: Connection = .unknown
+ private(set) var pushRegistered = false
+ private(set) var lastAPNSToken: String?
+ /// True between a successful pairing and the user tapping Continue on the success screen.
+ var onboarding = false
+
+ private let keychain: KeychainStore
+ private let defaults: UserDefaults
+ private var credential: String?
+
+ private enum Keys {
+ static let server = "boop.server"
+ static let deviceID = "boop.deviceID"
+ static let deviceName = "boop.deviceName"
+ static let credential = "credential"
+ static let apnsToken = "boop.apnsToken"
+ }
+
+ init(keychain: KeychainStore = KeychainStore(), defaults: UserDefaults = .standard) {
+ self.keychain = keychain
+ self.defaults = defaults
+ serverURL = defaults.string(forKey: Keys.server).flatMap(URL.init(string:))
+ deviceID = defaults.string(forKey: Keys.deviceID)
+ deviceName = defaults.string(forKey: Keys.deviceName) ?? UIDevice.current.name
+ credential = keychain.get(Keys.credential)
+ lastAPNSToken = defaults.string(forKey: Keys.apnsToken)
+ pushRegistered = lastAPNSToken != nil
+ }
+
+ var isPaired: Bool { serverURL != nil && credential != nil }
+
+ var client: APIClient? {
+ guard let serverURL else { return nil }
+ return APIClient(baseURL: serverURL, credential: credential)
+ }
+
+ // MARK: Pairing
+
+ func pair(_ payload: PairingPayload) async throws -> Device {
+ guard let url = payload.serverURL else { throw PairingPayload.ParseError.badServer }
+ let client = APIClient(baseURL: url)
+ let result = try await client.exchangePairing(token: payload.token, name: deviceName)
+ keychain.set(result.credential, for: Keys.credential)
+ credential = result.credential
+ serverURL = url
+ deviceID = result.device.id
+ defaults.set(url.absoluteString, forKey: Keys.server)
+ defaults.set(result.device.id, forKey: Keys.deviceID)
+ defaults.set(deviceName, forKey: Keys.deviceName)
+ connection = .connected
+ onboarding = true
+ // Re-send a token we already hold (re-pairing after a reinstall keeps pushes working).
+ if let token = lastAPNSToken {
+ try? await registerAPNSToken(token)
+ }
+ return result.device
+ }
+
+ func disconnect() async {
+ if let client, let deviceID {
+ try? await client.deleteDevice(id: deviceID)
+ }
+ forget()
+ }
+
+ /// Drops local state without contacting the server (for re-pair, or when the credential was revoked).
+ func forget() {
+ keychain.delete(Keys.credential)
+ credential = nil
+ serverURL = nil
+ deviceID = nil
+ pushRegistered = false
+ connection = .unknown
+ defaults.removeObject(forKey: Keys.server)
+ defaults.removeObject(forKey: Keys.deviceID)
+ }
+
+ // MARK: Device
+
+ func registerAPNSToken(_ token: String) async throws {
+ lastAPNSToken = token
+ defaults.set(token, forKey: Keys.apnsToken)
+ guard let client else { return }
+ let device = try await client.registerDevice(token: token, name: deviceName, bundleID: Bundle.main.bundleIdentifier ?? "")
+ pushRegistered = device.pushRegistered
+ deviceID = device.id
+ }
+
+ func rename(_ name: String) async {
+ let trimmed = name.trimmingCharacters(in: .whitespacesAndNewlines)
+ guard !trimmed.isEmpty else { return }
+ deviceName = trimmed
+ defaults.set(trimmed, forKey: Keys.deviceName)
+ if let client, let deviceID {
+ _ = try? await client.updateDevice(id: deviceID, name: trimmed)
+ }
+ }
+
+ // MARK: Connection
+
+ @discardableResult
+ func checkConnection() async -> Connection {
+ guard let client else { connection = .unknown; return connection }
+ connection = .checking
+ do {
+ _ = try await client.events(limit: 1)
+ connection = .connected
+ } catch let e as APIError where e.isUnauthorized {
+ connection = .unauthorized
+ } catch {
+ connection = .unreachable((error as? APIError)?.message ?? error.localizedDescription)
+ }
+ return connection
+ }
+}
diff --git a/ios/Boop/Notifications/PushManager.swift b/ios/Boop/Notifications/PushManager.swift
new file mode 100644
index 0000000..3d48f04
--- /dev/null
+++ b/ios/Boop/Notifications/PushManager.swift
@@ -0,0 +1,75 @@
+import Foundation
+import Observation
+import UIKit
+import UserNotifications
+
+/// Requests permission, registers with APNs, and turns notification taps into navigation.
+@MainActor
+@Observable
+final class PushManager: NSObject, UNUserNotificationCenterDelegate {
+ var authorization: UNAuthorizationStatus = .notDetermined
+ /// Event id from the most recently tapped notification; the root view consumes it.
+ var pendingEventID: String?
+ /// Title/body from the tapped push, shown if the server cannot be reached.
+ var pendingSummary: (title: String, body: String)?
+ var lastError: String?
+
+ private weak var session: AppSession?
+
+ func attach(session: AppSession) {
+ self.session = session
+ UNUserNotificationCenter.current().delegate = self
+ }
+
+ func refreshAuthorization() async {
+ authorization = await UNUserNotificationCenter.current().notificationSettings().authorizationStatus
+ }
+
+ /// Ask for permission (first time) and register with APNs. Safe to call on every launch.
+ func requestAndRegister() async {
+ do {
+ let granted = try await UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge])
+ await refreshAuthorization()
+ if granted {
+ UIApplication.shared.registerForRemoteNotifications()
+ }
+ } catch {
+ lastError = error.localizedDescription
+ }
+ }
+
+ func didRegister(deviceToken: Data) {
+ let hex = deviceToken.map { String(format: "%02x", $0) }.joined()
+ lastError = nil
+ Task { [weak self] in
+ guard let self, let session = self.session else { return }
+ do {
+ try await session.registerAPNSToken(hex)
+ } catch {
+ self.lastError = (error as? APIError)?.message ?? error.localizedDescription
+ }
+ }
+ }
+
+ func didFailToRegister(_ error: any Error) {
+ // Expected in the simulator and on builds without the push entitlement.
+ lastError = error.localizedDescription
+ }
+
+ // MARK: UNUserNotificationCenterDelegate
+
+ nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification) async -> UNNotificationPresentationOptions {
+ [.banner, .sound, .list]
+ }
+
+ nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) async {
+ let info = response.notification.request.content.userInfo
+ let eventID = info["event_id"] as? String
+ let title = response.notification.request.content.title
+ let body = response.notification.request.content.body
+ await MainActor.run {
+ self.pendingSummary = (title, body)
+ self.pendingEventID = eventID
+ }
+ }
+}
diff --git a/ios/Boop/Pairing/KeychainStore.swift b/ios/Boop/Pairing/KeychainStore.swift
new file mode 100644
index 0000000..2aa9b4e
--- /dev/null
+++ b/ios/Boop/Pairing/KeychainStore.swift
@@ -0,0 +1,45 @@
+import Foundation
+import Security
+
+/// Minimal Keychain wrapper for the device credential.
+struct KeychainStore: Sendable {
+ let service: String
+
+ init(service: String = Bundle.main.bundleIdentifier ?? "com.example.Boop") {
+ self.service = service
+ }
+
+ func get(_ key: String) -> String? {
+ let q: [String: Any] = [
+ kSecClass as String: kSecClassGenericPassword,
+ kSecAttrService as String: service,
+ kSecAttrAccount as String: key,
+ kSecReturnData as String: true,
+ kSecMatchLimit as String: kSecMatchLimitOne,
+ ]
+ var out: AnyObject?
+ guard SecItemCopyMatching(q as CFDictionary, &out) == errSecSuccess, let data = out as? Data else { return nil }
+ return String(data: data, encoding: .utf8)
+ }
+
+ func set(_ value: String, for key: String) {
+ delete(key)
+ let q: [String: Any] = [
+ kSecClass as String: kSecClassGenericPassword,
+ kSecAttrService as String: service,
+ kSecAttrAccount as String: key,
+ kSecValueData as String: Data(value.utf8),
+ kSecAttrAccessible as String: kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly,
+ ]
+ SecItemAdd(q as CFDictionary, nil)
+ }
+
+ func delete(_ key: String) {
+ let q: [String: Any] = [
+ kSecClass as String: kSecClassGenericPassword,
+ kSecAttrService as String: service,
+ kSecAttrAccount as String: key,
+ ]
+ SecItemDelete(q as CFDictionary)
+ }
+}
diff --git a/ios/Boop/Pairing/PairingPayload.swift b/ios/Boop/Pairing/PairingPayload.swift
new file mode 100644
index 0000000..cb73933
--- /dev/null
+++ b/ios/Boop/Pairing/PairingPayload.swift
@@ -0,0 +1,55 @@
+import Foundation
+
+/// The JSON encoded in the pairing QR code shown by the web UI.
+struct PairingPayload: Codable, Equatable, Sendable {
+ let version: Int
+ let server: String
+ let token: String
+
+ enum ParseError: Error, LocalizedError, Equatable {
+ case notJSON
+ case unsupportedVersion(Int)
+ case badServer
+ case badToken
+
+ var errorDescription: String? {
+ switch self {
+ case .notJSON: "That code is not a Boop pairing code."
+ case .unsupportedVersion(let v): "Pairing code version \(v) is not supported by this app."
+ case .badServer: "The pairing code has an invalid server address."
+ case .badToken: "The pairing code has an invalid token."
+ }
+ }
+ }
+
+ static func parse(_ text: String) throws -> PairingPayload {
+ guard let data = text.data(using: .utf8), let p = try? JSONDecoder().decode(PairingPayload.self, from: data) else {
+ throw ParseError.notJSON
+ }
+ try p.validate()
+ return p
+ }
+
+ /// Manual entry: server address plus token typed by hand.
+ static func manual(server: String, token: String) throws -> PairingPayload {
+ var s = server.trimmingCharacters(in: .whitespacesAndNewlines)
+ if !s.contains("://") { s = "https://" + s }
+ let p = PairingPayload(version: 1, server: s, token: token.trimmingCharacters(in: .whitespacesAndNewlines))
+ try p.validate()
+ return p
+ }
+
+ func validate() throws {
+ guard version == 1 else { throw ParseError.unsupportedVersion(version) }
+ guard serverURL != nil else { throw ParseError.badServer }
+ guard token.hasPrefix("pair_"), token.count > 10 else { throw ParseError.badToken }
+ }
+
+ var serverURL: URL? {
+ guard let url = URL(string: server), let scheme = url.scheme?.lowercased(), url.host() != nil else { return nil }
+ guard scheme == "https" || scheme == "http" else { return nil }
+ var s = server
+ while s.hasSuffix("/") { s.removeLast() }
+ return URL(string: s)
+ }
+}
diff --git a/ios/Boop/Pairing/QRScannerView.swift b/ios/Boop/Pairing/QRScannerView.swift
new file mode 100644
index 0000000..2c001cc
--- /dev/null
+++ b/ios/Boop/Pairing/QRScannerView.swift
@@ -0,0 +1,48 @@
+import SwiftUI
+import VisionKit
+
+/// Live QR scanner built on VisionKit's DataScannerViewController.
+struct QRScannerView: UIViewControllerRepresentable {
+ let onCode: (String) -> Void
+
+ func makeUIViewController(context: Context) -> DataScannerViewController {
+ let vc = DataScannerViewController(
+ recognizedDataTypes: [.barcode(symbologies: [.qr])],
+ qualityLevel: .balanced,
+ recognizesMultipleItems: false,
+ isHighFrameRateTrackingEnabled: false,
+ isHighlightingEnabled: true
+ )
+ vc.delegate = context.coordinator
+ return vc
+ }
+
+ func updateUIViewController(_ vc: DataScannerViewController, context: Context) {
+ guard DataScannerViewController.isSupported, DataScannerViewController.isAvailable else { return }
+ if !vc.isScanning {
+ try? vc.startScanning()
+ }
+ }
+
+ static func dismantleUIViewController(_ vc: DataScannerViewController, coordinator: Coordinator) {
+ vc.stopScanning()
+ }
+
+ func makeCoordinator() -> Coordinator { Coordinator(onCode: onCode) }
+
+ final class Coordinator: NSObject, DataScannerViewControllerDelegate {
+ let onCode: (String) -> Void
+ private var lastCode: String?
+
+ init(onCode: @escaping (String) -> Void) { self.onCode = onCode }
+
+ func dataScanner(_ dataScanner: DataScannerViewController, didAdd addedItems: [RecognizedItem], allItems: [RecognizedItem]) {
+ for item in addedItems {
+ if case .barcode(let code) = item, let s = code.payloadStringValue, s != lastCode {
+ lastCode = s
+ onCode(s)
+ }
+ }
+ }
+ }
+}
diff --git a/ios/Boop/Resources/Fonts/Figtree-Bold.ttf b/ios/Boop/Resources/Fonts/Figtree-Bold.ttf
new file mode 100644
index 0000000..588d2bd
Binary files /dev/null and b/ios/Boop/Resources/Fonts/Figtree-Bold.ttf differ
diff --git a/ios/Boop/Resources/Fonts/Figtree-Medium.ttf b/ios/Boop/Resources/Fonts/Figtree-Medium.ttf
new file mode 100644
index 0000000..26b9620
Binary files /dev/null and b/ios/Boop/Resources/Fonts/Figtree-Medium.ttf differ
diff --git a/ios/Boop/Resources/Fonts/Figtree-Regular.ttf b/ios/Boop/Resources/Fonts/Figtree-Regular.ttf
new file mode 100644
index 0000000..3a56cd5
Binary files /dev/null and b/ios/Boop/Resources/Fonts/Figtree-Regular.ttf differ
diff --git a/ios/Boop/Resources/Fonts/Figtree-SemiBold.ttf b/ios/Boop/Resources/Fonts/Figtree-SemiBold.ttf
new file mode 100644
index 0000000..1422008
Binary files /dev/null and b/ios/Boop/Resources/Fonts/Figtree-SemiBold.ttf differ
diff --git a/ios/Boop/Resources/Fonts/OFL.txt b/ios/Boop/Resources/Fonts/OFL.txt
new file mode 100644
index 0000000..80b12bb
--- /dev/null
+++ b/ios/Boop/Resources/Fonts/OFL.txt
@@ -0,0 +1,93 @@
+Copyright 2022 The Figtree Project Authors (https://github.com/erikdkennedy/figtree)
+
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/ios/Boop/Screens/EventDetailView.swift b/ios/Boop/Screens/EventDetailView.swift
new file mode 100644
index 0000000..e94680d
--- /dev/null
+++ b/ios/Boop/Screens/EventDetailView.swift
@@ -0,0 +1,280 @@
+import SwiftUI
+
+/// Presented as a 3/4-height sheet from the inbox (and from a notification tap).
+struct EventDetailView: View {
+ @Environment(AppSession.self) private var session
+ @Environment(\.dismiss) private var dismiss
+ let route: EventRoute
+
+ @State private var event: Event?
+ @State private var error: String?
+ @State private var showRaw = false
+
+ var body: some View {
+ NavigationStack {
+ content
+ .navigationTitle(event?.projectName ?? "Event")
+ .navigationBarTitleDisplayMode(.inline)
+ .toolbar {
+ ToolbarItem(placement: .topBarLeading) {
+ Button("Close", systemImage: "xmark") { dismiss() }
+ }
+ if let event {
+ ToolbarItem(placement: .topBarTrailing) {
+ ShareLink(item: event.data.pretty, subject: Text(event.title)) {
+ Image(systemName: "square.and.arrow.up")
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private var content: some View {
+ ScrollView {
+ VStack(alignment: .leading, spacing: DS.Space.s4) {
+ if let event {
+ summary(event)
+ sections(event)
+ raw(event)
+ } else if let error {
+ offline(error)
+ } else {
+ loading
+ }
+ }
+ .padding(DS.Space.s4)
+ }
+ .background(DS.Colors.bg)
+ .task(id: route.id) { await load() }
+ }
+
+ // MARK: Pieces
+
+ private func summary(_ e: Event) -> some View {
+ Card {
+ VStack(alignment: .leading, spacing: 8) {
+ HStack(spacing: 8) {
+ ProjectIcon(icon: e.projectIcon, size: 14)
+ Text(e.projectName).font(DS.Text.meta).foregroundStyle(DS.Colors.textSecondary)
+ Text("·").foregroundStyle(DS.Colors.textFaint)
+ LevelBadge(level: e.level)
+ if !e.source.isEmpty {
+ Text("·").foregroundStyle(DS.Colors.textFaint)
+ Text(e.source).font(DS.Text.meta).foregroundStyle(DS.Colors.textMuted)
+ }
+ }
+ Text(e.title)
+ .font(DS.Text.metric)
+ .foregroundStyle(DS.Colors.ink)
+ .textSelection(.enabled)
+ if !e.body.isEmpty {
+ Text(e.body)
+ .font(DS.Text.statusLine)
+ .foregroundStyle(DS.Colors.textSecondary)
+ .textSelection(.enabled)
+ }
+ Rectangle().fill(DS.Colors.borderHairline).frame(height: 1).padding(.vertical, 6)
+ LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible())], alignment: .leading, spacing: 12) {
+ Fact(label: "Occurred", value: Formatting.full(e.occurredAt))
+ Fact(label: "Received", value: Formatting.full(e.createdAt))
+ if !e.type.isEmpty { Fact(label: "Type", value: e.type) }
+ if !e.fingerprint.isEmpty { Fact(label: "Fingerprint", value: e.fingerprint, mono: true) }
+ if let ext = e.externalID, !ext.isEmpty { Fact(label: "External id", value: ext, mono: true) }
+ Fact(label: "Event id", value: e.id, mono: true)
+ }
+ }
+ }
+ }
+
+ @ViewBuilder
+ private func sections(_ e: Event) -> some View {
+ let s = e.sections
+ if let exc = s.exception {
+ Card(title: "Exception") {
+ VStack(alignment: .leading, spacing: 6) {
+ if let t = exc["type"]?.display { Text(t).font(DS.Text.rowTitle).foregroundStyle(DS.Colors.ink) }
+ if let m = exc["message"]?.display {
+ Text(m).font(DS.Text.code).foregroundStyle(DS.Colors.textSecondary).textSelection(.enabled)
+ }
+ ForEach(exc.keys.filter { $0 != "type" && $0 != "message" }.sorted(), id: \.self) { k in
+ JSONTreeView(name: k, value: exc[k]!, depth: 0, expanded: false)
+ }
+ }
+ }
+ }
+ if let frames = s.frames {
+ Card(title: "Stacktrace") {
+ VStack(spacing: DS.Space.s1) {
+ ForEach(frames) { f in
+ StackFrameRow(frame: f)
+ }
+ }
+ }
+ }
+ if let tags = s.tags, !tags.isEmpty {
+ Card(title: "Tags") {
+ FlowLayout(spacing: 8) {
+ ForEach(tags, id: \.0) { k, v in
+ HStack(spacing: 5) {
+ Text(k).font(DS.Text.small).fontWeight(.medium).foregroundStyle(DS.Colors.textMuted)
+ Text(v.display).font(DS.Text.small).foregroundStyle(DS.Colors.ink)
+ }
+ .padding(.horizontal, 10)
+ .padding(.vertical, 5)
+ .background(DS.Colors.bgHover, in: Capsule())
+ .overlay(Capsule().stroke(DS.Colors.ink.opacity(0.06)))
+ }
+ }
+ }
+ }
+ if let ctx = s.context, !ctx.isEmpty {
+ Card(title: "Context") {
+ VStack(alignment: .leading, spacing: 10) {
+ ForEach(ctx, id: \.0) { k, v in
+ if v.isContainer {
+ JSONTreeView(name: k, value: v, depth: 0, expanded: true)
+ } else {
+ HStack(alignment: .firstTextBaseline, spacing: 12) {
+ Text(k).font(DS.Text.caption).foregroundStyle(DS.Colors.textMuted).frame(width: 110, alignment: .leading)
+ Text(v.display).font(DS.Text.code).foregroundStyle(DS.Colors.ink).textSelection(.enabled)
+ }
+ }
+ }
+ }
+ }
+ }
+ if let bcs = s.breadcrumbs, !bcs.isEmpty {
+ Card(title: "Breadcrumbs") {
+ VStack(alignment: .leading, spacing: 8) {
+ ForEach(bcs) { b in
+ HStack(alignment: .firstTextBaseline, spacing: 10) {
+ Text(b.timestamp).font(DS.Text.caption).foregroundStyle(DS.Colors.textMuted).frame(width: 64, alignment: .leading)
+ Text(b.category).font(DS.Text.caption).foregroundStyle(DS.Colors.textSecondary).frame(width: 80, alignment: .leading)
+ Text(b.message).font(DS.Text.meta).foregroundStyle(DS.Colors.ink)
+ }
+ }
+ }
+ }
+ }
+ if !s.rest.isEmpty {
+ Card(title: "Data") {
+ VStack(alignment: .leading, spacing: 2) {
+ ForEach(s.rest, id: \.0) { k, v in
+ JSONTreeView(name: k, value: v, depth: 0, expanded: true)
+ }
+ }
+ }
+ }
+ }
+
+ private func raw(_ e: Event) -> some View {
+ Card {
+ HStack {
+ Text("Raw JSON").font(DS.Text.setting).foregroundStyle(DS.Colors.ink)
+ Spacer()
+ Button(showRaw ? "Hide" : "Show") { withAnimation(DS.Motion.snappy) { showRaw.toggle() } }
+ .buttonStyle(.boopGhost)
+ }
+ if showRaw {
+ CodeBlock(text: e.data.pretty)
+ .transition(.opacity.combined(with: .move(edge: .top)))
+ }
+ }
+ }
+
+ private var loading: some View {
+ VStack(spacing: 12) {
+ if let s = route.summary {
+ Card {
+ Text(s.title).font(DS.Text.metric).foregroundStyle(DS.Colors.ink)
+ if !s.body.isEmpty { Text(s.body).font(DS.Text.statusLine).foregroundStyle(DS.Colors.textSecondary) }
+ }
+ }
+ ProgressView().tint(DS.Colors.accent).padding(.top, DS.Space.s5)
+ }
+ }
+
+ private func offline(_ message: String) -> some View {
+ VStack(spacing: DS.Space.s4) {
+ if let s = route.summary {
+ Card {
+ Text(s.title).font(DS.Text.metric).foregroundStyle(DS.Colors.ink)
+ if !s.body.isEmpty { Text(s.body).font(DS.Text.statusLine).foregroundStyle(DS.Colors.textSecondary) }
+ Text("From the notification · full details unavailable")
+ .font(DS.Text.caption).foregroundStyle(DS.Colors.textMuted)
+ }
+ }
+ Notice(tone: .bad, text: message)
+ Button("Retry") { Task { await load() } }.buttonStyle(.boopSecondary)
+ }
+ }
+
+ private func load() async {
+ guard let client = session.client else { return }
+ error = nil
+ do {
+ let e = try await client.event(id: route.id)
+ event = e
+ } catch {
+ self.error = (error as? APIError)?.message ?? error.localizedDescription
+ }
+ }
+}
+
+struct StackFrameRow: View {
+ let frame: StackFrame
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 2) {
+ Text(frame.function).font(DS.Text.ui).foregroundStyle(DS.Colors.ink)
+ if !frame.file.isEmpty {
+ HStack(spacing: 0) {
+ Text(frame.file).font(DS.Text.code).foregroundStyle(DS.Colors.textSecondary)
+ if let line = frame.line {
+ Text(":").font(DS.Text.code).foregroundStyle(DS.Colors.textFaint)
+ Text(line).font(DS.Text.code).foregroundStyle(DS.Colors.textSecondary)
+ }
+ }
+ .lineLimit(2)
+ }
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.horizontal, 12)
+ .padding(.vertical, 8)
+ .background(frame.inApp ? DS.Colors.accentTint : DS.Colors.bgHover, in: RoundedRectangle(cornerRadius: DS.Radius.row, style: .continuous))
+ .overlay {
+ if frame.inApp {
+ RoundedRectangle(cornerRadius: DS.Radius.row, style: .continuous).stroke(DS.Colors.ink.opacity(0.06))
+ }
+ }
+ }
+}
+
+/// Wrapping horizontal layout for tag pills.
+struct FlowLayout: Layout {
+ var spacing: CGFloat = 8
+
+ func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize {
+ let width = proposal.width ?? .infinity
+ var x: CGFloat = 0, y: CGFloat = 0, rowH: CGFloat = 0
+ for s in subviews {
+ let size = s.sizeThatFits(.unspecified)
+ if x + size.width > width, x > 0 { x = 0; y += rowH + spacing; rowH = 0 }
+ x += size.width + spacing
+ rowH = max(rowH, size.height)
+ }
+ return CGSize(width: width == .infinity ? x : width, height: y + rowH)
+ }
+
+ func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) {
+ var x = bounds.minX, y = bounds.minY, rowH: CGFloat = 0
+ for s in subviews {
+ let size = s.sizeThatFits(.unspecified)
+ if x + size.width > bounds.maxX, x > bounds.minX { x = bounds.minX; y += rowH + spacing; rowH = 0 }
+ s.place(at: CGPoint(x: x, y: y), proposal: .unspecified)
+ x += size.width + spacing
+ rowH = max(rowH, size.height)
+ }
+ }
+}
diff --git a/ios/Boop/Screens/InboxView.swift b/ios/Boop/Screens/InboxView.swift
new file mode 100644
index 0000000..0ae9acb
--- /dev/null
+++ b/ios/Boop/Screens/InboxView.swift
@@ -0,0 +1,272 @@
+import SwiftUI
+
+@MainActor
+@Observable
+final class InboxModel {
+ var events: [Event] = []
+ var cursor: String?
+ var loading = false
+ var loadingMore = false
+ var error: String?
+ var level: Level?
+ var project: String?
+ private(set) var loadedOnce = false
+
+ var projects: [Project] {
+ var seen = Set<String>()
+ return events.compactMap { e in
+ guard seen.insert(e.projectID).inserted else { return nil }
+ return Project(id: e.projectID, name: e.projectName, slug: e.projectSlug, icon: e.projectIcon)
+ }.sorted { $0.name < $1.name }
+ }
+
+ struct Group: Identifiable {
+ let label: String
+ let events: [Event]
+ var id: String { label }
+ }
+
+ var groups: [Group] {
+ var out: [Group] = []
+ for e in events {
+ let label = Formatting.dayGroup(e.createdAt)
+ if let last = out.last, last.label == label {
+ out[out.count - 1] = Group(label: label, events: last.events + [e])
+ } else {
+ out.append(Group(label: label, events: [e]))
+ }
+ }
+ return out
+ }
+
+ func refresh(_ client: APIClient) async {
+ loading = true
+ error = nil
+ defer { loading = false; loadedOnce = true }
+ do {
+ let page = try await client.events(project: project, level: level)
+ withAnimation(DS.Motion.settle) {
+ events = page.events
+ cursor = page.nextCursor
+ }
+ } catch {
+ self.error = (error as? APIError)?.message ?? error.localizedDescription
+ }
+ }
+
+ func loadMore(_ client: APIClient) async {
+ guard let cursor, !loadingMore else { return }
+ loadingMore = true
+ defer { loadingMore = false }
+ do {
+ let page = try await client.events(project: project, level: level, before: cursor)
+ let known = Set(events.map(\.id))
+ withAnimation(DS.Motion.settle) {
+ events += page.events.filter { !known.contains($0.id) }
+ self.cursor = page.nextCursor
+ }
+ } catch {
+ self.error = (error as? APIError)?.message ?? error.localizedDescription
+ }
+ }
+}
+
+struct InboxView: View {
+ @Environment(AppSession.self) private var session
+ @Binding var selected: EventRoute?
+ @State private var model = InboxModel()
+
+ var body: some View {
+ NavigationStack {
+ list
+ .background(DS.Colors.bg)
+ .navigationTitle("Inbox")
+ .navigationBarTitleDisplayMode(.large)
+ .toolbar { toolbar }
+ .sheet(item: $selected) { route in
+ EventDetailView(route: route)
+ .presentationDetents([.fraction(0.75), .large])
+ .presentationDragIndicator(.visible)
+ .presentationBackground(DS.Colors.bg)
+ .presentationCornerRadius(DS.Radius.card + 10)
+ }
+ .refreshable { await reload() }
+ .task { if !model.loadedOnce { await reload() } }
+ .onChange(of: model.level) { Task { await reload() } }
+ .onChange(of: model.project) { Task { await reload() } }
+ }
+ }
+
+ @ViewBuilder
+ private var list: some View {
+ if model.loading && model.events.isEmpty {
+ skeleton
+ } else if let error = model.error, model.events.isEmpty {
+ VStack(spacing: DS.Space.s4) {
+ EmptyState(title: "Can't reach your server", message: error, systemImage: "wifi.exclamationmark")
+ Button("Retry") { Task { await reload() } }.buttonStyle(.boopGhost)
+ }
+ } else if model.events.isEmpty {
+ EmptyState(
+ title: model.level == nil && model.project == nil ? "No events yet" : "Nothing matches",
+ message: model.level == nil && model.project == nil
+ ? "Send one with curl or a client and it will show up here."
+ : "Try clearing the filters.",
+ systemImage: "tray"
+ )
+ } else {
+ List {
+ ForEach(model.groups) { group in
+ Section {
+ ForEach(group.events) { event in
+ Button {
+ selected = EventRoute(id: event.id, summary: nil)
+ } label: {
+ EventRow(event: event)
+ }
+ .buttonStyle(RowButtonStyle())
+ .listRowInsets(EdgeInsets(top: 0, leading: DS.Space.s4, bottom: 0, trailing: DS.Space.s4))
+ .listRowSeparatorTint(DS.Colors.borderHairline)
+ .listRowBackground(DS.Colors.bg)
+ .transition(.opacity.combined(with: .move(edge: .top)))
+ }
+ } header: {
+ Text(group.label)
+ .font(DS.Text.caption)
+ .foregroundStyle(DS.Colors.textFaint)
+ .textCase(nil)
+ }
+ }
+ if model.cursor != nil {
+ HStack {
+ Spacer()
+ ProgressView().tint(DS.Colors.accent)
+ Spacer()
+ }
+ .listRowBackground(DS.Colors.bg)
+ .listRowSeparator(.hidden)
+ .task { if let c = session.client { await model.loadMore(c) } }
+ }
+ }
+ .listStyle(.plain)
+ .scrollContentBackground(.hidden)
+ .animation(DS.Motion.settle, value: model.events)
+ }
+ }
+
+ private var skeleton: some View {
+ VStack(spacing: 0) {
+ ForEach(0..<6, id: \.self) { i in
+ HStack(spacing: 12) {
+ RoundedRectangle(cornerRadius: 4).fill(DS.Colors.borderHairline).frame(width: 60, height: 12)
+ VStack(alignment: .leading, spacing: 6) {
+ RoundedRectangle(cornerRadius: 4).fill(DS.Colors.borderHairline).frame(width: 160 + CGFloat(i % 3) * 30, height: 14)
+ RoundedRectangle(cornerRadius: 4).fill(DS.Colors.borderHairline).frame(width: 220, height: 11)
+ }
+ Spacer()
+ }
+ .padding(.horizontal, DS.Space.s4)
+ .padding(.vertical, 14)
+ }
+ Spacer()
+ }
+ .modifier(Shimmer())
+ }
+
+ @ToolbarContentBuilder
+ private var toolbar: some ToolbarContent {
+ ToolbarItem(placement: .topBarTrailing) {
+ Menu {
+ Picker("Level", selection: $model.level) {
+ Text("All levels").tag(Level?.none)
+ ForEach(Level.allCases) { l in
+ Label { Text(l.label) } icon: { Image(uiImage: IconShape.circle.image(l.strong, size: 14)) }
+ .tag(Level?.some(l))
+ }
+ }
+ if !model.projects.isEmpty {
+ Picker("Project", selection: $model.project) {
+ Text("All projects").tag(String?.none)
+ ForEach(model.projects) { p in
+ if let parsed = ProjectIcon.parse(p.icon) {
+ Label { Text(p.name) } icon: { Image(uiImage: parsed.shape.image(parsed.color, size: 16)) }
+ .tag(String?.some(p.id))
+ } else {
+ Text(p.icon.isEmpty ? p.name : "\(p.icon) \(p.name)").tag(String?.some(p.id))
+ }
+ }
+ }
+ }
+ } label: {
+ Image(systemName: model.level != nil || model.project != nil ? "line.3.horizontal.decrease.circle.fill" : "line.3.horizontal.decrease.circle")
+ }
+ .tint(DS.Colors.accent)
+ }
+ }
+
+ private func reload() async {
+ guard let client = session.client else { return }
+ await model.refresh(client)
+ }
+}
+
+struct EventRow: View {
+ let event: Event
+
+ var body: some View {
+ HStack(alignment: .top, spacing: 12) {
+ VStack(alignment: .leading, spacing: 3) {
+ HStack(spacing: 6) {
+ ProjectIcon(icon: event.projectIcon, size: 12)
+ Text(event.projectName).font(DS.Text.caption).foregroundStyle(DS.Colors.textSecondary)
+ Text("·").foregroundStyle(DS.Colors.textFaint).font(DS.Text.caption)
+ LevelBadge(level: event.level)
+ }
+ Text(event.title)
+ .font(DS.Text.rowTitle)
+ .foregroundStyle(DS.Colors.ink)
+ .lineLimit(1)
+ if !event.body.isEmpty {
+ Text(event.body)
+ .font(DS.Text.meta)
+ .foregroundStyle(DS.Colors.textMuted)
+ .lineLimit(2)
+ }
+ }
+ Spacer(minLength: 8)
+ Text(Formatting.relative(event.createdAt))
+ .font(DS.Text.caption)
+ .foregroundStyle(DS.Colors.textMuted)
+ .monospacedDigit()
+ }
+ .padding(.vertical, 12)
+ .contentShape(Rectangle())
+ }
+}
+
+/// Rows tint to bg-hover on press, no scale.
+struct RowButtonStyle: ButtonStyle {
+ func makeBody(configuration: Configuration) -> some View {
+ configuration.label
+ .background(configuration.isPressed ? DS.Colors.bgHover : .clear, in: RoundedRectangle(cornerRadius: DS.Radius.control, style: .continuous))
+ .animation(DS.Motion.gentle, value: configuration.isPressed)
+ }
+}
+
+/// Soft shimmer for skeleton rows.
+struct Shimmer: ViewModifier {
+ @State private var phase: CGFloat = -1
+
+ func body(content: Content) -> some View {
+ content
+ .overlay {
+ LinearGradient(colors: [.clear, DS.Colors.bg.opacity(0.8), .clear], startPoint: .leading, endPoint: .trailing)
+ .offset(x: phase * 400)
+ .blendMode(.plusLighter)
+ }
+ .mask(content)
+ .onAppear {
+ withAnimation(.linear(duration: 1.3).repeatForever(autoreverses: false)) { phase = 1.5 }
+ }
+ }
+}
diff --git a/ios/Boop/Screens/PairingView.swift b/ios/Boop/Screens/PairingView.swift
new file mode 100644
index 0000000..b3f1523
--- /dev/null
+++ b/ios/Boop/Screens/PairingView.swift
@@ -0,0 +1,216 @@
+import SwiftUI
+import VisionKit
+
+struct PairingView: View {
+ @Environment(AppSession.self) private var session
+ @Environment(PushManager.self) private var push
+
+ enum Mode { case welcome, scan, manual, pairing, done }
+ @State private var mode: Mode = .welcome
+ @State private var server = ""
+ @State private var token = ""
+ @State private var error: String?
+ @State private var device: Device?
+
+ var body: some View {
+ VStack(spacing: 0) {
+ header
+ Group {
+ switch mode {
+ case .welcome: welcome
+ case .scan: scanner
+ case .manual: manual
+ case .pairing: pairing
+ case .done: done
+ }
+ }
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ .transition(.asymmetric(insertion: .move(edge: .trailing).combined(with: .opacity), removal: .opacity))
+ .id(mode)
+ }
+ .animation(DS.Motion.settle, value: mode)
+ .background(DS.Colors.bg)
+ }
+
+ private var header: some View {
+ HStack {
+ Wordmark()
+ Spacer()
+ if mode == .scan || mode == .manual {
+ Button("Cancel") { withAnimation { mode = .welcome; error = nil } }
+ .buttonStyle(.boopGhost)
+ }
+ }
+ .padding(.horizontal, DS.Space.pagePad)
+ .padding(.vertical, 14)
+ }
+
+ // MARK: Screens
+
+ private var welcome: some View {
+ VStack(alignment: .leading, spacing: DS.Space.s5) {
+ Spacer()
+ Text("Welcome to Boop")
+ .font(DS.Text.title)
+ .foregroundStyle(DS.Colors.ink)
+ Text("Boop connects directly to your self-hosted server. Nothing passes through anyone else.")
+ .font(DS.Text.statusLine)
+ .foregroundStyle(DS.Colors.textSecondary)
+ .fixedSize(horizontal: false, vertical: true)
+ Spacer()
+ if let error {
+ Notice(tone: .bad, text: error)
+ }
+ VStack(spacing: 10) {
+ Button {
+ withAnimation { mode = DataScannerViewController.isSupported ? .scan : .manual }
+ } label: {
+ Label("Pair server", systemImage: "qrcode.viewfinder")
+ }
+ .buttonStyle(.boopPrimary)
+ Button("Enter details manually") { withAnimation { mode = .manual } }
+ .buttonStyle(.boopGhost)
+ }
+ Text("Open your Boop web UI, go to Devices, and tap Pair iPhone to show a code.")
+ .font(DS.Text.caption)
+ .foregroundStyle(DS.Colors.textMuted)
+ .frame(maxWidth: .infinity)
+ .multilineTextAlignment(.center)
+ }
+ .padding(DS.Space.pagePad)
+ }
+
+ private var scanner: some View {
+ VStack(spacing: DS.Space.s4) {
+ QRScannerView { text in
+ handle(scanned: text)
+ }
+ .clipShape(RoundedRectangle(cornerRadius: DS.Radius.card, style: .continuous))
+ .overlay(RoundedRectangle(cornerRadius: DS.Radius.card, style: .continuous).stroke(DS.Colors.borderHairline))
+ .overlay { ScanReticle() }
+ Text("Point the camera at the pairing code")
+ .font(DS.Text.meta)
+ .foregroundStyle(DS.Colors.textSecondary)
+ if let error {
+ Notice(tone: .bad, text: error)
+ }
+ Button("Enter details manually") { withAnimation { mode = .manual } }
+ .buttonStyle(.boopGhost)
+ }
+ .padding(DS.Space.pagePad)
+ }
+
+ private var manual: some View {
+ ScrollView {
+ VStack(alignment: .leading, spacing: DS.Space.s4) {
+ Text("Pair manually").font(DS.Text.metric).foregroundStyle(DS.Colors.ink)
+ Text("Use Show payload under the QR code in the web UI to see these values.")
+ .font(DS.Text.meta).foregroundStyle(DS.Colors.textSecondary)
+ VStack(alignment: .leading, spacing: 6) {
+ Text("Server").font(DS.Text.caption).foregroundStyle(DS.Colors.textMuted)
+ BoopTextField(placeholder: "https://boop.example.com", text: $server)
+ .keyboardType(.URL)
+ }
+ VStack(alignment: .leading, spacing: 6) {
+ Text("Pairing token").font(DS.Text.caption).foregroundStyle(DS.Colors.textMuted)
+ BoopTextField(placeholder: "pair_…", text: $token, mono: true)
+ }
+ if let error {
+ Notice(tone: .bad, text: error)
+ }
+ Button("Pair") {
+ do {
+ let p = try PairingPayload.manual(server: server, token: token)
+ start(p)
+ } catch {
+ self.error = error.localizedDescription
+ }
+ }
+ .buttonStyle(.boopPrimary)
+ .disabled(server.isEmpty || token.isEmpty)
+ }
+ .padding(DS.Space.pagePad)
+ }
+ .scrollDismissesKeyboard(.interactively)
+ }
+
+ private var pairing: some View {
+ VStack(spacing: DS.Space.s4) {
+ ProgressView().tint(DS.Colors.accent).controlSize(.large)
+ Text("Pairing with your server").font(DS.Text.statusLine).foregroundStyle(DS.Colors.textSecondary)
+ }
+ }
+
+ private var done: some View {
+ VStack(spacing: DS.Space.s4) {
+ Spacer()
+ Image(systemName: "checkmark.circle.fill")
+ .font(.system(size: 56, weight: .medium))
+ .foregroundStyle(DS.Colors.ok)
+ .symbolEffect(.bounce, options: .nonRepeating)
+ Text("Paired").font(DS.Text.metric).foregroundStyle(DS.Colors.ink)
+ if let device {
+ Text("\(device.name) is connected to \(session.serverURL?.host() ?? "your server").")
+ .font(DS.Text.meta).foregroundStyle(DS.Colors.textSecondary).multilineTextAlignment(.center)
+ }
+ Spacer()
+ Text("Next, allow notifications so Boop can reach you.")
+ .font(DS.Text.caption).foregroundStyle(DS.Colors.textMuted)
+ Button("Continue") {
+ Task {
+ await push.requestAndRegister()
+ withAnimation(DS.Motion.settle) { session.onboarding = false }
+ await session.checkConnection()
+ }
+ }
+ .buttonStyle(.boopPrimary)
+ }
+ .padding(DS.Space.pagePad)
+ }
+
+ // MARK: Actions
+
+ private func handle(scanned text: String) {
+ guard mode == .scan else { return }
+ do {
+ start(try PairingPayload.parse(text))
+ } catch {
+ self.error = error.localizedDescription
+ }
+ }
+
+ private func start(_ payload: PairingPayload) {
+ error = nil
+ withAnimation { mode = .pairing }
+ Task {
+ do {
+ let d = try await session.pair(payload)
+ device = d
+ withAnimation { mode = .done }
+ // Hold on the success screen; the root view swaps to the inbox when the user continues.
+ } catch {
+ self.error = (error as? APIError)?.message ?? error.localizedDescription
+ withAnimation { mode = payload.token == token ? .manual : .welcome }
+ }
+ }
+ }
+}
+
+/// Corner brackets over the camera preview.
+private struct ScanReticle: View {
+ @State private var breathe = false
+
+ var body: some View {
+ GeometryReader { geo in
+ let side = min(geo.size.width, geo.size.height) * 0.62
+ RoundedRectangle(cornerRadius: DS.Radius.card, style: .continuous)
+ .strokeBorder(DS.Colors.bg.opacity(0.9), lineWidth: 2)
+ .frame(width: side, height: side)
+ .scaleEffect(breathe ? 1.02 : 0.98)
+ .position(x: geo.size.width / 2, y: geo.size.height / 2)
+ .animation(.easeInOut(duration: 1.6).repeatForever(autoreverses: true), value: breathe)
+ .onAppear { breathe = true }
+ }
+ .allowsHitTesting(false)
+ }
+}
diff --git a/ios/Boop/Screens/RootView.swift b/ios/Boop/Screens/RootView.swift
new file mode 100644
index 0000000..f8f7d9b
--- /dev/null
+++ b/ios/Boop/Screens/RootView.swift
@@ -0,0 +1,54 @@
+import SwiftUI
+
+struct RootView: View {
+ @Environment(AppSession.self) private var session
+ @Environment(PushManager.self) private var push
+
+ var body: some View {
+ ZStack {
+ DS.Colors.bg.ignoresSafeArea()
+ if session.isPaired && !session.onboarding {
+ MainTabs()
+ .transition(.opacity.combined(with: .scale(scale: 0.98)))
+ } else {
+ PairingView()
+ .transition(.opacity)
+ }
+ }
+ .animation(DS.Motion.settle, value: session.isPaired && !session.onboarding)
+ }
+}
+
+private struct MainTabs: View {
+ @Environment(PushManager.self) private var push
+ @State private var selected: EventRoute?
+ @State private var tab: Section = .inbox
+
+ enum Section: Hashable { case inbox, settings }
+
+ var body: some View {
+ TabView(selection: $tab) {
+ Tab("Inbox", systemImage: "tray.full", value: Section.inbox) {
+ InboxView(selected: $selected)
+ }
+ Tab("Settings", systemImage: "slider.horizontal.3", value: Section.settings) {
+ SettingsView()
+ }
+ }
+ .onChange(of: push.pendingEventID) { _, id in
+ guard let id else { return }
+ tab = .inbox
+ selected = EventRoute(id: id, summary: push.pendingSummary)
+ push.pendingEventID = nil
+ }
+ }
+}
+
+/// Navigation destination for an event, carrying the push title/body as a fallback.
+struct EventRoute: Hashable, Identifiable {
+ let id: String
+ var summary: (title: String, body: String)?
+
+ static func == (a: EventRoute, b: EventRoute) -> Bool { a.id == b.id }
+ func hash(into hasher: inout Hasher) { hasher.combine(id) }
+}
diff --git a/ios/Boop/Screens/SettingsView.swift b/ios/Boop/Screens/SettingsView.swift
new file mode 100644
index 0000000..3347acb
--- /dev/null
+++ b/ios/Boop/Screens/SettingsView.swift
@@ -0,0 +1,121 @@
+import SwiftUI
+import UserNotifications
+
+struct SettingsView: View {
+ @Environment(AppSession.self) private var session
+ @Environment(PushManager.self) private var push
+ @State private var name = ""
+ @State private var confirmDisconnect = false
+ @State private var rePair = false
+
+ var body: some View {
+ NavigationStack {
+ ScrollView {
+ VStack(spacing: DS.Space.s4) {
+ serverCard
+ deviceCard
+ notificationsCard
+ aboutCard
+ }
+ .padding(DS.Space.s4)
+ }
+ .background(DS.Colors.bg)
+ .navigationTitle("Settings")
+ .task {
+ name = session.deviceName
+ await push.refreshAuthorization()
+ await session.checkConnection()
+ }
+ .refreshable {
+ await push.refreshAuthorization()
+ await session.checkConnection()
+ }
+ .confirmationDialog("Disconnect from this server?", isPresented: $confirmDisconnect, titleVisibility: .visible) {
+ Button("Disconnect", role: .destructive) { Task { await session.disconnect() } }
+ Button("Cancel", role: .cancel) {}
+ } message: {
+ Text("The device is removed from the server and pushes stop. You can pair again any time.")
+ }
+ }
+ }
+
+ private var serverCard: some View {
+ Card(title: "Server") {
+ VStack(alignment: .leading, spacing: 8) {
+ Text(session.serverURL?.absoluteString ?? "—")
+ .font(DS.Text.code).foregroundStyle(DS.Colors.ink).textSelection(.enabled)
+ connectionStatus
+ .animation(DS.Motion.gentle, value: session.connection)
+ }
+ SettingRow(label: "Re-pair", hint: "Scan a new code, for example after moving the server.") {
+ Button("Re-pair") { session.forget() }.buttonStyle(BoopButtonStyle(variant: .secondary))
+ }
+ SettingRow(label: "Disconnect", hint: "Removes this phone from the server.") {
+ Button("Disconnect") { confirmDisconnect = true }.buttonStyle(BoopButtonStyle(variant: .danger))
+ }
+ }
+ }
+
+ @ViewBuilder
+ private var connectionStatus: some View {
+ switch session.connection {
+ case .unknown: StatusDot(tone: .muted, text: "Not checked")
+ case .checking: StatusDot(tone: .muted, text: "Checking")
+ case .connected: StatusDot(tone: .ok, text: "Connected")
+ case .unauthorized: StatusDot(tone: .bad, text: "Credential rejected · re-pair")
+ case .unreachable(let why): StatusDot(tone: .bad, text: "Unreachable · \(why)")
+ }
+ }
+
+ private var deviceCard: some View {
+ Card(title: "Device") {
+ SettingRow(label: "Name", hint: "Shown in the web UI's device list.") {
+ BoopTextField(placeholder: "iPhone", text: $name)
+ .frame(width: 170)
+ .onSubmit { Task { await session.rename(name) } }
+ }
+ SettingRow(label: "Push registration", hint: session.pushRegistered ? "APNs token is on the server." : "No APNs token yet. Push registration fails in the simulator.") {
+ StatusDot(tone: session.pushRegistered ? .ok : .warn, text: session.pushRegistered ? "Registered" : "Not registered")
+ }
+ if let err = push.lastError {
+ Text(err).font(DS.Text.caption).foregroundStyle(DS.Colors.textMuted)
+ }
+ }
+ }
+
+ private var notificationsCard: some View {
+ Card(title: "Notifications") {
+ SettingRow(label: "Permission") {
+ switch push.authorization {
+ case .authorized, .provisional, .ephemeral: StatusDot(tone: .ok, text: "Allowed")
+ case .denied: StatusDot(tone: .bad, text: "Denied")
+ case .notDetermined: StatusDot(tone: .warn, text: "Not asked")
+ @unknown default: StatusDot(tone: .muted, text: "Unknown")
+ }
+ }
+ if push.authorization == .denied {
+ Button("Open iOS Settings") {
+ if let url = URL(string: UIApplication.openSettingsURLString) { UIApplication.shared.open(url) }
+ }
+ .buttonStyle(.boopSecondary)
+ } else if push.authorization == .notDetermined {
+ Button("Allow notifications") { Task { await push.requestAndRegister() } }
+ .buttonStyle(.boopPrimary)
+ } else {
+ Button("Re-register with APNs") { Task { await push.requestAndRegister() } }
+ .buttonStyle(.boopGhost)
+ }
+ }
+ }
+
+ private var aboutCard: some View {
+ Card(title: "About") {
+ LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible())], alignment: .leading, spacing: 12) {
+ Fact(label: "App version", value: Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "—")
+ Fact(label: "Bundle id", value: Bundle.main.bundleIdentifier ?? "—", mono: true)
+ }
+ Text("Boop is open source. This build is signed with your own Apple team; the bundle id must match APNS_BUNDLE_ID on your server.")
+ .font(DS.Text.caption).foregroundStyle(DS.Colors.textMuted)
+ }
+ }
+}
diff --git a/ios/BoopTests/APIClientTests.swift b/ios/BoopTests/APIClientTests.swift
new file mode 100644
index 0000000..9598b47
--- /dev/null
+++ b/ios/BoopTests/APIClientTests.swift
@@ -0,0 +1,81 @@
+import XCTest
+@testable import Boop
+
+/// Intercepts URLSession traffic so the client can be tested without a server.
+final class StubProtocol: URLProtocol {
+ nonisolated(unsafe) static var handler: ((URLRequest) -> (Int, Data))?
+
+ override class func canInit(with request: URLRequest) -> Bool { true }
+ override class func canonicalRequest(for request: URLRequest) -> URLRequest { request }
+ override func startLoading() {
+ guard let handler = Self.handler else { return }
+ let (status, data) = handler(request)
+ let resp = HTTPURLResponse(url: request.url!, statusCode: status, httpVersion: nil, headerFields: ["Content-Type": "application/json"])!
+ client?.urlProtocol(self, didReceive: resp, cacheStoragePolicy: .notAllowed)
+ client?.urlProtocol(self, didLoad: data)
+ client?.urlProtocolDidFinishLoading(self)
+ }
+ override func stopLoading() {}
+}
+
+final class APIClientTests: XCTestCase {
+ var client: APIClient!
+
+ override func setUp() {
+ let cfg = URLSessionConfiguration.ephemeral
+ cfg.protocolClasses = [StubProtocol.self]
+ client = APIClient(baseURL: URL(string: "https://boop.test")!, credential: "boop_dev_secret", session: URLSession(configuration: cfg))
+ }
+
+ func testEventsSendsBearerAndQuery() async throws {
+ nonisolated(unsafe) var captured: URLRequest?
+ StubProtocol.handler = { req in
+ captured = req
+ return (200, Data(#"{"events":[],"next_cursor":"evt_9"}"#.utf8))
+ }
+ let page = try await client.events(project: "prj_1", level: .error, before: "evt_5", limit: 20)
+ XCTAssertEqual(page.nextCursor, "evt_9")
+ XCTAssertEqual(captured?.value(forHTTPHeaderField: "Authorization"), "Bearer boop_dev_secret")
+ let q = URLComponents(url: captured!.url!, resolvingAgainstBaseURL: false)!.queryItems!
+ XCTAssertEqual(q.first { $0.name == "project" }?.value, "prj_1")
+ XCTAssertEqual(q.first { $0.name == "level" }?.value, "error")
+ XCTAssertEqual(q.first { $0.name == "before" }?.value, "evt_5")
+ XCTAssertEqual(q.first { $0.name == "limit" }?.value, "20")
+ XCTAssertEqual(captured?.url?.path(), "/api/v1/events")
+ }
+
+ func testPairingExchangeIsUnauthenticatedAndPostsJSON() async throws {
+ nonisolated(unsafe) var captured: URLRequest?
+ StubProtocol.handler = { req in
+ captured = req
+ return (201, Data(#"{"device":{"id":"dev_1","name":"Phone","push_registered":false,"platform":"ios","app_bundle_id":"","last_seen_at":null,"created_at":"2026-08-28T12:00:00Z"},"credential":"boop_dev_new"}"#.utf8))
+ }
+ let r = try await client.exchangePairing(token: "pair_x", name: "Phone")
+ XCTAssertEqual(r.credential, "boop_dev_new")
+ XCTAssertEqual(r.device.id, "dev_1")
+ XCTAssertNil(captured?.value(forHTTPHeaderField: "Authorization"))
+ XCTAssertEqual(captured?.httpMethod, "POST")
+ let body = try XCTUnwrap(captured?.httpBody ?? captured?.httpBodyStream.map { s in
+ s.open(); defer { s.close() }
+ var d = Data(); var buf = [UInt8](repeating: 0, count: 1024)
+ while s.hasBytesAvailable { let n = s.read(&buf, maxLength: 1024); if n > 0 { d.append(buf, count: n) } else { break } }
+ return d
+ })
+ let dict = try JSONSerialization.jsonObject(with: body) as? [String: String]
+ XCTAssertEqual(dict?["token"], "pair_x")
+ XCTAssertEqual(dict?["platform"], "ios")
+ }
+
+ func testErrorsSurfaceServerMessage() async {
+ StubProtocol.handler = { _ in (401, Data(#"{"error":"unauthorized","message":"invalid device credential"}"#.utf8)) }
+ do {
+ _ = try await client.event(id: "evt_1")
+ XCTFail("expected error")
+ } catch let e as APIError {
+ XCTAssertTrue(e.isUnauthorized)
+ XCTAssertEqual(e.message, "invalid device credential")
+ } catch {
+ XCTFail("wrong error type \(error)")
+ }
+ }
+}
diff --git a/ios/BoopTests/EventTests.swift b/ios/BoopTests/EventTests.swift
new file mode 100644
index 0000000..b020398
--- /dev/null
+++ b/ios/BoopTests/EventTests.swift
@@ -0,0 +1,60 @@
+import XCTest
+@testable import Boop
+
+final class EventTests: XCTestCase {
+ let rich = """
+ {
+ "id": "evt_1", "external_id": "4f9d", "project_id": "prj_1", "project_name": "Uini", "project_slug": "uini", "project_icon": "",
+ "source": "error_tracker", "type": "error", "level": "error", "title": "KeyError", "body": "key not found", "fingerprint": "fp",
+ "data": {
+ "exception": {"type": "KeyError", "message": "boom"},
+ "stacktrace": [{"file": "lib/a.ex", "line": 49, "function": "A.b/3", "in_app": true}, {"file": "lib/c.ex", "line": 5, "function": "C.d/1", "in_app": false}],
+ "tags": {"environment": "production"},
+ "context": {"user_id": "123", "request": {"path": "/x"}},
+ "breadcrumbs": [{"timestamp": "12:51", "category": "nav", "message": "GET /"}],
+ "custom": {"deep": [1, 2, {"k": "v"}]}
+ },
+ "occurred_at": "2026-08-28T12:51:44Z",
+ "created_at": "2026-08-28T14:10:46.627043000Z"
+ }
+ """
+
+ func testDecodesRichEventAndSections() throws {
+ let e = try APIClient.decoder.decode(Event.self, from: Data(rich.utf8))
+ XCTAssertEqual(e.level, .error)
+ XCTAssertEqual(e.externalID, "4f9d")
+ XCTAssertEqual(Calendar(identifier: .gregorian).component(.year, from: e.createdAt), 2026)
+ // Nanosecond timestamps are accepted and keep millisecond precision.
+ XCTAssertEqual(e.createdAt.timeIntervalSince1970, 1_787_926_246.627, accuracy: 0.001)
+
+ let s = e.sections
+ XCTAssertEqual(s.exception?["type"]?.display, "KeyError")
+ XCTAssertEqual(s.frames?.count, 2)
+ XCTAssertEqual(s.frames?[0].function, "A.b/3")
+ XCTAssertEqual(s.frames?[0].line, "49")
+ XCTAssertTrue(s.frames?[0].inApp ?? false)
+ XCTAssertFalse(s.frames?[1].inApp ?? true)
+ XCTAssertEqual(s.tags?.first?.0, "environment")
+ XCTAssertEqual(s.context?.count, 2)
+ XCTAssertEqual(s.breadcrumbs?.first?.message, "GET /")
+ XCTAssertEqual(s.rest.map(\.0), ["custom"])
+ XCTAssertFalse(s.isEmpty)
+ }
+
+ func testMinimalEventDefaults() throws {
+ let json = #"{"id":"evt_2","project_id":"prj_1","title":"Hi","level":"bogus","occurred_at":"2026-08-28T12:51:44Z","created_at":"2026-08-28T12:51:44Z"}"#
+ let e = try APIClient.decoder.decode(Event.self, from: Data(json.utf8))
+ XCTAssertEqual(e.level, .info)
+ XCTAssertEqual(e.body, "")
+ XCTAssertEqual(e.data, .object([:]))
+ XCTAssertTrue(e.sections.isEmpty)
+ }
+
+ func testJSONValueDisplay() {
+ XCTAssertEqual(JSONValue.number(49).display, "49")
+ XCTAssertEqual(JSONValue.number(1.5).display, "1.5")
+ XCTAssertEqual(JSONValue.array([.null]).display, "[1]")
+ XCTAssertEqual(JSONValue.object(["a": .bool(true)]).display, "{1}")
+ XCTAssertTrue(JSONValue.object(["a": .bool(true)]).pretty.contains("\"a\" : true"))
+ }
+}
diff --git a/ios/BoopTests/FormattingTests.swift b/ios/BoopTests/FormattingTests.swift
new file mode 100644
index 0000000..d44c606
--- /dev/null
+++ b/ios/BoopTests/FormattingTests.swift
@@ -0,0 +1,22 @@
+import XCTest
+@testable import Boop
+
+final class FormattingTests: XCTestCase {
+ let now = Date(timeIntervalSince1970: 1_787_961_600) // 2026-08-29T00:00:00Z
+
+ func testRelative() {
+ XCTAssertEqual(Formatting.relative(now.addingTimeInterval(-10), now: now), "now")
+ XCTAssertEqual(Formatting.relative(now.addingTimeInterval(-120), now: now), "2m")
+ XCTAssertEqual(Formatting.relative(now.addingTimeInterval(-3 * 3600), now: now), "3h")
+ XCTAssertEqual(Formatting.relative(now.addingTimeInterval(-2 * 86400), now: now), "2d")
+ XCTAssertFalse(Formatting.relative(now.addingTimeInterval(-20 * 86400), now: now).hasSuffix("d"))
+ }
+
+ func testDayGroup() {
+ var cal = Calendar(identifier: .gregorian)
+ cal.timeZone = TimeZone(identifier: "UTC")!
+ XCTAssertEqual(Formatting.dayGroup(now.addingTimeInterval(3600), now: now.addingTimeInterval(7200), calendar: cal), "Today")
+ XCTAssertEqual(Formatting.dayGroup(now.addingTimeInterval(-3600), now: now.addingTimeInterval(7200), calendar: cal), "Yesterday")
+ XCTAssertNotEqual(Formatting.dayGroup(now.addingTimeInterval(-10 * 86400), now: now, calendar: cal), "Today")
+ }
+}
diff --git a/ios/BoopTests/PairingPayloadTests.swift b/ios/BoopTests/PairingPayloadTests.swift
new file mode 100644
index 0000000..6bce2fb
--- /dev/null
+++ b/ios/BoopTests/PairingPayloadTests.swift
@@ -0,0 +1,31 @@
+import XCTest
+@testable import Boop
+
+final class PairingPayloadTests: XCTestCase {
+ func testParsesQRPayload() throws {
+ let p = try PairingPayload.parse(#"{"version":1,"server":"https://boop.example.com/","token":"pair_abcdefghijklmnop"}"#)
+ XCTAssertEqual(p.serverURL?.absoluteString, "https://boop.example.com")
+ XCTAssertEqual(p.token, "pair_abcdefghijklmnop")
+ }
+
+ func testRejectsGarbage() {
+ XCTAssertThrowsError(try PairingPayload.parse("hello")) { XCTAssertEqual($0 as? PairingPayload.ParseError, .notJSON) }
+ XCTAssertThrowsError(try PairingPayload.parse(#"{"version":2,"server":"https://x.y","token":"pair_abcdefghijk"}"#)) {
+ XCTAssertEqual($0 as? PairingPayload.ParseError, .unsupportedVersion(2))
+ }
+ XCTAssertThrowsError(try PairingPayload.parse(#"{"version":1,"server":"ftp://x.y","token":"pair_abcdefghijk"}"#)) {
+ XCTAssertEqual($0 as? PairingPayload.ParseError, .badServer)
+ }
+ XCTAssertThrowsError(try PairingPayload.parse(#"{"version":1,"server":"https://x.y","token":"nope"}"#)) {
+ XCTAssertEqual($0 as? PairingPayload.ParseError, .badToken)
+ }
+ }
+
+ func testManualEntryAddsScheme() throws {
+ let p = try PairingPayload.manual(server: " boop.example.com ", token: " pair_abcdefghijklmnop\n")
+ XCTAssertEqual(p.serverURL?.absoluteString, "https://boop.example.com")
+ XCTAssertEqual(p.token, "pair_abcdefghijklmnop")
+ let local = try PairingPayload.manual(server: "http://192.168.1.10:8080", token: "pair_abcdefghijklmnop")
+ XCTAssertEqual(local.serverURL?.absoluteString, "http://192.168.1.10:8080")
+ }
+}
diff --git a/ios/BoopUITests/NotificationTapUITests.swift b/ios/BoopUITests/NotificationTapUITests.swift
new file mode 100644
index 0000000..0225ab5
--- /dev/null
+++ b/ios/BoopUITests/NotificationTapUITests.swift
@@ -0,0 +1,19 @@
+import XCTest
+
+/// Verifies notification tap → event sheet. The push itself must be injected from outside while the test
+/// waits, e.g. `xcrun simctl push booted com.example.Boop push.json`. Skipped unless BOOP_EXPECT_PUSH=1.
+final class NotificationTapUITests: XCTestCase {
+ @MainActor
+ func testTapOpensEventSheet() throws {
+ guard ProcessInfo.processInfo.environment["BOOP_EXPECT_PUSH"] == "1" else { throw XCTSkip("Set BOOP_EXPECT_PUSH=1 and inject a push") }
+ let app = XCUIApplication()
+ app.launch()
+ XCTAssertTrue(app.navigationBars["Inbox"].waitForExistence(timeout: 8))
+ let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
+ let banner = springboard.otherElements["NotificationShortLookView"]
+ XCTAssertTrue(banner.waitForExistence(timeout: 150), "no push banner arrived")
+ banner.tap()
+ XCTAssertTrue(app.staticTexts["Stacktrace"].waitForExistence(timeout: 10), "event sheet should open from the notification")
+ XCTAssertTrue(app.staticTexts["KeyError"].firstMatch.exists)
+ }
+}
diff --git a/ios/BoopUITests/PairingFlowUITests.swift b/ios/BoopUITests/PairingFlowUITests.swift
new file mode 100644
index 0000000..972639d
--- /dev/null
+++ b/ios/BoopUITests/PairingFlowUITests.swift
@@ -0,0 +1,61 @@
+import XCTest
+
+/// End-to-end: pair against a running Boop server (BOOP_TEST_SERVER, default http://localhost:8091),
+/// then check the inbox and an event detail render. Skipped when the server is not reachable.
+final class PairingFlowUITests: XCTestCase {
+ let server = ProcessInfo.processInfo.environment["BOOP_TEST_SERVER"] ?? "http://localhost:8091"
+
+ static func mintToken(_ server: String) async throws -> String? {
+ var req = URLRequest(url: URL(string: server + "/api/v1/pairing")!)
+ req.httpMethod = "POST"
+ req.timeoutInterval = 5
+ guard let (data, _) = try? await URLSession.shared.data(for: req) else { return nil }
+ let obj = try JSONSerialization.jsonObject(with: data) as? [String: Any]
+ return obj?["token"] as? String
+ }
+
+ @MainActor
+ func testPairThenBrowseInbox() async throws {
+ guard let token = try await Self.mintToken(server) else {
+ throw XCTSkip("No Boop server at \(server)")
+ }
+ continueAfterFailure = false
+ let app = XCUIApplication()
+ app.launch()
+
+ // If a previous run left the app paired, reset via Settings → Re-pair.
+ if app.tabBars.buttons["Settings"].waitForExistence(timeout: 3) {
+ app.tabBars.buttons["Settings"].tap()
+ app.buttons["Re-pair"].firstMatch.tap()
+ }
+
+ XCTAssertTrue(app.staticTexts["Welcome to Boop"].waitForExistence(timeout: 5))
+ app.buttons["Enter details manually"].firstMatch.tap()
+
+ let serverField = app.textFields["https://boop.example.com"]
+ XCTAssertTrue(serverField.waitForExistence(timeout: 3))
+ serverField.tap()
+ serverField.typeText(server)
+ let tokenField = app.textFields["pair_…"]
+ tokenField.tap()
+ tokenField.typeText(token)
+ app.buttons["Pair"].firstMatch.tap()
+
+ XCTAssertTrue(app.staticTexts["Paired"].waitForExistence(timeout: 10))
+ app.buttons["Continue"].tap()
+
+ // Notification permission alert (springboard).
+ let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
+ let allow = springboard.buttons["Allow"]
+ if allow.waitForExistence(timeout: 4) { allow.tap() }
+
+ XCTAssertTrue(app.navigationBars["Inbox"].waitForExistence(timeout: 10))
+ let row = app.staticTexts["KeyError"].firstMatch
+ XCTAssertTrue(row.waitForExistence(timeout: 10), "seeded event should be listed")
+ row.tap()
+ XCTAssertTrue(app.staticTexts["Stacktrace"].waitForExistence(timeout: 5))
+ XCTAssertTrue(app.staticTexts["[REDACTED]"].firstMatch.exists)
+ app.buttons["Close"].firstMatch.tap()
+ XCTAssertTrue(app.navigationBars["Inbox"].waitForExistence(timeout: 5))
+ }
+}
diff --git a/ios/BoopUITests/ScreenshotUITests.swift b/ios/BoopUITests/ScreenshotUITests.swift
new file mode 100644
index 0000000..487dde4
--- /dev/null
+++ b/ios/BoopUITests/ScreenshotUITests.swift
@@ -0,0 +1,37 @@
+import XCTest
+
+/// Walks the main screens of an already-paired app and attaches screenshots (for docs and design review).
+/// Run with -only-testing:BoopUITests/ScreenshotUITests against a server that has events.
+final class ScreenshotUITests: XCTestCase {
+ @MainActor
+ func testCaptureScreens() throws {
+ let app = XCUIApplication()
+ app.launch()
+ guard app.navigationBars["Inbox"].waitForExistence(timeout: 8) else { throw XCTSkip("App is not paired") }
+ XCTAssertTrue(app.staticTexts["KeyError"].firstMatch.waitForExistence(timeout: 10))
+ sleep(1)
+ attach(app, "inbox")
+ app.staticTexts["KeyError"].firstMatch.tap()
+ XCTAssertTrue(app.staticTexts["Stacktrace"].waitForExistence(timeout: 5))
+ sleep(1)
+ attach(app, "event-sheet")
+ app.swipeUp()
+ sleep(1)
+ attach(app, "event-sheet-scrolled")
+ app.buttons["Close"].firstMatch.tap()
+ app.navigationBars["Inbox"].buttons.firstMatch.tap()
+ sleep(1)
+ attach(app, "filter-menu")
+ app.tap()
+ app.tabBars.buttons["Settings"].tap()
+ sleep(2)
+ attach(app, "settings")
+ }
+
+ private func attach(_ app: XCUIApplication, _ name: String) {
+ let a = XCTAttachment(screenshot: app.screenshot())
+ a.name = name
+ a.lifetime = .keepAlways
+ add(a)
+ }
+}
diff --git a/ios/README.md b/ios/README.md
new file mode 100644
index 0000000..10361a5
--- /dev/null
+++ b/ios/README.md
@@ -0,0 +1,61 @@
+# Boop for iOS
+
+The native client for a self-hosted [Boop](../README.md) server. You build and sign it yourself with your own Apple Developer account; nothing is distributed through Boop infrastructure.
+
+Requires Xcode 26 and iOS 26.
+
+## Build it
+
+```bash
+open ios/Boop.xcodeproj
+```
+
+Then in Xcode:
+
+1. Select the **Boop** target → **Signing & Capabilities**.
+2. Pick your **Team**.
+3. Change the **Bundle Identifier** from `com.example.Boop` to your own (for example `com.yourname.Boop`). This exact value must also be set as `APNS_BUNDLE_ID` on your server.
+4. Make sure the **Push Notifications** capability is present (it comes from `Boop.entitlements`). Xcode will register the App ID with Apple automatically when signing is set up.
+5. Plug in your iPhone, select it as the run destination, and press Run. Push notifications do not work in the simulator.
+
+`Boop.entitlements` ships with `aps-environment: development`; Xcode switches it to `production` automatically when you archive. Match the server: `APNS_ENVIRONMENT=sandbox` for a debug build installed from Xcode, `production` for TestFlight or an archive.
+
+The project file is generated from `project.yml` with [XcodeGen](https://github.com/yonaskolb/XcodeGen). If you edit `project.yml`, run `xcodegen generate` in `ios/`. Editing the bundle id and team in Xcode is fine too.
+
+## Pair it
+
+1. In the Boop web UI open **Devices** → **Pair iPhone**.
+2. In the app tap **Pair server** and scan the code. There is also **Enter details manually** for the simulator or when the camera is unavailable; the values are under **Show payload** in the web UI.
+3. Allow notifications when asked. The app registers with APNs and sends the token to your server; the device then shows as "Registered" in the web UI.
+4. **Settings → Send test notification** in the web UI should now reach your phone.
+
+The server address in the pairing code comes from `BOOP_BASE_URL`. It must be reachable from the phone (HTTPS in production). For local development, `http://<your-mac-ip>:8080` works: `Info.plist` allows plain-HTTP local networking.
+
+## What it does
+
+- Inbox grouped by day, pull to refresh, cursor pagination, project and level filters.
+- Event detail with exception, stacktrace (in-app frames highlighted), tags, context, breadcrumbs, raw JSON, share.
+- Notification tap opens the event and fetches the latest data; if the server is unreachable the push's title and body are shown with a retry.
+- Device credential is stored in the Keychain. The app never sees project API keys or APNs keys.
+- Re-registers with APNs on every launch and updates the server when the token changes.
+
+## Simulator testing
+
+APNs registration fails in the simulator (expected; the app treats "no token" as normal), but everything else can be exercised:
+
+```bash
+# Pair via "Enter details manually" using a token minted from the server:
+curl -s -X POST http://localhost:8080/api/v1/pairing | jq -r .token
+
+# Deliver a fake push to the simulator to test notification tap → event detail:
+cat > /tmp/push.json <<'JSON'
+{"aps":{"alert":{"title":"Uini · KeyError","body":"key :can_palette? not found"},"sound":"default"},"event_id":"evt_REPLACE","project_id":"prj_REPLACE"}
+JSON
+xcrun simctl push booted com.example.Boop /tmp/push.json
+```
+
+## Tests
+
+```bash
+xcodebuild -project Boop.xcodeproj -scheme Boop -destination 'platform=iOS Simulator,name=iPhone 17 Pro' test
+```
diff --git a/ios/project.yml b/ios/project.yml
new file mode 100644
index 0000000..b17f3b9
--- /dev/null
+++ b/ios/project.yml
@@ -0,0 +1,74 @@
+name: Boop
+options:
+ bundleIdPrefix: com.example
+ deploymentTarget:
+ iOS: "26.0"
+ xcodeVersion: "26.0"
+ createIntermediateGroups: true
+ generateEmptyDirectories: true
+settings:
+ base:
+ SWIFT_VERSION: "6.0"
+ MARKETING_VERSION: "0.1.0"
+ CURRENT_PROJECT_VERSION: "1"
+ # Users set their own team in Xcode (Signing & Capabilities).
+ DEVELOPMENT_TEAM: ""
+ CODE_SIGN_STYLE: Automatic
+ ENABLE_USER_SCRIPT_SANDBOXING: YES
+ SWIFT_STRICT_CONCURRENCY: complete
+ SWIFT_UPCOMING_FEATURE_EXISTENTIAL_ANY: YES
+targets:
+ Boop:
+ type: application
+ platform: iOS
+ sources:
+ - path: Boop
+ excludes:
+ - "Resources/Fonts/OFL.txt"
+ - path: Boop/Resources/Fonts/OFL.txt
+ buildPhase: none
+ settings:
+ base:
+ # Change this to your own bundle identifier. It must match APNS_BUNDLE_ID on the server.
+ PRODUCT_BUNDLE_IDENTIFIER: com.example.Boop
+ CODE_SIGN_ENTITLEMENTS: Boop/Boop.entitlements
+ INFOPLIST_FILE: Boop/Info.plist
+ ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
+ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME: AccentColor
+ TARGETED_DEVICE_FAMILY: "1"
+ SUPPORTS_MACCATALYST: NO
+ INFOPLIST_KEY_UISupportedInterfaceOrientations: UIInterfaceOrientationPortrait
+ INFOPLIST_KEY_UILaunchScreen_Generation: YES
+ BoopTests:
+ type: bundle.unit-test
+ platform: iOS
+ sources: [BoopTests]
+ dependencies:
+ - target: Boop
+ settings:
+ base:
+ PRODUCT_BUNDLE_IDENTIFIER: com.example.BoopTests
+ GENERATE_INFOPLIST_FILE: YES
+ BoopUITests:
+ type: bundle.ui-testing
+ platform: iOS
+ sources: [BoopUITests]
+ dependencies:
+ - target: Boop
+ settings:
+ base:
+ PRODUCT_BUNDLE_IDENTIFIER: com.example.BoopUITests
+ GENERATE_INFOPLIST_FILE: YES
+ TEST_TARGET_NAME: Boop
+schemes:
+ Boop:
+ build:
+ targets:
+ Boop: all
+ BoopTests: [test]
+ BoopUITests: [test]
+ run:
+ config: Debug
+ test:
+ config: Debug
+ targets: [BoopTests, BoopUITests]
diff --git a/server/cmd/boop/main.go b/server/cmd/boop/main.go
index 11787c0..595d08f 100644
--- a/server/cmd/boop/main.go
+++ b/server/cmd/boop/main.go
@@ -16,6 +16,7 @@ import (
"github.com/chrisgregori/boop/server/internal/api"
"github.com/chrisgregori/boop/server/internal/apns"
+ "github.com/chrisgregori/boop/server/internal/auth"
"github.com/chrisgregori/boop/server/internal/config"
"github.com/chrisgregori/boop/server/internal/database"
"github.com/chrisgregori/boop/server/internal/delivery"
@@ -74,11 +75,18 @@ func run() error {
dispatcher := delivery.New(db, devStore, sender, log)
dispatcher.Start(ctx)
+ admin := auth.NewAdmin(cfg.AdminUser, cfg.AdminPassword)
+ if admin.Enabled() {
+ log.Info("auth.enabled", "user", cfg.AdminUser)
+ } else {
+ log.Warn("auth.disabled", "hint", "set BOOP_ADMIN_USER and BOOP_ADMIN_PASSWORD to protect the web UI")
+ }
+
evStore := events.New(db)
srv := &api.Server{
Config: cfg, DB: db, Log: log, Settings: st,
Projects: projects.New(db), Devices: devStore, Pairing: pairing.New(db, devStore), Events: evStore,
- Dispatcher: dispatcher, APNS: client, APNSError: apnsErr, StartedAt: time.Now(), Web: web.Handler(),
+ Dispatcher: dispatcher, APNS: client, APNSError: apnsErr, Admin: admin, StartedAt: time.Now(), Web: web.Handler(),
}
go retentionLoop(ctx, log, st, evStore, srv.Pairing, cfg.RetentionDays)
diff --git a/server/internal/api/api.go b/server/internal/api/api.go
index 19a1560..db8e0f7 100644
--- a/server/internal/api/api.go
+++ b/server/internal/api/api.go
@@ -42,6 +42,7 @@ type Server struct {
Dispatcher *delivery.Dispatcher
APNS *apns.Client // nil when not configured
APNSError string // why APNS is nil
+ Admin *auth.Admin // web UI / admin API login; open when not enabled
StartedAt time.Time
Web http.Handler
}
@@ -51,6 +52,11 @@ func (s *Server) Handler() http.Handler {
mux := http.NewServeMux()
mux.HandleFunc("GET /health", s.health)
+ // Admin session.
+ mux.HandleFunc("GET /api/v1/auth/me", s.authMe)
+ mux.HandleFunc("POST /api/v1/auth/login", s.authLogin)
+ mux.HandleFunc("POST /api/v1/auth/logout", s.authLogout)
+
// Event ingestion: project API key.
mux.Handle("POST /api/v1/events", s.projectAuth(s.createEvent))
@@ -73,6 +79,7 @@ func (s *Server) Handler() http.Handler {
// Admin.
mux.Handle("GET /api/v1/projects", s.adminAuth(s.listProjects))
+ mux.HandleFunc("GET /api/v1/projects/icons", s.projectIcons)
mux.Handle("POST /api/v1/projects", s.adminAuth(s.createProject))
mux.Handle("GET /api/v1/projects/{id}", s.adminAuth(s.getProject))
mux.Handle("PATCH /api/v1/projects/{id}", s.adminAuth(s.updateProject))
@@ -162,6 +169,10 @@ func (s *Server) readerAuth(next http.HandlerFunc) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
cred := auth.Bearer(r)
if cred == "" {
+ if !s.Admin.Authorized(r) {
+ writeError(w, http.StatusUnauthorized, "login_required", "sign in to the Boop web UI")
+ return
+ }
next(w, r)
return
}
@@ -174,24 +185,73 @@ func (s *Server) readerAuth(next http.HandlerFunc) http.Handler {
})
}
-// adminAuth serves the web UI. Boop has no accounts in v1: the UI is expected
-// to sit behind the operator's own HTTPS/proxy. Project and device credentials
-// are explicitly refused so that a leaked client secret grants no admin rights.
+// adminAuth serves the web UI and admin API. When BOOP_ADMIN_USER/PASSWORD are
+// set, a session cookie (from /auth/login) or HTTP Basic credentials are
+// required; otherwise it is open and expected to sit behind the operator's own
+// proxy. Project and device credentials are explicitly refused so that a
+// leaked client secret grants no admin rights.
func (s *Server) adminAuth(next http.HandlerFunc) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if cred := auth.Bearer(r); cred != "" {
writeError(w, http.StatusForbidden, "forbidden", "project and device credentials cannot perform administrative actions")
return
}
+ if !s.Admin.Authorized(r) {
+ writeError(w, http.StatusUnauthorized, "login_required", "sign in to the Boop web UI")
+ return
+ }
next(w, r)
})
}
+// ---- admin session ----
+
+func (s *Server) authMe(w http.ResponseWriter, r *http.Request) {
+ writeJSON(w, http.StatusOK, map[string]any{"auth_required": s.Admin.Enabled(), "authenticated": s.Admin.Authorized(r)})
+}
+
+func (s *Server) authLogin(w http.ResponseWriter, r *http.Request) {
+ if !s.Admin.Enabled() {
+ writeJSON(w, http.StatusOK, map[string]any{"auth_required": false, "authenticated": true})
+ return
+ }
+ var in struct {
+ Username string `json:"username"`
+ Password string `json:"password"`
+ }
+ if !readJSON(w, r, &in) {
+ return
+ }
+ tok, ok := s.Admin.Login(in.Username, in.Password)
+ if !ok {
+ // Slow down guessing a little; there is one account and no lockout.
+ time.Sleep(400 * time.Millisecond)
+ s.Log.Warn("auth.login_failed", "remote", r.RemoteAddr)
+ writeError(w, http.StatusUnauthorized, "bad_credentials", "wrong username or password")
+ return
+ }
+ s.Admin.SetCookie(w, r, tok)
+ s.Log.Info("auth.login", "remote", r.RemoteAddr)
+ writeJSON(w, http.StatusOK, map[string]any{"auth_required": true, "authenticated": true})
+}
+
+func (s *Server) authLogout(w http.ResponseWriter, r *http.Request) {
+ if c, err := r.Cookie(auth.SessionCookie); err == nil {
+ s.Admin.Logout(c.Value)
+ }
+ s.Admin.ClearCookie(w, r)
+ w.WriteHeader(http.StatusNoContent)
+}
+
// deviceOrAdmin allows a device to act on itself, or the web UI on anything.
func (s *Server) deviceOrAdmin(next http.HandlerFunc) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
cred := auth.Bearer(r)
if cred == "" {
+ if !s.Admin.Authorized(r) {
+ writeError(w, http.StatusUnauthorized, "login_required", "sign in to the Boop web UI")
+ return
+ }
next(w, r)
return
}
@@ -291,6 +351,7 @@ type statusResponse struct {
LastPush *delivery.Delivery `json:"last_push"`
RetentionDays int `json:"retention_days"`
SetupCompleted bool `json:"setup_completed"`
+ AdminAuth bool `json:"admin_auth"`
}
type apnsStatus struct {
@@ -305,7 +366,7 @@ type apnsStatus struct {
func (s *Server) status(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
- resp := statusResponse{Version: Version, Server: "ok", Database: "ok", DatabasePath: s.Config.DatabasePath, BaseURL: s.baseURL(r), UptimeSeconds: int64(time.Since(s.StartedAt).Seconds())}
+ resp := statusResponse{Version: Version, Server: "ok", Database: "ok", DatabasePath: s.Config.DatabasePath, BaseURL: s.baseURL(r), UptimeSeconds: int64(time.Since(s.StartedAt).Seconds()), AdminAuth: s.Admin.Enabled()}
if err := s.DB.PingContext(ctx); err != nil {
resp.Database = err.Error()
}
@@ -513,6 +574,10 @@ func (s *Server) eventDeliveries(w http.ResponseWriter, r *http.Request) {
// ---- projects ----
+func (s *Server) projectIcons(w http.ResponseWriter, r *http.Request) {
+ writeJSON(w, http.StatusOK, map[string]any{"shapes": projects.IconShapes, "colors": projects.IconColors})
+}
+
func (s *Server) listProjects(w http.ResponseWriter, r *http.Request) {
ps, err := s.Projects.List(r.Context())
if err != nil {
diff --git a/server/internal/api/api_test.go b/server/internal/api/api_test.go
index f49423b..db527a3 100644
--- a/server/internal/api/api_test.go
+++ b/server/internal/api/api_test.go
@@ -15,6 +15,7 @@ import (
"time"
"github.com/chrisgregori/boop/server/internal/apns"
+ "github.com/chrisgregori/boop/server/internal/auth"
"github.com/chrisgregori/boop/server/internal/config"
"github.com/chrisgregori/boop/server/internal/database"
"github.com/chrisgregori/boop/server/internal/delivery"
@@ -71,6 +72,7 @@ func newEnv(t *testing.T) *env {
Pairing: pairing.New(db, dev),
Events: events.New(db),
Dispatcher: delivery.New(db, dev, sender, log),
+ Admin: auth.NewAdmin("", ""),
StartedAt: time.Now(),
}
srv := httptest.NewServer(s.Handler())
@@ -161,6 +163,9 @@ func TestProjectLifecycle(t *testing.T) {
if r.body["slug"] != "uini" || r.body["notify"] != true || r.body["min_level"] != "info" {
t.Errorf("project = %v", r.body)
}
+ if icon, _ := r.body["icon"].(string); !strings.Contains(icon, ":") {
+ t.Errorf("a default shape icon should be assigned, got %q", icon)
+ }
// Duplicate names get distinct slugs.
r = e.do("POST", "/api/v1/projects", "", map[string]string{"name": "Uini"})
@@ -193,6 +198,15 @@ func TestProjectLifecycle(t *testing.T) {
if r.status != 422 {
t.Errorf("bad level should be 422, got %d", r.status)
}
+ if r := e.do("PATCH", "/api/v1/projects/"+id, "", map[string]any{"icon": "triangle:mint"}); r.status != 200 || r.body["icon"] != "triangle:mint" {
+ t.Errorf("shape icon: %d %s", r.status, r.raw)
+ }
+ if r := e.do("PATCH", "/api/v1/projects/"+id, "", map[string]any{"icon": "star:red"}); r.status != 422 {
+ t.Errorf("unknown shape should be 422, got %d", r.status)
+ }
+ if r := e.do("GET", "/api/v1/projects/icons", "", nil); r.status != 200 || len(r.body["shapes"].([]any)) == 0 {
+ t.Errorf("icons catalogue: %d %s", r.status, r.raw)
+ }
r = e.do("POST", "/api/v1/projects", "", map[string]string{"name": " "})
if r.status != 422 {
t.Errorf("empty name should be 422, got %d", r.status)
@@ -694,3 +708,115 @@ func TestUnknownAPIRouteIsJSON404(t *testing.T) {
t.Errorf("unknown route: %d %s", r.status, r.raw)
}
}
+
+func TestAdminAuth(t *testing.T) {
+ e := newEnv(t)
+ e.server.Admin = auth.NewAdmin("chris", "correct horse battery")
+
+ // Unauthenticated: status says login required, admin + reader endpoints refuse.
+ r := e.do("GET", "/api/v1/auth/me", "", nil)
+ if r.body["auth_required"] != true || r.body["authenticated"] != false {
+ t.Fatalf("me: %s", r.raw)
+ }
+ if r := e.do("GET", "/api/v1/projects", "", nil); r.status != 401 || r.body["error"] != "login_required" {
+ t.Errorf("projects without login: %d %s", r.status, r.raw)
+ }
+ if r := e.do("GET", "/api/v1/events", "", nil); r.status != 401 {
+ t.Errorf("events without login: %d", r.status)
+ }
+ if r := e.do("GET", "/health", "", nil); r.status != 200 {
+ t.Errorf("health must stay open: %d", r.status)
+ }
+
+ // Wrong password.
+ if r := e.do("POST", "/api/v1/auth/login", "", map[string]string{"username": "chris", "password": "nope"}); r.status != 401 {
+ t.Errorf("bad login: %d", r.status)
+ }
+
+ // Login sets a cookie that authorises admin calls.
+ req, _ := http.NewRequest("POST", e.srv.URL+"/api/v1/auth/login", strings.NewReader(`{"username":"chris","password":"correct horse battery"}`))
+ req.Header.Set("Content-Type", "application/json")
+ res, err := http.DefaultClient.Do(req)
+ if err != nil {
+ t.Fatal(err)
+ }
+ res.Body.Close()
+ if res.StatusCode != 200 {
+ t.Fatalf("login: %d", res.StatusCode)
+ }
+ var cookie *http.Cookie
+ for _, c := range res.Cookies() {
+ if c.Name == auth.SessionCookie {
+ cookie = c
+ }
+ }
+ if cookie == nil || !cookie.HttpOnly {
+ t.Fatalf("session cookie missing or not HttpOnly: %v", res.Cookies())
+ }
+ withCookie := func(method, path string, body any) resp {
+ var rdr io.Reader
+ if body != nil {
+ b, _ := json.Marshal(body)
+ rdr = bytes.NewReader(b)
+ }
+ req, _ := http.NewRequest(method, e.srv.URL+path, rdr)
+ if body != nil {
+ req.Header.Set("Content-Type", "application/json")
+ }
+ req.AddCookie(cookie)
+ res, err := http.DefaultClient.Do(req)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer res.Body.Close()
+ raw, _ := io.ReadAll(res.Body)
+ out := resp{status: res.StatusCode, raw: raw}
+ _ = json.Unmarshal(raw, &out.body)
+ return out
+ }
+ if r := withCookie("POST", "/api/v1/projects", map[string]string{"name": "Uini"}); r.status != 201 {
+ t.Errorf("create project with session: %d %s", r.status, r.raw)
+ }
+ if r := withCookie("GET", "/api/v1/events", nil); r.status != 200 {
+ t.Errorf("events with session: %d", r.status)
+ }
+ if r := withCookie("GET", "/api/v1/status", nil); r.body["admin_auth"] != true {
+ t.Errorf("status should report admin_auth: %s", r.raw)
+ }
+
+ // HTTP Basic also works (for scripts).
+ req, _ = http.NewRequest("GET", e.srv.URL+"/api/v1/projects", nil)
+ req.SetBasicAuth("chris", "correct horse battery")
+ res, _ = http.DefaultClient.Do(req)
+ res.Body.Close()
+ if res.StatusCode != 200 {
+ t.Errorf("basic auth: %d", res.StatusCode)
+ }
+
+ // Client credentials are still refused on admin endpoints and still work for their own purposes.
+ pid := withCookie("GET", "/api/v1/projects", nil).body["projects"].([]any)[0].(map[string]any)["id"].(string)
+ key := withCookie("POST", "/api/v1/projects/"+pid+"/rotate-key", nil).body["api_key"].(string)
+ if r := e.do("POST", "/api/v1/events", key, map[string]string{"title": "x"}); r.status != 201 {
+ t.Errorf("project key ingest under admin auth: %d %s", r.status, r.raw)
+ }
+ if r := e.do("GET", "/api/v1/projects", key, nil); r.status != 403 {
+ t.Errorf("project key on admin endpoint: %d", r.status)
+ }
+ tok := withCookie("POST", "/api/v1/pairing", nil).body["token"].(string)
+ r = e.do("POST", "/api/v1/pairing/exchange", "", map[string]string{"token": tok, "name": "phone"})
+ if r.status != 201 {
+ t.Fatalf("exchange must stay open: %d %s", r.status, r.raw)
+ }
+ cred := r.body["credential"].(string)
+ if r := e.do("GET", "/api/v1/events", cred, nil); r.status != 200 {
+ t.Errorf("device read under admin auth: %d", r.status)
+ }
+
+ // Logout revokes the session.
+ if r := withCookie("POST", "/api/v1/auth/logout", nil); r.status != 204 {
+ t.Errorf("logout: %d", r.status)
+ }
+ if r := withCookie("GET", "/api/v1/projects", nil); r.status != 401 {
+ t.Errorf("session should be revoked: %d", r.status)
+ }
+}
diff --git a/server/internal/apns/apns.go b/server/internal/apns/apns.go
index 22548a5..c8b5e45 100644
--- a/server/internal/apns/apns.go
+++ b/server/internal/apns/apns.go
@@ -94,7 +94,13 @@ func New(cfg config.APNS) (*Client, error) {
if missing := cfg.Missing(); len(missing) > 0 {
return nil, fmt.Errorf("missing %s", strings.Join(missing, ", "))
}
- pemBytes := []byte(cfg.PrivateKey)
+ pemBytes := []byte(strings.TrimSpace(cfg.PrivateKey))
+ // APNS_PRIVATE_KEY may hold the PEM text or its base64 (handy for single-line env editors).
+ if len(pemBytes) > 0 && !strings.Contains(string(pemBytes), "-----BEGIN") {
+ if decoded, err := base64.StdEncoding.DecodeString(string(pemBytes)); err == nil {
+ pemBytes = decoded
+ }
+ }
if cfg.PrivateKeyPath != "" {
b, err := os.ReadFile(cfg.PrivateKeyPath)
if err != nil {
diff --git a/server/internal/apns/apns_test.go b/server/internal/apns/apns_test.go
index a3781a4..0163b73 100644
--- a/server/internal/apns/apns_test.go
+++ b/server/internal/apns/apns_test.go
@@ -16,6 +16,8 @@ import (
"strings"
"sync/atomic"
"testing"
+
+ "github.com/chrisgregori/boop/server/internal/config"
)
func testKey(t *testing.T) (*ecdsa.PrivateKey, []byte) {
@@ -141,3 +143,23 @@ func TestSendRetriesOn5xxAndReportsUnregistered(t *testing.T) {
t.Errorf("calls = %d, want 2 (one retry)", calls)
}
}
+
+func TestNewAcceptsBase64PrivateKey(t *testing.T) {
+ _, pemBytes := testKey(t)
+ cfg := config.APNS{TeamID: "T", KeyID: "K", BundleID: "b", Environment: "sandbox", PrivateKey: base64.StdEncoding.EncodeToString(pemBytes)}
+ c, err := New(cfg)
+ if err != nil {
+ t.Fatalf("base64 key: %v", err)
+ }
+ if c.Host() != HostSandbox {
+ t.Errorf("host = %s", c.Host())
+ }
+ cfg.PrivateKey = string(pemBytes)
+ if _, err := New(cfg); err != nil {
+ t.Fatalf("pem key: %v", err)
+ }
+ cfg.PrivateKey = "not a key"
+ if _, err := New(cfg); err == nil {
+ t.Fatal("garbage should fail")
+ }
+}
diff --git a/server/internal/auth/admin.go b/server/internal/auth/admin.go
new file mode 100644
index 0000000..5c358ce
--- /dev/null
+++ b/server/internal/auth/admin.go
@@ -0,0 +1,130 @@
+package auth
+
+import (
+ "crypto/sha256"
+ "crypto/subtle"
+ "net/http"
+ "strings"
+ "sync"
+ "time"
+
+ "github.com/chrisgregori/boop/server/internal/ids"
+)
+
+// SessionCookie is the name of the admin session cookie.
+const SessionCookie = "boop_session"
+
+// SessionTTL is how long an admin login lasts.
+const SessionTTL = 30 * 24 * time.Hour
+
+// Admin guards the web UI and admin endpoints with a single username/password
+// from the environment. When Enabled is false everything is open (v1 default).
+type Admin struct {
+ username string
+ password string // stored hashed
+ enabled bool
+
+ mu sync.Mutex
+ sessions map[string]time.Time // token hash -> expiry
+ now func() time.Time
+}
+
+// NewAdmin returns an Admin; it is enabled only when both values are non-empty.
+func NewAdmin(username, password string) *Admin {
+ a := &Admin{sessions: map[string]time.Time{}, now: time.Now}
+ if username != "" && password != "" {
+ a.enabled = true
+ a.username = username
+ a.password = Hash(password)
+ }
+ return a
+}
+
+// Enabled reports whether admin authentication is configured.
+func (a *Admin) Enabled() bool { return a != nil && a.enabled }
+
+// Check verifies a username/password pair in constant time.
+func (a *Admin) Check(username, password string) bool {
+ if !a.Enabled() {
+ return false
+ }
+ u := subtle.ConstantTimeCompare(hashBytes(username), hashBytes(a.username)) == 1
+ p := subtle.ConstantTimeCompare([]byte(Hash(password)), []byte(a.password)) == 1
+ return u && p
+}
+
+// Login creates a session and returns its raw token.
+func (a *Admin) Login(username, password string) (string, bool) {
+ if !a.Check(username, password) {
+ return "", false
+ }
+ tok := NewSecret("boop_sess")
+ a.mu.Lock()
+ a.sessions[Hash(tok)] = a.now().Add(SessionTTL)
+ a.mu.Unlock()
+ return tok, true
+}
+
+// Logout revokes a session token.
+func (a *Admin) Logout(token string) {
+ a.mu.Lock()
+ delete(a.sessions, Hash(token))
+ a.mu.Unlock()
+}
+
+// Valid reports whether a raw session token is live.
+func (a *Admin) Valid(token string) bool {
+ if token == "" {
+ return false
+ }
+ a.mu.Lock()
+ defer a.mu.Unlock()
+ exp, ok := a.sessions[Hash(token)]
+ if !ok {
+ return false
+ }
+ if a.now().After(exp) {
+ delete(a.sessions, Hash(token))
+ return false
+ }
+ return true
+}
+
+// Authorized reports whether r carries a valid session cookie or HTTP Basic
+// credentials. Always true when auth is not enabled.
+func (a *Admin) Authorized(r *http.Request) bool {
+ if !a.Enabled() {
+ return true
+ }
+ if c, err := r.Cookie(SessionCookie); err == nil && a.Valid(c.Value) {
+ return true
+ }
+ if u, p, ok := r.BasicAuth(); ok && a.Check(u, p) {
+ return true
+ }
+ return false
+}
+
+// SetCookie writes the session cookie for token onto w.
+func (a *Admin) SetCookie(w http.ResponseWriter, r *http.Request, token string) {
+ http.SetCookie(w, &http.Cookie{
+ Name: SessionCookie, Value: token, Path: "/", HttpOnly: true, SameSite: http.SameSiteLaxMode,
+ Secure: isHTTPS(r), MaxAge: int(SessionTTL.Seconds()),
+ })
+}
+
+// ClearCookie removes the session cookie.
+func (a *Admin) ClearCookie(w http.ResponseWriter, r *http.Request) {
+ http.SetCookie(w, &http.Cookie{Name: SessionCookie, Value: "", Path: "/", HttpOnly: true, SameSite: http.SameSiteLaxMode, Secure: isHTTPS(r), MaxAge: -1})
+}
+
+func isHTTPS(r *http.Request) bool {
+ return r.TLS != nil || strings.EqualFold(r.Header.Get("X-Forwarded-Proto"), "https")
+}
+
+func hashBytes(s string) []byte {
+ sum := sha256.Sum256([]byte(s))
+ return sum[:]
+}
+
+var _ = ids.Now
diff --git a/server/internal/config/config.go b/server/internal/config/config.go
index dd300fb..6ee71d0 100644
--- a/server/internal/config/config.go
+++ b/server/internal/config/config.go
@@ -16,6 +16,10 @@ type Config struct {
RetentionDays int
LogLevel string
+ // Optional admin login for the web UI and admin API. Both must be set to enable it.
+ AdminUser string
+ AdminPassword string
+
APNS APNS
}
@@ -60,6 +64,8 @@ func Load() (Config, error) {
DatabasePath: env("BOOP_DATABASE_PATH", "/data/boop.db"),
RetentionDays: 30,
LogLevel: env("BOOP_LOG_LEVEL", "info"),
+ AdminUser: env("BOOP_ADMIN_USER", ""),
+ AdminPassword: env("BOOP_ADMIN_PASSWORD", ""),
APNS: APNS{
TeamID: env("APNS_TEAM_ID", ""),
KeyID: env("APNS_KEY_ID", ""),
@@ -84,6 +90,12 @@ func Load() (Config, error) {
c.RetentionDays = d
}
c.BaseURL = strings.TrimRight(c.BaseURL, "/")
+ if (c.AdminUser == "") != (c.AdminPassword == "") {
+ return c, fmt.Errorf("BOOP_ADMIN_USER and BOOP_ADMIN_PASSWORD must be set together")
+ }
+ if c.AdminPassword != "" && len(c.AdminPassword) < 8 {
+ return c, fmt.Errorf("BOOP_ADMIN_PASSWORD must be at least 8 characters")
+ }
if c.APNS.Environment != "production" && c.APNS.Environment != "sandbox" {
return c, fmt.Errorf("APNS_ENVIRONMENT must be production or sandbox, got %q", c.APNS.Environment)
}
diff --git a/server/internal/projects/icons.go b/server/internal/projects/icons.go
new file mode 100644
index 0000000..e88286c
--- /dev/null
+++ b/server/internal/projects/icons.go
@@ -0,0 +1,64 @@
+package projects
+
+import (
+ "hash/fnv"
+ "strings"
+)
+
+// Project icons are abstract shapes from the design palette, encoded as
+// "<shape>:<color>" (for example "triangle:mint"). Clients render them
+// natively. Short free text (an emoji) is still accepted for compatibility.
+
+// IconShapes lists the supported shapes.
+var IconShapes = []string{"circle", "ring", "square", "diamond", "triangle", "hexagon", "pill", "blob"}
+
+// IconColors lists the supported palette names with their hex values.
+var IconColors = []struct{ Name, Hex string }{
+ {"periwinkle", "#7C83E8"},
+ {"mint", "#5FBF9F"},
+ {"blush", "#E88CB0"},
+ {"amber", "#E8B34C"},
+ {"violet", "#9B7BEA"},
+ {"slate", "#9C9EAB"},
+}
+
+// ValidIcon reports whether s is empty, a known shape:color pair, or short free text.
+func ValidIcon(s string) bool {
+ if s == "" {
+ return true
+ }
+ if shape, color, ok := strings.Cut(s, ":"); ok {
+ return contains(IconShapes, shape) && iconColor(color)
+ }
+ return len([]rune(s)) <= 4
+}
+
+// DefaultIcon picks a deterministic shape:color for a seed (the project slug),
+// so every project has a distinct glyph without the user choosing one.
+func DefaultIcon(seed string) string {
+ h := fnv.New32a()
+ _, _ = h.Write([]byte(seed))
+ n := h.Sum32()
+ shape := IconShapes[n%uint32(len(IconShapes))]
+ // Skip slate for defaults; it reads as "disabled".
+ color := IconColors[(n/uint32(len(IconShapes)))%uint32(len(IconColors)-1)].Name
+ return shape + ":" + color
+}
+
+func contains(list []string, s string) bool {
+ for _, x := range list {
+ if x == s {
+ return true
+ }
+ }
+ return false
+}
+
+func iconColor(name string) bool {
+ for _, c := range IconColors {
+ if c.Name == name {
+ return true
+ }
+ }
+ return false
+}
diff --git a/server/internal/projects/projects.go b/server/internal/projects/projects.go
index 5165755..4506fe3 100644
--- a/server/internal/projects/projects.go
+++ b/server/internal/projects/projects.go
@@ -87,6 +87,12 @@ func (s *Store) Create(ctx context.Context, in Input) (Project, string, error) {
if in.Icon != nil {
icon = strings.TrimSpace(*in.Icon)
}
+ if !ValidIcon(icon) {
+ return Project{}, "", fmt.Errorf("%w: icon must be <shape>:<color> (shapes: %s) or a short emoji", ErrInvalid, strings.Join(IconShapes, ", "))
+ }
+ if icon == "" {
+ icon = DefaultIcon(Slugify(name))
+ }
key := auth.NewSecret(auth.PrefixProjectKey)
now := ids.Now()
p := Project{ID: ids.New("prj"), Name: name, Icon: icon, Notify: notify, MinLevel: minLevel, CreatedAt: now, UpdatedAt: now}
@@ -178,7 +184,14 @@ func (s *Store) Update(ctx context.Context, id string, in Input) (Project, error
p.Name = n
}
if in.Icon != nil {
- p.Icon = strings.TrimSpace(*in.Icon)
+ icon := strings.TrimSpace(*in.Icon)
+ if !ValidIcon(icon) {
+ return Project{}, fmt.Errorf("%w: icon must be <shape>:<color> (shapes: %s) or a short emoji", ErrInvalid, strings.Join(IconShapes, ", "))
+ }
+ if icon == "" {
+ icon = DefaultIcon(p.Slug)
+ }
+ p.Icon = icon
}
if in.Notify != nil {
p.Notify = *in.Notify
diff --git a/server/internal/projects/projects_test.go b/server/internal/projects/projects_test.go
index b47d41a..a64789d 100644
--- a/server/internal/projects/projects_test.go
+++ b/server/internal/projects/projects_test.go
@@ -1,6 +1,9 @@
package projects
-import "testing"
+import (
+ "strings"
+ "testing"
+)
func TestSlugify(t *testing.T) {
cases := map[string]string{"Uini": "uini", "My Project!": "my-project", "--": "project", "FPL XI 2026": "fpl-xi-2026"}
@@ -10,3 +13,23 @@ func TestSlugify(t *testing.T) {
}
}
}
+
+func TestIcons(t *testing.T) {
+ for _, ok := range []string{"", "circle:mint", "blob:slate", "🚀", "ab"} {
+ if !ValidIcon(ok) {
+ t.Errorf("%q should be valid", ok)
+ }
+ }
+ for _, bad := range []string{"star:mint", "circle:red", "circle:", ":mint", "toolongtext"} {
+ if ValidIcon(bad) {
+ t.Errorf("%q should be invalid", bad)
+ }
+ }
+ a, b := DefaultIcon("uini"), DefaultIcon("uini")
+ if a != b || !ValidIcon(a) || !strings.Contains(a, ":") {
+ t.Errorf("DefaultIcon not deterministic/valid: %q %q", a, b)
+ }
+ if DefaultIcon("uini") == DefaultIcon("infrastructure") && DefaultIcon("uini") == DefaultIcon("tonight") {
+ t.Errorf("DefaultIcon should vary across seeds")
+ }
+}
diff --git a/server/web/src/App.svelte b/server/web/src/App.svelte
index 147dd38..b5a4f79 100644
--- a/server/web/src/App.svelte
+++ b/server/web/src/App.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import { api } from './lib/api'
+ import { api, setLoginHandler } from './lib/api'
import { router, link } from './lib/router.svelte'
import Tabs from './lib/ui/Tabs.svelte'
import StatusDot from './lib/ui/StatusDot.svelte'
@@ -9,13 +9,26 @@
import Devices from './pages/Devices.svelte'
import Settings from './pages/Settings.svelte'
import Setup from './pages/Setup.svelte'
+ import Login from './pages/Login.svelte'
+ import { pageIn } from './lib/motion'
let setupCompleted = $state<boolean | null>(null)
let apnsConfigured = $state<boolean | null>(null)
let unreachable = $state(false)
+ let authRequired = $state(false)
+ let needsLogin = $state(false)
+ setLoginHandler(() => (needsLogin = true))
async function boot() {
try {
+ const me = await api.me()
+ authRequired = me.auth_required
+ if (me.auth_required && !me.authenticated) {
+ needsLogin = true
+ unreachable = false
+ return
+ }
+ needsLogin = false
const s = await api.status()
setupCompleted = s.setup_completed
apnsConfigured = s.apns.configured
@@ -31,6 +44,11 @@
return () => clearInterval(t)
})
+ async function signOut() {
+ await api.logout().catch(() => {})
+ needsLogin = true
+ }
+
const route = $derived(router.route)
const tabs = [
{ label: 'Inbox', href: '/' },
@@ -50,31 +68,42 @@
<div class="right">
{#if unreachable}
<StatusDot tone="bad">Server unreachable</StatusDot>
+ {:else if needsLogin}
+ <span></span>
{:else if apnsConfigured === false}
<a href="/settings" onclick={link} class="plain"><StatusDot tone="warn">APNs not configured</StatusDot></a>
{:else if apnsConfigured}
<StatusDot tone="ok">Push ready</StatusDot>
{/if}
+ {#if authRequired && !needsLogin}
+ <button type="button" class="signout" onclick={signOut}>Sign out</button>
+ {/if}
</div>
</header>
- {#if route.name === 'setup'}
+ {#if needsLogin}
+ <Login onsuccess={boot} />
+ {:else if route.name === 'setup'}
<Setup onfinished={() => (setupCompleted = true)} />
{:else}
<div class="tabs"><Tabs items={tabs} active={activeTab} /></div>
- {#if route.name === 'inbox'}
- <Inbox />
- {:else if route.name === 'event'}
- {#key route.params.id}<EventDetail id={route.params.id} />{/key}
- {:else if route.name === 'projects'}
- <Projects />
- {:else if route.name === 'devices'}
- <Devices />
- {:else if route.name === 'settings'}
- <Settings />
- {:else}
- <p class="muted">Nothing here. <a href="/" onclick={link}>Back to the inbox</a>.</p>
- {/if}
+ {#key router.path}
+ <div in:pageIn>
+ {#if route.name === 'inbox'}
+ <Inbox />
+ {:else if route.name === 'event'}
+ <EventDetail id={route.params.id} />
+ {:else if route.name === 'projects'}
+ <Projects />
+ {:else if route.name === 'devices'}
+ <Devices />
+ {:else if route.name === 'settings'}
+ <Settings />
+ {:else}
+ <p class="muted">Nothing here. <a href="/" onclick={link}>Back to the inbox</a>.</p>
+ {/if}
+ </div>
+ {/key}
{/if}
<footer class="caption faint">Boop · self-hosted · <a href="/settings" onclick={link}>status</a></footer>
@@ -89,6 +118,8 @@
.wordmark { font: var(--up-type-wordmark); letter-spacing: 0.02em; }
.right { display: flex; align-items: center; gap: 18px; }
.plain { color: inherit; }
+ .signout { background: none; border: none; cursor: pointer; padding: 0; font: var(--up-type-ui); color: var(--up-text-muted); }
+ .signout:hover { color: var(--up-ink); }
.tabs { margin-bottom: var(--up-space-5); }
footer { margin-top: var(--up-space-6); padding-top: var(--up-space-4); border-top: 1px solid var(--up-border-hairline); }
</style>
diff --git a/server/web/src/app.css b/server/web/src/app.css
index 6aa581a..588a874 100644
--- a/server/web/src/app.css
+++ b/server/web/src/app.css
@@ -111,3 +111,9 @@ h1, h2, h3, p { margin: 0; }
@media (max-width: 600px) {
:root { --up-page-pad: 16px; }
}
+
+/* Interaction feedback: colour/background only, no motion, per the design system. */
+button, a, select, input { transition: background-color 120ms ease-out, color 120ms ease-out, border-color 120ms ease-out, box-shadow 120ms ease-out; }
+@media (prefers-reduced-motion: reduce) {
+ *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
+}
diff --git a/server/web/src/lib/api.ts b/server/web/src/lib/api.ts
index 6189457..7cb2cf0 100644
--- a/server/web/src/lib/api.ts
+++ b/server/web/src/lib/api.ts
@@ -94,6 +94,12 @@ export interface Status {
last_push: Delivery | null
retention_days: number
setup_completed: boolean
+ admin_auth: boolean
+}
+
+export interface AuthState {
+ auth_required: boolean
+ authenticated: boolean
}
export interface Settings {
@@ -124,12 +130,23 @@ async function request<T>(method: string, path: string, body?: unknown): Promise
parsed = null
}
if (!res.ok) {
+ if (res.status === 401 && parsed?.error === 'login_required') onLoginRequired?.()
throw new ApiError(res.status, parsed?.error ?? 'error', parsed?.message ?? `Request failed (${res.status})`)
}
return parsed as T
}
+/** Called on any 401 with login_required so the app can show the sign-in screen. */
+export let onLoginRequired: (() => void) | null = null
+export function setLoginHandler(fn: () => void) {
+ onLoginRequired = fn
+}
+
export const api = {
+ me: () => request<AuthState>('GET', '/api/v1/auth/me'),
+ login: (username: string, password: string) => request<AuthState>('POST', '/api/v1/auth/login', { username, password }),
+ logout: () => request<void>('POST', '/api/v1/auth/logout'),
+
status: () => request<Status>('GET', '/api/v1/status'),
settings: () => request<Settings>('GET', '/api/v1/settings'),
updateSettings: (patch: Partial<Settings>) => request<Settings>('PATCH', '/api/v1/settings', patch),
diff --git a/server/web/src/lib/icons.test.ts b/server/web/src/lib/icons.test.ts
new file mode 100644
index 0000000..fc705db
--- /dev/null
+++ b/server/web/src/lib/icons.test.ts
@@ -0,0 +1,14 @@
+import { describe, it, expect } from 'vitest'
+import { parseIcon } from './icons'
+
+describe('parseIcon', () => {
+ it('parses shape:color', () => {
+ expect(parseIcon('triangle:mint')).toEqual({ shape: 'triangle', color: 'mint' })
+ })
+ it('rejects unknown values and free text', () => {
+ expect(parseIcon('star:mint')).toBeNull()
+ expect(parseIcon('circle:red')).toBeNull()
+ expect(parseIcon('🚀')).toBeNull()
+ expect(parseIcon('')).toBeNull()
+ })
+})
diff --git a/server/web/src/lib/icons.ts b/server/web/src/lib/icons.ts
new file mode 100644
index 0000000..5ca8775
--- /dev/null
+++ b/server/web/src/lib/icons.ts
@@ -0,0 +1,21 @@
+// Project icon catalogue, mirrored from server/internal/projects/icons.go.
+export const ICON_SHAPES = ['circle', 'ring', 'square', 'diamond', 'triangle', 'hexagon', 'pill', 'blob'] as const
+export type IconShape = (typeof ICON_SHAPES)[number]
+
+export const ICON_COLORS: Record<string, string> = {
+ periwinkle: '#7C83E8',
+ mint: '#5FBF9F',
+ blush: '#E88CB0',
+ amber: '#E8B34C',
+ violet: '#9B7BEA',
+ slate: '#9C9EAB',
+}
+
+export function parseIcon(icon: string): { shape: IconShape; color: string } | null {
+ const i = icon.indexOf(':')
+ if (i < 0) return null
+ const shape = icon.slice(0, i) as IconShape
+ const color = icon.slice(i + 1)
+ if (!ICON_SHAPES.includes(shape) || !(color in ICON_COLORS)) return null
+ return { shape, color }
+}
diff --git a/server/web/src/lib/motion.ts b/server/web/src/lib/motion.ts
new file mode 100644
index 0000000..fa0ef3e
--- /dev/null
+++ b/server/web/src/lib/motion.ts
@@ -0,0 +1,17 @@
+// Motion presets. The design system wants near-instant state changes, so everything is short
+// and ease-out, and it all collapses to zero under prefers-reduced-motion.
+import { cubicOut } from 'svelte/easing'
+import { fade, fly, slide, scale } from 'svelte/transition'
+import { flip } from 'svelte/animate'
+
+const reduced = typeof matchMedia !== 'undefined' && matchMedia('(prefers-reduced-motion: reduce)').matches
+
+/** Duration in ms, or 0 when the user prefers reduced motion. */
+export const dur = (ms: number) => (reduced ? 0 : ms)
+
+export const pageIn = (node: Element) => fly(node, { y: 6, duration: dur(180), easing: cubicOut })
+export const rowIn = (node: Element, { i = 0 }: { i?: number } = {}) => fly(node, { y: 8, duration: dur(200), delay: dur(Math.min(i, 12) * 22), easing: cubicOut })
+export const panel = (node: Element) => slide(node, { duration: dur(200), easing: cubicOut })
+export const soft = (node: Element) => fade(node, { duration: dur(140) })
+export const pop = (node: Element) => scale(node, { start: 0.96, duration: dur(180), easing: cubicOut })
+export const reorder = (node: Element, params: { from: DOMRect; to: DOMRect }) => flip(node, params, { duration: dur(220), easing: cubicOut })
diff --git a/server/web/src/lib/ui/Card.svelte b/server/web/src/lib/ui/Card.svelte
index 9ae9833..44d9511 100644
--- a/server/web/src/lib/ui/Card.svelte
+++ b/server/web/src/lib/ui/Card.svelte
@@ -5,7 +5,7 @@
<section class="card" class:flush>
{#if title || action}
- <header>
+ <header class:only-action={!title}>
{#if title}<h2>{title}</h2>{/if}
{#if action}<div>{@render action()}</div>{/if}
</header>
@@ -29,5 +29,6 @@
margin-bottom: var(--up-space-4);
}
.flush header { padding: 0 var(--up-space-4); }
+ header.only-action { justify-content: flex-end; margin-bottom: var(--up-space-2); }
h2 { font: var(--up-type-setting); color: var(--up-ink); }
</style>
diff --git a/server/web/src/lib/ui/CodeBlock.svelte b/server/web/src/lib/ui/CodeBlock.svelte
index 4e30eed..6b7454e 100644
--- a/server/web/src/lib/ui/CodeBlock.svelte
+++ b/server/web/src/lib/ui/CodeBlock.svelte
@@ -1,5 +1,6 @@
<script lang="ts">
let { code, copyable = true, wrap = false }: { code: string; copyable?: boolean; wrap?: boolean } = $props()
+ import { soft } from '../motion'
let copied = $state(false)
function copy() {
navigator.clipboard?.writeText(code)
@@ -11,7 +12,7 @@
<div class="block">
<code class:wrap>{code}</code>
{#if copyable}
- <button type="button" onclick={copy} class:copied>{copied ? 'Copied' : 'Copy'}</button>
+ <button type="button" onclick={copy} class:copied>{#key copied}<span in:soft>{copied ? 'Copied' : 'Copy'}</span>{/key}</button>
{/if}
</div>
diff --git a/server/web/src/lib/ui/IconPicker.svelte b/server/web/src/lib/ui/IconPicker.svelte
new file mode 100644
index 0000000..d2c8077
--- /dev/null
+++ b/server/web/src/lib/ui/IconPicker.svelte
@@ -0,0 +1,36 @@
+<script lang="ts">
+ import { ICON_SHAPES, ICON_COLORS, parseIcon } from '../icons'
+ import ProjectIcon from './ProjectIcon.svelte'
+ let { value, onchange }: { value: string; onchange: (v: string) => void } = $props()
+ const current = $derived(parseIcon(value) ?? { shape: 'circle', color: 'periwinkle' })
+</script>
+
+<div class="picker">
+ <div class="row">
+ {#each ICON_SHAPES as shape (shape)}
+ <button type="button" class:on={current.shape === shape} aria-label={shape} title={shape} onclick={() => onchange(`${shape}:${current.color}`)}>
+ <ProjectIcon icon="{shape}:{current.color}" size={18} />
+ </button>
+ {/each}
+ </div>
+ <div class="row">
+ {#each Object.entries(ICON_COLORS) as [name, hex] (name)}
+ <button type="button" class="swatch" class:on={current.color === name} aria-label={name} title={name} style="--c: {hex}" onclick={() => onchange(`${current.shape}:${name}`)}></button>
+ {/each}
+ </div>
+</div>
+
+<style>
+ .picker { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
+ .row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
+ button {
+ width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
+ background: var(--up-bg); border: 1px solid var(--up-border-control); border-radius: var(--up-radius-control);
+ cursor: pointer; padding: 0; transition: background 120ms ease-out, border-color 120ms ease-out;
+ }
+ button:hover { background: var(--up-bg-hover); }
+ button.on { border-color: var(--up-accent); background: var(--up-accent-tint); }
+ .swatch { width: 24px; height: 24px; border-radius: var(--up-radius-pill); background: var(--c); border: 2px solid transparent; box-shadow: var(--up-ring-inset); }
+ .swatch:hover { background: var(--c); }
+ .swatch.on { border-color: var(--up-ink); background: var(--c); }
+</style>
diff --git a/server/web/src/lib/ui/JsonTree.svelte b/server/web/src/lib/ui/JsonTree.svelte
index 218b8b6..98e5d2c 100644
--- a/server/web/src/lib/ui/JsonTree.svelte
+++ b/server/web/src/lib/ui/JsonTree.svelte
@@ -1,6 +1,7 @@
<script lang="ts">
// Expandable JSON viewer for unrecognised event data.
import JsonTree from './JsonTree.svelte'
+ import { panel } from '../motion'
let { value, name, depth = 0, open = depth < 1 }: { value: unknown; name?: string; depth?: number; open?: boolean } = $props()
// svelte-ignore state_referenced_locally
let expanded = $state(open)
@@ -17,9 +18,11 @@
<span class="summary">{summary}</span>
</button>
{#if expanded}
- {#each entries as [k, v] (k)}
- <JsonTree value={v} name={k} depth={depth + 1} />
- {/each}
+ <div transition:panel>
+ {#each entries as [k, v] (k)}
+ <JsonTree value={v} name={k} depth={depth + 1} />
+ {/each}
+ </div>
{/if}
{:else}
<div class="line leaf">
@@ -48,6 +51,7 @@
.leaf { cursor: default; }
button.line:hover { background: var(--up-bg-hover); }
.chev { color: var(--up-text-inactive); width: 10px; display: inline-block; font-size: 10px; }
+ .chev { transition: transform 120ms ease-out; }
.chev.open { transform: rotate(90deg); display: inline-block; }
.key { color: var(--up-text-secondary); }
.colon { color: var(--up-text-faint); }
diff --git a/server/web/src/lib/ui/ProjectIcon.svelte b/server/web/src/lib/ui/ProjectIcon.svelte
new file mode 100644
index 0000000..88d164c
--- /dev/null
+++ b/server/web/src/lib/ui/ProjectIcon.svelte
@@ -0,0 +1,36 @@
+<script lang="ts">
+ // Renders a project icon: "<shape>:<color>" as an inline SVG from the palette, anything else as text.
+ import { ICON_COLORS, parseIcon } from '../icons'
+ let { icon, size = 16 }: { icon: string; size?: number } = $props()
+ const parsed = $derived(parseIcon(icon))
+ const fill = $derived(parsed ? ICON_COLORS[parsed.color] ?? ICON_COLORS.periwinkle : '')
+</script>
+
+{#if parsed}
+ <svg width={size} height={size} viewBox="0 0 20 20" aria-hidden="true" class="icon">
+ {#if parsed.shape === 'circle'}
+ <circle cx="10" cy="10" r="8" {fill} />
+ {:else if parsed.shape === 'ring'}
+ <circle cx="10" cy="10" r="6.5" fill="none" stroke={fill} stroke-width="3.5" />
+ {:else if parsed.shape === 'square'}
+ <rect x="2.5" y="2.5" width="15" height="15" rx="3" {fill} />
+ {:else if parsed.shape === 'diamond'}
+ <rect x="4.5" y="4.5" width="11" height="11" rx="2" transform="rotate(45 10 10)" {fill} />
+ {:else if parsed.shape === 'triangle'}
+ <path d="M10 2.5 L18 16.5 Q18.6 17.6 17.4 17.6 L2.6 17.6 Q1.4 17.6 2 16.5 Z" {fill} stroke={fill} stroke-width="1.5" stroke-linejoin="round" />
+ {:else if parsed.shape === 'hexagon'}
+ <path d="M10 1.8 L17.2 6 L17.2 14 L10 18.2 L2.8 14 L2.8 6 Z" {fill} stroke={fill} stroke-width="1.2" stroke-linejoin="round" />
+ {:else if parsed.shape === 'pill'}
+ <rect x="1.5" y="5.5" width="17" height="9" rx="4.5" {fill} />
+ {:else if parsed.shape === 'blob'}
+ <path d="M10.5 2 C15 2 18.5 5 18 9.5 C17.6 13.5 15 18 10 18 C5.5 18 2 15 2 10.5 C2 6 6 2 10.5 2 Z" {fill} />
+ {/if}
+ </svg>
+{:else if icon}
+ <span class="txt" style="font-size: {size}px; line-height: 1">{icon}</span>
+{/if}
+
+<style>
+ .icon { display: inline-block; vertical-align: -3px; flex-shrink: 0; }
+ .txt { display: inline-block; }
+</style>
diff --git a/server/web/src/lib/ui/Skeleton.svelte b/server/web/src/lib/ui/Skeleton.svelte
new file mode 100644
index 0000000..8582d18
--- /dev/null
+++ b/server/web/src/lib/ui/Skeleton.svelte
@@ -0,0 +1,46 @@
+<script lang="ts">
+ // Placeholder blocks shown while data loads. `lines` draws stacked bars; `rows` draws list rows.
+ let { lines = 0, rows = 0, height = 12, width = '100%', widths = [] as string[] }: { lines?: number; rows?: number; height?: number; width?: string; widths?: string[] } = $props()
+ const lineWidths = $derived(Array.from({ length: lines }, (_, i) => widths[i] ?? (i === lines - 1 && lines > 1 ? '60%' : '100%')))
+</script>
+
+{#if rows > 0}
+ <div class="rows" aria-hidden="true">
+ {#each Array(rows) as _, i (i)}
+ <div class="row">
+ <span class="bar" style="width: 90px; height: 12px"></span>
+ <span class="main">
+ <span class="bar" style="width: {55 + ((i * 17) % 30)}%; height: 14px"></span>
+ <span class="bar" style="width: {35 + ((i * 23) % 40)}%; height: 11px"></span>
+ </span>
+ <span class="bar" style="width: 56px; height: 11px"></span>
+ <span class="bar" style="width: 44px; height: 10px"></span>
+ </div>
+ {/each}
+ </div>
+{:else if lines > 0}
+ <div class="lines" aria-hidden="true" style="width: {width}">
+ {#each lineWidths as w, i (i)}
+ <span class="bar" style="width: {w}; height: {height}px"></span>
+ {/each}
+ </div>
+{:else}
+ <span class="bar" aria-hidden="true" style="width: {width}; height: {height}px"></span>
+{/if}
+
+<style>
+ .bar {
+ display: block;
+ border-radius: var(--up-radius-cell);
+ background: linear-gradient(90deg, var(--up-border-hairline) 0%, var(--up-bg-hover) 45%, var(--up-border-hairline) 90%);
+ background-size: 240% 100%;
+ animation: shimmer 1.4s ease-in-out infinite;
+ }
+ .lines { display: flex; flex-direction: column; gap: 8px; }
+ .rows { display: flex; flex-direction: column; }
+ .row { display: grid; grid-template-columns: 120px 1fr auto 64px; gap: var(--up-space-4); align-items: center; padding: 14px var(--up-space-4); }
+ .main { display: flex; flex-direction: column; gap: 7px; }
+ @keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
+ @media (prefers-reduced-motion: reduce) { .bar { animation: none; } }
+ @media (max-width: 600px) { .row { grid-template-columns: 1fr 64px; } .row > :nth-child(1), .row > :nth-child(3) { display: none; } }
+</style>
diff --git a/server/web/src/lib/ui/Tabs.svelte b/server/web/src/lib/ui/Tabs.svelte
index 2d5783c..17c50e4 100644
--- a/server/web/src/lib/ui/Tabs.svelte
+++ b/server/web/src/lib/ui/Tabs.svelte
@@ -1,20 +1,39 @@
<script lang="ts">
import { link } from '../router.svelte'
let { items, active }: { items: { label: string; href: string }[]; active: string } = $props()
+ let nav = $state<HTMLElement | null>(null)
+ let links = $state<Record<string, HTMLElement>>({})
+ let indicator = $state({ left: 0, width: 0, ready: false })
+
+ // Sliding underline: measure the active link and move the indicator to it.
+ $effect(() => {
+ const el = links[active]
+ if (!el || !nav) return
+ const measure = () => {
+ indicator = { left: el.offsetLeft, width: el.offsetWidth, ready: true }
+ }
+ measure()
+ if (document.fonts?.ready) document.fonts.ready.then(measure)
+ const ro = new ResizeObserver(measure)
+ ro.observe(el)
+ return () => ro.disconnect()
+ })
</script>
-<nav>
+<nav bind:this={nav}>
{#each items as it (it.href)}
- <a href={it.href} class:active={it.href === active} onclick={link}>{it.label}</a>
+ <a href={it.href} class:active={it.href === active} onclick={link} bind:this={links[it.href]}>{it.label}</a>
{/each}
+ <span class="indicator" class:ready={indicator.ready} style="left: {indicator.left}px; width: {indicator.width}px"></span>
</nav>
<style>
nav {
+ position: relative;
display: flex;
gap: var(--up-space-5);
border-bottom: 1px solid var(--up-border-hairline);
- overflow-x: auto;
+ overflow: visible;
}
a {
font: var(--up-type-ui);
@@ -24,5 +43,18 @@
transition: color 120ms ease-out;
}
a:hover { color: var(--up-ink); }
- a.active { color: var(--up-ink); box-shadow: inset 0 -2px 0 var(--up-accent); }
+ a.active { color: var(--up-ink); }
+ .indicator {
+ position: absolute;
+ bottom: -1px;
+ height: 2px;
+ pointer-events: none;
+ background: var(--up-accent);
+ opacity: 0;
+ transition: left 200ms cubic-bezier(0.2, 0, 0, 1), width 200ms cubic-bezier(0.2, 0, 0, 1), opacity 120ms ease-out;
+ }
+ .indicator.ready { opacity: 1; }
+ @media (prefers-reduced-motion: reduce) {
+ .indicator { transition: none; }
+ }
</style>
diff --git a/server/web/src/pages/Devices.svelte b/server/web/src/pages/Devices.svelte
index 71175a2..f8dcc03 100644
--- a/server/web/src/pages/Devices.svelte
+++ b/server/web/src/pages/Devices.svelte
@@ -8,10 +8,13 @@
import Notice from '../lib/ui/Notice.svelte'
import Empty from '../lib/ui/Empty.svelte'
import CodeBlock from '../lib/ui/CodeBlock.svelte'
+ import { panel, soft, pop, reorder } from '../lib/motion'
+ import Skeleton from '../lib/ui/Skeleton.svelte'
let { embedded = false, onpaired }: { embedded?: boolean; onpaired?: () => void } = $props()
let devices = $state<Device[]>([])
+ let loaded = $state(false)
let pairing = $state<PairingToken | null>(null)
let error = $state('')
let now = $state(new Date())
@@ -23,6 +26,8 @@
now = new Date()
} catch (e: any) {
error = e.message
+ } finally {
+ loaded = true
}
}
@@ -74,7 +79,7 @@
</script>
<div class="stack">
- {#if error}<Notice tone="bad">{error}</Notice>{/if}
+ {#if error}<div transition:panel><Notice tone="bad">{error}</Notice></div>{/if}
<Card title="Pair iPhone">
{#snippet action()}
@@ -85,7 +90,7 @@
{/if}
{/snippet}
{#if pairing}
- <div class="pair">
+ <div class="pair" in:pop>
<QR data={qrJSON} />
<div class="pair-text">
<div class="setting">Scan with the Boop app</div>
@@ -96,23 +101,25 @@
</div>
</div>
{#if showPayload}
- <div style="margin-top: 16px"><CodeBlock code={qrJSON} wrap /></div>
+ <div style="margin-top: 16px" transition:panel><CodeBlock code={qrJSON} wrap /></div>
{/if}
{:else}
- <p class="secondary lead">Generates a one-time QR code that the Boop iOS app scans to connect to this server. Nothing to type.</p>
+ <p class="secondary lead" in:soft>Generates a one-time QR code that the Boop iOS app scans to connect to this server. Nothing to type.</p>
{/if}
</Card>
{#if !embedded}
<Card title="Paired devices" flush>
- {#if devices.length === 0}
+ {#if !loaded}
+ <Skeleton rows={2} />
+ {:else if devices.length === 0}
<Empty title="No devices paired">Pair an iPhone above to start receiving pushes.</Empty>
{:else}
<div class="thead caption faint">
<div>Name</div><div>Push</div><div class="r">Last seen</div><div></div>
</div>
{#each devices as d (d.id)}
- <div class="dev">
+ <div class="dev" animate:reorder in:soft out:soft>
<div class="dn">
<div class="setting">{d.name}</div>
<div class="caption faint">{d.platform}{d.app_bundle_id ? ` · ${d.app_bundle_id}` : ''} · paired {relative(d.created_at, now)}</div>
diff --git a/server/web/src/pages/EventDetail.svelte b/server/web/src/pages/EventDetail.svelte
index f0c512a..1d6e62f 100644
--- a/server/web/src/pages/EventDetail.svelte
+++ b/server/web/src/pages/EventDetail.svelte
@@ -9,6 +9,9 @@
import Notice from '../lib/ui/Notice.svelte'
import Empty from '../lib/ui/Empty.svelte'
import StatusDot from '../lib/ui/StatusDot.svelte'
+ import ProjectIcon from '../lib/ui/ProjectIcon.svelte'
+ import { panel } from '../lib/motion'
+ import Skeleton from '../lib/ui/Skeleton.svelte'
let { id }: { id: string } = $props()
let event = $state<Event | null>(null)
@@ -45,12 +48,23 @@
{#if error}
<Notice tone="bad">{error}</Notice>
{:else if !event}
- <Card><Empty title="Loading" /></Card>
+ <Card>
+ <Skeleton lines={1} height={12} width="40%" />
+ <div style="margin-top: 12px"><Skeleton lines={1} height={24} width="55%" /></div>
+ <div style="margin-top: 10px"><Skeleton lines={1} height={14} width="70%" /></div>
+ <div class="facts" style="margin-top: 24px">
+ <Skeleton lines={2} height={11} widths={['40%', '80%']} />
+ <Skeleton lines={2} height={11} widths={['40%', '80%']} />
+ </div>
+ </Card>
+ <Card><Skeleton lines={3} height={12} widths={['30%', '90%', '75%']} /></Card>
+ <Card><Skeleton lines={4} height={12} widths={['30%', '95%', '85%', '60%']} /></Card>
{:else}
+ <div class="stack rise">
<Card>
<div class="head">
<div class="meta">
- <span class="secondary proj">{#if event.project_icon}<span>{event.project_icon}</span>{/if}<span>{event.project_name}</span></span>
+ <span class="secondary proj"><ProjectIcon icon={event.project_icon} size={14} /><span>{event.project_name}</span></span>
<span class="faint">·</span>
<LevelBadge level={event.level} />
{#if event.source}<span class="faint">·</span><span class="muted">{event.source}</span>{/if}
@@ -150,7 +164,7 @@
<button type="button" class="linkish" onclick={() => (showRaw = !showRaw)}>{showRaw ? 'Hide' : 'Show'}</button>
{/snippet}
{#if showRaw}
- <CodeBlock code={JSON.stringify(event, null, 2)} />
+ <div transition:panel><CodeBlock code={JSON.stringify(event, null, 2)} /></div>
{:else}
<div class="muted">{Object.keys(data).length} top-level keys</div>
{/if}
@@ -172,11 +186,23 @@
</div>
{/if}
</Card>
+ </div>
{/if}
</div>
<style>
.crumb { display: flex; gap: 8px; align-items: center; font: var(--up-type-meta); }
+ /* Cards rise in one after another once the event has loaded. */
+ .rise > :global(*) { animation: rise 220ms cubic-bezier(0.2, 0, 0, 1) both; }
+ .rise > :global(:nth-child(1)) { animation-delay: 0ms; }
+ .rise > :global(:nth-child(2)) { animation-delay: 40ms; }
+ .rise > :global(:nth-child(3)) { animation-delay: 80ms; }
+ .rise > :global(:nth-child(4)) { animation-delay: 120ms; }
+ .rise > :global(:nth-child(5)) { animation-delay: 160ms; }
+ .rise > :global(:nth-child(6)) { animation-delay: 200ms; }
+ .rise > :global(:nth-child(n + 7)) { animation-delay: 240ms; }
+ @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
+ @media (prefers-reduced-motion: reduce) { .rise > :global(*) { animation: none; } }
.head { display: flex; flex-direction: column; gap: 8px; }
.proj { display: inline-flex; gap: 6px; align-items: center; }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font: var(--up-type-meta); }
diff --git a/server/web/src/pages/Inbox.svelte b/server/web/src/pages/Inbox.svelte
index cd27583..13d096a 100644
--- a/server/web/src/pages/Inbox.svelte
+++ b/server/web/src/pages/Inbox.svelte
@@ -9,6 +9,9 @@
import LevelBadge from '../lib/ui/LevelBadge.svelte'
import Empty from '../lib/ui/Empty.svelte'
import Notice from '../lib/ui/Notice.svelte'
+ import ProjectIcon from '../lib/ui/ProjectIcon.svelte'
+ import { rowIn, reorder, soft, panel } from '../lib/motion'
+ import Skeleton from '../lib/ui/Skeleton.svelte'
let events = $state<Event[]>([])
let projects = $state<Project[]>([])
@@ -77,12 +80,13 @@
</div>
{#if error}
- <Notice tone="bad">{error}</Notice>
+ <div transition:panel><Notice tone="bad">{error}</Notice></div>
{/if}
<Card flush>
{#if loading && events.length === 0}
- <Empty title="Loading" />
+ <div class="group">&nbsp;</div>
+ <Skeleton rows={6} />
{:else if events.length === 0}
<Empty title="No events yet">
{#if projects.length === 0}
@@ -92,12 +96,12 @@
{/if}
</Empty>
{:else}
- {#each groups as g (g.label)}
- <div class="group">{g.label}</div>
- {#each g.items as e (e.id)}
- <a class="ev" href="/events/{e.id}" onclick={link}>
+ {#each groups as g, gi (g.label)}
+ <div class="group" in:soft>{g.label}</div>
+ {#each g.items as e, i (e.id)}
+ <a class="ev" href="/events/{e.id}" onclick={link} in:rowIn={{ i: gi * 4 + i }} animate:reorder>
<div class="proj">
- {#if e.project_icon}<span class="icon">{e.project_icon}</span>{/if}
+ <ProjectIcon icon={e.project_icon} size={14} />
<span>{e.project_name}</span>
</div>
<div class="main">
diff --git a/server/web/src/pages/Login.svelte b/server/web/src/pages/Login.svelte
new file mode 100644
index 0000000..be8e157
--- /dev/null
+++ b/server/web/src/pages/Login.svelte
@@ -0,0 +1,51 @@
+<script lang="ts">
+ import { api } from '../lib/api'
+ import Card from '../lib/ui/Card.svelte'
+ import Button from '../lib/ui/Button.svelte'
+ import Input from '../lib/ui/Input.svelte'
+ import Notice from '../lib/ui/Notice.svelte'
+ import { panel } from '../lib/motion'
+
+ let { onsuccess }: { onsuccess: () => void } = $props()
+ let username = $state('')
+ let password = $state('')
+ let error = $state('')
+ let busy = $state(false)
+
+ async function submit() {
+ busy = true
+ error = ''
+ try {
+ await api.login(username, password)
+ onsuccess()
+ } catch (e: any) {
+ error = e.status === 401 ? 'Wrong username or password.' : e.message
+ password = ''
+ } finally {
+ busy = false
+ }
+ }
+</script>
+
+<div class="login">
+ <Card title="Sign in">
+ <p class="secondary lead">This Boop server is protected. Use the username and password from its environment.</p>
+ <form
+ onsubmit={(e) => {
+ e.preventDefault()
+ submit()
+ }}
+ >
+ <Input bind:value={username} placeholder="Username" aria-label="Username" autocomplete="username" required />
+ <Input bind:value={password} placeholder="Password" aria-label="Password" type="password" autocomplete="current-password" required />
+ {#if error}<div transition:panel><Notice tone="bad">{error}</Notice></div>{/if}
+ <Button type="submit" disabled={busy || !username || !password}>{busy ? 'Signing in' : 'Sign in'}</Button>
+ </form>
+ </Card>
+</div>
+
+<style>
+ .login { max-width: 380px; margin: var(--up-space-7) auto 0; }
+ .lead { font: var(--up-type-meta); line-height: 1.6; margin-bottom: 12px; }
+ form { display: flex; flex-direction: column; gap: var(--up-space-3); }
+</style>
diff --git a/server/web/src/pages/Projects.svelte b/server/web/src/pages/Projects.svelte
index 81fcf96..e5cd787 100644
--- a/server/web/src/pages/Projects.svelte
+++ b/server/web/src/pages/Projects.svelte
@@ -11,11 +11,15 @@
import CodeBlock from '../lib/ui/CodeBlock.svelte'
import Notice from '../lib/ui/Notice.svelte'
import Empty from '../lib/ui/Empty.svelte'
+ import ProjectIcon from '../lib/ui/ProjectIcon.svelte'
+ import IconPicker from '../lib/ui/IconPicker.svelte'
+ import { panel, soft, pop, reorder } from '../lib/motion'
+ import Skeleton from '../lib/ui/Skeleton.svelte'
let projects = $state<Project[]>([])
+ let loaded = $state(false)
let error = $state('')
let newName = $state('')
- let newIcon = $state('')
let creating = $state(false)
let revealed = $state<ProjectCreated | null>(null)
let editing = $state<string | null>(null)
@@ -26,6 +30,8 @@
projects = (await api.projects()).projects
} catch (e: any) {
error = e.message
+ } finally {
+ loaded = true
}
}
$effect(() => {
@@ -37,9 +43,8 @@
creating = true
error = ''
try {
- revealed = await api.createProject({ name: newName.trim(), icon: newIcon.trim() || undefined })
+ revealed = await api.createProject({ name: newName.trim() })
newName = ''
- newIcon = ''
await load()
} catch (e: any) {
error = e.message
@@ -80,9 +85,10 @@
</script>
<div class="stack">
- {#if error}<Notice tone="bad">{error}</Notice>{/if}
+ {#if error}<div transition:panel><Notice tone="bad">{error}</Notice></div>{/if}
{#if revealed}
+ <div transition:panel>
<Card title="API key for {revealed.name}">
<p class="secondary lead">Copy this key now. It is shown once and only a hash is stored.</p>
<CodeBlock code={revealed.api_key} />
@@ -92,6 +98,7 @@
/>
<div class="actions"><Button variant="secondary" onclick={() => (revealed = null)}>Done</Button></div>
</Card>
+ </div>
{/if}
<Card title="New project">
@@ -103,34 +110,41 @@
}}
>
<Input bind:value={newName} placeholder="Project name" aria-label="Project name" maxlength={80} required />
- <Input bind:value={newIcon} placeholder="Icon" aria-label="Icon (optional)" maxlength={4} style="width: 72px" />
<Button type="submit" disabled={creating || !newName.trim()}>Create</Button>
</form>
- <p class="muted caption" style="margin-top: 8px">Each project gets its own API key. The icon is optional (an emoji or short text).</p>
+ <p class="muted caption" style="margin-top: 8px">Each project gets its own API key and a shape icon you can change in its settings.</p>
</Card>
- {#if projects.length === 0}
+ {#if !loaded}
+ {#each [0, 1] as i (i)}
+ <Card>
+ <Skeleton lines={2} height={13} widths={['35%', '55%']} />
+ </Card>
+ {/each}
+ {:else if projects.length === 0}
<Card><Empty title="No projects yet">Create one above to get an API key.</Empty></Card>
{/if}
{#each projects as p (p.id)}
- <Card title={(p.icon ? p.icon + ' ' : '') + p.name}>
+ <div animate:reorder in:soft>
+ <Card>
{#snippet action()}
<div class="row">
<Button variant="ghost" size="sm" onclick={() => (editing = editing === p.id ? null : p.id)}>{editing === p.id ? 'Close' : 'Settings'}</Button>
</div>
{/snippet}
+ <div class="pname"><ProjectIcon icon={p.icon} size={18} /><span class="n">{p.name}</span></div>
<div class="pmeta muted caption">
<span class="mono">{p.slug}</span> · {p.notify ? `notify ≥ ${LEVEL_LABEL[p.min_level].toLowerCase()}` : 'notifications off'} · created {relative(p.created_at)}
</div>
{#if editing === p.id}
- <div class="edit">
+ <div class="edit" transition:panel>
<SettingRow label="Name">
<Input value={p.name} onchange={(e) => patch(p, { name: (e.currentTarget as HTMLInputElement).value })} style="width: 200px" />
</SettingRow>
- <SettingRow label="Icon" hint="Shown next to the project name in the inbox.">
- <Input value={p.icon} onchange={(e) => patch(p, { icon: (e.currentTarget as HTMLInputElement).value })} style="width: 80px" maxlength={4} />
+ <SettingRow label="Icon" hint="An abstract shape from the palette, shown next to the project name in the inbox and on your phone.">
+ <IconPicker value={p.icon} onchange={(v) => patch(p, { icon: v })} />
</SettingRow>
<SettingRow label="Push notifications" hint="Turn off to store events without notifying your phone.">
<Switch checked={p.notify} onchange={(v) => patch(p, { notify: v })} label="Push notifications" />
@@ -143,7 +157,7 @@
</SettingRow>
<SettingRow label="Delete project" hint="Removes the project and every event it received.">
{#if confirmDelete === p.id}
- <div class="row">
+ <div class="row" in:pop>
<Button variant="secondary" size="sm" onclick={() => (confirmDelete = null)}>Cancel</Button>
<Button variant="danger" size="sm" onclick={() => remove(p)}>Confirm delete</Button>
</div>
@@ -154,6 +168,7 @@
</div>
{/if}
</Card>
+ </div>
{/each}
</div>
@@ -162,7 +177,9 @@
.actions { display: flex; justify-content: flex-end; margin-top: var(--up-space-4); }
.new { display: flex; gap: var(--up-space-3); align-items: center; }
.new :global(input:first-child) { flex: 1; }
- .pmeta { margin-top: -8px; }
+ .pname { display: flex; align-items: center; gap: 8px; margin-top: -8px; }
+ .n { font: var(--up-type-row-title); }
+ .pmeta { margin-top: 2px; }
.edit { margin-top: var(--up-space-4); }
@media (max-width: 520px) {
.new { flex-wrap: wrap; }
diff --git a/server/web/src/pages/Settings.svelte b/server/web/src/pages/Settings.svelte
index 603cda0..f15ec45 100644
--- a/server/web/src/pages/Settings.svelte
+++ b/server/web/src/pages/Settings.svelte
@@ -10,6 +10,8 @@
import Notice from '../lib/ui/Notice.svelte'
import CodeBlock from '../lib/ui/CodeBlock.svelte'
import Metric from '../lib/ui/Metric.svelte'
+ import { panel, pop, reorder, soft } from '../lib/motion'
+ import Skeleton from '../lib/ui/Skeleton.svelte'
let status = $state<Status | null>(null)
let settings = $state<Settings | null>(null)
@@ -85,10 +87,20 @@
</script>
<div class="stack">
- {#if error}<Notice tone="bad">{error}</Notice>{/if}
+ {#if error}<div transition:panel><Notice tone="bad">{error}</Notice></div>{/if}
- {#if status}
+ {#if !status && !error}
<div class="metrics">
+ {#each [0, 1, 2, 3] as i (i)}
+ <Card><Skeleton lines={2} height={12} widths={['50%', '35%']} /></Card>
+ {/each}
+ </div>
+ <Card><Skeleton lines={1} height={13} width="20%" /><div class="status" style="margin-top: 16px">{#each [0, 1, 2, 3, 4, 5] as i (i)}<Skeleton lines={2} height={11} widths={['40%', '70%']} />{/each}</div></Card>
+ <Card><Skeleton lines={3} height={12} widths={['35%', '80%', '60%']} /></Card>
+ {/if}
+
+ {#if status}
+ <div class="metrics" in:soft>
<Card><Metric label="Events" value={compact(status.events)} /></Card>
<Card><Metric label="Projects" value={String(status.projects)} /></Card>
<Card><Metric label="Devices" value={String(status.devices)} delta={status.pushable_devices < status.devices ? `${status.pushable_devices} with push` : undefined} tone="neutral" /></Card>
@@ -121,6 +133,10 @@
<div><span class="k">Database path</span><span class="mono">{status.database_path}</span></div>
<div><span class="k">Base URL</span><span class="mono">{status.base_url}</span></div>
<div><span class="k">Retention</span><span>{retentionLabel(status.retention_days)}</span></div>
+ <div>
+ <span class="k">Admin login</span>
+ {#if status.admin_auth}<StatusDot tone="ok">Enabled</StatusDot>{:else}<StatusDot tone="warn">Off · set BOOP_ADMIN_USER and BOOP_ADMIN_PASSWORD</StatusDot>{/if}
+ </div>
</div>
{#if !status.apns.configured}
<div style="margin-top: 16px">
@@ -153,7 +169,7 @@
<Button onclick={sendTest} disabled={testing || projects.length === 0}>{testing ? 'Sending' : 'Send test notification'}</Button>
</div>
{#if testResult}
- <div style="margin-top: 16px">
+ <div style="margin-top: 16px" transition:panel>
{#if testResult.deliveries.length === 0}
<Notice tone="info">Event created. No paired phones with push registered, so nothing was sent.</Notice>
{:else if !testResult.apns_configured}
@@ -186,7 +202,7 @@
<span class="pill muted">{k}</span>
{/each}
{#each settings.redact_keys as k (k)}
- <span class="pill custom">{k}<button type="button" aria-label="Remove {k}" onclick={() => removeKey(k)}>×</button></span>
+ <span class="pill custom" in:pop out:soft animate:reorder>{k}<button type="button" aria-label="Remove {k}" onclick={() => removeKey(k)}>×</button></span>
{/each}
</div>
<form
diff --git a/server/web/src/pages/Setup.svelte b/server/web/src/pages/Setup.svelte
index 2148694..41e49ed 100644
--- a/server/web/src/pages/Setup.svelte
+++ b/server/web/src/pages/Setup.svelte
@@ -8,6 +8,9 @@
import StatusDot from '../lib/ui/StatusDot.svelte'
import Notice from '../lib/ui/Notice.svelte'
import Devices from './Devices.svelte'
+ import { fly } from 'svelte/transition'
+ import { cubicOut } from 'svelte/easing'
+ import { dur, panel } from '../lib/motion'
let { onfinished }: { onfinished: () => void } = $props()
@@ -84,8 +87,10 @@
{/each}
</ol>
- {#if error}<Notice tone="bad">{error}</Notice>{/if}
+ {#if error}<div transition:panel><Notice tone="bad">{error}</Notice></div>{/if}
+ {#key step}
+ <div in:fly={{ x: 12, duration: dur(180), easing: cubicOut }} class="step-body">
{#if step === 0}
<Card title="Server">
<div class="facts">
@@ -156,9 +161,11 @@
<Button onclick={sendTest} disabled={testing || (status?.projects ?? 0) === 0}>{testing ? 'Sending' : 'Send test notification'}</Button>
{#if (status?.projects ?? 0) === 0}<span class="muted">Create a project first.</span>{/if}
</div>
- {#if testMsg}<div style="margin-top: 16px"><Notice tone="info">{testMsg}</Notice></div>{/if}
+ {#if testMsg}<div style="margin-top: 16px" transition:panel><Notice tone="info">{testMsg}</Notice></div>{/if}
</Card>
{/if}
+ </div>
+ {/key}
<div class="nav">
<Button variant="secondary" onclick={() => (step = Math.max(0, step - 1))} disabled={step === 0}>Back</Button>
@@ -174,6 +181,7 @@
<style>
.setup { display: flex; flex-direction: column; gap: var(--up-space-5); }
+ .step-body { display: flex; flex-direction: column; gap: var(--up-space-5); }
.hero { padding: var(--up-space-6) 0 0; display: flex; flex-direction: column; gap: 6px; }
h1 { font: var(--up-type-metric); letter-spacing: -0.01em; }
.hero p { font: var(--up-type-status-line); }