Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

Usage tab and a provider usage widget on iPhone

leepokaiac5b2ff936e0
diff --git a/CLAUDE.md b/CLAUDE.md
index 56cb9237..8db2eb42 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -50,7 +50,7 @@ Bot-based remote for coding agents: persistent named bots on your computer, mess
- `macOS` (`apps/macos/`) — menu bar app + embedded host
- `iOS` (`apps/ios/`) — iOS app
-- `Widgets` (`apps/widgets/`) — usage widget + bot Live Activity (bundle id `com.pokai.Codync.ios.LiveActivity`)
+- `Widgets` (`apps/ios/Widgets/`) — usage widget + bot Live Activity (bundle id `com.pokai.Codync.ios.LiveActivity`)
- `CodyncKit` (`kit/`) — shared Swift package: `CodyncKit` + `CodyncUI` libraries
- `apps/linux/` — `codync` GTK app (build/test in a container with libgtk-4-dev + libadwaita-1-dev)
diff --git a/Codync.xcodeproj/project.pbxproj b/Codync.xcodeproj/project.pbxproj
index 8a469397..b57c0fa9 100644
--- a/Codync.xcodeproj/project.pbxproj
+++ b/Codync.xcodeproj/project.pbxproj
@@ -8,7 +8,6 @@
/* Begin PBXBuildFile section */
03774684DC8344D81AFED53B /* ChatWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A59E3A7670EAF57F2F4C9B9 /* ChatWindow.swift */; };
- 0CCA5DAC7A621F1786E37EA7 /* CodyncWidgets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6679F051F456F976152EF5B7 /* CodyncWidgets.swift */; };
24DF3CB466CC877FCB8BAED6 /* CodyncUI in Frameworks */ = {isa = PBXBuildFile; productRef = BEE30A9D5C73E5A151F34180 /* CodyncUI */; };
25667EBFCCC64B96FDCE95A9 /* CodyncKit in Frameworks */ = {isa = PBXBuildFile; productRef = 59F5D19A417A7A50596902FA /* CodyncKit */; };
2CC074683AE086D6C77CC1E8 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B274A0195CB3B2409EA4C194 /* WidgetKit.framework */; };
@@ -17,8 +16,8 @@
48DAAA1384E5B8D0BA27C895 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1E47C60032C326157E0386B8 /* SwiftUI.framework */; };
513F59BF65DED5379AB950A1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D2C705F063CD20F5B3036BD4 /* Assets.xcassets */; };
52CF04B855C6AAEC47B75B8F /* CodyncUI in Frameworks */ = {isa = PBXBuildFile; productRef = 06C9F37C6502131CAF0F145E /* CodyncUI */; };
+ 826FEDA23997E436D632E579 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 4CFB70DD8757C90695CDA211 /* PrivacyInfo.xcprivacy */; };
8CD641A45F144BF41D703D2A /* CodyncMacApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2969919CCC8BC89F277C43A6 /* CodyncMacApp.swift */; };
- 93ACC89E84F8907D8DA378F8 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = ABF006FDBF6F111F379DC786 /* PrivacyInfo.xcprivacy */; };
B75DD137E6F645F797B60B09 /* PairingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 739EC95223CC8F8717C33736 /* PairingView.swift */; };
C937F66F810AA238B73E8363 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 4EDD440CC0624F03363AC1BA /* PrivacyInfo.xcprivacy */; };
CC9F6FB8055C38D5D625F738 /* BotListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5E57711E223A292872322C5 /* BotListView.swift */; };
@@ -26,7 +25,9 @@
DEF7478AB86DB605F52905F5 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE4AE9A34F61B3D28E0C2550 /* SettingsView.swift */; };
E430F9317B690366F62164DB /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1B79D48C1D6F90D53751B3F /* RootView.swift */; };
EBB0417A5FB2CE6D514D21BE /* CodyncKit in Frameworks */ = {isa = PBXBuildFile; productRef = 1285DDFA0390A76ECDAAD6C0 /* CodyncKit */; };
+ ED143C01BF7AD4953101D160 /* UsageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47BCE8E2AFA6CA829DBC489A /* UsageView.swift */; };
F0A26FABD15480810021C86A /* HostController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A9881C76B67297BE26D8FD /* HostController.swift */; };
+ F191B13B972C72CB4253B449 /* CodyncWidgets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00F135A0B168269BD6C2A199 /* CodyncWidgets.swift */; };
F842AE1C5ED96AF9A7F5D16C /* Widgets.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 6D734BEE7CD3F84677B0218B /* Widgets.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
F93D9960F7C20B2E629C1736 /* CodyncKit in Frameworks */ = {isa = PBXBuildFile; productRef = 80868F96B9905FF52DCDFAE2 /* CodyncKit */; };
/* End PBXBuildFile section */
@@ -56,27 +57,28 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 00F135A0B168269BD6C2A199 /* CodyncWidgets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodyncWidgets.swift; sourceTree = "<group>"; };
1E47C60032C326157E0386B8 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
+ 22F1B304BD18E48C91FC73E3 /* Widgets.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Widgets.entitlements; sourceTree = "<group>"; };
232B2C00B9575BFF7068BB62 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
2969919CCC8BC89F277C43A6 /* CodyncMacApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodyncMacApp.swift; sourceTree = "<group>"; };
+ 47BCE8E2AFA6CA829DBC489A /* UsageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UsageView.swift; sourceTree = "<group>"; };
+ 4CFB70DD8757C90695CDA211 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
4EDD440CC0624F03363AC1BA /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
55AABA9596547D7459B1CC5B /* Push.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Push.swift; sourceTree = "<group>"; };
60422D3CA8FEBCDC5AC465E0 /* iOS.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = iOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
- 6679F051F456F976152EF5B7 /* CodyncWidgets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodyncWidgets.swift; sourceTree = "<group>"; };
6D734BEE7CD3F84677B0218B /* Widgets.appex */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "wrapper.app-extension"; path = Widgets.appex; sourceTree = BUILT_PRODUCTS_DIR; };
739EC95223CC8F8717C33736 /* PairingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PairingView.swift; sourceTree = "<group>"; };
+ 74BB0269490A0689868F05F7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
7A2F5A7F5A648909D8CC5C19 /* kit */ = {isa = PBXFileReference; lastKnownFileType = folder; name = kit; path = kit; sourceTree = SOURCE_ROOT; };
93A9881C76B67297BE26D8FD /* HostController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HostController.swift; sourceTree = "<group>"; };
- 967A0E1863D8CAA961B1F7B1 /* Widgets.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Widgets.entitlements; sourceTree = "<group>"; };
991A0FD3EAAD4B446F3BF14E /* macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = macOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
9A59E3A7670EAF57F2F4C9B9 /* ChatWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatWindow.swift; sourceTree = "<group>"; };
- ABF006FDBF6F111F379DC786 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
B274A0195CB3B2409EA4C194 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
C5E57711E223A292872322C5 /* BotListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BotListView.swift; sourceTree = "<group>"; };
D2C705F063CD20F5B3036BD4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
DE4AE9A34F61B3D28E0C2550 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
E1B79D48C1D6F90D53751B3F /* RootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = "<group>"; };
- E7AD1923720498095EFAC927 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
E8B808BC2A9AA0ECD666A454 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
F0B6AECA1FDDD3064F3D4447 /* iOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = iOS.entitlements; sourceTree = "<group>"; };
F45CCA6BBDCF412897AEC105 /* CodyncApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodyncApp.swift; sourceTree = "<group>"; };
@@ -121,16 +123,25 @@
739EC95223CC8F8717C33736 /* PairingView.swift */,
E1B79D48C1D6F90D53751B3F /* RootView.swift */,
DE4AE9A34F61B3D28E0C2550 /* SettingsView.swift */,
+ 47BCE8E2AFA6CA829DBC489A /* UsageView.swift */,
);
path = Views;
sourceTree = "<group>";
};
+ 2095D7AA44080F7BCB6E9204 /* Widgets */ = {
+ isa = PBXGroup;
+ children = (
+ 00F135A0B168269BD6C2A199 /* CodyncWidgets.swift */,
+ 5CD54037D222223E9929C80F /* Resources */,
+ );
+ path = Widgets;
+ sourceTree = "<group>";
+ };
256CA337F23BD52B220335F9 /* apps */ = {
isa = PBXGroup;
children = (
B297A6ACE16EAA751102BC05 /* ios */,
C0244F098744E616AB7FA840 /* macos */,
- 3BFDB5AF2213E26750AEF225 /* widgets */,
);
path = apps;
sourceTree = "<group>";
@@ -144,15 +155,6 @@
name = Frameworks;
sourceTree = "<group>";
};
- 3BFDB5AF2213E26750AEF225 /* widgets */ = {
- isa = PBXGroup;
- children = (
- 6679F051F456F976152EF5B7 /* CodyncWidgets.swift */,
- 4D41FDF3805D43BB7A2B1E93 /* Resources */,
- );
- path = widgets;
- sourceTree = "<group>";
- };
3EC1FDCCFFFB4BA1A23FDDB0 /* Products */ = {
isa = PBXGroup;
children = (
@@ -163,23 +165,23 @@
name = Products;
sourceTree = "<group>";
};
- 4D41FDF3805D43BB7A2B1E93 /* Resources */ = {
+ 5893B7E84BB07F9649417F2D /* App */ = {
isa = PBXGroup;
children = (
- E7AD1923720498095EFAC927 /* Info.plist */,
- ABF006FDBF6F111F379DC786 /* PrivacyInfo.xcprivacy */,
- 967A0E1863D8CAA961B1F7B1 /* Widgets.entitlements */,
+ F45CCA6BBDCF412897AEC105 /* CodyncApp.swift */,
+ 55AABA9596547D7459B1CC5B /* Push.swift */,
);
- path = Resources;
+ path = App;
sourceTree = "<group>";
};
- 5893B7E84BB07F9649417F2D /* App */ = {
+ 5CD54037D222223E9929C80F /* Resources */ = {
isa = PBXGroup;
children = (
- F45CCA6BBDCF412897AEC105 /* CodyncApp.swift */,
- 55AABA9596547D7459B1CC5B /* Push.swift */,
+ 74BB0269490A0689868F05F7 /* Info.plist */,
+ 4CFB70DD8757C90695CDA211 /* PrivacyInfo.xcprivacy */,
+ 22F1B304BD18E48C91FC73E3 /* Widgets.entitlements */,
);
- path = App;
+ path = Resources;
sourceTree = "<group>";
};
81605AFE04C3CF723841CD87 /* Views */ = {
@@ -204,6 +206,7 @@
5893B7E84BB07F9649417F2D /* App */,
E5F3C27CC2117EB5AF702188 /* Resources */,
1E45A5D617A608D762EC7EC5 /* Views */,
+ 2095D7AA44080F7BCB6E9204 /* Widgets */,
);
path = ios;
sourceTree = "<group>";
@@ -393,7 +396,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 93ACC89E84F8907D8DA378F8 /* PrivacyInfo.xcprivacy in Resources */,
+ 826FEDA23997E436D632E579 /* PrivacyInfo.xcprivacy in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -427,7 +430,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 0CCA5DAC7A621F1786E37EA7 /* CodyncWidgets.swift in Sources */,
+ F191B13B972C72CB4253B449 /* CodyncWidgets.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -441,6 +444,7 @@
31A78A067C217F77FBDEDFD0 /* Push.swift in Sources */,
E430F9317B690366F62164DB /* RootView.swift in Sources */,
DEF7478AB86DB605F52905F5 /* SettingsView.swift in Sources */,
+ ED143C01BF7AD4953101D160 /* UsageView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -553,9 +557,9 @@
6A5CD5AB98E7B897A9E57C49 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CODE_SIGN_ENTITLEMENTS = apps/widgets/Resources/Widgets.entitlements;
+ CODE_SIGN_ENTITLEMENTS = apps/ios/Widgets/Resources/Widgets.entitlements;
GENERATE_INFOPLIST_FILE = YES;
- INFOPLIST_FILE = apps/widgets/Resources/Info.plist;
+ INFOPLIST_FILE = apps/ios/Widgets/Resources/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Codync;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@@ -703,9 +707,9 @@
EB1D26BC053D93E98D308A5C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- CODE_SIGN_ENTITLEMENTS = apps/widgets/Resources/Widgets.entitlements;
+ CODE_SIGN_ENTITLEMENTS = apps/ios/Widgets/Resources/Widgets.entitlements;
GENERATE_INFOPLIST_FILE = YES;
- INFOPLIST_FILE = apps/widgets/Resources/Info.plist;
+ INFOPLIST_FILE = apps/ios/Widgets/Resources/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Codync;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
diff --git a/README.md b/README.md
index 017ce18e..e37b6c59 100644
--- a/README.md
+++ b/README.md
@@ -73,7 +73,7 @@ Data lives in `~/.codync` (`codync.db`, `token`, `host.log`). **The token is ful
| `host/` | `codync-host` — Rust daemon: ACP client, SQLite transcript, HTTP/SSE API, push, usage |
| `kit/` | Swift package: `CodyncKit` (wire models, host client, theme, avatars) and `CodyncUI` (store + chat screens shared by iPhone and Mac) |
| `apps/ios/` | iOS app: pairing, roster, push, Live Activity glue |
-| `apps/widgets/` | Usage widget + bot Live Activity |
+| `apps/ios/Widgets/` | Bots, usage and per-provider usage widgets + bot Live Activity |
| `apps/macos/` | Menu bar + native chat window; installs/monitors the host |
| `apps/linux/` | Native Linux app (GTK 4 + libadwaita, Rust) |
| `relay/` | Cloudflare Worker APNs relay with encrypted per-device tickets |
diff --git a/apps/ios/App/CodyncApp.swift b/apps/ios/App/CodyncApp.swift
index 45641978..cc272760 100644
--- a/apps/ios/App/CodyncApp.swift
+++ b/apps/ios/App/CodyncApp.swift
@@ -9,10 +9,11 @@ struct CodyncApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) private var delegate
@State private var model = AppStore.shared
@Environment(\.scenePhase) private var scenePhase
+ @State private var tab = AppTab.bots
var body: some Scene {
WindowGroup {
- RootView()
+ RootView(tab: $tab)
.environment(model)
.tint(Palette.accent)
.onOpenURL { url in
@@ -22,9 +23,13 @@ struct CodyncApp: App {
model.selection = url.lastPathComponent
} else if url.host() == "plugins" {
model.selection = nil
+ tab = .bots
model.showPlugins = true
+ } else if url.host() == "usage" {
+ tab = .usage
} else if url.host() == "computers" {
model.selection = nil
+ tab = .bots
model.showProfile = true
}
}
@@ -37,6 +42,7 @@ struct CodyncApp: App {
if let s = ProcessInfo.processInfo.environment["CODYNC_PAIR_URL"], let p = Pairing(string: s) {
model.pair(p)
}
+ if ProcessInfo.processInfo.environment["CODYNC_OPEN_USAGE"] != nil { tab = .usage }
}
#endif
}
diff --git a/apps/ios/Views/BotListView.swift b/apps/ios/Views/BotListView.swift
index e63221cb..a5cf75d6 100644
--- a/apps/ios/Views/BotListView.swift
+++ b/apps/ios/Views/BotListView.swift
@@ -13,9 +13,6 @@ struct BotListView: View {
List {
Section {
ConnectionBanner()
- if !model.usage.providers.isEmpty {
- UsageStrip(usage: model.usage)
- }
}
.listRowSeparator(.hidden)
.listRowBackground(Color.clear)
@@ -76,10 +73,7 @@ struct BotListView: View {
.disabled(model.connection != .online)
}
}
- .refreshable {
- model.restartStream()
- await model.refreshUsage()
- }
+ .refreshable { model.restartStream() }
.sheet(item: $editing) { request in
NavigationStack { BotEditorView(draft: request.draft) }
}
diff --git a/apps/ios/Views/RootView.swift b/apps/ios/Views/RootView.swift
index 28c28a94..d295b843 100644
--- a/apps/ios/Views/RootView.swift
+++ b/apps/ios/Views/RootView.swift
@@ -2,8 +2,11 @@ import CodyncKit
import CodyncUI
import SwiftUI
+enum AppTab: Hashable { case bots, usage }
+
struct RootView: View {
@Environment(BotStore.self) private var model
+ @Binding var tab: AppTab
/// The open bot, as a NavigationStack path.
private var path: Binding<[String]> {
@@ -15,12 +18,22 @@ struct RootView: View {
if model.pairing == nil {
PairingView()
} else {
- NavigationStack(path: path) {
- BotListView()
- .navigationDestination(for: String.self) { botId in
- ThreadView(botId: botId)
+ TabView(selection: $tab) {
+ Tab("Bots", systemImage: "bubble.left.and.bubble.right.fill", value: .bots) {
+ NavigationStack(path: path) {
+ BotListView()
+ .navigationDestination(for: String.self) { botId in
+ ThreadView(botId: botId)
+ .toolbar(.hidden, for: .tabBar)
+ }
}
+ }
+ Tab("Usage", systemImage: "chart.bar.fill", value: .usage) {
+ NavigationStack { UsageView() }
+ }
}
+ // Opening a bot (notification, widget, link) always lands on the Bots tab.
+ .onChange(of: model.selection) { _, id in if id != nil { tab = .bots } }
}
}
.background(Palette.background)
diff --git a/apps/ios/Views/SettingsView.swift b/apps/ios/Views/SettingsView.swift
index e37f6807..bf39843d 100644
--- a/apps/ios/Views/SettingsView.swift
+++ b/apps/ios/Views/SettingsView.swift
@@ -4,7 +4,7 @@ import SwiftUI
import UserNotifications
/// The profile sheet behind the top-left button: which computer you're talking
-/// to (and switching between them), usage, notifications, hidden bots.
+/// to (and switching between them), notifications, hidden bots.
struct SettingsView: View {
@Environment(BotStore.self) private var model
@Environment(\.dismiss) private var dismiss
@@ -61,15 +61,6 @@ struct SettingsView: View {
}
Section {
- NavigationLink {
- UsageDetail()
- } label: {
- LabeledContent("Usage") {
- if let top = model.usage.providers.flatMap(\.windows).map(\.percent).max() {
- Text("\(Int(top.rounded()))%").monospacedDigit()
- }
- }
- }
notificationsRow
}
@@ -172,25 +163,3 @@ private struct ComputerRow: View {
}
}
}
-
-private struct UsageDetail: View {
- @Environment(BotStore.self) private var model
-
- var body: some View {
- Form {
- Section {
- ForEach(model.usage.providers) { UsageCard(provider: $0) }
- if model.usage.providers.isEmpty {
- Text("No usage reported yet.").foregroundStyle(Palette.secondary)
- }
- } footer: {
- Text("Read on your computer from Claude Code and Codex. Add the Codync widget to your Home or Lock Screen to keep an eye on them.")
- }
- }
- .scrollContentBackground(.hidden)
- .background(Palette.background)
- .navigationTitle("Usage")
- .navigationBarTitleDisplayMode(.inline)
- .refreshable { await model.refreshUsage() }
- }
-}
diff --git a/apps/ios/Views/UsageView.swift b/apps/ios/Views/UsageView.swift
new file mode 100644
index 00000000..94de0ab0
--- /dev/null
+++ b/apps/ios/Views/UsageView.swift
@@ -0,0 +1,157 @@
+import CodyncKit
+import CodyncUI
+import SwiftUI
+
+/// The Usage tab: one card per provider, the tightest limit as a big bar, every limit listed below.
+struct UsageView: View {
+ @Environment(BotStore.self) private var model
+ @State private var collapsed: Set<String> = []
+ @State private var widgetHelp = false
+
+ var body: some View {
+ ScrollView {
+ VStack(spacing: 16) {
+ ForEach(model.usage.providers) { provider in
+ ProviderCard(provider: provider, collapsed: Binding(
+ get: { collapsed.contains(provider.id) },
+ set: { if $0 { collapsed.insert(provider.id) } else { collapsed.remove(provider.id) } }
+ ))
+ }
+ if model.usage.providers.isEmpty {
+ ContentUnavailableView("No usage yet", systemImage: "chart.bar",
+ description: Text("Your computer reads the limits from Claude Code and Codex."))
+ .padding(.top, 60)
+ }
+ Button("How to add a widget") { widgetHelp = true }
+ .font(.subheadline.weight(.medium))
+ .foregroundStyle(Palette.secondary)
+ .padding(.top, 4)
+ }
+ .padding(16)
+ }
+ .background(Palette.background)
+ .navigationTitle("Usage")
+ .navigationBarTitleDisplayMode(.inline)
+ .refreshable { await model.refreshUsage() }
+ .sheet(isPresented: $widgetHelp) { WidgetHelp() }
+ }
+}
+
+private struct ProviderCard: View {
+ let provider: UsageProvider
+ @Binding var collapsed: Bool
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 14) {
+ HStack(spacing: 12) {
+ ProviderMascot(provider, size: 40)
+ .frame(width: 52, height: 52)
+ .background(provider.tint.opacity(0.12), in: RoundedRectangle(cornerRadius: 14, style: .continuous))
+ Text(provider.name).font(.title3.weight(.semibold)).foregroundStyle(Palette.text)
+ Spacer()
+ Button(collapsed ? "Expand" : "Collapse", systemImage: "chevron.up") {
+ withAnimation(.snappy) { collapsed.toggle() }
+ }
+ .labelStyle(.iconOnly)
+ .rotationEffect(.degrees(collapsed ? 180 : 0))
+ .foregroundStyle(Palette.tertiary)
+ }
+
+ if let top = provider.tightest {
+ VStack(alignment: .leading, spacing: 6) {
+ HStack {
+ Text(top.label)
+ Spacer()
+ Text("\(Int(top.percent.rounded()))%").monospacedDigit()
+ }
+ .font(.subheadline)
+ .foregroundStyle(Palette.text)
+ TickBar(percent: top.percent, tint: provider.tint)
+ if let reset = top.resetsShort() {
+ Text(reset).font(.caption.monospacedDigit()).foregroundStyle(Palette.tertiary)
+ .frame(maxWidth: .infinity, alignment: .trailing)
+ }
+ }
+ }
+
+ if !collapsed {
+ Divider()
+ VStack(spacing: 12) {
+ ForEach(provider.windows) { w in
+ row(w.label, "\(Int(w.percent.rounded()))%")
+ if let reset = w.resetsShort() { row("\(w.label) reset", reset.replacingOccurrences(of: "resets ", with: "")) }
+ }
+ row("Source", source)
+ row("Updated", Date(milliseconds: provider.updatedAt).formatted(date: .abbreviated, time: .shortened))
+ }
+ .transition(.opacity)
+ }
+ }
+ .padding(18)
+ .background(Palette.surface, in: RoundedRectangle(cornerRadius: 24, style: .continuous))
+ }
+
+ private var source: String {
+ switch provider.source {
+ case "claude": "Claude Code"
+ case "statusline": "Claude Code status line"
+ case "agent": "A running bot"
+ case "sessions": "Codex sessions"
+ default: provider.source
+ }
+ }
+
+ private func row(_ label: String, _ value: String) -> some View {
+ HStack {
+ Text(label).foregroundStyle(Palette.secondary)
+ Spacer()
+ Text(value).foregroundStyle(Palette.text).monospacedDigit()
+ }
+ .font(.body)
+ }
+}
+
+/// Nowdex-style bar: a row of ticks, filled up to the percentage.
+private struct TickBar: View {
+ let percent: Double
+ let tint: Color
+
+ var body: some View {
+ GeometryReader { geo in
+ let count = max(1, Int(geo.size.width / 7))
+ let filled = Int((Double(count) * min(100, percent) / 100).rounded())
+ let color = percent >= 90 ? Palette.danger : tint
+ HStack(spacing: 3) {
+ ForEach(0..<count, id: \.self) { i in
+ Capsule().fill(i < filled ? color : color.opacity(0.18))
+ }
+ }
+ }
+ .frame(height: 24)
+ .accessibilityElement()
+ .accessibilityLabel("\(Int(percent.rounded())) percent used")
+ }
+}
+
+private struct WidgetHelp: View {
+ @Environment(\.dismiss) private var dismiss
+
+ var body: some View {
+ NavigationStack {
+ List {
+ Label("Touch and hold an empty spot on your Home Screen until the apps jiggle.", systemImage: "hand.tap")
+ Label("Tap Edit, then Add Widget.", systemImage: "plus.square")
+ Label("Search for Codync and pick Provider usage or Usage limits.", systemImage: "magnifyingglass")
+ Label("Touch and hold the widget, then Edit Widget to choose Claude or Codex.", systemImage: "slider.horizontal.3")
+ }
+ .navigationTitle("Add a widget")
+ .navigationBarTitleDisplayMode(.inline)
+ .toolbar {
+ ToolbarItem(placement: .cancellationAction) {
+ Button("Close", systemImage: "xmark") { dismiss() }.labelStyle(.iconOnly)
+ }
+ }
+ }
+ .presentationDetents([.medium])
+ }
+}
diff --git a/apps/widgets/CodyncWidgets.swift b/apps/ios/Widgets/CodyncWidgets.swift
similarity index 72%
rename from apps/widgets/CodyncWidgets.swift
rename to apps/ios/Widgets/CodyncWidgets.swift
index 98cab1b3..17c8736b 100644
--- a/apps/widgets/CodyncWidgets.swift
+++ b/apps/ios/Widgets/CodyncWidgets.swift
@@ -9,6 +9,7 @@ struct CodyncWidgets: WidgetBundle {
var body: some Widget {
BotsWidget()
UsageWidget()
+ ProviderUsageWidget()
BotLiveActivity()
}
}
@@ -201,7 +202,11 @@ struct UsageTimeline: AppIntentTimelineProvider {
/// Refreshes every 30 minutes, or right after the next limit resets if that's sooner.
func timeline(for configuration: UsageIntent, in context: Context) async -> Timeline<UsageEntry> {
- let fetched = await Self.fetch()
+ await Self.timeline()
+ }
+
+ static func timeline() async -> Timeline<UsageEntry> {
+ let fetched = await fetch()
let usage = fetched ?? SharedStore.usage ?? Usage()
let nextReset = usage.providers.flatMap(\.windows).compactMap(\.resetDate).filter { $0 > .now }.min()
var next = Date.now + (fetched == nil ? 5 * 60 : 30 * 60)
@@ -210,9 +215,10 @@ struct UsageTimeline: AppIntentTimelineProvider {
}
/// Asks the paired host directly (works over Tailscale), falling back to the app's cache.
- static func fetch() async -> Usage? {
+ /// `refresh` makes the host re-read the limits first instead of answering from its cache.
+ static func fetch(refresh: Bool = false) async -> Usage? {
guard let pairing = SharedStore.orderedPairing, let client = await HostClient.resolve(pairing),
- let usage = try? await client.usage() else { return nil }
+ let usage = try? await client.usage(refresh: refresh) else { return nil }
SharedStore.usage = usage
return usage
}
@@ -332,6 +338,151 @@ struct UsageWidgetView: View {
}
}
+// MARK: - One provider
+
+enum UsageProviderChoice: String, AppEnum {
+ case claude, codex
+
+ static let typeDisplayRepresentation: TypeDisplayRepresentation = "Provider"
+ static let caseDisplayRepresentations: [Self: DisplayRepresentation] = [.claude: "Claude", .codex: "Codex"]
+}
+
+struct ProviderUsageIntent: WidgetConfigurationIntent {
+ static let title: LocalizedStringResource = "Provider usage"
+
+ @Parameter(title: "Provider", default: .claude)
+ var provider: UsageProviderChoice
+}
+
+struct ProviderUsageEntry: TimelineEntry {
+ let date: Date
+ let usage: Usage
+ let provider: UsageProviderChoice
+}
+
+struct ProviderUsageTimeline: AppIntentTimelineProvider {
+ func placeholder(in context: Context) -> ProviderUsageEntry {
+ ProviderUsageEntry(date: .now, usage: .preview, provider: .claude)
+ }
+
+ func snapshot(for configuration: ProviderUsageIntent, in context: Context) async -> ProviderUsageEntry {
+ let usage = SharedStore.usage.flatMap { $0.providers.isEmpty ? nil : $0 } ?? .preview
+ return ProviderUsageEntry(date: .now, usage: usage, provider: configuration.provider)
+ }
+
+ func timeline(for configuration: ProviderUsageIntent, in context: Context) async -> Timeline<ProviderUsageEntry> {
+ let shared = await UsageTimeline.timeline()
+ return Timeline(entries: shared.entries.map { ProviderUsageEntry(date: $0.date, usage: $0.usage, provider: configuration.provider) },
+ policy: shared.policy)
+ }
+}
+
+/// The widget's refresh button: asks the host to re-read the limits; WidgetKit
+/// reloads the widget when this returns.
+struct RefreshUsageIntent: AppIntent {
+ static let title: LocalizedStringResource = "Refresh usage"
+
+ func perform() async throws -> some IntentResult {
+ _ = await UsageTimeline.fetch(refresh: true)
+ return .result()
+ }
+}
+
+extension Usage {
+ static let preview: Usage = {
+ let json = """
+ {"providers":[{"id":"claude","name":"Claude","source":"claude","updatedAt":0,"windows":[
+ {"id":"five_hour","label":"5-hour","percent":16},{"id":"seven_day","label":"Weekly","percent":59}]},
+ {"id":"codex","name":"Codex","source":"sessions","updatedAt":0,"windows":[
+ {"id":"primary","label":"5-hour","percent":8},{"id":"secondary","label":"Weekly","percent":70}]}]}
+ """
+ return (try? JSONDecoder().decode(Usage.self, from: Data(json.utf8))) ?? Usage()
+ }()
+}
+
+struct ProviderUsageWidget: Widget {
+ var body: some WidgetConfiguration {
+ AppIntentConfiguration(kind: "CodyncProviderUsage", intent: ProviderUsageIntent.self, provider: ProviderUsageTimeline()) { entry in
+ ProviderUsageView(entry: entry)
+ }
+ .configurationDisplayName("Provider usage")
+ .description("One provider's session and weekly limits, with its character.")
+ .supportedFamilies([.systemMedium])
+ }
+}
+
+/// A provider card: its character and name on the left, the two main limits on the right.
+struct ProviderUsageView: View {
+ let entry: ProviderUsageEntry
+
+ private var provider: UsageProvider? { entry.usage.providers.first { $0.id == entry.provider.rawValue } }
+
+ var body: some View {
+ let tint = provider?.tint ?? Palette.accent
+ Group {
+ if let provider {
+ HStack(spacing: 18) {
+ VStack(alignment: .leading, spacing: 2) {
+ ProviderMascot(provider, size: 52)
+ Spacer(minLength: 4)
+ Text(provider.name).font(.system(.title3, design: .serif, weight: .bold)).foregroundStyle(Palette.text)
+ Text("Usage").font(.subheadline).foregroundStyle(Palette.secondary)
+ }
+ .frame(width: 80, alignment: .leading)
+ VStack(alignment: .leading, spacing: 10) {
+ ForEach(provider.windows.prefix(2)) { window(provider, $0) }
+ Spacer(minLength: 0)
+ HStack {
+ Text("updated \(Date(milliseconds: provider.updatedAt).formatted(date: .omitted, time: .shortened))")
+ Spacer()
+ Button(intent: RefreshUsageIntent()) {
+ Image(systemName: "arrow.clockwise").font(.subheadline.weight(.semibold))
+ }
+ .buttonStyle(.plain)
+ .accessibilityLabel("Refresh")
+ }
+ .font(.caption2)
+ .foregroundStyle(Palette.secondary)
+ }
+ }
+ } else {
+ EmptyWidget(text: SharedStore.pairing == nil ? "Open Codync to pair with your computer."
+ : "No \(entry.provider.rawValue.capitalized) usage reported yet.")
+ }
+ }
+ .containerBackground(for: .widget) {
+ LinearGradient(colors: [tint.opacity(0.16), tint.opacity(0.03), tint.opacity(0.12)],
+ startPoint: .topLeading, endPoint: .bottomTrailing)
+ .background(Palette.background)
+ }
+ .widgetURL(URL(string: "codync://usage"))
+ }
+
+ private func window(_ provider: UsageProvider, _ w: UsageWindow) -> some View {
+ let color = w.percent >= 90 ? Palette.danger : provider.tint
+ return VStack(alignment: .leading, spacing: 5) {
+ HStack(alignment: .firstTextBaseline, spacing: 6) {
+ Text(w.title).font(.system(.subheadline, design: .serif, weight: .bold)).foregroundStyle(Palette.text)
+ Text([w.span, w.resetsShort(now: entry.date)].compactMap(\.self).joined(separator: " · "))
+ .font(.caption2)
+ .foregroundStyle(Palette.secondary)
+ .lineLimit(1)
+ Spacer(minLength: 4)
+ Text("\(Text("\(Int(w.percent.rounded()))").font(.system(.title3, design: .serif, weight: .bold)))\(Text("%").font(.system(.caption, design: .serif, weight: .bold)))")
+ .foregroundStyle(color)
+ .monospacedDigit()
+ }
+ GeometryReader { geo in
+ ZStack(alignment: .leading) {
+ Capsule().fill(Palette.text.opacity(0.1))
+ Capsule().fill(color).frame(width: geo.size.width * min(1, max(0.03, w.percent / 100)))
+ }
+ }
+ .frame(height: 7)
+ }
+ }
+}
+
// MARK: - Live Activity
struct BotLiveActivity: Widget {
diff --git a/apps/widgets/Resources/Info.plist b/apps/ios/Widgets/Resources/Info.plist
similarity index 100%
rename from apps/widgets/Resources/Info.plist
rename to apps/ios/Widgets/Resources/Info.plist
diff --git a/apps/widgets/Resources/PrivacyInfo.xcprivacy b/apps/ios/Widgets/Resources/PrivacyInfo.xcprivacy
similarity index 100%
rename from apps/widgets/Resources/PrivacyInfo.xcprivacy
rename to apps/ios/Widgets/Resources/PrivacyInfo.xcprivacy
diff --git a/apps/widgets/Resources/Widgets.entitlements b/apps/ios/Widgets/Resources/Widgets.entitlements
similarity index 100%
rename from apps/widgets/Resources/Widgets.entitlements
rename to apps/ios/Widgets/Resources/Widgets.entitlements
diff --git a/docs/structure.md b/docs/structure.md
index 8f3253ef..b0a544f7 100644
--- a/docs/structure.md
+++ b/docs/structure.md
@@ -1,7 +1,7 @@
# Layout & naming
```
-apps/{ios,macos,widgets,linux} one folder per client
+apps/{ios,macos,linux} one folder per client (iOS widgets in apps/ios/Widgets)
kit/Sources/CodyncKit/ Models/ Client/ Design/ (no CodyncUI, widget-safe)
kit/Sources/CodyncUI/ Store/ Bots/ Thread/ Marketplace/ Usage/ Resources/, cross-platform glue at root (Platform.swift)
host/ relay/ web/ packaging/
diff --git a/docs/ui-audit.md b/docs/ui-audit.md
index ccc07f96..1ba70e2f 100644
--- a/docs/ui-audit.md
+++ b/docs/ui-audit.md
@@ -48,7 +48,7 @@ Checked against the `apple-design` skill (emilkowalski/skills), plus the iOS/mac
- `MarketplaceView.swift:71`: "Couldn't load connectors." has no Retry button.
- `MarketplaceView.swift:461`: favicons come from `google.com/s2/favicons`, which sends each connector's domain to Google. That conflicts with the "no cloud" promise. Fix: bundle the logos or fetch them through the host.
-## iOS (apps/ios, apps/widgets)
+## iOS (apps/ios, including Widgets)
- **Medium** `apps/ios/Views/BotListView.swift:71`: the title is hidden, and the only sign of the current computer is a one-letter monogram. This fails "Where am I?" when several computers are paired. Fix: show the host name in the principal toolbar slot.
- **Medium** `apps/ios/Views/SettingsView.swift:87`: the sheet has no `navigationTitle`.
diff --git a/kit/Sources/CodyncKit/Design/CharacterAvatar.swift b/kit/Sources/CodyncKit/Design/CharacterAvatar.swift
index c3c907d8..7803e7b5 100644
--- a/kit/Sources/CodyncKit/Design/CharacterAvatar.swift
+++ b/kit/Sources/CodyncKit/Design/CharacterAvatar.swift
@@ -13,8 +13,12 @@ public struct CharacterAvatar: View {
let mood: Mood
public init(shape: String, color: String, size: CGFloat = 40, mood: Mood = .idle) {
+ self.init(shape: shape, tint: AvatarPalette.color(color), size: size, mood: mood)
+ }
+
+ public init(shape: String, tint: Color, size: CGFloat = 40, mood: Mood = .idle) {
self.shape = shape
- self.color = AvatarPalette.color(color)
+ self.color = tint
self.size = size
self.mood = mood
}
diff --git a/kit/Sources/CodyncKit/Design/UsageBar.swift b/kit/Sources/CodyncKit/Design/UsageBar.swift
index e61d61a1..2bbda69d 100644
--- a/kit/Sources/CodyncKit/Design/UsageBar.swift
+++ b/kit/Sources/CodyncKit/Design/UsageBar.swift
@@ -34,3 +34,64 @@ public struct UsageBar: View {
.frame(height: height)
}
}
+
+public extension UsageProvider {
+ /// Each provider's own color, used by the Usage tab and the provider widget.
+ var tint: Color {
+ switch id {
+ case "claude": Color(hex: 0xD97757)
+ case "codex": Color(hex: 0x3D8BF2)
+ default: Palette.accent
+ }
+ }
+
+ /// The character that stands for this provider.
+ var mascotShape: String { id == "codex" ? "hex" : "blob" }
+
+ var tightest: UsageWindow? { windows.max { $0.percent < $1.percent } }
+}
+
+public extension UsageWindow {
+ /// "Session" for the 5-hour window, "Opus" for "Weekly · Opus", else the label.
+ var title: String {
+ if label == "5-hour" { return "Session" }
+ if let model = label.split(separator: " · ").dropFirst().first { return String(model) }
+ return label
+ }
+
+ /// Window length, when the label says it: "5h", "7d".
+ var span: String? {
+ label == "5-hour" ? "5h" : label.hasPrefix("Weekly") ? "7d" : nil
+ }
+
+ /// "resets 3h 20m" / "resets Sep 26 at 12pm", compact for widgets and cards.
+ func resetsShort(now: Date = .now) -> String? {
+ if let d = resetDate { return d > now ? "resets \(RelativeTime.until(d, now: now))" : nil }
+ return resetDescription
+ }
+}
+
+/// A provider's character, with a red "!" once any of its limits is nearly used up.
+public struct ProviderMascot: View {
+ let provider: UsageProvider
+ let size: CGFloat
+
+ public init(_ provider: UsageProvider, size: CGFloat) {
+ self.provider = provider
+ self.size = size
+ }
+
+ public var body: some View {
+ let full = (provider.tightest?.percent ?? 0) >= 90
+ CharacterAvatar(shape: provider.mascotShape, tint: provider.tint, size: size, mood: full ? .needsInput : .idle)
+ .overlay(alignment: .topTrailing) {
+ if full {
+ Image(systemName: "exclamationmark.circle.fill")
+ .font(.system(size: size * 0.34, weight: .bold))
+ .symbolRenderingMode(.palette)
+ .foregroundStyle(.white, Palette.danger)
+ .offset(x: size * 0.12, y: -size * 0.12)
+ }
+ }
+ }
+}
diff --git a/kit/Sources/CodyncKit/Models/Models.swift b/kit/Sources/CodyncKit/Models/Models.swift
index 79a651ec..d4c37a02 100644
--- a/kit/Sources/CodyncKit/Models/Models.swift
+++ b/kit/Sources/CodyncKit/Models/Models.swift
@@ -156,7 +156,34 @@ public struct UsageWindow: Codable, Hashable, Sendable, Identifiable {
public var resetsAt: Int64?
/// Human text when only that is known ("Sep 26 at 12pm (Asia/Taipei)").
public var resetsText: String?
- public var resetDate: Date? { resetsAt.map(Date.init(milliseconds:)) }
+ public var resetDate: Date? { resetsAt.map(Date.init(milliseconds:)) ?? resetsText.flatMap { Self.parseReset($0) } }
+
+ /// Claude Code's text: "Sep 26 at 12pm (Asia/Taipei)", "Sep 25 at 7:30pm (Asia/Taipei)", or just "7:30pm (…)".
+ /// The year isn't given: the next such date from `now`.
+ static func parseReset(_ text: String, now: Date = .now) -> Date? {
+ guard let match = text.firstMatch(of: /^(?:(\w{3} \d{1,2}) at )?(\d{1,2})(?::(\d{2}))?(am|pm)(?: \(([^)]+)\))?$/) else { return nil }
+ var cal = Calendar(identifier: .gregorian)
+ cal.timeZone = match.5.flatMap { TimeZone(identifier: String($0)) } ?? .current
+ guard let hour12 = Int(match.2) else { return nil }
+ var parts = cal.dateComponents([.year, .month, .day], from: now)
+ if let day = match.1 {
+ let f = DateFormatter()
+ f.locale = Locale(identifier: "en_US_POSIX")
+ f.dateFormat = "MMM d"
+ guard let md = f.date(from: String(day)) else { return nil }
+ let c = Calendar(identifier: .gregorian).dateComponents([.month, .day], from: md)
+ parts.month = c.month
+ parts.day = c.day
+ }
+ parts.hour = hour12 % 12 + (match.4 == "pm" ? 12 : 0)
+ parts.minute = match.3.flatMap { Int($0) } ?? 0
+ guard var date = cal.date(from: parts) else { return nil }
+ // Past by more than a day: it means next year (or tomorrow, for a bare time).
+ if date < now - 86_400 || (match.1 == nil && date < now) {
+ date = cal.date(byAdding: match.1 == nil ? .day : .year, value: 1, to: date) ?? date
+ }
+ return date
+ }
/// "resets in 3h 20m" / "resets Sep 26 at 12pm", or nil.
public var resetDescription: String? {
diff --git a/kit/Sources/CodyncUI/Usage/UsageViews.swift b/kit/Sources/CodyncUI/Usage/UsageViews.swift
index f3060636..2cdd5efe 100644
--- a/kit/Sources/CodyncUI/Usage/UsageViews.swift
+++ b/kit/Sources/CodyncUI/Usage/UsageViews.swift
@@ -1,38 +1,6 @@
import CodyncKit
import SwiftUI
-public struct UsageCard: View {
- let provider: UsageProvider
-
- public init(provider: UsageProvider) { self.provider = provider }
-
- public var body: some View {
- VStack(alignment: .leading, spacing: 8) {
- HStack {
- Text(provider.name).font(.subheadline.bold())
- Spacer()
- Text("updated \(RelativeTime.short(Date(milliseconds: provider.updatedAt)))")
- .font(.caption2)
- .foregroundStyle(Palette.tertiary)
- }
- ForEach(provider.windows) { w in
- VStack(alignment: .leading, spacing: 3) {
- HStack {
- Text(w.label).font(.caption)
- Spacer()
- Text("\(Int(w.percent.rounded()))%").font(.caption.monospacedDigit().bold())
- if let reset = w.resetDescription {
- Text("· \(reset)").font(.caption2).foregroundStyle(Palette.tertiary)
- }
- }
- UsageBar(percent: w.percent)
- }
- }
- }
- .padding(.vertical, 4)
- }
-}
-
/// Compact usage chips at the top of the roster.
public struct UsageStrip: View {
let usage: Usage
diff --git a/kit/Tests/CodyncKitTests/CodyncKitTests.swift b/kit/Tests/CodyncKitTests/CodyncKitTests.swift
index 4a707310..7ea4337e 100644
--- a/kit/Tests/CodyncKitTests/CodyncKitTests.swift
+++ b/kit/Tests/CodyncKitTests/CodyncKitTests.swift
@@ -33,3 +33,16 @@ import Testing
#expect(RelativeTime.short(now.addingTimeInterval(-600), now: now) == "10m")
#expect(RelativeTime.short(now.addingTimeInterval(-7200), now: now) == "2h")
}
+
+@Test func parsesClaudeResetText() throws {
+ let taipei = try #require(TimeZone(identifier: "Asia/Taipei"))
+ var cal = Calendar(identifier: .gregorian)
+ cal.timeZone = taipei
+ let now = try #require(cal.date(from: DateComponents(year: 2026, month: 9, day: 25, hour: 17, minute: 20)))
+ let at = { (m: Int, d: Int, h: Int, min: Int, y: Int) in cal.date(from: DateComponents(year: y, month: m, day: d, hour: h, minute: min)) }
+ #expect(UsageWindow.parseReset("Sep 25 at 7:30pm (Asia/Taipei)", now: now) == at(9, 25, 19, 30, 2026))
+ #expect(UsageWindow.parseReset("Sep 26 at 12pm (Asia/Taipei)", now: now) == at(9, 26, 12, 0, 2026))
+ #expect(UsageWindow.parseReset("Jan 2 at 12am (Asia/Taipei)", now: now) == at(1, 2, 0, 0, 2027))
+ #expect(UsageWindow.parseReset("5am (Asia/Taipei)", now: now) == at(9, 26, 5, 0, 2026))
+ #expect(UsageWindow.parseReset("soon") == nil)
+}
diff --git a/project.yml b/project.yml
index 32cea01a..723ad17d 100644
--- a/project.yml
+++ b/project.yml
@@ -79,7 +79,9 @@ targets:
type: application
platform: iOS
sources:
- - apps/ios
+ - path: apps/ios
+ excludes:
+ - Widgets
dependencies:
- package: CodyncKit
product: CodyncKit
@@ -111,7 +113,7 @@ targets:
type: app-extension
platform: iOS
sources:
- - apps/widgets
+ - apps/ios/Widgets
dependencies:
- package: CodyncKit
product: CodyncKit
@@ -121,9 +123,9 @@ targets:
base:
PRODUCT_NAME: CodyncWidgets
PRODUCT_BUNDLE_IDENTIFIER: com.pokai.Codync.ios.LiveActivity
- INFOPLIST_FILE: apps/widgets/Resources/Info.plist
+ INFOPLIST_FILE: apps/ios/Widgets/Resources/Info.plist
GENERATE_INFOPLIST_FILE: YES
- CODE_SIGN_ENTITLEMENTS: apps/widgets/Resources/Widgets.entitlements
+ CODE_SIGN_ENTITLEMENTS: apps/ios/Widgets/Resources/Widgets.entitlements
INFOPLIST_KEY_CFBundleDisplayName: Codync
TARGETED_DEVICE_FAMILY: "1,2"
SKIP_INSTALL: YES