mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-30 17:29:23 +00:00
Merge branch '7.1.3-pre' of https://github.com/Ranchero-Software/NetNewsWire into 7.1.3-pre
This commit is contained in:
commit
3b8ebc6bc1
17 files changed
+186
-78
No files matched your search
@@ -63,6 +63,7 @@ import Images
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
FaviconGenerator.templateImage = Assets.Images.faviconTemplate
|
||||
|
||||
WebViewConfiguration.resolveBrowserUserAgent()
|
||||
Task {
|
||||
await WebViewConfiguration.compileContentBlockingRules()
|
||||
}
|
||||
|
||||
@@ -703,7 +703,7 @@ private extension WebViewController {
|
||||
|
||||
guard let imageURL = URL(string: clickMessage.imageURL) else { return }
|
||||
|
||||
Downloader.shared.download(imageURL) { [weak self] downloadResponse, error in
|
||||
Downloader.shared.download(imageURL, userAgentStyle: .browser) { [weak self] downloadResponse, error in
|
||||
guard let self, let data = downloadResponse.data, error == nil, !data.isEmpty,
|
||||
let image = UIImage(data: data) else {
|
||||
return
|
||||
@@ -888,10 +888,21 @@ private extension WebViewController {
|
||||
guard let viewController = SFSafariViewController.safeSafariViewController(url) else {
|
||||
return
|
||||
}
|
||||
viewController.delegate = self
|
||||
coordinator?.beganBrowsing(url: url)
|
||||
present(viewController, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: SFSafariViewControllerDelegate
|
||||
|
||||
extension WebViewController: @preconcurrency SFSafariViewControllerDelegate {
|
||||
|
||||
func safariViewControllerDidFinish(_ controller: SFSafariViewController) {
|
||||
coordinator?.endedBrowsing()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Find in Article
|
||||
|
||||
private struct FindInArticleOptions: Codable {
|
||||
|
||||
@@ -1528,6 +1528,14 @@ struct SidebarItemNode: Hashable, Sendable {
|
||||
}
|
||||
}
|
||||
|
||||
func beganBrowsing(url: URL) {
|
||||
activityManager.browsing(url: url)
|
||||
}
|
||||
|
||||
func endedBrowsing() {
|
||||
activityManager.invalidateBrowsing()
|
||||
}
|
||||
|
||||
func navigateToFeeds() {
|
||||
mainFeedCollectionViewController?.focus()
|
||||
selectArticle(nil)
|
||||
|
||||
+3
-26
@@ -192,32 +192,9 @@ final class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
return
|
||||
}
|
||||
|
||||
if let providedThemeURL = queryItems.first(where: { $0.name == "url" })?.value {
|
||||
if let themeURL = URL(string: providedThemeURL) {
|
||||
let request = URLRequest(url: themeURL)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
NotificationCenter.default.post(name: .didBeginDownloadingTheme, object: nil)
|
||||
}
|
||||
let task = URLSession.shared.downloadTask(with: request) { location, _, error in
|
||||
guard
|
||||
let location = location else { return }
|
||||
|
||||
Task { @MainActor in
|
||||
do {
|
||||
try ArticleThemeDownloader.shared.handleFile(at: location)
|
||||
} catch {
|
||||
NotificationCenter.default.post(name: .didFailToImportThemeWithError, object: nil, userInfo: ["error": error])
|
||||
}
|
||||
}
|
||||
}
|
||||
task.resume()
|
||||
} else {
|
||||
print("No theme URL")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return
|
||||
if let providedThemeURL = queryItems.first(where: { $0.name == "url" })?.value,
|
||||
let themeURL = URL(string: providedThemeURL) {
|
||||
ArticleThemeDownloader.shared.downloadTheme(from: themeURL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user