mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-03-31 03:16:05 +00:00
ios: fix layout of voice message (#1836)
* ios: fix layout of voice message * fix layout * prevent translations
This commit is contained in:
committed by
GitHub
parent
e27013071b
commit
25e4a1e86d
@@ -17,25 +17,28 @@ struct CIVoiceView: View {
|
||||
@State var playbackTime: TimeInterval?
|
||||
|
||||
var body: some View {
|
||||
VStack (
|
||||
alignment: chatItem.chatDir.sent ? .trailing : .leading,
|
||||
spacing: 6
|
||||
) {
|
||||
HStack {
|
||||
if chatItem.chatDir.sent {
|
||||
playerTime()
|
||||
.frame(width: 50, alignment: .leading)
|
||||
player()
|
||||
} else {
|
||||
player()
|
||||
playerTime()
|
||||
.frame(width: 50, alignment: .leading)
|
||||
Group {
|
||||
if chatItem.chatDir.sent {
|
||||
VStack (alignment: .trailing, spacing: 6) {
|
||||
HStack {
|
||||
playerTime()
|
||||
player()
|
||||
}
|
||||
.frame(alignment: .trailing)
|
||||
metaView().padding(.trailing, 10)
|
||||
}
|
||||
} else {
|
||||
VStack (alignment: .leading, spacing: 6) {
|
||||
HStack {
|
||||
player()
|
||||
playerTime()
|
||||
}
|
||||
.frame(alignment: .leading)
|
||||
metaView().padding(.leading, -6)
|
||||
}
|
||||
}
|
||||
CIMetaView(chatItem: chatItem)
|
||||
.padding(.leading, chatItem.chatDir.sent ? 0 : 12)
|
||||
.padding(.trailing, chatItem.chatDir.sent ? 12 : 0)
|
||||
}
|
||||
.padding([.top, .horizontal], 4)
|
||||
.padding(.bottom, 8)
|
||||
}
|
||||
|
||||
@@ -58,6 +61,10 @@ struct CIVoiceView: View {
|
||||
)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
|
||||
private func metaView() -> some View {
|
||||
CIMetaView(chatItem: chatItem)
|
||||
}
|
||||
}
|
||||
|
||||
struct VoiceMessagePlayerTime: View {
|
||||
@@ -66,13 +73,16 @@ struct VoiceMessagePlayerTime: View {
|
||||
@Binding var playbackTime: TimeInterval?
|
||||
|
||||
var body: some View {
|
||||
switch playbackState {
|
||||
case .noPlayback:
|
||||
Text(voiceMessageTime(recordingTime))
|
||||
case .playing:
|
||||
Text(voiceMessageTime_(playbackTime))
|
||||
case .paused:
|
||||
Text(voiceMessageTime_(playbackTime))
|
||||
ZStack(alignment: .leading) {
|
||||
Text(String("66:66")).foregroundColor(.clear)
|
||||
switch playbackState {
|
||||
case .noPlayback:
|
||||
Text(voiceMessageTime(recordingTime))
|
||||
case .playing:
|
||||
Text(voiceMessageTime_(playbackTime))
|
||||
case .paused:
|
||||
Text(voiceMessageTime_(playbackTime))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,11 @@ enum VoiceMessagePlaybackState {
|
||||
}
|
||||
|
||||
func voiceMessageTime(_ time: TimeInterval) -> String {
|
||||
let min = Int(time / 60)
|
||||
let sec = Int(time.truncatingRemainder(dividingBy: 60))
|
||||
return String(format: "%02d:%02d", min, sec)
|
||||
durationText(Int(time))
|
||||
}
|
||||
|
||||
func voiceMessageTime_(_ time: TimeInterval?) -> String {
|
||||
return voiceMessageTime(time ?? TimeInterval(0))
|
||||
durationText(Int(time ?? 0))
|
||||
}
|
||||
|
||||
struct ComposeVoiceView: View {
|
||||
|
||||
Reference in New Issue
Block a user