Files
NetNewsWire/Mac/MainWindow/URLPasteboardWriter+NetNewsWire.swift
Stuart Breckenridge ed6ff090be Merge branch 'ios-ui-settings-localised' into localize_strings
# 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
2023-05-27 17:00:42 +08:00

37 lines
1.3 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// 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 dont 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
}
}
}