original lyrics colors when possible

This commit is contained in:
eevee
2024-05-30 15:03:55 +03:00
parent 1f0bc4f01f
commit f98b0197c2
2 changed files with 5 additions and 3 deletions
@@ -85,7 +85,9 @@ class SPTDataLoaderServiceHook: ClassHook<NSObject> {
orig.URLSession(
session,
dataTask: task,
didReceiveData: try getCurrentTrackLyricsData()
didReceiveData: try getCurrentTrackLyricsData(
originalLyrics: try? Lyrics(serializedData: data)
)
)
orig.URLSession(session, task: task, didCompleteWithError: nil)
@@ -28,7 +28,7 @@ class EncoreButtonHook: ClassHook<UIButton> {
}
}
func getCurrentTrackLyricsData() throws -> Data {
func getCurrentTrackLyricsData(originalLyrics: Lyrics? = nil) throws -> Data {
guard let track = HookedInstances.currentTrack else {
throw LyricsError.NoCurrentTrack
@@ -67,7 +67,7 @@ func getCurrentTrackLyricsData() throws -> Data {
}
let lyrics = try Lyrics.with {
$0.colors = LyricsColors.with {
$0.colors = originalLyrics?.colors ?? LyricsColors.with {
$0.backgroundColor = Color(hex: track.extractedColorHex()).normalized.uInt32
$0.lineColor = Color.black.uInt32
$0.activeLineColor = Color.white.uInt32