damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 7f6540b0c08aa6fa72510063bba4f5dbd12848ca
parent 2be83560bcfd6272813df95a16f00c7329b9849b
Author: kernelkind <kernelkind@gmail.com>
Date:   Thu,  1 Feb 2024 15:19:56 -0500

translate: remove redundant translation call

When auto-translate is enabled, translations are saved in cache through
preload_event in EventCache so it's redundant and wasteful to call
translate() as an async task

Closes: https://github.com/damus-io/damus/issues/1940
Lightning-address: kernelkind@getalby.com
Signed-off-by: kernelkind <kernelkind@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mdamus/Components/TranslateView.swift | 11-----------
1 file changed, 0 insertions(+), 11 deletions(-)

diff --git a/damus/Components/TranslateView.swift b/damus/Components/TranslateView.swift @@ -72,15 +72,7 @@ struct TranslateView: View { } } } - - func attempt_translation() { - guard should_translate(event: event, our_keypair: damus_state.keypair, settings: damus_state.settings, note_lang: self.translations_model.note_language), damus_state.settings.auto_translate else { - return - } - translate() - } - func should_transl(_ note_lang: String) -> Bool { should_translate(event: event, our_keypair: damus_state.keypair, settings: damus_state.settings, note_lang: note_lang) } @@ -105,9 +97,6 @@ struct TranslateView: View { Text("") } } - .task { - attempt_translation() - } } func translationMeetsStringDistanceRequirements(original: String, translated: String) -> Bool {