Skip to content

Commit

Permalink
something
Browse files Browse the repository at this point in the history
  • Loading branch information
whoeevee committed Jul 3, 2024
1 parent 00920de commit 06766d5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 22 deletions.
21 changes: 7 additions & 14 deletions Sources/EeveeSpotify/DarkPopUps.x.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)

let superview: UIView?
if let viewController = WindowHelper.shared.viewController(for: target) {

if #available(iOS 15.0, *) {
superview = target.superview?.superview?.superview?.superview
} else {
superview = target.superview?.superview?.superview
}
if NSStringFromClass(type(of: viewController)) == "SPTEncorePopUpContainer" {

let label = Dynamic.convert(target.subviews.first!, to: UILabel.self)

if !(String(describing: superview) ~= "Primary") {
label.textColor = .white
if !label.hasParent("Primary") {
label.textColor = .white
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/EeveeSpotify/Helpers/WindowHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}
Expand Down
16 changes: 16 additions & 0 deletions Sources/EeveeSpotify/Models/Extensions/UIView+Extension.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
7 changes: 3 additions & 4 deletions Sources/EeveeSpotify/Premium/ServerSidedReminder.x.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 06766d5

Please sign in to comment.