Skip to content

Commit

Permalink
kinda fix for whoeevee#246
Browse files Browse the repository at this point in the history
  • Loading branch information
whoeevee authored and Dark-Matter7232 committed Jul 19, 2024
1 parent cc74771 commit 01e027f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Sources/EeveeSpotify/Lyrics/CustomLyrics.x.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class LyricsFullscreenViewControllerHook: ClassHook<UIViewController> {

if UserDefaults.lyricsSource == .musixmatch
&& lastLyricsError == nil
&& !lastLyricsWasRomanized {
&& !lastLyricsWasRomanized
&& !lastLyricsAreEmpty {
return
}

Expand All @@ -41,6 +42,7 @@ class LyricsFullscreenViewControllerHook: ClassHook<UIViewController> {
//

private var lastLyricsWasRomanized = false
private var lastLyricsAreEmpty = false
private var lastLyricsError: LyricsError? = nil

private var hasShownRestrictedPopUp = false
Expand Down Expand Up @@ -212,6 +214,7 @@ func getCurrentTrackLyricsData(originalLyrics: Lyrics? = nil) throws -> Data {
}

lastLyricsWasRomanized = lyricsDto.romanized
lastLyricsAreEmpty = lyricsDto.lines.isEmpty

let lyrics = Lyrics.with {
$0.colors = getLyricsColors()
Expand Down
17 changes: 15 additions & 2 deletions Sources/EeveeSpotify/Lyrics/Models/LyricsDto.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,26 @@ struct LyricsDto {
$0.timeSynchronized = timeSynced
$0.restriction = .unrestricted
$0.providedBy = "\(source) (EeveeSpotify)"
$0.lines = lines.map { line in
}

lyricsData.lines = lines.isEmpty
? [
LyricsLine.with {
$0.content = "This song is instrumental."
},
LyricsLine.with {
$0.content = "Let the music play..."
},
LyricsLine.with {
$0.content = ""
}
]
: lines.map { line in
LyricsLine.with {
$0.content = line.content
$0.offsetMs = Int32(line.offsetMs ?? 0)
}
}
}

if let translation = translation {
lyricsData.translation = LyricsTranslation.with {
Expand Down
1 change: 1 addition & 0 deletions Sources/EeveeSpotify/Models/Headers/SPTPlayerTrack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Foundation

@objc protocol SPTPlayerTrack {
func setMetadata(_ metadata: [String:String])
func metadata() -> [String:String]
func extractedColorHex() -> String
func trackTitle() -> String
func artistTitle() -> String
Expand Down

0 comments on commit 01e027f

Please sign in to comment.