Settings: Actually make settings scene properly
This commit is contained in:
@@ -19,7 +19,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
|
|
||||||
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration
|
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration
|
||||||
{
|
{
|
||||||
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
|
if let userActivity = options.userActivities.first {
|
||||||
|
if userActivity.activityType == SessionActivityType.SettingsWindow.rawValue {
|
||||||
|
return UISceneConfiguration(name: "Settings", sessionRole: connectingSceneSession.role)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return UISceneConfiguration(name: "Browser", sessionRole: connectingSceneSession.role)
|
||||||
}
|
}
|
||||||
|
|
||||||
static func appMenuShortcuts() -> [UIKeyCommand] {
|
static func appMenuShortcuts() -> [UIKeyCommand] {
|
||||||
|
|||||||
@@ -23,14 +23,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||||||
guard let windowScene = (scene as? UIWindowScene) else { return }
|
guard let windowScene = (scene as? UIWindowScene) else { return }
|
||||||
|
|
||||||
let window = UIWindow(windowScene: windowScene)
|
let window = UIWindow(windowScene: windowScene)
|
||||||
if let userActivity = connectionOptions.userActivities.first {
|
|
||||||
if userActivity.activityType == SessionActivityType.SettingsWindow.rawValue {
|
|
||||||
let settingsViewController = SettingsViewController(windowScene: windowScene)
|
|
||||||
self.settingsViewController = settingsViewController
|
|
||||||
window.rootViewController = settingsViewController
|
|
||||||
windowScene.sizeRestrictions?.maximumSize = CGSize(width: 760.0, height: 400.0)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let browserViewController = BrowserViewController()
|
let browserViewController = BrowserViewController()
|
||||||
self.browserViewController = browserViewController
|
self.browserViewController = browserViewController
|
||||||
window.rootViewController = browserViewController
|
window.rootViewController = browserViewController
|
||||||
@@ -44,7 +36,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||||||
windowScene.titlebar?.titleVisibility = .hidden
|
windowScene.titlebar?.titleVisibility = .hidden
|
||||||
windowScene.titlebar?.separatorStyle = .none
|
windowScene.titlebar?.separatorStyle = .none
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
window.makeKeyAndVisible()
|
window.makeKeyAndVisible()
|
||||||
self.window = window
|
self.window = window
|
||||||
|
|||||||
28
App/SettingsSceneDelegate.swift
Normal file
28
App/SettingsSceneDelegate.swift
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
//
|
||||||
|
// SettingsSceneDelegate.swift
|
||||||
|
// SBrowser
|
||||||
|
//
|
||||||
|
// Copyright © 2021 Apple Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
class SettingsSceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
|
var window: UIWindow?
|
||||||
|
|
||||||
|
var settingsViewController: SettingsViewController?
|
||||||
|
|
||||||
|
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions)
|
||||||
|
{
|
||||||
|
guard let windowScene = (scene as? UIWindowScene) else { return }
|
||||||
|
|
||||||
|
let window = UIWindow(windowScene: windowScene)
|
||||||
|
let settingsViewController = SettingsViewController(windowScene: windowScene)
|
||||||
|
self.settingsViewController = settingsViewController
|
||||||
|
window.rootViewController = settingsViewController
|
||||||
|
windowScene.sizeRestrictions?.maximumSize = CGSize(width: 760.0, height: 400.0)
|
||||||
|
|
||||||
|
window.makeKeyAndVisible()
|
||||||
|
self.window = window
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,8 +50,14 @@
|
|||||||
<key>UIWindowSceneSessionRoleApplication</key>
|
<key>UIWindowSceneSessionRoleApplication</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>UISceneDelegateClassName</key>
|
||||||
|
<string>$(PRODUCT_MODULE_NAME).SettingsSceneDelegate</string>
|
||||||
<key>UISceneConfigurationName</key>
|
<key>UISceneConfigurationName</key>
|
||||||
<string>Default Configuration</string>
|
<string>Settings</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>UISceneConfigurationName</key>
|
||||||
|
<string>Browser</string>
|
||||||
<key>UISceneDelegateClassName</key>
|
<key>UISceneDelegateClassName</key>
|
||||||
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
|
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
@@ -73,6 +73,7 @@
|
|||||||
CDE6A30425F023BC00E912A4 /* AmberSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDE6A30325F023BC00E912A4 /* AmberSettingsViewController.swift */; };
|
CDE6A30425F023BC00E912A4 /* AmberSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDE6A30325F023BC00E912A4 /* AmberSettingsViewController.swift */; };
|
||||||
CDE6A30625F023EA00E912A4 /* AmberSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDE6A30525F023EA00E912A4 /* AmberSettingsView.swift */; };
|
CDE6A30625F023EA00E912A4 /* AmberSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDE6A30525F023EA00E912A4 /* AmberSettingsView.swift */; };
|
||||||
CDEDD8AA25D62ADB00862605 /* UITraitCollection+MacLike.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDEDD8A925D62ADB00862605 /* UITraitCollection+MacLike.swift */; };
|
CDEDD8AA25D62ADB00862605 /* UITraitCollection+MacLike.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDEDD8A925D62ADB00862605 /* UITraitCollection+MacLike.swift */; };
|
||||||
|
CDF3468E276C105900FB3141 /* SettingsSceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDF3468D276C105900FB3141 /* SettingsSceneDelegate.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@@ -175,6 +176,7 @@
|
|||||||
CDE6A30325F023BC00E912A4 /* AmberSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmberSettingsViewController.swift; sourceTree = "<group>"; };
|
CDE6A30325F023BC00E912A4 /* AmberSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmberSettingsViewController.swift; sourceTree = "<group>"; };
|
||||||
CDE6A30525F023EA00E912A4 /* AmberSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmberSettingsView.swift; sourceTree = "<group>"; };
|
CDE6A30525F023EA00E912A4 /* AmberSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AmberSettingsView.swift; sourceTree = "<group>"; };
|
||||||
CDEDD8A925D62ADB00862605 /* UITraitCollection+MacLike.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITraitCollection+MacLike.swift"; sourceTree = "<group>"; };
|
CDEDD8A925D62ADB00862605 /* UITraitCollection+MacLike.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITraitCollection+MacLike.swift"; sourceTree = "<group>"; };
|
||||||
|
CDF3468D276C105900FB3141 /* SettingsSceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsSceneDelegate.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -276,6 +278,7 @@
|
|||||||
children = (
|
children = (
|
||||||
1ADFF45F24C7DE53006DC7AE /* AppDelegate.swift */,
|
1ADFF45F24C7DE53006DC7AE /* AppDelegate.swift */,
|
||||||
1ADFF46124C7DE53006DC7AE /* SceneDelegate.swift */,
|
1ADFF46124C7DE53006DC7AE /* SceneDelegate.swift */,
|
||||||
|
CDF3468D276C105900FB3141 /* SettingsSceneDelegate.swift */,
|
||||||
CD7A89162519872D0075991E /* KeyboardShortcuts.swift */,
|
CD7A89162519872D0075991E /* KeyboardShortcuts.swift */,
|
||||||
CD7A89132519759D0075991E /* Autocomplete */,
|
CD7A89132519759D0075991E /* Autocomplete */,
|
||||||
1ADFF47A24C7E176006DC7AE /* Backend */,
|
1ADFF47A24C7E176006DC7AE /* Backend */,
|
||||||
@@ -616,6 +619,7 @@
|
|||||||
CD01D5AB254A206D00189CDC /* TabBarViewController.swift in Sources */,
|
CD01D5AB254A206D00189CDC /* TabBarViewController.swift in Sources */,
|
||||||
1ADFF47924C7DFF8006DC7AE /* BrowserView.swift in Sources */,
|
1ADFF47924C7DFF8006DC7AE /* BrowserView.swift in Sources */,
|
||||||
CDCE2664251AA80F007FE92A /* DocumentControlViewController.swift in Sources */,
|
CDCE2664251AA80F007FE92A /* DocumentControlViewController.swift in Sources */,
|
||||||
|
CDF3468E276C105900FB3141 /* SettingsSceneDelegate.swift in Sources */,
|
||||||
1AB88EFF24D3BBA50006F850 /* TabPickerViewController.swift in Sources */,
|
1AB88EFF24D3BBA50006F850 /* TabPickerViewController.swift in Sources */,
|
||||||
CD19576D268BE95900E8089B /* GenericContentView.swift in Sources */,
|
CD19576D268BE95900E8089B /* GenericContentView.swift in Sources */,
|
||||||
1A14FC2324D203D9009B3F83 /* TitlebarView.swift in Sources */,
|
1A14FC2324D203D9009B3F83 /* TitlebarView.swift in Sources */,
|
||||||
|
|||||||
Reference in New Issue
Block a user