on master help sign in
feat: hide unconfigured services from menu bar + z.ai weekly + stub fix
0f40344iko
UsageMenubar/UsageMenubarApp.swift+13−4
@@ -57,14 +57,23 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
57 // Delivery is hopped through `DispatchQueue.main` rather than `RunLoop.main`,
57 // Delivery is hopped through `DispatchQueue.main` rather than `RunLoop.main`,
58 // whose Combine scheduler only runs in the default run loop mode — the title
58 // whose Combine scheduler only runs in the default run loop mode — the title
59 // would freeze while a menu or a scroll was tracking.
59 // would freeze while a menu or a scroll was tracking.
60+ // Combine has CombineLatest4 but not 5, so nest: outer combines
61+ // balance + isLoading + hyperConfigured with an inner that merges
62+ // claudeUsage + zaiUsage. The inner Just(()) is a dummy third stream
63+ // to satisfy CombineLatest3 — it fires once and never again, so the
64+ // inner effectively republishes claudeUsage and zaiUsage changes.
60− statusTextCancellable = Publishers.CombineLatest5(
65+ statusTextCancellable = Publishers.CombineLatest4(
61 viewModel.$balance,
66 viewModel.$balance,
62 viewModel.$isLoading,
67 viewModel.$isLoading,
63 viewModel.$hyperConfigured,
68 viewModel.$hyperConfigured,
69+ Publishers.CombineLatest3(
64− viewModel.$claudeUsage,
70+ viewModel.$claudeUsage,
65− viewModel.$zaiUsage
71+ viewModel.$zaiUsage,
72+ Just<Void>(())
73+ )
66 )
74 )
67− .map { balance, isLoading, hyperConfigured, claudeUsage, zaiUsage in
75+ .map { balance, isLoading, hyperConfigured, claudeAndZai in
76+ let (claudeUsage, zaiUsage, _) = claudeAndZai
68 let fiveHour = claudeUsage?.fiveHour
77 let fiveHour = claudeUsage?.fiveHour
69 .map { Int($0.utilization.rounded()) }
78 .map { Int($0.utilization.rounded()) }
70 let sevenDay = claudeUsage?.sevenDay
79 let sevenDay = claudeUsage?.sevenDay