mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Add sharingServicesForItems_noDeprecationWarning to silence deprecation that we’re accepting.
This commit is contained in:
23
Mac/MainWindow/Timeline/NSSharingService+Extension.h
Normal file
23
Mac/MainWindow/Timeline/NSSharingService+Extension.h
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// NSObject+NSSharingService_RSCore.h
|
||||
// RSCore
|
||||
//
|
||||
// Created by Brent Simmons on 11/3/24.
|
||||
//
|
||||
|
||||
@import AppKit;
|
||||
|
||||
@interface NSSharingService (NoDeprecationWarning)
|
||||
|
||||
// The only way to create custom UI — a Share menu, for instance —
|
||||
// is to use the unfortunately deprecated
|
||||
// +[NSSharingService sharingServicesForItems:].
|
||||
// This cover method allows us to not generate a warning.
|
||||
//
|
||||
// We know it’s deprecated, and we don’t want to be bugged
|
||||
// about it every time we build. (If anyone from Apple
|
||||
// is reading this — a replacement would be very welcome!)
|
||||
|
||||
+ (NSArray *)sharingServicesForItems_noDeprecationWarning:(NSArray *)items;
|
||||
|
||||
@end
|
||||
22
Mac/MainWindow/Timeline/NSSharingService+Extension.m
Normal file
22
Mac/MainWindow/Timeline/NSSharingService+Extension.m
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// NSSharingService+Extension.m
|
||||
// RSCore
|
||||
//
|
||||
// Created by Brent Simmons on 11/3/24.
|
||||
//
|
||||
|
||||
#import "NSSharingService+Extension.h"
|
||||
|
||||
@implementation NSSharingService (NoDeprecationWarning)
|
||||
|
||||
+ (NSArray *)sharingServicesForItems_noDeprecationWarning:(NSArray *)items {
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
return [NSSharingService sharingServicesForItems:items];
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -200,7 +200,7 @@ private extension TimelineViewController {
|
||||
|
||||
let sortedArticles = articles.sortedByDate(.orderedAscending)
|
||||
let items = sortedArticles.map { ArticlePasteboardWriter(article: $0) }
|
||||
let standardServices = NSSharingService.sharingServices(forItems: items)
|
||||
let standardServices = NSSharingService.sharingServices(forItems_noDeprecationWarning: items) as? [NSSharingService] ?? [NSSharingService]()
|
||||
let customServices = SharingServicePickerDelegate.customSharingServices(for: items)
|
||||
let services = standardServices + customServices
|
||||
if services.isEmpty {
|
||||
|
||||
@@ -7,3 +7,4 @@
|
||||
//
|
||||
|
||||
#import "WKPreferencesPrivate.h"
|
||||
#import "NSSharingService+Extension.h"
|
||||
|
||||
Reference in New Issue
Block a user