mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
# Conflicts: # Mac/AppDelegate.swift # Mac/Base.lproj/Preferences.storyboard # NetNewsWire.xcodeproj/project.pbxproj # Shared/Localizations/LocalizedNetNewsWireError.swift # iOS/MasterFeed/MasterFeedViewController.swift # iOS/Settings/Appearance/ArticleThemeManagerView.swift # iOS/Settings/Appearance/DisplayAndBehaviorsView.swift # iOS/Settings/General/SettingsView.swift
37 lines
1.3 KiB
Swift
37 lines
1.3 KiB
Swift
//
|
||
// URLPasteboardWriter+NetNewsWire.swift
|
||
// NetNewsWire
|
||
//
|
||
// Created by Nate Weaver on 2022-10-10.
|
||
// Copyright © 2022 Ranchero Software. All rights reserved.
|
||
//
|
||
|
||
import RSCore
|
||
|
||
@MainActor extension URLPasteboardWriter {
|
||
|
||
/// Copy URL strings, alerting the user the first time the array of URL strings contains `nil`.
|
||
/// - Parameters:
|
||
/// - urlStrings: The URL strings to copy.
|
||
/// - pasteboard: The pastebaord to copy to.
|
||
/// - window: The window to use as a sheet parent for the alert. If `nil`, will run the alert modally.
|
||
static func write(urlStrings: [String?], to pasteboard: NSPasteboard = .general, alertingIn window: NSWindow?) {
|
||
URLPasteboardWriter.write(urlStrings: urlStrings.compactMap { $0 }, to: pasteboard)
|
||
|
||
if urlStrings.contains(nil), !AppDefaults.shared.hasSeenNotAllArticlesHaveURLsAlert {
|
||
let alert = NSAlert()
|
||
alert.messageText = NSLocalizedString("alert.message.articles-without-links", comment: "Some articles don’t have links, so they weren't copied.")
|
||
alert.informativeText = NSLocalizedString("alert.informative.will-not-see-again", comment: "You won't see this message again")
|
||
|
||
if let window {
|
||
alert.beginSheetModal(for: window)
|
||
} else {
|
||
alert.runModal() // this should never happen
|
||
}
|
||
|
||
AppDefaults.shared.hasSeenNotAllArticlesHaveURLsAlert = true
|
||
}
|
||
}
|
||
|
||
}
|