mirror of
https://github.com/lux-tel/session-ios.git
synced 2026-10-30 20:38:32 +00:00
• Added new 'LintControl' mechanisms to allow for ignoring sections of code • Added new 'MatchType' mechanisms for excluding unlocalized cases • Updated the code to explicitly handle localized template strings (both single and multiline) • Updated the code to process files across multiple threads to improve performance • Updated the code to use Swift 5.7 regex and store in static variables to prevent reconstruction every time they are used • Removed the list of individual files which are ignored (now just output a count) • Fixed an issue where having a localized string on a subsequent line could result in an unlocalized (or incorrectly localized) string not being detected • Fixed an issue where having multiple strings on a single line could result in an unlocalized string not being detected • Fixed an issue where zero-width characters would result in the variable count comparison between translations failing • Fixed a number of localization warnings
96 lines
3.3 KiB
Swift
96 lines
3.3 KiB
Swift
// Copyright © 2023 Rangeproof Pty Ltd. All rights reserved.
|
||
|
||
import SwiftUI
|
||
import SessionUIKit
|
||
import SessionMessagingKit
|
||
|
||
struct VoiceMessageView_SwiftUI: View {
|
||
@State var isPlaying: Bool = false
|
||
@State var time: String = "0:00" // stringlint:ignore
|
||
@State var speed: String = "1.5×" // stringlint:ignore
|
||
@State var progress: Double = 0.0
|
||
|
||
private static let width: CGFloat = 160
|
||
private static let toggleContainerSize: CGFloat = 20
|
||
|
||
private var attachment: Attachment
|
||
|
||
public init(attachment: Attachment) {
|
||
self.attachment = attachment
|
||
}
|
||
|
||
var body: some View {
|
||
ZStack(alignment: .leading) {
|
||
Rectangle()
|
||
.foregroundColor(themeColor: .messageBubble_overlay)
|
||
.frame(width: Self.width * progress)
|
||
|
||
HStack(
|
||
alignment: .center,
|
||
spacing: 0
|
||
) {
|
||
ZStack {
|
||
Circle()
|
||
.foregroundColor(themeColor: .backgroundSecondary)
|
||
.frame(
|
||
width: Self.toggleContainerSize,
|
||
height: Self.toggleContainerSize
|
||
)
|
||
if let toggleImage: UIImage = UIImage(named: isPlaying ? "Pause" : "Play")?.withRenderingMode(.alwaysTemplate) {
|
||
Image(uiImage: toggleImage)
|
||
.resizable()
|
||
.foregroundColor(themeColor: .textPrimary)
|
||
.scaledToFit()
|
||
.frame(
|
||
width: 8,
|
||
height: 8
|
||
)
|
||
}
|
||
|
||
if attachment.state == .downloading {
|
||
ActivityIndicator(themeColor: .textPrimary, width: 2)
|
||
.frame(
|
||
width: Self.toggleContainerSize,
|
||
height: Self.toggleContainerSize
|
||
)
|
||
}
|
||
}
|
||
|
||
Rectangle()
|
||
.foregroundColor(themeColor: .backgroundSecondary)
|
||
.frame(height: 1)
|
||
|
||
ZStack {
|
||
Capsule()
|
||
.foregroundColor(themeColor: .backgroundSecondary)
|
||
.frame(
|
||
width: 44,
|
||
height: Self.toggleContainerSize
|
||
)
|
||
|
||
Text(attachment.duration.defaulting(to: 0).formatted(format: .hoursMinutesSeconds))
|
||
.foregroundColor(themeColor: .textPrimary)
|
||
.font(.system(size: Values.smallFontSize))
|
||
}
|
||
}
|
||
.padding(.all, Values.smallSpacing)
|
||
}
|
||
.frame(
|
||
width: Self.width
|
||
)
|
||
}
|
||
}
|
||
|
||
struct VoiceMessageView_SwiftUI_Previews: PreviewProvider {
|
||
static var previews: some View {
|
||
VoiceMessageView_SwiftUI(
|
||
attachment: Attachment(
|
||
variant: .voiceMessage,
|
||
contentType: "mp4",
|
||
byteCount: 100
|
||
)
|
||
)
|
||
.frame(height: 58)
|
||
}
|
||
}
|