2020-07-22 19:29:38 -07:00
|
|
|
//
|
|
|
|
|
// SceneDelegate.swift
|
|
|
|
|
// SBrowser
|
|
|
|
|
//
|
|
|
|
|
// Created by James Magahern on 7/21/20.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
|
|
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|
|
|
|
var window: UIWindow?
|
|
|
|
|
let navigationController = UINavigationController()
|
|
|
|
|
let browserViewController = BrowserViewController()
|
|
|
|
|
|
|
|
|
|
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions)
|
|
|
|
|
{
|
|
|
|
|
guard let windowScene = (scene as? UIWindowScene) else { return }
|
|
|
|
|
|
|
|
|
|
navigationController.viewControllers = [ browserViewController ]
|
2020-07-22 19:42:38 -07:00
|
|
|
navigationController.setNavigationBarHidden(true, animated: false)
|
2020-07-22 19:29:38 -07:00
|
|
|
|
|
|
|
|
let window = UIWindow(windowScene: windowScene)
|
|
|
|
|
window.rootViewController = navigationController
|
|
|
|
|
window.makeKeyAndVisible()
|
|
|
|
|
self.window = window
|
2020-08-04 12:45:55 -07:00
|
|
|
|
2020-09-30 15:23:05 -07:00
|
|
|
if let urlContext = connectionOptions.urlContexts.first {
|
|
|
|
|
let url = urlContext.url
|
|
|
|
|
browserViewController.tab.beginLoadingURL(url)
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-14 15:55:08 -07:00
|
|
|
#if targetEnvironment(macCatalyst)
|
|
|
|
|
windowScene.titlebar?.titleVisibility = .hidden
|
|
|
|
|
windowScene.titlebar?.separatorStyle = .none
|
|
|
|
|
#endif
|
2020-07-22 19:29:38 -07:00
|
|
|
}
|
2020-09-30 15:23:05 -07:00
|
|
|
|
|
|
|
|
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>)
|
|
|
|
|
{
|
|
|
|
|
for urlContext in URLContexts {
|
|
|
|
|
browserViewController.createNewTab(withURL: urlContext.url)
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-22 19:29:38 -07:00
|
|
|
}
|
|
|
|
|
|