Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
fix: "Translated by" names only a saved translation that shows
My-Name-Is-Jeff0c75c43f66e4
diff --git a/tweak/Sources/Redesigned/Lyrics/SGRKaraokeView.m b/tweak/Sources/Redesigned/Lyrics/SGRKaraokeView.mindex 96d746bb..88259f58 100644--- a/tweak/Sources/Redesigned/Lyrics/SGRKaraokeView.m+++ b/tweak/Sources/Redesigned/Lyrics/SGRKaraokeView.m@@ -1977,7 +1977,8 @@ static BOOL anyUntranslated(NSArray<SGKaraokeLine *> *lines) {: @"Date unknown";source.attributes = UIMenuElementAttributesDisabled;NSMutableArray<UIMenuElement *> *about = [NSMutableArray arrayWithObject:source];- if (_saved.deletable) {+ // Not while a translator works: its next batch would save the file again.+ if (_saved.deletable && !translating) {NSString *track = _track;UIAction *delete = [UIAction actionWithTitle:@"Delete This Translation" image:[UIImage systemImageNamed:@"trash"] identifier:nilhandler:^(UIAction *action) { SGLyricsDeleteSavedTranslation(track, SGLyricsTranslationTarget()); }];diff --git a/tweak/Sources/Shared/LyricsTranslation/LyricsTranslation.h b/tweak/Sources/Shared/LyricsTranslation/LyricsTranslation.hindex 3e9b47b2..16f219e0 100644--- a/tweak/Sources/Shared/LyricsTranslation/LyricsTranslation.h+++ b/tweak/Sources/Shared/LyricsTranslation/LyricsTranslation.h@@ -81,7 +81,7 @@ NSArray<SGModRow *> *SGAITranslatorRows(void);// SavedTranslations.m: a song's translations kept on disk by track and language, matched to lines by their text,// with who made them and when. The saved ones are the truth for translations made here: syncing fills the lines// with no translation from them, and takes a made translation off a line that has none saved (after Delete).-// Syncing and saving give the saved file's source, nil when there is none. Main thread.+// Syncing gives the saved file's source, nil when none of its lines shows; saving gives the new one. Main thread.SGTranslationSource *SGLyricsSyncSavedTranslation(NSString *track, NSString *language, NSArray<SGKaraokeLine *> *lines);SGTranslationSource *SGLyricsSaveTranslation(NSString *track, NSString *language, NSArray<SGKaraokeLine *> *lines, SGTranslationSource *source);// Deletes the song's saved translation and the launch's answers for it, then posts SGLyricsTranslationsDidChangeNotification.diff --git a/tweak/Sources/Shared/LyricsTranslation/SavedTranslations.m b/tweak/Sources/Shared/LyricsTranslation/SavedTranslations.mindex d98c74d8..98e78c28 100644--- a/tweak/Sources/Shared/LyricsTranslation/SavedTranslations.m+++ b/tweak/Sources/Shared/LyricsTranslation/SavedTranslations.m@@ -45,6 +45,7 @@ SGTranslationSource *SGLyricsSyncSavedTranslation(NSString *track, NSString *lanNSData *data = [NSData dataWithContentsOfURL:fileFor(track, language)];SGTranslationSource *source = nil;NSDictionary *saved = SGSavedTranslationLines(data ? [NSJSONSerialization JSONObjectWithData:data options:0 error:nil] : nil, &source);+ BOOL shown = NO;for (SGKaraokeLine *line in lines) {id translation = saved[SGKaraokeLineText(line) ?: @""];BOOL has = [translation isKindOfClass:NSString.class] && [translation length];@@ -55,8 +56,10 @@ SGTranslationSource *SGLyricsSyncSavedTranslation(NSString *track, NSString *lanline.translation = translation;line.translationMade = YES;}+ shown |= line.translationMade;}- return source;+ // A file none of these lines matched (lyrics from another source) made nothing that shows.+ return shown ? source : nil;}// One at a time, in the order asked: a song is saved after every batch, and an older write must not land last.