File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -698,6 +698,8 @@ + (void)setLaunchURLsInApp:(BOOL)launchInApp {
698698 NSMutableDictionary *newSettings = [[NSMutableDictionary alloc ] initWithDictionary: appSettings];
699699 newSettings[kOSSettingsKeyInAppLaunchURL ] = launchInApp ? @true : @false ;
700700 appSettings = newSettings;
701+ // This allows this method to have an effect after init is called
702+ [self enableInAppLaunchURL: launchInApp];
701703}
702704
703705+ (void )setProvidesNotificationSettingsView : (BOOL )providesView {
Original file line number Diff line number Diff line change @@ -3318,6 +3318,22 @@ - (void)testLaunchURL {
33183318 XCTAssertFalse (OneSignalOverrider.launchWebURLWasCalled );
33193319}
33203320
3321+ - (void )testsetLaunchURLInAppAfterInit {
3322+ // 1. setLaunchURLsInApp to false
3323+ [OneSignal setLaunchURLsInApp: false ];
3324+
3325+ // 2. Init OneSignal with app start
3326+ [UnitTestCommonMethods initOneSignal ];
3327+ [UnitTestCommonMethods runBackgroundThreads ];
3328+
3329+ XCTAssertFalse ([OneSignalUserDefaults.initStandard getSavedBoolForKey: OSUD_NOTIFICATION_OPEN_LAUNCH_URL defaultValue: false ]);
3330+
3331+ // 3. Change setLaunchURLsInApp to true
3332+ [OneSignal setLaunchURLsInApp: true ];
3333+
3334+ XCTAssertTrue ([OneSignalUserDefaults.initStandard getSavedBoolForKey: OSUD_NOTIFICATION_OPEN_LAUNCH_URL defaultValue: false ]);
3335+ }
3336+
33213337- (void )testTimezoneId {
33223338
33233339 let mockTimezone = [NSTimeZone timeZoneWithName: @" Europe/London" ];
You can’t perform that action at this time.
0 commit comments