2021-11-30 15:56:00 +03:00
|
|
|
// Copyright © 2021 Tokenary. All rights reserved.
|
2021-08-14 22:28:36 +03:00
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
2021-12-11 16:11:26 +03:00
|
|
|
var launchURL: URL?
|
|
|
|
|
2021-08-14 22:28:36 +03:00
|
|
|
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|
|
|
|
|
|
|
var window: UIWindow?
|
|
|
|
|
|
|
|
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
|
2021-08-21 16:30:56 +03:00
|
|
|
guard (scene as? UIWindowScene) != nil else { return }
|
2021-12-11 16:11:26 +03:00
|
|
|
|
|
|
|
if let url = connectionOptions.userActivities.first?.webpageURL ?? connectionOptions.urlContexts.first?.url {
|
|
|
|
wasOpenedWithURL(url, onStart: true)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
|
|
|
|
if let url = userActivity.webpageURL {
|
|
|
|
wasOpenedWithURL(url, onStart: false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
|
|
|
|
if let url = URLContexts.first?.url {
|
|
|
|
wasOpenedWithURL(url, onStart: false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private func wasOpenedWithURL(_ url: URL, onStart: Bool) {
|
|
|
|
launchURL = url
|
2021-08-14 22:28:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|