mirror of
https://github.com/whoeevee/EeveeSpotifyReborn.git
synced 2026-01-08 23:23:20 +00:00
potential fix for lyrics crashes
This commit is contained in:
@@ -14,6 +14,19 @@ struct WindowHelper {
|
||||
func present(_ viewController: UIViewController) {
|
||||
rootViewController.present(viewController, animated: true)
|
||||
}
|
||||
|
||||
func findFirstSubview(_ regex: String, in view: UIView) -> UIView? {
|
||||
for subview in view.subviews {
|
||||
if NSStringFromClass(type(of: subview)) ~= regex {
|
||||
return subview
|
||||
}
|
||||
if let found = findFirstSubview(regex, in: subview) {
|
||||
return found
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func findFirstViewController(_ regex: String) -> UIViewController? {
|
||||
let rootView = self.rootViewController.view!
|
||||
|
||||
@@ -63,12 +63,11 @@ class LyricsOnlyViewControllerHook: ClassHook<UIViewController> {
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
let lyricsLabel = EeveeSpotify.isOldSpotifyVersion
|
||||
? lyricsHeaderViewController.view.subviews.first?.subviews.first
|
||||
: lyricsHeaderViewController.view.subviews.first
|
||||
|
||||
guard let lyricsLabel = lyricsLabel else {
|
||||
guard let lyricsLabel = WindowHelper.shared.findFirstSubview(
|
||||
"SPTEncoreLabel",
|
||||
in: lyricsHeaderViewController.view
|
||||
) else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user