Skip to content

Commit 5096cd0

Browse files
committed
afgfdssgfd
1 parent 7398517 commit 5096cd0

File tree

2 files changed

+58
-52
lines changed

2 files changed

+58
-52
lines changed

iOS_SDK/OneSignalSDK/OneSignalNotifications/OSNotificationsManager.m

+2
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,10 @@ + (void)start {
260260
+ (void)registerLifecycleObserver {
261261
// Replacing swizzled lifecycle selectors with notification center observers for scene based Apps
262262
if ([OSBundleUtils isAppUsingUIScene]) {
263+
NSLog(@"💛 registerLifecycleObserverAs UIScene ");
263264
[self registerLifecycleObserverAsUIScene];
264265
} else {
266+
NSLog(@"💛 registerLifecycleObserverAs UIApplication ");
265267
[self registerLifecycleObserverAsUIApplication];
266268
}
267269
}

iOS_SDK/OneSignalSDK/OneSignalNotificationsTests/OneSignalNotificationsTests.swift

+56-52
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ final class OneSignalNotificationsTests: XCTestCase {
3131
var token: String = ""
3232

3333
override func setUpWithError() throws {
34+
// Temp. logging to help debug during testing
35+
OneSignalLog.setLogLevel(.LL_VERBOSE)
3436
// Put setup code here. This method is called before the invocation of each test method in the class.
3537
self.notifTypes = 0
3638
self.token = ""
@@ -44,6 +46,7 @@ final class OneSignalNotificationsTests: XCTestCase {
4446
// NotificationManager Start to register lifecycle listener
4547
OSNotificationsManager.start()
4648
// Set badge count > 0
49+
print("💛 testClearBadgesWhenAppEntersForeground setting applicationIconBadgeNumber")
4750
UIApplication.shared.applicationIconBadgeNumber = 1
4851
// Then background the app
4952
OneSignalCoreMocks.backgroundApp()
@@ -57,6 +60,7 @@ final class OneSignalNotificationsTests: XCTestCase {
5760
// NotificationManager Start to register lifecycle listener
5861
OSNotificationsManager.start()
5962
// Set badge count > 0
63+
print("💛 testDontclearBadgesWhenAppBecomesActive setting applicationIconBadgeNumber")
6064
UIApplication.shared.applicationIconBadgeNumber = 1
6165
// Then resign active
6266
OneSignalCoreMocks.resignActive()
@@ -65,58 +69,58 @@ final class OneSignalNotificationsTests: XCTestCase {
6569
// Ensure that badge count == 1
6670
XCTAssertEqual(UIApplication.shared.applicationIconBadgeNumber, 1)
6771
}
68-
69-
func testClearBadgesWhenAppEntersForeground1() throws {
70-
// NotificationManager Start to register lifecycle listener
71-
OSNotificationsManager.start()
72-
// Set badge count > 0
73-
UIApplication.shared.applicationIconBadgeNumber = 1
74-
// Then background the app
75-
OneSignalCoreMocks.backgroundApp()
76-
// Foreground the app
77-
OneSignalCoreMocks.foregroundApp()
78-
// Ensure that badge count == 0
79-
XCTAssertEqual(UIApplication.shared.applicationIconBadgeNumber, 0)
80-
}
81-
82-
func testDontclearBadgesWhenAppBecomesActive2() throws {
83-
// NotificationManager Start to register lifecycle listener
84-
OSNotificationsManager.start()
85-
// Set badge count > 0
86-
UIApplication.shared.applicationIconBadgeNumber = 1
87-
// Then resign active
88-
OneSignalCoreMocks.resignActive()
89-
// App becomes active the app
90-
OneSignalCoreMocks.becomeActive()
91-
// Ensure that badge count == 1
92-
XCTAssertEqual(UIApplication.shared.applicationIconBadgeNumber, 1)
93-
}
94-
95-
func testClearBadgesWhenAppEntersForeground3() throws {
96-
// NotificationManager Start to register lifecycle listener
97-
OSNotificationsManager.start()
98-
// Set badge count > 0
99-
UIApplication.shared.applicationIconBadgeNumber = 1
100-
// Then background the app
101-
OneSignalCoreMocks.backgroundApp()
102-
// Foreground the app
103-
OneSignalCoreMocks.foregroundApp()
104-
// Ensure that badge count == 0
105-
XCTAssertEqual(UIApplication.shared.applicationIconBadgeNumber, 0)
106-
}
107-
108-
func testDontclearBadgesWhenAppBecomesActive4() throws {
109-
// NotificationManager Start to register lifecycle listener
110-
OSNotificationsManager.start()
111-
// Set badge count > 0
112-
UIApplication.shared.applicationIconBadgeNumber = 1
113-
// Then resign active
114-
OneSignalCoreMocks.resignActive()
115-
// App becomes active the app
116-
OneSignalCoreMocks.becomeActive()
117-
// Ensure that badge count == 1
118-
XCTAssertEqual(UIApplication.shared.applicationIconBadgeNumber, 1)
119-
}
72+
//
73+
// func testClearBadgesWhenAppEntersForeground1() throws {
74+
// // NotificationManager Start to register lifecycle listener
75+
// OSNotificationsManager.start()
76+
// // Set badge count > 0
77+
// UIApplication.shared.applicationIconBadgeNumber = 1
78+
// // Then background the app
79+
// OneSignalCoreMocks.backgroundApp()
80+
// // Foreground the app
81+
// OneSignalCoreMocks.foregroundApp()
82+
// // Ensure that badge count == 0
83+
// XCTAssertEqual(UIApplication.shared.applicationIconBadgeNumber, 0)
84+
// }
85+
//
86+
// func testDontclearBadgesWhenAppBecomesActive2() throws {
87+
// // NotificationManager Start to register lifecycle listener
88+
// OSNotificationsManager.start()
89+
// // Set badge count > 0
90+
// UIApplication.shared.applicationIconBadgeNumber = 1
91+
// // Then resign active
92+
// OneSignalCoreMocks.resignActive()
93+
// // App becomes active the app
94+
// OneSignalCoreMocks.becomeActive()
95+
// // Ensure that badge count == 1
96+
// XCTAssertEqual(UIApplication.shared.applicationIconBadgeNumber, 1)
97+
// }
98+
//
99+
// func testClearBadgesWhenAppEntersForeground3() throws {
100+
// // NotificationManager Start to register lifecycle listener
101+
// OSNotificationsManager.start()
102+
// // Set badge count > 0
103+
// UIApplication.shared.applicationIconBadgeNumber = 1
104+
// // Then background the app
105+
// OneSignalCoreMocks.backgroundApp()
106+
// // Foreground the app
107+
// OneSignalCoreMocks.foregroundApp()
108+
// // Ensure that badge count == 0
109+
// XCTAssertEqual(UIApplication.shared.applicationIconBadgeNumber, 0)
110+
// }
111+
//
112+
// func testDontclearBadgesWhenAppBecomesActive4() throws {
113+
// // NotificationManager Start to register lifecycle listener
114+
// OSNotificationsManager.start()
115+
// // Set badge count > 0
116+
// UIApplication.shared.applicationIconBadgeNumber = 1
117+
// // Then resign active
118+
// OneSignalCoreMocks.resignActive()
119+
// // App becomes active the app
120+
// OneSignalCoreMocks.becomeActive()
121+
// // Ensure that badge count == 1
122+
// XCTAssertEqual(UIApplication.shared.applicationIconBadgeNumber, 1)
123+
// }
120124

121125
func testUpdateNotificationTypesOnAppEntersForeground() throws {
122126
// NotificationManager Start to register lifecycle listener

0 commit comments

Comments
 (0)