2020-07-22 19:29:38 -07:00
|
|
|
//
|
|
|
|
|
// AppDelegate.swift
|
|
|
|
|
// SBrowser
|
|
|
|
|
//
|
|
|
|
|
// Created by James Magahern on 7/21/20.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
|
|
@main
|
|
|
|
|
class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
|
|
|
|
|
|
|
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
|
|
|
|
|
{
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: UISceneSession Lifecycle
|
|
|
|
|
|
|
|
|
|
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration
|
|
|
|
|
{
|
|
|
|
|
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
|
|
|
|
|
}
|
2020-09-21 18:35:39 -07:00
|
|
|
|
2020-09-21 18:40:23 -07:00
|
|
|
static func fileMenuShortcuts() -> [UIKeyCommand] {
|
|
|
|
|
[
|
2020-09-21 18:35:39 -07:00
|
|
|
// Open Location...
|
|
|
|
|
UIKeyCommand(
|
|
|
|
|
modifiers: .command, input: "L",
|
|
|
|
|
title: "Open Location",
|
|
|
|
|
action: #selector(ShortcutResponder.focusURLBar)
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// Go Back
|
|
|
|
|
UIKeyCommand(
|
|
|
|
|
modifiers: .command, input: "[",
|
|
|
|
|
title: "Go Back",
|
|
|
|
|
action: #selector(ShortcutResponder.goBack)
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// Go Forward
|
|
|
|
|
UIKeyCommand(
|
|
|
|
|
modifiers: .command, input: "]",
|
|
|
|
|
title: "Go Forward",
|
|
|
|
|
action: #selector(ShortcutResponder.goForward)
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// Create Tab
|
|
|
|
|
UIKeyCommand(
|
|
|
|
|
modifiers: .command, input: "T",
|
|
|
|
|
title: "New Tab",
|
|
|
|
|
action: #selector(ShortcutResponder.createTab)
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
// Previous Tab
|
|
|
|
|
UIKeyCommand(
|
|
|
|
|
modifiers: [.command, .shift], input: "[",
|
|
|
|
|
title: "Previous Tab",
|
|
|
|
|
action: #selector(ShortcutResponder.previousTab)
|
|
|
|
|
),
|
|
|
|
|
|
2020-11-10 11:57:40 -06:00
|
|
|
// Close tab
|
|
|
|
|
UIKeyCommand(
|
|
|
|
|
modifiers: [.command], input: "W",
|
|
|
|
|
title: "Close Tab",
|
|
|
|
|
action: #selector(ShortcutResponder.closeTab)
|
|
|
|
|
),
|
|
|
|
|
|
2020-09-21 18:35:39 -07:00
|
|
|
// Next Tab
|
|
|
|
|
UIKeyCommand(
|
|
|
|
|
modifiers: [.command, .shift], input: "]",
|
|
|
|
|
title: "Next Tab",
|
|
|
|
|
action: #selector(ShortcutResponder.nextTab)
|
|
|
|
|
),
|
2020-09-30 18:06:47 -07:00
|
|
|
|
|
|
|
|
// Find on page
|
|
|
|
|
UIKeyCommand(
|
|
|
|
|
modifiers: [.command], input: "F",
|
|
|
|
|
title: "Find on Page",
|
|
|
|
|
action: #selector(ShortcutResponder.findOnPage)
|
|
|
|
|
),
|
2020-09-21 18:35:39 -07:00
|
|
|
]
|
2020-09-21 18:40:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override var keyCommands: [UIKeyCommand]? {
|
|
|
|
|
get { return Self.fileMenuShortcuts() }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override func buildMenu(with builder: UIMenuBuilder) {
|
2020-09-21 18:35:39 -07:00
|
|
|
builder.replaceChildren(ofMenu: .file) { children in
|
2020-09-21 18:40:23 -07:00
|
|
|
return Self.fileMenuShortcuts() + children
|
2020-09-21 18:35:39 -07:00
|
|
|
}
|
|
|
|
|
}
|
2020-07-22 19:29:38 -07:00
|
|
|
}
|
|
|
|
|
|