@onekeyfe/react-native-capture-protection 6.7.0-2 → 6.7.0-21

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.
package/docs/SPEC.md CHANGED
@@ -66,6 +66,11 @@ are retained. No storage, persistence, cache, migrations or network access.
66
66
  | Recording event | UIScreen capture change notification | Upstream-derived virtual-display heuristic |
67
67
  | Permissions | None | DETECT_SCREEN_CAPTURE, normal permission, Android 14+ |
68
68
 
69
+ iOS adds the app-switcher window only on resign/background notifications, or on
70
+ prevent while the app is already in `.background`. Prevent during transient
71
+ `.inactive` (Face ID, system alerts, Control Center) must not cover the visible
72
+ page; the window is removed on didBecomeActive.
73
+
69
74
  Android below 14 intentionally has no screenshot notification; blocking remains
70
75
  available. Android virtual-display events are a heuristic and may also represent
71
76
  casting/external displays; they are not proof that a recording was made.
@@ -100,7 +105,8 @@ disposal and secure-layer owner isolation; physical capture acceptance remains
100
105
  separate.
101
106
  Required runtime acceptance: prevent/allow, nested sensitive pages, repeated
102
107
  navigation, recording started before/after subscription, background snapshots,
103
- activity recreation, subscription cleanup, and main/background object isolation.
108
+ prevent right after Face ID (no blank overlay), activity recreation, subscription
109
+ cleanup, and main/background object isolation.
104
110
  Inspect merged Android manifest and packaged iOS plist for media-read permissions.
105
111
  Build/type/unit results do not prove screenshot prevention on physical devices.
106
112
 
@@ -104,7 +104,10 @@ private final class CaptureProtectionCoordinator {
104
104
  owners.insert(owner)
105
105
  startObservers()
106
106
  refreshRecording()
107
- if UIApplication.shared.applicationState != .active { showSwitcher() }
107
+ // `.inactive` is transient (Face ID, system alerts, Control Center) and the app is
108
+ // still on screen, so covering it here blanks the page until didBecomeActive; the
109
+ // resign/background observers already cover real app-switcher transitions.
110
+ if UIApplication.shared.applicationState == .background { showSwitcher() }
108
111
  }
109
112
 
110
113
  func allow(owner: UUID) {
@@ -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-2",
3
+ "version": "6.7.0-21",
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",