Skip to content

Commit

Permalink
original lyrics colors when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
whoeevee committed May 30, 2024
1 parent 1f0bc4f commit f98b019
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Sources/EeveeSpotify/DataLoaderServiceHooks.x.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Sources/EeveeSpotify/Lyrics/CustomLyrics.x.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f98b019

Please sign in to comment.