Add Homepage home screen shortcut item
This commit is contained in:
parent
e470d7b58e
commit
29e2589d5c
|
@ -2,6 +2,17 @@
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>UIApplicationShortcutItems</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>UIApplicationShortcutItemIconType</key>
|
||||||
|
<string>UIApplicationShortcutIconTypeHome</string>
|
||||||
|
<key>UIApplicationShortcutItemType</key>
|
||||||
|
<string>home</string>
|
||||||
|
<key>UIApplicationShortcutItemTitle</key>
|
||||||
|
<string>Homepage</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
|
|
|
@ -56,11 +56,22 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
|
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
|
||||||
if let url = userActivity.geminiURL {
|
if userActivity.isHomepage {
|
||||||
|
navigationManager.changeURL(Preferences.shared.homepage)
|
||||||
|
} else if let url = userActivity.geminiURL {
|
||||||
navigationManager.changeURL(url)
|
navigationManager.changeURL(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func windowScene(_ windowScene: UIWindowScene, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
|
||||||
|
if shortcutItem.type == "home" {
|
||||||
|
navigationManager.changeURL(Preferences.shared.homepage)
|
||||||
|
completionHandler(true)
|
||||||
|
} else {
|
||||||
|
completionHandler(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func sceneDidDisconnect(_ scene: UIScene) {
|
func sceneDidDisconnect(_ scene: UIScene) {
|
||||||
// Called as the scene is being released by the system.
|
// Called as the scene is being released by the system.
|
||||||
// This occurs shortly after the scene enters the background, or when its session is discarded.
|
// This occurs shortly after the scene enters the background, or when its session is discarded.
|
||||||
|
@ -100,6 +111,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
// navigate the existing manager to that URL
|
// navigate the existing manager to that URL
|
||||||
if let newURL = connectionOptions.userActivities.first?.geminiURL {
|
if let newURL = connectionOptions.userActivities.first?.geminiURL {
|
||||||
manager.changeURL(newURL)
|
manager.changeURL(newURL)
|
||||||
|
} else if connectionOptions.shortcutItem?.type == "home" {
|
||||||
|
manager.changeURL(Preferences.shared.homepage)
|
||||||
}
|
}
|
||||||
return manager
|
return manager
|
||||||
}
|
}
|
||||||
|
@ -120,13 +133,15 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
initialURL = connectionOptions.urlContexts.first?.url
|
initialURL = connectionOptions.urlContexts.first?.url
|
||||||
}
|
}
|
||||||
|
|
||||||
if initialURL == nil {
|
if initialURL == nil || connectionOptions.shortcutItem?.type == "home" {
|
||||||
if ProcessInfo.processInfo.environment.keys.contains("DEFAULT_URL") {
|
|
||||||
initialURL = URL(string: ProcessInfo.processInfo.environment["DEFAULT_URL"]!)!
|
|
||||||
} else {
|
|
||||||
initialURL = Preferences.shared.homepage
|
initialURL = Preferences.shared.homepage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
if ProcessInfo.processInfo.environment.keys.contains("DEFAULT_URL") {
|
||||||
|
initialURL = URL(string: ProcessInfo.processInfo.environment["DEFAULT_URL"]!)!
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return NavigationManager(url: initialURL!)
|
return NavigationManager(url: initialURL!)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue