Skip to content

Commit

Permalink
something
Browse files Browse the repository at this point in the history
  • Loading branch information
whoeevee committed Jul 10, 2024
1 parent 5a374cc commit 257983b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
34 changes: 14 additions & 20 deletions Sources/EeveeSpotify/Lyrics/CustomLyrics.x.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ class SPTPlayerTrackHook: ClassHook<NSObject> {
class LyricsFullscreenViewControllerHook: ClassHook<UIViewController> {

static var targetName: String {
if #available(iOS 15.0, *) {
"Lyrics_FullscreenPageImpl.FullscreenViewController"
} else {
"Lyrics_CoreImpl.FullscreenViewController"
}
return EeveeSpotify.isOldSpotifyVersion
? "Lyrics_CoreImpl.FullscreenViewController"
: "Lyrics_FullscreenPageImpl.FullscreenViewController"
}

func viewDidLoad() {
orig.viewDidLoad()

if UserDefaults.lyricsSource == .musixmatch {
if UserDefaults.lyricsSource == .musixmatch
&& lastLyricsError == nil
&& lastLyricsLanguageLabel == nil {
return
}

Expand All @@ -51,11 +51,9 @@ private var hasShownUnauthorizedPopUp = false
class LyricsOnlyViewControllerHook: ClassHook<UIViewController> {

static var targetName: String {
if #available(iOS 15.0, *) {
"Lyrics_NPVCommunicatorImpl.LyricsOnlyViewController"
} else {
"Lyrics_CoreImpl.LyricsOnlyViewController"
}
return EeveeSpotify.isOldSpotifyVersion
? "Lyrics_CoreImpl.LyricsOnlyViewController"
: "Lyrics_NPVCommunicatorImpl.LyricsOnlyViewController"
}

func viewDidLoad() {
Expand All @@ -70,14 +68,10 @@ class LyricsOnlyViewControllerHook: ClassHook<UIViewController> {

//

let lyricsLabel: UIView?

if #available(iOS 15.0, *) {
lyricsLabel = lyricsHeaderViewController.view.subviews.first
} else {
lyricsLabel = lyricsHeaderViewController.view.subviews.first?.subviews.first
}

let lyricsLabel = EeveeSpotify.isOldSpotifyVersion
? lyricsHeaderViewController.view.subviews.first?.subviews.first
: lyricsHeaderViewController.view.subviews.first

guard let lyricsLabel = lyricsLabel else {
return
}
Expand Down Expand Up @@ -124,7 +118,7 @@ class LyricsOnlyViewControllerHook: ClassHook<UIViewController> {
)
}

if #unavailable(iOS 15.0) {
if EeveeSpotify.isOldSpotifyVersion {
encoreLabel.setNumberOfLines(text.count)
}

Expand Down
1 change: 1 addition & 0 deletions Sources/EeveeSpotify/Tweak.x.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func exitApplication() {
struct EeveeSpotify: Tweak {

static let version = "4.3"
static let isOldSpotifyVersion = NSClassFromString("Lyrics_NPVCommunicatorImpl.LyricsOnlyViewController") == nil

init() {

Expand Down

0 comments on commit 257983b

Please sign in to comment.