Add support for becoming a default browser

This commit is contained in:
James Magahern
2020-09-30 15:23:05 -07:00
parent 6e0e2a0f20
commit d725bbb9d7
4 changed files with 34 additions and 2 deletions

View File

@@ -297,6 +297,11 @@ class BrowserViewController: UIViewController, WKNavigationDelegate, WKUIDelegat
iconView.setBlockedScriptsNumber(numBlockedScripts)
}
public func createNewTab(withURL url: URL?) {
let newTab = tabController.createNewTab(url: url)
self.tab = newTab
}
// MARK: UIPopoverPresentationControllerDelegate
func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
@@ -520,8 +525,7 @@ class BrowserViewController: UIViewController, WKNavigationDelegate, WKUIDelegat
}
func createTab(_ sender: Any?) {
let newTab = tabController.createNewTab(url: nil)
self.tab = newTab
createNewTab(withURL: nil)
}
func previousTab(_ sender: Any?) {

View File

@@ -24,10 +24,22 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
window.makeKeyAndVisible()
self.window = window
if let urlContext = connectionOptions.urlContexts.first {
let url = urlContext.url
browserViewController.tab.beginLoadingURL(url)
}
#if targetEnvironment(macCatalyst)
windowScene.titlebar?.titleVisibility = .hidden
windowScene.titlebar?.separatorStyle = .none
#endif
}
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>)
{
for urlContext in URLContexts {
browserViewController.createNewTab(withURL: urlContext.url)
}
}
}

View File

@@ -18,6 +18,20 @@
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>net.buzzert.rosslerattix</string>
<key>CFBundleURLSchemes</key>
<array>
<string>http</string>
<string>https</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>

View File

@@ -6,5 +6,7 @@
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.developer.web-browser</key>
<true/>
</dict>
</plist>