From f1aababc452f99f9b77e8d8d171923516b973508 Mon Sep 17 00:00:00 2001 From: eevee Date: Sat, 11 May 2024 18:03:37 +0300 Subject: [PATCH] Open In Spotify --- Sources/EeveeSpotify/OpenInSpotify.x.swift | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Sources/EeveeSpotify/OpenInSpotify.x.swift diff --git a/Sources/EeveeSpotify/OpenInSpotify.x.swift b/Sources/EeveeSpotify/OpenInSpotify.x.swift new file mode 100644 index 0000000..76cdae9 --- /dev/null +++ b/Sources/EeveeSpotify/OpenInSpotify.x.swift @@ -0,0 +1,27 @@ +import Orion +import UIKit + +class SpotifySceneDelegateHook: ClassHook { + + static let targetName = "MusicApp_ContainerWiring.SpotifySceneDelegate" + + func scene(_ scene: UIScene, continueUserActivity userActivity: NSUserActivity) { + orig.scene(scene, continueUserActivity: userActivity) + } + + func scene(_ scene: UIScene, openURLContexts URLContexts: Set) { + + 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 + } + + orig.scene(scene, openURLContexts: URLContexts) + } +}