-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a00246
commit d810ca8
Showing
9 changed files
with
110 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// BSGAppKit.h | ||
// Bugsnag | ||
// | ||
// Created by Nick Dowell on 13/04/2021. | ||
// Copyright © 2021 Bugsnag Inc. All rights reserved. | ||
// | ||
|
||
#import <AppKit/AppKit.h> | ||
|
||
// Daemons and other processes running in non-UI sessions should not link against AppKit. | ||
// These macros exist to allow the use of AppKit without adding a link-time dependency on it. | ||
|
||
// Calling code should be prepared for classes to not be found when AppKit is not linked. | ||
#define NSAPPLICATION NSClassFromString(@"NSApplication") | ||
#define NSMENUITEM NSClassFromString(@"NSMenuItem") | ||
#define NSWORKSPACE NSClassFromString(@"NSWorkspace") | ||
|
||
#define NSApplicationDidBecomeActiveNotification @"NSApplicationDidBecomeActiveNotification" | ||
#define NSApplicationDidBecomeActiveNotification @"NSApplicationDidBecomeActiveNotification" | ||
#define NSApplicationDidFinishLaunchingNotification @"NSApplicationDidFinishLaunchingNotification" | ||
#define NSApplicationDidHideNotification @"NSApplicationDidHideNotification" | ||
#define NSApplicationDidResignActiveNotification @"NSApplicationDidResignActiveNotification" | ||
#define NSApplicationDidResignActiveNotification @"NSApplicationDidResignActiveNotification" | ||
#define NSApplicationDidUnhideNotification @"NSApplicationDidUnhideNotification" | ||
#define NSApplicationWillBecomeActiveNotification @"NSApplicationWillBecomeActiveNotification" | ||
#define NSApplicationWillTerminateNotification @"NSApplicationWillTerminateNotification" | ||
#define NSApplicationWillTerminateNotification @"NSApplicationWillTerminateNotification" | ||
#define NSControlTextDidBeginEditingNotification @"NSControlTextDidBeginEditingNotification" | ||
#define NSControlTextDidEndEditingNotification @"NSControlTextDidEndEditingNotification" | ||
#define NSMenuWillSendActionNotification @"NSMenuWillSendActionNotification" | ||
#define NSTableViewSelectionDidChangeNotification @"NSTableViewSelectionDidChangeNotification" | ||
#define NSUndoManagerDidRedoChangeNotification @"NSUndoManagerDidRedoChangeNotification" | ||
#define NSUndoManagerDidUndoChangeNotification @"NSUndoManagerDidUndoChangeNotification" | ||
#define NSWindowDidBecomeKeyNotification @"NSWindowDidBecomeKeyNotification" | ||
#define NSWindowDidEnterFullScreenNotification @"NSWindowDidEnterFullScreenNotification" | ||
#define NSWindowDidExitFullScreenNotification @"NSWindowDidExitFullScreenNotification" | ||
#define NSWindowWillCloseNotification @"NSWindowWillCloseNotification" | ||
#define NSWindowWillMiniaturizeNotification @"NSWindowWillMiniaturizeNotification" | ||
#define NSWorkspaceScreensDidSleepNotification @"NSWorkspaceScreensDidSleepNotification" | ||
#define NSWorkspaceScreensDidWakeNotification @"NSWorkspaceScreensDidWakeNotification" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// BSGAppKitTests.m | ||
// Bugsnag-macOSTests | ||
// | ||
// Created by Nick Dowell on 13/04/2021. | ||
// Copyright © 2021 Bugsnag Inc. All rights reserved. | ||
// | ||
|
||
#import <XCTest/XCTest.h> | ||
|
||
@interface BSGAppKitTests : XCTestCase | ||
|
||
@end | ||
|
||
@implementation BSGAppKitTests | ||
|
||
- (void)testNotificationNames { | ||
// The notifier uses hard-coded notification names so that it can avoid linking to AppKit. | ||
// These tests ensure that the hard-coded names in BSGAppKit.h match the SDK. | ||
#define ASSERT_NOTIFICATION_NAME(name) XCTAssertEqualObjects(name, @#name) | ||
ASSERT_NOTIFICATION_NAME(NSApplicationDidBecomeActiveNotification); | ||
ASSERT_NOTIFICATION_NAME(NSApplicationDidBecomeActiveNotification); | ||
ASSERT_NOTIFICATION_NAME(NSApplicationDidFinishLaunchingNotification); | ||
ASSERT_NOTIFICATION_NAME(NSApplicationDidHideNotification); | ||
ASSERT_NOTIFICATION_NAME(NSApplicationDidResignActiveNotification); | ||
ASSERT_NOTIFICATION_NAME(NSApplicationDidResignActiveNotification); | ||
ASSERT_NOTIFICATION_NAME(NSApplicationDidUnhideNotification); | ||
ASSERT_NOTIFICATION_NAME(NSApplicationWillBecomeActiveNotification); | ||
ASSERT_NOTIFICATION_NAME(NSApplicationWillTerminateNotification); | ||
ASSERT_NOTIFICATION_NAME(NSApplicationWillTerminateNotification); | ||
ASSERT_NOTIFICATION_NAME(NSControlTextDidBeginEditingNotification); | ||
ASSERT_NOTIFICATION_NAME(NSControlTextDidEndEditingNotification); | ||
ASSERT_NOTIFICATION_NAME(NSMenuWillSendActionNotification); | ||
ASSERT_NOTIFICATION_NAME(NSTableViewSelectionDidChangeNotification); | ||
ASSERT_NOTIFICATION_NAME(NSUndoManagerDidRedoChangeNotification); | ||
ASSERT_NOTIFICATION_NAME(NSUndoManagerDidUndoChangeNotification); | ||
ASSERT_NOTIFICATION_NAME(NSWindowDidBecomeKeyNotification); | ||
ASSERT_NOTIFICATION_NAME(NSWindowDidEnterFullScreenNotification); | ||
ASSERT_NOTIFICATION_NAME(NSWindowDidExitFullScreenNotification); | ||
ASSERT_NOTIFICATION_NAME(NSWindowWillCloseNotification); | ||
ASSERT_NOTIFICATION_NAME(NSWindowWillMiniaturizeNotification); | ||
ASSERT_NOTIFICATION_NAME(NSWorkspaceScreensDidSleepNotification); | ||
ASSERT_NOTIFICATION_NAME(NSWorkspaceScreensDidWakeNotification); | ||
} | ||
|
||
@end |