the voice message toolbar now appears

This commit is contained in:
Mauro Romito
2022-10-20 19:18:50 +02:00
parent 8b14400b2c
commit d06adfc32f
7 changed files with 79 additions and 62 deletions
@@ -26,7 +26,7 @@ struct Composer: View {
@Environment(\.theme) private var theme: ThemeSwiftUI
@State private var focused = false
@State private var isActionButtonEnabled = false
@State private var isActionButtonShowing = false
private let horizontalPadding: CGFloat = 12
private let borderHeight: CGFloat = 40
@@ -148,7 +148,7 @@ struct Composer: View {
.resizable()
.foregroundColor(theme.colors.tertiaryContent)
.frame(width: 14, height: 14)
}
.frame(width: 36, height: 36)
.background(Circle().fill(theme.colors.system))
@@ -159,16 +159,6 @@ struct Composer: View {
}
.frame(height: 44)
Spacer()
// ZStack {
// TODO: Add support for voice messages
// Button {
//
// } label: {
// Image(Asset.Images.voiceMessageRecordButtonDefault.name)
// .foregroundColor(theme.colors.tertiaryContent)
// }
// .isHidden(showSendButton)
// .isHidden(true)
Button {
sendMessageAction(wysiwygViewModel.content)
wysiwygViewModel.clearContent()
@@ -181,13 +171,12 @@ struct Composer: View {
}
.frame(width: 36, height: 36)
.padding(.leading, 8)
.disabled(!isActionButtonEnabled)
.opacity(isActionButtonEnabled ? 1 : 0.3)
.animation(.easeInOut(duration: 0.15), value: isActionButtonEnabled)
.isHidden(!isActionButtonShowing)
.accessibilityIdentifier(actionButtonAccessibilityIdentifier)
.accessibilityLabel(VectorL10n.send)
.onChange(of: wysiwygViewModel.isContentEmpty) { empty in
isActionButtonEnabled = !empty
.onChange(of: wysiwygViewModel.isContentEmpty) { isEmpty in
isActionButtonShowing = !isEmpty
viewModel.send(viewAction: .contentDidChange(isEmpty: isEmpty))
}
}
.padding(.horizontal, 12)