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.

fix(ios): animate the working bot on every live activity surface

leepokai61a52ea79e2d
diff --git a/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swift b/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swift
index b67b0c0d..16fc8e71 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Design/ActivityCards.swift
@@ -111,38 +111,36 @@ public struct ActivityReviewButton: View {
}
}
-/// Shared by the Lock Screen Live Activity and the in-app gallery.
-public struct BotActivityCard: View {
+/// Shared by the Lock Screen Live Activity and the in-app gallery. The Live Activity passes its
+/// own face and mark (the working loops drawn in timer fonts); the gallery uses the still ones.
+public struct BotActivityCard<Face: View, Mark: View>: View {
let name: String
- let shape: String
- let color: String
let state: BotActivityPresentation
let startedAt: Date?
let link: URL?
+ let face: Face
+ let mark: Mark
- public init(bot: Bot, state: BotActivityPresentation, startedAt: Date? = nil) {
- self.init(name: bot.name, shape: bot.avatarShape, color: bot.avatarColor, state: state, startedAt: startedAt)
- }
-
- public init(name: String, shape: String, color: String, state: BotActivityPresentation, startedAt: Date? = nil, link: URL? = nil) {
+ public init(name: String, state: BotActivityPresentation, startedAt: Date? = nil, link: URL? = nil,
+ @ViewBuilder face: () -> Face, @ViewBuilder mark: () -> Mark) {
self.name = name
- self.shape = shape
- self.color = color
self.state = state
self.startedAt = startedAt
self.link = link
+ self.face = face()
+ self.mark = mark()
}
public var body: some View {
VStack(spacing: 12) {
HStack(spacing: 12) {
- ActivityAvatar(shape: shape, color: color, state: state, size: 32)
+ face
VStack(alignment: .leading, spacing: 2) {
Text(name).font(.system(size: 14, weight: .semibold)).foregroundStyle(Palette.text).lineLimit(1)
ActivityCaption(state: state, startedAt: startedAt)
}
Spacer(minLength: 8)
- BotActivityIndicator(state: state, size: 28)
+ mark
}
if state.phase == .needsInput {
ActivityReviewButton(state: state, link: link).transition(.activityRow)
@@ -155,6 +153,16 @@ public struct BotActivityCard: View {
}
}
+public extension BotActivityCard where Face == ActivityAvatar, Mark == BotActivityIndicator {
+ init(bot: Bot, state: BotActivityPresentation, startedAt: Date? = nil) {
+ self.init(name: bot.name, state: state, startedAt: startedAt) {
+ ActivityAvatar(shape: bot.avatarShape, color: bot.avatarColor, state: state, size: 32)
+ } mark: {
+ BotActivityIndicator(state: state, size: 28)
+ }
+ }
+}
+
/// The state mark: a thinking orb while the task is live, a symbol once it has ended
/// (errors and delayed updates never look complete).
public struct BotActivityIndicator: View {
diff --git a/apps/ios/Widgets/CodyncWidgets.swift b/apps/ios/Widgets/CodyncWidgets.swift
index b08dc2bb..74096aef 100644
--- a/apps/ios/Widgets/CodyncWidgets.swift
+++ b/apps/ios/Widgets/CodyncWidgets.swift
@@ -582,10 +582,14 @@ struct ProviderUsageView: View {
struct BotLiveActivity: Widget {
var body: some WidgetConfiguration {
ActivityConfiguration(for: BotActivityAttributes.self) { context in
- BotActivityCard(name: context.attributes.name, shape: context.attributes.avatarShape,
- color: context.attributes.avatarColor, state: presentation(context),
- startedAt: context.state.startedAt, link: context.attributes.link)
- .activityBackgroundTint(Palette.surface)
+ let state = presentation(context)
+ BotActivityCard(name: context.attributes.name, state: state,
+ startedAt: context.state.startedAt, link: context.attributes.link) {
+ avatar(context, state: state, size: 32)
+ } mark: {
+ indicator(context, state: state, size: 28)
+ }
+ .modifier(SurfaceTint())
.widgetURL(context.attributes.link ?? URL(string: "codync://computers"))
} dynamicIsland: { context in
let state = presentation(context)
@@ -618,7 +622,7 @@ struct BotLiveActivity: Widget {
} compactTrailing: {
indicator(context, state: state, size: 20)
} minimal: {
- BotActivityIndicator(state: state)
+ indicator(context, state: state, size: 20)
.accessibilityLabel("\(context.attributes.name), \(state.title)")
}
.keylineTint(state.tint)
@@ -663,6 +667,21 @@ struct BotLiveActivity: Widget {
}
}
+/// The Lock Screen card's ground, painted by the card itself in its own color scheme. The
+/// system's tint alone can draw light under dark text (the Mac's menu bar shows it that way),
+/// leaving the name white on white.
+private struct SurfaceTint: ViewModifier {
+ @Environment(\.self) private var environment
+
+ func body(content: Content) -> some View {
+ let surface = Color(Palette.surface.resolve(in: environment))
+ content
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ .background(surface)
+ .activityBackgroundTint(surface)
+ }
+}
+
/// The working bot, alive in the Dynamic Island. A Live Activity draws one frame and only a
/// timer keeps changing, so this is a timer drawn in fonts whose digits are the ten frames of
/// the bot's loop (tools/timer-fonts.py); only the seconds digit draws, one frame a second.