diff --git a/Sources/EeveeSpotify/Models/Extensions/StirngArray+Extension.swift b/Sources/EeveeSpotify/Models/Extensions/StringArray+Extension.swift similarity index 100% rename from Sources/EeveeSpotify/Models/Extensions/StirngArray+Extension.swift rename to Sources/EeveeSpotify/Models/Extensions/StringArray+Extension.swift diff --git a/Sources/EeveeSpotify/Premium/SiriNoPlayAsRadio.x.swift b/Sources/EeveeSpotify/Premium/SiriNoPlayAsRadio.x.swift new file mode 100644 index 0000000..0639d0f --- /dev/null +++ b/Sources/EeveeSpotify/Premium/SiriNoPlayAsRadio.x.swift @@ -0,0 +1,29 @@ +import Orion +import Intents + +class INMediaItemHook: ClassHook { + func identifier() -> String { + var identifier = orig.identifier() + + if identifier.contains("play-command") { + let components = identifier.components(separatedBy: ":") + let jsonData = Data(base64Encoded: components[2])! + var json = try! JSONSerialization.jsonObject(with: jsonData) as! [String: Any] + + if let feedbackDetails = json["feedback_details"] as? [String: Any], + feedbackDetails["restriction"] as? String == "play-as-radio" { + var context = json["context"] as! [String: Any] + + let urlString = context["url"] as! String + context["url"] = urlString.removeMatches(":station") + + json["context"] = context + + let newData = try! JSONSerialization.data(withJSONObject: json) + identifier = "spotify:play-command:\(newData.base64EncodedString())" + } + } + + return identifier + } +}