mirror of
https://github.com/whoeevee/EeveeSpotifyReborn.git
synced 2026-01-09 00:23:20 +01:00
hide lyrics on error
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import Orion
|
||||
import UIKit
|
||||
|
||||
class fefewfwfwefewefw: ClassHook<UIViewController> {
|
||||
typealias Group = LyricsGroup
|
||||
|
||||
static var targetName: String {
|
||||
switch EeveeSpotify.hookTarget {
|
||||
case .lastAvailableiOS14: return "Lyrics_CoreImpl.ErrorViewController"
|
||||
default: return "Lyrics_NPVCommunicatorImpl.ErrorViewController"
|
||||
}
|
||||
}
|
||||
|
||||
func loadView() {
|
||||
orig.loadView()
|
||||
|
||||
guard UserDefaults.lyricsOptions.hideOnError, let controller = nowPlayingScrollViewController else {
|
||||
return
|
||||
}
|
||||
|
||||
var providers = controller.activeProviders
|
||||
|
||||
providers.removeAll(
|
||||
where: { NSStringFromClass(type(of: $0)) == HookTargetNameHelper.lyricsScrollProvider }
|
||||
)
|
||||
|
||||
controller.activeProviders = providers
|
||||
controller.collectionView().reloadData()
|
||||
}
|
||||
}
|
||||
+17
@@ -24,6 +24,23 @@ extension NowPlayingScrollViewController {
|
||||
|
||||
//
|
||||
|
||||
private var dataSource: NSObject {
|
||||
get {
|
||||
Ivars<NSObject>(nowPlayingScrollViewModel).dataSource
|
||||
}
|
||||
}
|
||||
|
||||
var activeProviders: Array<NSObject> {
|
||||
get {
|
||||
Ivars<Array<NSObject>>(dataSource).activeProviders
|
||||
}
|
||||
set {
|
||||
Ivars<Array<NSObject>>(dataSource).activeProviders = newValue
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
var backgroundViewController: SPTNowPlayingBackgroundViewController {
|
||||
get {
|
||||
Ivars<SPTNowPlayingBackgroundViewController>(self).backgroundViewController
|
||||
|
||||
@@ -8,7 +8,8 @@ extension UserDefaults {
|
||||
musixmatchLanguage: Locale.current.languageCode ?? "",
|
||||
lrclibUrl: LrclibLyricsRepository.originalApiUrl,
|
||||
geniusFallback: true,
|
||||
showFallbackReasons: true
|
||||
showFallbackReasons: true,
|
||||
hideOnError: false
|
||||
)
|
||||
)
|
||||
static var lyricsOptions
|
||||
|
||||
@@ -6,4 +6,5 @@ struct LyricsOptions: Codable, Hashable {
|
||||
var lrclibUrl: String
|
||||
var geniusFallback: Bool
|
||||
var showFallbackReasons: Bool
|
||||
var hideOnError: Bool
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ struct EeveeLyricsSettingsView: View {
|
||||
geniusFallbackSection()
|
||||
}
|
||||
|
||||
hideOnErrorSection()
|
||||
romanizedLyricsSection()
|
||||
|
||||
if viewModel.lyricsSource == .musixmatch {
|
||||
@@ -59,6 +60,17 @@ struct EeveeLyricsSettingsView: View {
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder private func hideOnErrorSection() -> some View {
|
||||
Section {
|
||||
Toggle(
|
||||
"hide_lyrics_on_error".localized,
|
||||
isOn: $viewModel.lyricsOptions.hideOnError
|
||||
)
|
||||
} footer: {
|
||||
Text("hide_lyrics_on_error_description".localized)
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder private func musixmatchLanguageSection() -> some View {
|
||||
Section {
|
||||
HStack {
|
||||
|
||||
@@ -55,6 +55,9 @@ genius_fallback_description = "Load lyrics from Genius if there is a problem wit
|
||||
|
||||
show_fallback_reasons = "Show Fallback Reasons";
|
||||
|
||||
hide_lyrics_on_error = "Hide on Error";
|
||||
hide_lyrics_on_error_description = "Remove the lyrics component if lyrics fail to load.";
|
||||
|
||||
romanized_lyrics = "Romanized Lyrics";
|
||||
romanized_lyrics_description = "Display romanized lyrics for Japanese, Korean, and Chinese.";
|
||||
|
||||
|
||||
@@ -54,6 +54,9 @@ genius_fallback_description = "Загружать тексты из Genius пр
|
||||
|
||||
show_fallback_reasons = "Показывать проблемы";
|
||||
|
||||
hide_lyrics_on_error = "Скрывать при ошибке";
|
||||
hide_lyrics_on_error_description = "Скрывать компонент текста, если не удается загрузить текст.";
|
||||
|
||||
romanized_lyrics = "Латинизация текстов";
|
||||
romanized_lyrics_description = "Отображать латинизированный текст для японского, корейского и китайского языков.";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user