Updated the Sample app and Widget targets in the Xcode project to make the app works for visionOS.
This commit is contained in:
@@ -81,54 +81,13 @@ public struct RecordingView: View {
|
||||
.accessibilityValue(model.textTimerAccessible)
|
||||
}
|
||||
|
||||
#if os(visionOS)
|
||||
controls
|
||||
#else
|
||||
GlassEffectContainer {
|
||||
HStack(
|
||||
spacing: Constant.Spacing.stack
|
||||
) {
|
||||
if model.shouldShowActions {
|
||||
Button {
|
||||
model.pressedDiscard()
|
||||
} label: {
|
||||
Image.Icon.discard
|
||||
.resizable()
|
||||
}
|
||||
.buttonStyle(.recording(
|
||||
tintColor: .red
|
||||
))
|
||||
.accessibilityLabel(.viewRecordingButtonDiscardLabel)
|
||||
}
|
||||
|
||||
Button {
|
||||
model.pressedMain()
|
||||
} label: {
|
||||
Image(model.iconMain)
|
||||
.resizable()
|
||||
}
|
||||
.buttonStyle(.recording(
|
||||
tintColor: .yellow
|
||||
))
|
||||
.disabled(model.shouldDisableMain)
|
||||
.accessibilityLabel(model.labelMain)
|
||||
|
||||
if model.shouldShowActions {
|
||||
Button {
|
||||
model.pressedSend()
|
||||
} label: {
|
||||
if let icon = model.iconSend {
|
||||
Image(icon)
|
||||
.resizable()
|
||||
} else {
|
||||
ProgressView()
|
||||
}
|
||||
}
|
||||
.buttonStyle(.recording(
|
||||
tintColor: .green
|
||||
))
|
||||
.disabled(model.isProcessing)
|
||||
.accessibilityLabel(model.labelSend)
|
||||
}
|
||||
}
|
||||
controls
|
||||
}
|
||||
#endif
|
||||
}
|
||||
.animation(
|
||||
.easeInOut,
|
||||
@@ -174,6 +133,64 @@ public struct RecordingView: View {
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Subviews
|
||||
|
||||
private extension RecordingView {
|
||||
|
||||
// MARK: Computed
|
||||
|
||||
/// The main, discard, and send buttons controlling the recording flow, laid out in a horizontal stack.
|
||||
var controls: some View {
|
||||
HStack(
|
||||
spacing: Constant.Spacing.stack
|
||||
) {
|
||||
if model.shouldShowActions {
|
||||
Button {
|
||||
model.pressedDiscard()
|
||||
} label: {
|
||||
Image.Icon.discard
|
||||
.resizable()
|
||||
}
|
||||
.buttonStyle(.recording(
|
||||
tintColor: .red
|
||||
))
|
||||
.accessibilityLabel(.viewRecordingButtonDiscardLabel)
|
||||
}
|
||||
|
||||
Button {
|
||||
model.pressedMain()
|
||||
} label: {
|
||||
Image(model.iconMain)
|
||||
.resizable()
|
||||
}
|
||||
.buttonStyle(.recording(
|
||||
tintColor: .yellow
|
||||
))
|
||||
.disabled(model.shouldDisableMain)
|
||||
.accessibilityLabel(model.labelMain)
|
||||
|
||||
if model.shouldShowActions {
|
||||
Button {
|
||||
model.pressedSend()
|
||||
} label: {
|
||||
if let icon = model.iconSend {
|
||||
Image(icon)
|
||||
.resizable()
|
||||
} else {
|
||||
ProgressView()
|
||||
}
|
||||
}
|
||||
.buttonStyle(.recording(
|
||||
tintColor: .green
|
||||
))
|
||||
.disabled(model.isProcessing)
|
||||
.accessibilityLabel(model.labelSend)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Constants
|
||||
|
||||
/// The constant values used across the view.
|
||||
|
||||
Reference in New Issue
Block a user