From cb8e98263d506a51684b144b6a8746279b6f5a59 Mon Sep 17 00:00:00 2001 From: eevee Date: Thu, 11 Jul 2024 11:54:05 +0300 Subject: [PATCH] musixmatch language codes are crazy --- .../EeveeSpotify/Models/Extensions/UIColor+Extension.swift | 4 ++-- .../Settings/Views/Sections/EeveeLyricsSettingsView.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/EeveeSpotify/Models/Extensions/UIColor+Extension.swift b/Sources/EeveeSpotify/Models/Extensions/UIColor+Extension.swift index a9de376..653035d 100644 --- a/Sources/EeveeSpotify/Models/Extensions/UIColor+Extension.swift +++ b/Sources/EeveeSpotify/Models/Extensions/UIColor+Extension.swift @@ -14,10 +14,10 @@ extension UIColor { red: r1 * (1.0 - amount) + r2 * amount, green: g1 * (1.0 - amount) + g2 * amount, blue: b1 * (1.0 - amount) + b2 * amount, - alpha: a1 + alpha: a1 * (1.0 - amount) + a2 * amount ) } func lighter(by amount: CGFloat = 0.2) -> Self { mix(with: .white, amount: amount) } func darker(by amount: CGFloat = 0.2) -> Self { mix(with: .black, amount: amount) } -} \ No newline at end of file +} diff --git a/Sources/EeveeSpotify/Settings/Views/Sections/EeveeLyricsSettingsView.swift b/Sources/EeveeSpotify/Settings/Views/Sections/EeveeLyricsSettingsView.swift index a8389a4..7410e56 100644 --- a/Sources/EeveeSpotify/Settings/Views/Sections/EeveeLyricsSettingsView.swift +++ b/Sources/EeveeSpotify/Settings/Views/Sections/EeveeLyricsSettingsView.swift @@ -64,7 +64,7 @@ struct EeveeLyricsSettingsView: View { .foregroundColor(.gray) } } footer: { - Text("You can enter a 2-letter ISO language code and see translated lyrics on Musixmatch if they are available. It overrides Romanized Lyrics.") + Text("You can enter a 2-letter Musixmatch language code and see translated lyrics on Musixmatch if they are available. It overrides Romanized Lyrics.") } } @@ -90,7 +90,7 @@ struct EeveeLyricsSettingsView: View { let selectedLanguage = lyricsOptions.musixmatchLanguage - if selectedLanguage.isEmpty || Locale.isoLanguageCodes.contains(selectedLanguage) { + if selectedLanguage.isEmpty || selectedLanguage ~= "^[\\w\\d]{2}$" { showLanguageWarning = false MusixmatchLyricsRepository.shared.selectedLanguage = selectedLanguage