Skip to content

Commit 393ec87

Browse files
committed
chore: add condition for screen blocking
1 parent 9531e3d commit 393ec87

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ios/FreeraspReactNative.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,16 @@ class FreeraspReactNative: RCTEventEmitter {
7777

7878
private func getProtectedWindow(completion: @escaping (UIWindow?) -> Void) {
7979
DispatchQueue.main.async {
80-
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
81-
if let window = windowScene.windows.first {
82-
completion(window)
80+
if #available(iOS 13.0, *) {
81+
if let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene {
82+
if let window = windowScene.windows.first {
83+
completion(window)
84+
} else {
85+
completion(nil)
86+
}
8387
} else {
8488
completion(nil)
8589
}
86-
} else {
87-
completion(nil)
8890
}
8991
}
9092
}

0 commit comments

Comments
 (0)