Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix ios width for download

laurenspriema55ccbe7382a
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/Components/ChatViewComponents.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/Components/ChatViewComponents.swift
index 4d562d8ca7..bbd42dc137 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/Components/ChatViewComponents.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/Components/ChatViewComponents.swift
@@ -32,11 +32,11 @@ struct DownloadOnboardingView: View {
return "Downloading..."
}()
- Text(statusLine)
- .font(EnsuTypography.body)
- .monospacedDigit()
- .foregroundStyle(EnsuColor.textMuted)
- .multilineTextAlignment(.center)
+ StableDownloadStatusText(
+ text: statusLine,
+ font: EnsuTypography.body,
+ color: EnsuColor.textMuted
+ )
progressView
} else {
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/DownloadToastView.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/DownloadToastView.swift
index b7ac70a73c..02663300d6 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/DownloadToastView.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/DownloadToastView.swift
@@ -99,10 +99,11 @@ struct DownloadToastView: View {
}
HStack {
- Text(state.status)
- .font(EnsuFont.message(size: 12, weight: .regular))
- .monospacedDigit()
- .foregroundStyle(hasError ? EnsuColor.error : EnsuColor.textMuted)
+ StableDownloadStatusText(
+ text: state.status,
+ font: EnsuFont.message(size: 12, weight: .regular),
+ color: hasError ? EnsuColor.error : EnsuColor.textMuted
+ )
Spacer()
@@ -144,3 +145,29 @@ struct DownloadToastView: View {
.transition(.move(edge: .top).combined(with: .opacity))
}
}
+
+struct StableDownloadStatusText: View {
+ let text: String
+ let font: Font
+ let color: Color
+
+ private var widestText: String {
+ guard text.hasPrefix("Downloading... "), let slashRange = text.range(of: " / ") else {
+ return text
+ }
+ return "Downloading... 999.9 MB / \(text[slashRange.upperBound...])"
+ }
+
+ var body: some View {
+ ZStack(alignment: .leading) {
+ Text(widestText)
+ .hidden()
+ .accessibilityHidden(true)
+ Text(text)
+ }
+ .font(font)
+ .monospacedDigit()
+ .foregroundStyle(color)
+ .lineLimit(1)
+ }
+}