mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Fix accessibility label for VoiceMessageButton
This commit is contained in:
committed by
Alfonso Grillo
parent
5823af6a91
commit
1780b58e58
@@ -56,6 +56,7 @@ struct VoiceMessageButton: View {
|
||||
.buttonStyle(VoiceMessageButtonStyle())
|
||||
.disabled(state == .loading)
|
||||
.background(Circle().foregroundColor(.compound.bgCanvasDefault))
|
||||
.accessibilityLabel(accessibilityLabel)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
@@ -65,7 +66,6 @@ struct VoiceMessageButton: View {
|
||||
ProgressView()
|
||||
case .playing, .paused:
|
||||
let imageAsset = state == .playing ? Asset.Images.mediaPause : Asset.Images.mediaPlay
|
||||
let accessibilityLabel = state == .playing ? L10n.a11yPause : L10n.a11yPlay
|
||||
let offset: CGFloat = state == .playing ? 0 : 2
|
||||
|
||||
Image(asset: imageAsset)
|
||||
@@ -73,7 +73,17 @@ struct VoiceMessageButton: View {
|
||||
.scaledToFit()
|
||||
.frame(width: imageWidth, height: imageHeight)
|
||||
.offset(x: offset)
|
||||
.accessibilityLabel(accessibilityLabel)
|
||||
}
|
||||
}
|
||||
|
||||
private var accessibilityLabel: String {
|
||||
switch state {
|
||||
case .loading:
|
||||
return ""
|
||||
case .playing:
|
||||
return L10n.a11yPause
|
||||
case .paused:
|
||||
return L10n.a11yPlay
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user