montana/Русский/Сайт/junona-app/ios-native/AppDelegate.swift

30 lines
1.0 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = ViewController()
window?.makeKeyAndVisible()
// Тёмный фон для launch screen
window?.backgroundColor = UIColor(red: 15/255, green: 15/255, blue: 26/255, alpha: 1)
return true
}
// Deep links (t.me/junomontanaagibot?start=...)
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
if let vc = window?.rootViewController as? ViewController {
// Передаём deep link в WebView
let js = "window.handleDeepLink && window.handleDeepLink('\(url.absoluteString)')"
vc.webView.evaluateJavaScript(js)
}
return true
}
}