commit 4786c6f0cb34f7678e59e152a78786411af169db
parent 8d0aea22fd4a1276a64e3a98f3c3b2c8fab195ac
Author: William Casarin <jb55@jb55.com>
Date: Thu, 6 Apr 2023 17:33:01 -0700
Don't show Translating... if we're not actually translating
Changelog-Fixed: Don't show Translating... if we're not actually translating
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/damus/Components/TranslateView.swift b/damus/Components/TranslateView.swift
@@ -17,6 +17,7 @@ struct Translated: Equatable {
enum TranslateStatus: Equatable {
case havent_tried
case trying
+ case translating
case translated(Translated)
case not_needed
}
@@ -88,7 +89,7 @@ struct TranslateView: View {
guard damus_state.settings.can_translate(damus_state.pubkey) else {
return
}
-
+
let note_lang = event.note_language(damus_state.keypair.privkey) ?? currentLanguage
// Don't translate if its in our preferred languages
@@ -97,6 +98,10 @@ struct TranslateView: View {
return
}
+ DispatchQueue.main.async {
+ self.translated = .translating
+ }
+
// If the note language is different from our preferred languages, send a translation request.
let translator = Translator(damus_state.settings)
let originalContent = event.get_content(damus_state.keypair.privkey)
@@ -135,6 +140,8 @@ struct TranslateView: View {
TranslateButton
}
case .trying:
+ Text("")
+ case .translating:
Text("Translating...")
.foregroundColor(.gray)
.font(.footnote)