diff --git a/Sources/EeveeSpotify/Lyrics/CustomLyrics.x.swift b/Sources/EeveeSpotify/Lyrics/CustomLyrics.x.swift index 5fe248b8..2bd367ac 100644 --- a/Sources/EeveeSpotify/Lyrics/CustomLyrics.x.swift +++ b/Sources/EeveeSpotify/Lyrics/CustomLyrics.x.swift @@ -87,30 +87,52 @@ class LyricsOnlyViewControllerHook: ClassHook { }) let typeStyle = type( - of: Dynamic.SPTEncoreTypeStyle.alloc(interface: SPTEncoreTypeStyle.self) + of: Dynamic[ + dynamicMember: EeveeSpotify.isOldSpotifyVersion + ? "SPTEncoreTypeStyle" + : "SPTEncoreTextStyle" + ].alloc(interface: SPTEncoreTypeStyle.self) ).bodyMediumBold() // if UserDefaults.fallbackReasons, let description = lastLyricsState.fallbackError?.description { + var attributedString = Dynamic.SPTEncoreAttributedString.alloc( + interface: SPTEncoreAttributedString.self + ) + text.append( - Dynamic.SPTEncoreAttributedString.alloc(interface: SPTEncoreAttributedString.self) - .initWithString( + EeveeSpotify.isOldSpotifyVersion + ? attributedString.initWithString( "\n\("fallback_attribute".localized): \(description)", typeStyle: typeStyle, attributes: attributes ) + : attributedString.initWithString( + "\n\("fallback_attribute".localized): \(description)", + textStyle: typeStyle, + attributes: attributes + ) ) } if lastLyricsState.wasRomanized { + var attributedString = Dynamic.SPTEncoreAttributedString.alloc( + interface: SPTEncoreAttributedString.self + ) + text.append( - Dynamic.SPTEncoreAttributedString.alloc(interface: SPTEncoreAttributedString.self) - .initWithString( + EeveeSpotify.isOldSpotifyVersion + ? attributedString.initWithString( "\n\("romanized_attribute".localized)", typeStyle: typeStyle, attributes: attributes ) + : attributedString.initWithString( + "\n\("romanized_attribute".localized)", + textStyle: typeStyle, + attributes: attributes + ) ) } diff --git a/Sources/EeveeSpotify/Models/Headers/SPTEncoreAttributedString.swift b/Sources/EeveeSpotify/Models/Headers/SPTEncoreAttributedString.swift index 15eeda2d..d9810340 100644 --- a/Sources/EeveeSpotify/Models/Headers/SPTEncoreAttributedString.swift +++ b/Sources/EeveeSpotify/Models/Headers/SPTEncoreAttributedString.swift @@ -2,6 +2,9 @@ import Foundation @objc protocol SPTEncoreAttributedString { func initWithString(_ string: String, typeStyle: SPTEncoreTypeStyle, attributes: SPTEncoreAttributes) -> SPTEncoreAttributedString + // new method since 9.0.14 + func initWithString(_ string: String, textStyle: SPTEncoreTypeStyle, attributes: SPTEncoreAttributes) -> SPTEncoreAttributedString + func text() -> String @available(iOS 15.0, *)