something

This commit is contained in:
eevee
2024-07-04 02:44:49 +03:00
parent 00920de57a
commit 06766d5b47
5 changed files with 31 additions and 22 deletions
+7 -14
View File
@@ -11,22 +11,15 @@ class EncoreLabelHook: ClassHook<UIView> {
func intrinsicContentSize() -> CGSize {
if String(
describing: WindowHelper.shared.viewController(for: target)
) ~= "SPTEncorePopUpContainer" {
let label = Dynamic.convert(target.subviews.first!, to: UILabel.self)
if let viewController = WindowHelper.shared.viewController(for: target) {
let superview: UIView?
if #available(iOS 15.0, *) {
superview = target.superview?.superview?.superview?.superview
} else {
superview = target.superview?.superview?.superview
}
if NSStringFromClass(type(of: viewController)) == "SPTEncorePopUpContainer" {
if !(String(describing: superview) ~= "Primary") {
label.textColor = .white
let label = Dynamic.convert(target.subviews.first!, to: UILabel.self)
if !label.hasParent("Primary") {
label.textColor = .white
}
}
}
@@ -23,7 +23,7 @@ class WindowHelper {
func searchViews(_ view: UIView) {
if let viewController = self.viewController(for: view) {
if String(describing: type(of: viewController)) ~= regex {
if NSStringFromClass(type(of: viewController)) ~= regex {
result = viewController
return
}
@@ -114,9 +114,10 @@ struct LrcLibLyricsRepository: LyricsRepository {
}
return LyricsDto(
lines: plainLyrics.components(separatedBy: "\n").dropLast().map { content in
LyricsLineDto(content: content)
},
lines: plainLyrics
.components(separatedBy: "\n")
.dropLast()
.map { content in LyricsLineDto(content: content) },
timeSynced: false
)
}
@@ -0,0 +1,16 @@
import UIKit
extension UIView {
func hasParent(_ regex: String) -> Bool {
guard let parent = self.superview else {
return false
}
let parentClassName = NSStringFromClass(type(of: parent))
if parentClassName ~= regex {
return true
} else {
return parent.hasParent(regex)
}
}
}
@@ -46,11 +46,10 @@ class UIButtonHook: ClassHook<UIButton> {
if highlighted {
if let identifier = target.accessibilityIdentifier, identifier.contains("DownloadButton") {
if let identifier = target.accessibilityIdentifier, identifier.contains("DownloadButton"),
let viewController = WindowHelper.shared.viewController(for: target) {
let vcDescription = String(describing: WindowHelper.shared.viewController(for: target))
if !(vcDescription ~= "Podcast|CreativeWorkPlatform") {
if !(NSStringFromClass(type(of: viewController)) ~= "Podcast|CreativeWorkPlatform") {
target.removeTarget(nil, action: nil, for: .allEvents)
showOfflineModePopUp()