From 0f889e22e4a89de6b4e0beaedbc211db955f2740 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Mon, 6 Jul 2026 04:07:14 +0200 Subject: [PATCH] Refined the Recording Live Activity presentation in the Attendi widget target. --- .../Styles/Buttons/ActionButtonStyle.swift | 2 +- .../Views/RecordingLiveActivityView.swift | 31 ++---------- .../Widgets/RecordingLiveActivity.swift | 48 ++++++++++++++----- 3 files changed, 39 insertions(+), 42 deletions(-) diff --git a/Widgets/Attendi/Sources/Styles/Buttons/ActionButtonStyle.swift b/Widgets/Attendi/Sources/Styles/Buttons/ActionButtonStyle.swift index 97f3d54..4eb320e 100644 --- a/Widgets/Attendi/Sources/Styles/Buttons/ActionButtonStyle.swift +++ b/Widgets/Attendi/Sources/Styles/Buttons/ActionButtonStyle.swift @@ -37,8 +37,8 @@ struct ActionButtonStyle: PrimitiveButtonStyle { width: Constant.Size.icon.width, height: Constant.Size.icon.height ) + .foregroundStyle(.primary) .padding(Constant.Padding.icon) - .foregroundStyle(.windowBackground) .background { Circle() .foregroundStyle(backgroundColor) diff --git a/Widgets/Attendi/Sources/Views/RecordingLiveActivityView.swift b/Widgets/Attendi/Sources/Views/RecordingLiveActivityView.swift index ac90e97..f6bb9df 100644 --- a/Widgets/Attendi/Sources/Views/RecordingLiveActivityView.swift +++ b/Widgets/Attendi/Sources/Views/RecordingLiveActivityView.swift @@ -18,13 +18,12 @@ struct RecordingLiveActivityView: View { alignment: .center, spacing: Constant.Spacing.stack ) { + RecordingStateLabel(state: state) + RecordingTimerText(state: state) .font(.largeTitle) .fontWeight(.bold) - .monospacedDigit() - - RecordingStateLabel(state: state) - + RecordingControls(state: state) } } @@ -35,35 +34,11 @@ struct RecordingLiveActivityView: View { /// The constant values used across the recording Live Activity. private enum Constant { - /// The size constants. - enum Size { - /// The maximum width of the timer in the compact trailing presentation of the Dynamic Island. - static let compactTimer: CGFloat = 44 - } - /// The spacing constants. enum Spacing { /// The spacing between the elements of a stack. static let stack: CGFloat = 8 } - - /// The system symbol constants. - enum Symbol { - /// The symbol of the discard button. - static let discard = "trash" - /// The symbol marking the recording flow. - static let microphone = "mic.fill" - /// The symbol of the main button while recording. - static let pause = "pause.fill" - /// The symbol of the main button while paused. - static let record = "record.circle" - } - - /// The time constants. - enum Time { - /// The span of the running timer, comfortably beyond the maximum lifetime of a Live Activity. - static let span: TimeInterval = 24 * 60 * 60 - } } // MARK: - Previews diff --git a/Widgets/Attendi/Sources/Widgets/RecordingLiveActivity.swift b/Widgets/Attendi/Sources/Widgets/RecordingLiveActivity.swift index b7c0121..b05ba0a 100644 --- a/Widgets/Attendi/Sources/Widgets/RecordingLiveActivity.swift +++ b/Widgets/Attendi/Sources/Widgets/RecordingLiveActivity.swift @@ -22,27 +22,49 @@ struct RecordingLiveActivity: Widget { } dynamicIsland: { context in DynamicIsland { DynamicIslandExpandedRegion(.leading) { - RecordingStateLabel(state: context.state) + RecordingStateLabel( + state: context.state + ) } DynamicIslandExpandedRegion(.trailing) { - RecordingTimerText(state: context.state) - .font(.title2) - .fontWeight(.bold) - .monospacedDigit() + RecordingTimerText( + state: context.state + ) } DynamicIslandExpandedRegion(.bottom) { - RecordingControls(state: context.state) + RecordingControls( + state: context.state + ) } } compactLeading: { - Image(systemName: Constant.Symbol.microphone) - .foregroundStyle(.red) + switch context.state.state { + case .paused: + Image.Symbol.pause + .foregroundStyle(.yellow) + case .processing: + Image.Symbol.send + .foregroundStyle(.green) + case .recording: + Image.Symbol.microphone + .foregroundStyle(.yellow) + } } compactTrailing: { - RecordingTimerText(state: context.state) - .monospacedDigit() - .frame(maxWidth: Constant.Size.compactTimer) + RecordingTimerText( + state: context.state + ) + .frame(maxWidth: Constant.Size.compactTimer) } minimal: { - Image(systemName: Constant.Symbol.microphone) - .foregroundStyle(.red) + switch context.state.state { + case .paused: + Image.Symbol.pause + .foregroundStyle(.yellow) + case .processing: + Image.Symbol.send + .foregroundStyle(.green) + case .recording: + Image.Symbol.microphone + .foregroundStyle(.yellow) + } } } }