mirror of
https://github.com/whoeevee/EeveeSpotifyReborn.git
synced 2026-01-09 00:23:20 +01:00
fix lyrics crashes on 9.0.14
This commit is contained in:
@@ -87,30 +87,52 @@ class LyricsOnlyViewControllerHook: ClassHook<UIViewController> {
|
||||
})
|
||||
|
||||
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
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -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, *)
|
||||
|
||||
Reference in New Issue
Block a user