diff --git a/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Views/SFSDKWindowManager.m b/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Views/SFSDKWindowManager.m index 603d3a57e7..9e5d287706 100644 --- a/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Views/SFSDKWindowManager.m +++ b/libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Views/SFSDKWindowManager.m @@ -247,7 +247,7 @@ - (SFSDKWindowContainer *)windowWithName:(NSString *)name { - (SFSDKWindowContainer *)windowWithName:(NSString *)name scene:(nullable UIScene *)scene { scene = [self nonnullScene:scene]; SFSDKWindowContainer *container = [[self.namedWindows objectForKey:scene.session.persistentIdentifier] objectForKey:name]; - [self setWindowScene:container scene:nil]; + [self setWindowScene:container scene:scene]; return container; } diff --git a/libs/SalesforceSDKCore/SalesforceSDKCoreTests/SFSDKWindowManagerTests.m b/libs/SalesforceSDKCore/SalesforceSDKCoreTests/SFSDKWindowManagerTests.m index b4e0ed6c86..96f19674e6 100644 --- a/libs/SalesforceSDKCore/SalesforceSDKCoreTests/SFSDKWindowManagerTests.m +++ b/libs/SalesforceSDKCore/SalesforceSDKCoreTests/SFSDKWindowManagerTests.m @@ -143,6 +143,16 @@ - (void)testSnapshotWindow { XCTAssertEqual(snapshowWindowScene.window.windowLevel, SFWindowLevelSnapshotOffset); } +- (void)testCustomWindow { + NSString *windowName = @"test"; + SFSDKWindowContainer *createdWindow = [[SFSDKWindowManager sharedManager] createNewNamedWindow:windowName]; + XCTAssert(createdWindow.window != nil); + XCTAssert(createdWindow.windowType == SFSDKWindowTypeOther); + + SFSDKWindowContainer *retrievedWindow = [[SFSDKWindowManager sharedManager] windowWithName:windowName]; + XCTAssertEqualObjects(createdWindow, retrievedWindow); +} + - (void)testEnable { SFSDKWindowContainer *screenLockWindow = [SFSDKWindowManager sharedManager].screenLockWindow; [screenLockWindow presentWindow];