fix opening spotify links when app is closed

This commit is contained in:
eevee
2024-05-23 23:13:33 +03:00
parent 9393f1e82e
commit c2370ef3c6
2 changed files with 12 additions and 18 deletions
@@ -4,4 +4,8 @@ extension URL {
var isLyrics: Bool {
self.path.contains("color-lyrics/v2")
}
var isOpenSpotifySafariExtension: Bool {
self.host == "eevee"
}
}
+8 -18
View File
@@ -1,27 +1,17 @@
import Orion
import UIKit
class SpotifySceneDelegateHook: ClassHook<NSObject> {
class UIOpenURLContextHook: ClassHook<NSObject> {
static let targetName = "MusicApp_ContainerWiring.SpotifySceneDelegate"
static let targetName = "UIOpenURLContext"
func scene(_ scene: UIScene, continueUserActivity userActivity: NSUserActivity) {
orig.scene(scene, continueUserActivity: userActivity)
}
func URL() -> URL {
let url = orig.URL()
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
let url = URLContexts.first!.url
if url.host == "eevee" {
let userActivity = NSUserActivity(activityType: NSUserActivityTypeBrowsingWeb)
userActivity.webpageURL = URL(string: "https:/\(url.path)")
orig.scene(scene, continueUserActivity: userActivity)
return
if url.isOpenSpotifySafariExtension {
return Foundation.URL(string: "https:/\(orig.URL().path)")!
}
orig.scene(scene, openURLContexts: URLContexts)
return url
}
}