Voice message UI polish (part 2) (#1995)

* Update compund

* Fix create poll screen bin button style

* Fix timeline menu description for voice messages

* Fix bin button in ComposerToolbar

* Add VoiceMessageButtonStyle

* Update compound & fix breaking changes

* Fix voice message bin size

* Refactor VoiceMessageRecordingButton

* Fix preview tests
This commit is contained in:
Alfonso Grillo
2023-11-01 10:03:35 +01:00
committed by GitHub
parent 213ae984cf
commit 4af8ef2a5f
25 changed files with 51 additions and 87 deletions
@@ -53,7 +53,7 @@ struct VoiceMessageButton: View {
.frame(width: buttonSize, height: buttonSize)
}
.animation(nil, value: state)
.buttonStyle(.plain)
.buttonStyle(VoiceMessageButtonStyle())
.disabled(state == .loading)
.background(Circle().foregroundColor(.compound.bgCanvasDefault))
}
@@ -73,12 +73,20 @@ struct VoiceMessageButton: View {
.scaledToFit()
.frame(width: imageWidth, height: imageHeight)
.offset(x: offset)
.foregroundColor(.compound.iconSecondary)
.accessibilityLabel(accessibilityLabel)
}
}
}
private struct VoiceMessageButtonStyle: ButtonStyle {
@Environment(\.isEnabled) var isEnabled: Bool
func makeBody(configuration: Configuration) -> some View {
configuration.label
.foregroundColor(isEnabled ? .compound.textSecondary.opacity(configuration.isPressed ? 0.6 : 1) : .compound.iconDisabled)
}
}
extension VoiceMessageButton.State {
init(state: AudioPlayerPlaybackState) {
switch state {