Implemented the resumed interrupted recordings and allowed processing discards on the RecordingViewModel view model in the Recording package target.

This commit is contained in:
2026-07-05 16:16:53 +02:00
parent 8576d6bac6
commit c2ac476257
14 changed files with 563 additions and 309 deletions
@@ -13,17 +13,21 @@ struct RecordingButtonStyle: ButtonStyle {
// MARK: Properties
/// The color scheme of the environment.
@Environment(\.colorScheme) private var colorScheme
@Environment(\.colorScheme)
private var colorScheme
/// Whether the button allows user interaction.
@Environment(\.isEnabled) private var isEnabled
@Environment(\.isEnabled)
private var isEnabled
/// The padding between the button's label and its background, scaled relative to the current dynamic type size.
@ScaledMetric private var padding = Constant.Padding.button
@ScaledMetric
private var padding = Constant.Padding.button
/// The width and height of the button's label, scaled relative to the current dynamic type size.
@ScaledMetric private var size = Constant.Size.button
@ScaledMetric
private var size = Constant.Size.button
/// Whether the color scheme of the button's label should be inverted from the environment's.
private let invertStyle: Bool
@@ -57,7 +61,7 @@ struct RecordingButtonStyle: ButtonStyle {
.foregroundStyle(.windowBackground.opacity(opacity))
.environment(
\.colorScheme,
colorSchemeLabel
colorSchemeLabel
)
.glassEffect(
.regular
@@ -73,9 +77,9 @@ struct RecordingButtonStyle: ButtonStyle {
// MARK: - Helpers
private extension RecordingButtonStyle {
// MARK: Computed
/// The color scheme for the button's label: the opposite of the environment's when ``invertStyle`` is set, the environment's otherwise.
var colorSchemeLabel: ColorScheme {
guard invertStyle else {
@@ -147,9 +151,12 @@ private enum Constant {
#Preview(
"Recording button style"
) {
@Previewable @State var isDisabled: Bool = false
@Previewable @State var isStyleInverted: Bool = false
@Previewable @State
var isDisabled: Bool = false
@Previewable @State
var isStyleInverted: Bool = false
Button {
// Button action closure.
} label: {