@onekeyfe/react-native-capture-protection 6.7.0-2 → 6.7.0-20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,10 +1,36 @@
|
|
|
1
|
+
import Darwin
|
|
1
2
|
import NitroModules
|
|
2
3
|
import UIKit
|
|
3
4
|
import XCTest
|
|
4
5
|
@testable import ReactNativeCaptureProtection
|
|
5
6
|
|
|
7
|
+
private final class CaptureProtectionTestAppDelegate: UIResponder, UIApplicationDelegate {
|
|
8
|
+
var window: UIWindow? = UIWindow(frame: CGRect(x: 0, y: 0, width: 320, height: 480))
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
@MainActor
|
|
7
12
|
final class CaptureProtectionTests: XCTestCase {
|
|
13
|
+
private static var retainedDelegate: CaptureProtectionTestAppDelegate?
|
|
14
|
+
|
|
15
|
+
override func setUp() {
|
|
16
|
+
super.setUp()
|
|
17
|
+
Self.ensureApplicationWindow()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private static func ensureApplicationWindow() {
|
|
21
|
+
if (UIApplication.value(forKey: "sharedApplication") as? UIApplication) == nil,
|
|
22
|
+
let sym = dlsym(UnsafeMutableRawPointer(bitPattern: -2), "UIApplicationInstantiateSingleton")
|
|
23
|
+
{
|
|
24
|
+
typealias InstantiateFn = @convention(c) (AnyClass) -> Void
|
|
25
|
+
unsafeBitCast(sym, to: InstantiateFn.self)(UIApplication.self)
|
|
26
|
+
}
|
|
27
|
+
if (UIApplication.shared.delegate?.window ?? nil) == nil {
|
|
28
|
+
let delegate = CaptureProtectionTestAppDelegate()
|
|
29
|
+
retainedDelegate = delegate
|
|
30
|
+
UIApplication.shared.delegate = delegate
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
8
34
|
func testNativeSubscriptionsRemainScopedToTheirObjects() throws {
|
|
9
35
|
let first = ReactNativeCaptureProtection()
|
|
10
36
|
let second = ReactNativeCaptureProtection()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-capture-protection",
|
|
3
|
-
"version": "6.7.0-
|
|
3
|
+
"version": "6.7.0-20",
|
|
4
4
|
"description": "Permission-minimal screenshot, recording and app-switcher protection",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|