Add stubs for NSUserNotificationCenter

This commit is contained in:
Duncan Cunningham 2024-01-13 14:03:56 +01:00
parent ffedc7bda0
commit afc6f99931
2 changed files with 33 additions and 3 deletions

View File

@ -25,10 +25,19 @@
@interface NSUserNotificationAction : NSObject <NSCopying>
@end
@interface NSUserNotificationCenter : NSObject
@end
@protocol NSUserNotificationCenterDelegate <NSObject>
@end
@interface NSUserNotificationCenter : NSObject {
id<NSUserNotificationCenterDelegate> _delegate;
}
@property(class, readonly, strong) NSUserNotificationCenter *defaultUserNotificationCenter;
@property(assign) id<NSUserNotificationCenterDelegate> delegate;
- (void)deliverNotification:(NSUserNotification *)notification;
- (void)removeDeliveredNotification:(NSUserNotification *)notification;
@end
FOUNDATION_EXPORT NSString * const NSUserNotificationDefaultSoundName;

View File

@ -40,6 +40,27 @@
@end
@implementation NSUserNotificationCenter
static NSUserNotificationCenter *_defaultUserNotificationCenter = nil;
@synthesize delegate = _delegate;
+ (NSUserNotificationCenter *)defaultUserNotificationCenter {
if (_defaultUserNotificationCenter == nil) {
_defaultUserNotificationCenter = [[NSUserNotificationCenter alloc] init];
}
return _defaultUserNotificationCenter;
}
- (void)deliverNotification:(NSUserNotification *)notification {
NSLog(@"[NSUserNotificationCenter deliverNotification:]");
}
- (void)removeDeliveredNotification:(NSUserNotification *)notification {
NSLog(@"[NSUserNotificationCenter removeDeliveredNotification:]");
}
@end
NSString * const NSUserNotificationDefaultSoundName = @"DefaultSoundName";