Skip to content

Commit 2adad58

Browse files
authored
Merge pull request #3776 from bbirman/windowLevel
Ensure window container level is set on underlying window
2 parents 514a191 + 65fb98d commit 2adad58

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Views/SFSDKWindowContainer.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ - (BOOL)isEnabled {
9999
#endif
100100
}
101101

102+
- (void)setWindowLevel:(UIWindowLevel)windowLevel {
103+
_windowLevel = windowLevel;
104+
_window.windowLevel = _windowLevel;
105+
}
106+
102107
- (void)presentWindowAnimated:(BOOL)animated withCompletion:(void (^ _Nullable)(void))completion {
103108
if ([self.windowDelegate respondsToSelector:@selector(presentWindow:animated:withCompletion:)]) {
104109
[self.windowDelegate presentWindow:self animated:animated withCompletion:completion];

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Views/SFSDKWindowManager+Internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727

2828
#import "SFSDKWindowManager.h"
2929

30+
static const CGFloat SFWindowLevelScreenLockOffset = 100;
31+
static const CGFloat SFWindowLevelAuthOffset = 120;
32+
static const CGFloat SFWindowLevelSnapshotOffset = 1000;
33+
3034
@interface SFSDKWindowManager ()
3135

3236
- (UIScene *)defaultScene;

libs/SalesforceSDKCore/SalesforceSDKCore/Classes/Views/SFSDKWindowManager.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929
*/
3030
#import "SFSDKWindowManager.h"
31+
#import "SFSDKWindowManager+Internal.h"
3132
#import "SFSDKWindowContainer.h"
3233
#import "SFApplicationHelper.h"
3334
#import "SFSDKMacDetectUtil.h"
@@ -70,9 +71,6 @@ - (void)disableWindow;
7071

7172
@implementation SFSDKWindowManager
7273

73-
static const CGFloat SFWindowLevelScreenLockOffset = 100;
74-
static const CGFloat SFWindowLevelAuthOffset = 120;
75-
static const CGFloat SFWindowLevelSnapshotOffset = 1000;
7674
static NSString *const kSFMainWindowKey = @"main";
7775
static NSString *const kSFLoginWindowKey = @"auth";
7876
static NSString *const kSFSnaphotWindowKey = @"snapshot";

libs/SalesforceSDKCore/SalesforceSDKCoreTests/SFSDKWindowManagerTests.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#import <XCTest/XCTest.h>
2727
#import "SFSDKWindowManager.h"
28+
#import "SFSDKWindowManager+Internal.h"
2829
#import "SFApplicationHelper.h"
2930

3031
@interface SFSDKWindowManagerTests: XCTestCase{
@@ -110,6 +111,7 @@ - (void)testLoginWindow {
110111
SFSDKWindowContainer *authWindowNilScene = [[SFSDKWindowManager sharedManager] authWindow:nil];
111112
XCTAssert(authWindowNilScene.window != nil);
112113
XCTAssert(authWindowNilScene.windowType == SFSDKWindowTypeAuth);
114+
XCTAssertEqual(authWindowNilScene.window.windowLevel, SFWindowLevelAuthOffset);
113115

114116
UIScene *scene = [SFApplicationHelper sharedApplication].connectedScenes.allObjects.firstObject;
115117
SFSDKWindowContainer *authWindowScene = [[SFSDKWindowManager sharedManager] authWindow:scene];
@@ -122,6 +124,7 @@ - (void)testScreenLockWindow {
122124
SFSDKWindowContainer *screenLockWindow = [SFSDKWindowManager sharedManager].screenLockWindow;
123125
XCTAssert(screenLockWindow.window!=nil);
124126
XCTAssert(screenLockWindow.windowType == SFSDKWindowTypeScreenLock);
127+
XCTAssertEqual(screenLockWindow.window.windowLevel, SFWindowLevelScreenLockOffset);
125128
}
126129

127130
- (void)testSnapshotWindow {
@@ -134,6 +137,7 @@ - (void)testSnapshotWindow {
134137
XCTAssert(snapshowWindowScene.window != nil);
135138
XCTAssert(snapshowWindowScene.windowType == SFSDKWindowTypeSnapshot);
136139
XCTAssertEqualObjects(snapshotWindowNilScene, snapshowWindowScene);
140+
XCTAssertEqual(snapshowWindowScene.window.windowLevel, SFWindowLevelSnapshotOffset);
137141
}
138142

139143
- (void)testEnable {

0 commit comments

Comments
 (0)