mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-30 04:01:02 +00:00
Fix translation on RT
This commit is contained in:
parent
2df40ff543
commit
34b6525b37
2 changed files with 5 additions and 3 deletions
|
@ -309,7 +309,7 @@ public struct StatusRowView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let translation = viewModel.translation {
|
if let translation = viewModel.translation, !viewModel.isLoadingTranslation {
|
||||||
GroupBox {
|
GroupBox {
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
Text(translation)
|
Text(translation)
|
||||||
|
|
|
@ -230,10 +230,12 @@ public class StatusRowViewModel: ObservableObject {
|
||||||
withAnimation {
|
withAnimation {
|
||||||
isLoadingTranslation = true
|
isLoadingTranslation = true
|
||||||
}
|
}
|
||||||
let translation = try await client.request(target: userLang, source: status.language, text: status.content.asRawText)
|
let translation = try await client.request(target: userLang,
|
||||||
|
source: status.language,
|
||||||
|
text: status.reblog?.content.asRawText ?? status.content.asRawText)
|
||||||
withAnimation {
|
withAnimation {
|
||||||
isLoadingTranslation = false
|
|
||||||
self.translation = translation
|
self.translation = translation
|
||||||
|
isLoadingTranslation = false
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue