mirror of
https://github.com/whoeevee/EeveeSpotifyReborn.git
synced 2026-01-09 00:23:20 +01:00
fix crashes on 8.9.54
This commit is contained in:
@@ -17,7 +17,7 @@ class EncoreLabelHook: ClassHook<UIView> {
|
||||
|
||||
let label = Dynamic.convert(target.subviews.first!, to: UILabel.self)
|
||||
|
||||
if !label.hasParent("Primary") {
|
||||
if !label.hasParent(matching: "Primary") {
|
||||
label.textColor = .white
|
||||
}
|
||||
}
|
||||
@@ -27,17 +27,15 @@ class EncoreLabelHook: ClassHook<UIView> {
|
||||
}
|
||||
}
|
||||
|
||||
class SPTEncorePopUpDialogHook: ClassHook<UIView> {
|
||||
class SPTEncorePopUpDialogHook: ClassHook<NSObject> {
|
||||
|
||||
typealias Group = DarkPopUps
|
||||
static let targetName = "_TtCO12EncoreMobile5ViewsP33_5A611B064D744992F9E8B522D8DE459B10ScrollView"
|
||||
static let targetName = "SPTEncorePopUpDialog"
|
||||
|
||||
func intrinsicContentSize() -> CGSize {
|
||||
|
||||
if target.accessibilityIdentifier == "PopUp.Dialog" {
|
||||
target.backgroundColor = UIColor(Color(hex: "#242424"))
|
||||
}
|
||||
|
||||
return orig.intrinsicContentSize()
|
||||
func uiView() -> UIView {
|
||||
let view = orig.uiView()
|
||||
view.backgroundColor = UIColor(Color(hex: "#242424"))
|
||||
|
||||
return view
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,18 +13,28 @@ class SPTPlayerTrackHook: ClassHook<NSObject> {
|
||||
}
|
||||
}
|
||||
|
||||
class EncoreButtonHook: ClassHook<UIButton> {
|
||||
class LyricsFullscreenViewControllerHook: ClassHook<UIViewController> {
|
||||
|
||||
static let targetName = "_TtC12EncoreMobileP33_6EF3A3C098E69FB1E331877B69ACBF8512EncoreButton"
|
||||
|
||||
func intrinsicContentSize() -> CGSize {
|
||||
|
||||
if target.accessibilityIdentifier == "Components.UI.LyricsHeader.ReportButton",
|
||||
UserDefaults.lyricsSource != .musixmatch {
|
||||
target.isEnabled = false
|
||||
static var targetName: String {
|
||||
if #available(iOS 15.0, *) {
|
||||
"Lyrics_FullscreenPageImpl.FullscreenViewController"
|
||||
} else {
|
||||
"Lyrics_CoreImpl.FullscreenViewController"
|
||||
}
|
||||
}
|
||||
|
||||
return orig.intrinsicContentSize()
|
||||
func viewDidLoad() {
|
||||
orig.viewDidLoad()
|
||||
|
||||
if UserDefaults.lyricsSource == .musixmatch {
|
||||
return
|
||||
}
|
||||
|
||||
let headerView = Ivars<UIView>(target.view).headerView
|
||||
|
||||
if let reportButton = headerView.subviews(matching: "EncoreButton")[1] as? UIButton {
|
||||
reportButton.isEnabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import UIKit
|
||||
|
||||
extension UIView {
|
||||
func hasParent(_ regex: String) -> Bool {
|
||||
func hasParent(matching regex: String) -> Bool {
|
||||
guard let parent = self.superview else {
|
||||
return false
|
||||
}
|
||||
@@ -10,7 +10,25 @@ extension UIView {
|
||||
if parentClassName ~= regex {
|
||||
return true
|
||||
} else {
|
||||
return parent.hasParent(regex)
|
||||
return parent.hasParent(matching: regex)
|
||||
}
|
||||
}
|
||||
|
||||
func subviews(matching regex: String) -> [UIView] {
|
||||
var matchingSubviews = [UIView]()
|
||||
var stack = [self]
|
||||
|
||||
while !stack.isEmpty {
|
||||
let currentView = stack.removeLast()
|
||||
|
||||
for subview in currentView.subviews {
|
||||
if NSStringFromClass(type(of: subview)) ~= regex {
|
||||
matchingSubviews.append(subview)
|
||||
}
|
||||
stack.append(subview)
|
||||
}
|
||||
}
|
||||
|
||||
return matchingSubviews
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user