File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 9
9
10
10
#import < Foundation/Foundation.h>
11
11
12
- #if TARGET_OS_IPHONE
12
+ #import < Parse/PFConstants.h>
13
+
14
+ #if TARGET_OS_IOS
13
15
#import < UIKit/UIKit.h>
14
- #else
16
+ #elif TARGET_OS_WATCH
17
+ @class UIApplication;
18
+ #elif TARGET_OS_MAC
15
19
#import < AppKit/AppKit.h>
16
20
@compatibility_alias UIApplication NSApplication ;
17
21
#endif
Original file line number Diff line number Diff line change 9
9
10
10
#import " PFApplication.h"
11
11
12
- #if TARGET_OS_IPHONE
12
+ #if TARGET_OS_IOS
13
13
#import < UIKit/UIKit.h>
14
- #else
14
+ #elif !TARGET_OS_WATCH && TARGET_OS_MAC
15
15
#import < AppKit/AppKit.h>
16
16
#endif
17
17
@@ -47,9 +47,11 @@ - (BOOL)isExtensionEnvironment {
47
47
}
48
48
49
49
- (NSInteger )iconBadgeNumber {
50
- #if TARGET_OS_IPHONE
50
+ #if TARGET_OS_WATCH
51
+ return 0 ;
52
+ #elif TARGET_OS_IOS
51
53
return self.systemApplication .applicationIconBadgeNumber ;
52
- #else
54
+ #elif TARGET_OS_MAC
53
55
// Make sure not to use `NSApp` here, because it doesn't work sometimes,
54
56
// `NSApplication +sharedApplication` does though.
55
57
NSString *badgeLabel = [[NSApplication sharedApplication ] dockTile ].badgeLabel ;
@@ -71,17 +73,21 @@ - (NSInteger)iconBadgeNumber {
71
73
72
74
- (void )setIconBadgeNumber : (NSInteger )iconBadgeNumber {
73
75
if (self.iconBadgeNumber != iconBadgeNumber) {
74
- #if TARGET_OS_IPHONE
76
+ #if TARGET_OS_IOS
75
77
self.systemApplication .applicationIconBadgeNumber = iconBadgeNumber;
76
- #else
78
+ #elif !TARGET_OS_WATCH
77
79
[[NSApplication sharedApplication ] dockTile ].badgeLabel = [@(iconBadgeNumber) stringValue ];
78
80
#endif
79
81
}
80
82
}
81
83
82
84
- (UIApplication *)systemApplication {
85
+ #if TARGET_OS_WATCH
86
+ return nil ;
87
+ #else
83
88
// Workaround to make `sharedApplication` still be called even if compiling for App Extensions or WatchKit apps.
84
89
return [UIApplication performSelector: @selector (sharedApplication )];
90
+ #endif
85
91
}
86
92
87
93
@end
You can’t perform that action at this time.
0 commit comments