-
Notifications
You must be signed in to change notification settings - Fork 999
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* master: (44 commits) iOS v13.1 Load offline story images even when online to speed up image display. #1875 (borders between panes not using theme colors) #1247 (Mac Catalyst edition) #1874 (Crash on opening widget story) #1247 (Mac Catalyst edition) #1247 (Mac Catalyst edition) #1247 (Mac Catalyst edition) #1247 (Mac Catalyst edition) #1247 (Mac Catalyst edition) #1247 (Mac Catalyst edition) Bumped version number #1247 (Mac Catalyst edition) #1851 (mark as read button at bottom of story list) #1247 (Mac Catalyst edition) #1247 (Mac Catalyst edition) Added privacy manifest #1247 (Mac Catalyst edition) #1247 (Mac Catalyst edition) #1247 (Mac Catalyst edition) ...
- Loading branch information
Showing
117 changed files
with
4,847 additions
and
948 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// AuxSceneDelegate.swift | ||
// NewsBlur | ||
// | ||
// Created by David Sinclair on 2024-05-30. | ||
// Copyright © 2024 NewsBlur. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
/// Scene delegate for auxiliary windows. Currently only used on macOS. | ||
class AuxSceneDelegate: UIResponder, UIWindowSceneDelegate { | ||
let appDelegate: NewsBlurAppDelegate = .shared | ||
|
||
var window: UIWindow? | ||
#if targetEnvironment(macCatalyst) | ||
var toolbar = NSToolbar(identifier: "aux") | ||
var toolbarDelegate = ToolbarDelegate() | ||
#endif | ||
|
||
/// Open a new window with an `OriginalStoryViewController` for the given URL. | ||
@objc(openWindowForURL:customTitle:) class func openWindow(for url: URL, customTitle: String) { | ||
let activity = NSUserActivity(activityType: "aux") | ||
|
||
activity.userInfo = ["url" : url, "title" : customTitle] | ||
|
||
if #available(iOS 17.0, *) { | ||
let request = UISceneSessionActivationRequest(userActivity: activity) | ||
|
||
UIApplication.shared.activateSceneSession(for: request) { error in | ||
print("Error activating scene: \(error)") | ||
} | ||
} else { | ||
UIApplication.shared.requestSceneSessionActivation(nil, userActivity: activity, options: nil) { error in | ||
print("Error activating scene: \(error)") | ||
} | ||
} | ||
} | ||
|
||
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | ||
#if targetEnvironment(macCatalyst) | ||
guard let windowScene = scene as? UIWindowScene, //let titlebar = windowScene.titlebar, | ||
let userInfo = connectionOptions.userActivities.first?.userInfo else { | ||
return | ||
} | ||
|
||
let url = userInfo["url"] as? URL | ||
let title = userInfo["title"] as? String | ||
|
||
let controller = OriginalStoryViewController() | ||
|
||
windowScene.title = "Loading…" | ||
window?.rootViewController = controller | ||
|
||
appDelegate.activeOriginalStoryURL = url | ||
|
||
controller.customPageTitle = title | ||
_ = controller.view | ||
controller.loadInitialStory() | ||
|
||
//TODO: 🚧 perhaps make a toolbar for this window | ||
// toolbar.delegate = toolbarDelegate | ||
// toolbar.displayMode = .iconOnly | ||
// | ||
// titlebar.toolbar = toolbar | ||
// titlebar.toolbarStyle = .automatic | ||
|
||
#endif | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.