expo-screen-capture 7.2.0-canary-20250713-8f814f8 → 7.2.0
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/CHANGELOG.md +12 -5
- package/android/build.gradle +2 -2
- package/android/src/main/AndroidManifest.xml +0 -1
- package/build/ScreenCapture.d.ts +27 -15
- package/build/ScreenCapture.d.ts.map +1 -1
- package/build/ScreenCapture.js +39 -23
- package/build/ScreenCapture.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/AnimatedBlurEffectView.swift +32 -0
- package/ios/ExpoScreenCapture.podspec +1 -1
- package/ios/ScreenCaptureModule.swift +105 -2
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0/expo.modules.screencapture-7.2.0.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0/expo.modules.screencapture-7.2.0.aar.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0/expo.modules.screencapture-7.2.0.aar.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0/expo.modules.screencapture-7.2.0.aar.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0/expo.modules.screencapture-7.2.0.aar.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/{7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.module → 7.2.0/expo.modules.screencapture-7.2.0.module} +19 -19
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0/expo.modules.screencapture-7.2.0.module.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0/expo.modules.screencapture-7.2.0.module.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0/expo.modules.screencapture-7.2.0.module.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0/expo.modules.screencapture-7.2.0.module.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/{7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.pom → 7.2.0/expo.modules.screencapture-7.2.0.pom} +2 -2
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0/expo.modules.screencapture-7.2.0.pom.md5 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0/expo.modules.screencapture-7.2.0.pom.sha1 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0/expo.modules.screencapture-7.2.0.pom.sha256 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0/expo.modules.screencapture-7.2.0.pom.sha512 +1 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/maven-metadata.xml +4 -4
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/maven-metadata.xml.sha512 +1 -1
- package/package.json +5 -4
- package/src/ScreenCapture.ts +43 -25
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.aar +0 -0
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.aar.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.aar.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.aar.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.aar.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.module.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.module.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.module.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.module.sha512 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.pom.md5 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.pom.sha1 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.pom.sha256 +0 -1
- package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8.pom.sha512 +0 -1
- /package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/{7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8-sources.jar → 7.2.0/expo.modules.screencapture-7.2.0-sources.jar} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/{7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8-sources.jar.md5 → 7.2.0/expo.modules.screencapture-7.2.0-sources.jar.md5} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/{7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8-sources.jar.sha1 → 7.2.0/expo.modules.screencapture-7.2.0-sources.jar.sha1} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/{7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8-sources.jar.sha256 → 7.2.0/expo.modules.screencapture-7.2.0-sources.jar.sha256} +0 -0
- /package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/{7.2.0-canary-20250713-8f814f8/expo.modules.screencapture-7.2.0-canary-20250713-8f814f8-sources.jar.sha512 → 7.2.0/expo.modules.screencapture-7.2.0-sources.jar.sha512} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,16 +6,23 @@
|
|
|
6
6
|
|
|
7
7
|
### 🎉 New features
|
|
8
8
|
|
|
9
|
-
- Implemented `useScreenshotListener` hook. ([#37411](https://github.com/expo/expo/pull/37411) by [@hryhoriiK97](https://github.com/hryhoriiK97))
|
|
10
|
-
- Implemented screenshot prevention on iOS. ([#37874](https://github.com/expo/expo/pull/37874) by [@hryhoriiK97](https://github.com/hryhoriiK97))
|
|
11
|
-
|
|
12
9
|
### 🐛 Bug fixes
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
### 💡 Others
|
|
12
|
+
|
|
13
|
+
## 7.2.0 — 2025-07-23
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- Implemented `useScreenshotListener` hook. ([#37411](https://github.com/expo/expo/pull/37411) by [@hryhoriiK97](https://github.com/hryhoriiK97))
|
|
18
|
+
- Implemented screenshot prevention on iOS. ([#37874](https://github.com/expo/expo/pull/37874) by [@hryhoriiK97](https://github.com/hryhoriiK97))
|
|
19
|
+
- Implement App Switcher protection on iOS. ([#38192](https://github.com/expo/expo/pull/38192) by [@hryhoriiK97](https://github.com/hryhoriiK97))
|
|
15
20
|
|
|
16
21
|
### 💡 Others
|
|
17
22
|
|
|
18
|
-
|
|
23
|
+
- [iOS] Replaced deprecated keyWindow usage. ([#38207](https://github.com/expo/expo/pull/38207) by [@hryhoriiK97](https://github.com/hryhoriiK97))
|
|
24
|
+
|
|
25
|
+
## 7.1.5 — 2025-07-01
|
|
19
26
|
|
|
20
27
|
### 💡 Others
|
|
21
28
|
|
package/android/build.gradle
CHANGED
|
@@ -4,13 +4,13 @@ plugins {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
group = 'host.exp.exponent'
|
|
7
|
-
version = '7.2.0
|
|
7
|
+
version = '7.2.0'
|
|
8
8
|
|
|
9
9
|
android {
|
|
10
10
|
namespace "expo.modules.screencapture"
|
|
11
11
|
defaultConfig {
|
|
12
12
|
versionCode 7
|
|
13
|
-
versionName '7.2.0
|
|
13
|
+
versionName '7.2.0'
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
2
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
|
|
3
|
-
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" android:minSdkVersion="33" android:maxSdkVersion="33"/>
|
|
4
3
|
<uses-permission android:name="android.permission.DETECT_SCREEN_CAPTURE" android:minSdkVersion="34" />
|
|
5
4
|
</manifest>
|
package/build/ScreenCapture.d.ts
CHANGED
|
@@ -41,13 +41,34 @@ export declare function allowScreenCaptureAsync(key?: string): Promise<void>;
|
|
|
41
41
|
*/
|
|
42
42
|
export declare function usePreventScreenCapture(key?: string): void;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Enables a privacy protection blur overlay that hides sensitive content when the app is not in focus.
|
|
45
|
+
* The overlay applies a customizable blur effect when the app is in the app switcher, background, or during interruptions
|
|
46
|
+
* (calls, Siri, Control Center, etc.), and automatically removes it when the app becomes active again.
|
|
47
|
+
*
|
|
48
|
+
* This provides visual privacy protection by preventing sensitive app content from being visible in:
|
|
49
|
+
* - App switcher previews
|
|
50
|
+
* - Background app snapshots
|
|
51
|
+
* - Screenshots taken during inactive states
|
|
52
|
+
*
|
|
53
|
+
* For Android, app switcher protection is automatically provided by `preventScreenCaptureAsync()`
|
|
54
|
+
* using the FLAG_SECURE window flag, which shows a blank screen in the recent apps preview.
|
|
45
55
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
56
|
+
* @param blurIntensity The intensity of the blur effect, from 0.0 (no blur) to 1.0 (maximum blur). Default is 0.5.
|
|
57
|
+
*
|
|
58
|
+
* @platform ios
|
|
59
|
+
*
|
|
60
|
+
*/
|
|
61
|
+
export declare function enableAppSwitcherProtectionAsync(blurIntensity?: number): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Disables the privacy protection overlay that was previously enabled with `enableAppSwitcherProtectionAsync`.
|
|
64
|
+
*
|
|
65
|
+
* @platform ios
|
|
66
|
+
*/
|
|
67
|
+
export declare function disableAppSwitcherProtectionAsync(): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Adds a listener that will fire whenever the user takes a screenshot while the app is foregrounded.
|
|
70
|
+
* On Android, this method requires the `READ_EXTERNAL_STORAGE` permission. You can request this
|
|
71
|
+
* with [`MediaLibrary.requestPermissionsAsync()`](./media-library/#medialibraryrequestpermissionsasync).
|
|
51
72
|
*
|
|
52
73
|
* @param listener The function that will be executed when the user takes a screenshot.
|
|
53
74
|
* This function accepts no arguments.
|
|
@@ -74,15 +95,6 @@ export declare function addScreenshotListener(listener: () => void): EventSubscr
|
|
|
74
95
|
* ```
|
|
75
96
|
*/
|
|
76
97
|
export declare function removeScreenshotListener(subscription: EventSubscription): void;
|
|
77
|
-
/**
|
|
78
|
-
* A React hook that listens for screenshots taken while the component is mounted.
|
|
79
|
-
*
|
|
80
|
-
* @param listener A function that will be called whenever a screenshot is detected.
|
|
81
|
-
*
|
|
82
|
-
* This hook automatically starts listening when the component mounts, and stops
|
|
83
|
-
* listening when the component unmounts.
|
|
84
|
-
*/
|
|
85
|
-
export declare function useScreenshotListener(listener: () => void): void;
|
|
86
98
|
/**
|
|
87
99
|
* Checks user's permissions for detecting when a screenshot is taken.
|
|
88
100
|
* > Only Android requires additional permissions to detect screenshots. On iOS devices, this method will always resolve to a `granted` permission response.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenCapture.d.ts","sourceRoot":"","sources":["../src/ScreenCapture.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAClB,gBAAgB,EAEhB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAU3B;;;;;GAKG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAEzD;AAGD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,yBAAyB,CAAC,GAAG,GAAE,MAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAStF;AAGD;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAAC,GAAG,GAAE,MAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CASpF;AAGD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,MAAkB,GAAG,IAAI,CAQrE;AAGD
|
|
1
|
+
{"version":3,"file":"ScreenCapture.d.ts","sourceRoot":"","sources":["../src/ScreenCapture.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAClB,gBAAgB,EAEhB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAU3B;;;;;GAKG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAEzD;AAGD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,yBAAyB,CAAC,GAAG,GAAE,MAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAStF;AAGD;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CAAC,GAAG,GAAE,MAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CASpF;AAGD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,MAAkB,GAAG,IAAI,CAQrE;AAGD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,gCAAgC,CAAC,aAAa,GAAE,MAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAMjG;AAGD;;;;GAIG;AACH,wBAAsB,iCAAiC,IAAI,OAAO,CAAC,IAAI,CAAC,CAMvE;AAGD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,iBAAiB,CAE7E;AAGD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,iBAAiB,QAEvE;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAKvE;AAED;;;;KAIK;AACL,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAK3E;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,4JAGzB,CAAC;AASH,OAAO,EACL,iBAAiB,IAAI,YAAY,EACjC,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,GACtB,CAAC"}
|
package/build/ScreenCapture.js
CHANGED
|
@@ -75,13 +75,46 @@ export function usePreventScreenCapture(key = 'default') {
|
|
|
75
75
|
}
|
|
76
76
|
// @needsAudit
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* Enables a privacy protection blur overlay that hides sensitive content when the app is not in focus.
|
|
79
|
+
* The overlay applies a customizable blur effect when the app is in the app switcher, background, or during interruptions
|
|
80
|
+
* (calls, Siri, Control Center, etc.), and automatically removes it when the app becomes active again.
|
|
81
|
+
*
|
|
82
|
+
* This provides visual privacy protection by preventing sensitive app content from being visible in:
|
|
83
|
+
* - App switcher previews
|
|
84
|
+
* - Background app snapshots
|
|
85
|
+
* - Screenshots taken during inactive states
|
|
86
|
+
*
|
|
87
|
+
* For Android, app switcher protection is automatically provided by `preventScreenCaptureAsync()`
|
|
88
|
+
* using the FLAG_SECURE window flag, which shows a blank screen in the recent apps preview.
|
|
89
|
+
*
|
|
90
|
+
* @param blurIntensity The intensity of the blur effect, from 0.0 (no blur) to 1.0 (maximum blur). Default is 0.5.
|
|
91
|
+
*
|
|
92
|
+
* @platform ios
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
export async function enableAppSwitcherProtectionAsync(blurIntensity = 0.5) {
|
|
96
|
+
if (!ExpoScreenCapture.enableAppSwitcherProtection) {
|
|
97
|
+
throw new UnavailabilityError('ScreenCapture', 'enableAppSwitcherProtectionAsync');
|
|
98
|
+
}
|
|
99
|
+
await ExpoScreenCapture.enableAppSwitcherProtection(blurIntensity);
|
|
100
|
+
}
|
|
101
|
+
// @needsAudit
|
|
102
|
+
/**
|
|
103
|
+
* Disables the privacy protection overlay that was previously enabled with `enableAppSwitcherProtectionAsync`.
|
|
79
104
|
*
|
|
80
|
-
*
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
105
|
+
* @platform ios
|
|
106
|
+
*/
|
|
107
|
+
export async function disableAppSwitcherProtectionAsync() {
|
|
108
|
+
if (!ExpoScreenCapture.disableAppSwitcherProtection) {
|
|
109
|
+
throw new UnavailabilityError('ScreenCapture', 'disableAppSwitcherProtectionAsync');
|
|
110
|
+
}
|
|
111
|
+
await ExpoScreenCapture.disableAppSwitcherProtection();
|
|
112
|
+
}
|
|
113
|
+
// @needsAudit
|
|
114
|
+
/**
|
|
115
|
+
* Adds a listener that will fire whenever the user takes a screenshot while the app is foregrounded.
|
|
116
|
+
* On Android, this method requires the `READ_EXTERNAL_STORAGE` permission. You can request this
|
|
117
|
+
* with [`MediaLibrary.requestPermissionsAsync()`](./media-library/#medialibraryrequestpermissionsasync).
|
|
85
118
|
*
|
|
86
119
|
* @param listener The function that will be executed when the user takes a screenshot.
|
|
87
120
|
* This function accepts no arguments.
|
|
@@ -113,23 +146,6 @@ export function addScreenshotListener(listener) {
|
|
|
113
146
|
export function removeScreenshotListener(subscription) {
|
|
114
147
|
subscription.remove();
|
|
115
148
|
}
|
|
116
|
-
// @needsAudit
|
|
117
|
-
/**
|
|
118
|
-
* A React hook that listens for screenshots taken while the component is mounted.
|
|
119
|
-
*
|
|
120
|
-
* @param listener A function that will be called whenever a screenshot is detected.
|
|
121
|
-
*
|
|
122
|
-
* This hook automatically starts listening when the component mounts, and stops
|
|
123
|
-
* listening when the component unmounts.
|
|
124
|
-
*/
|
|
125
|
-
export function useScreenshotListener(listener) {
|
|
126
|
-
useEffect(() => {
|
|
127
|
-
const subscription = addScreenshotListener(listener);
|
|
128
|
-
return () => {
|
|
129
|
-
removeScreenshotListener(subscription);
|
|
130
|
-
};
|
|
131
|
-
}, [listener]);
|
|
132
|
-
}
|
|
133
149
|
/**
|
|
134
150
|
* Checks user's permissions for detecting when a screenshot is taken.
|
|
135
151
|
* > Only Android requires additional permissions to detect screenshots. On iOS devices, this method will always resolve to a `granted` permission response.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScreenCapture.js","sourceRoot":"","sources":["../src/ScreenCapture.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n UnavailabilityError,\n PermissionResponse,\n PermissionStatus,\n createPermissionHook,\n PermissionHookOptions,\n EventSubscription,\n} from 'expo-modules-core';\nimport { useEffect } from 'react';\n\nimport ExpoScreenCapture from './ExpoScreenCapture';\n\nconst activeTags: Set<string> = new Set();\n\nconst onScreenshotEventName = 'onScreenshot';\n\n// @needsAudit\n/**\n * Returns whether the Screen Capture API is available on the current device.\n *\n * @returns A promise that resolves to a `boolean` indicating whether the Screen Capture API is available on the current\n * device.\n */\nexport async function isAvailableAsync(): Promise<boolean> {\n return !!ExpoScreenCapture.preventScreenCapture && !!ExpoScreenCapture.allowScreenCapture;\n}\n\n// @needsAudit\n/**\n * Prevents screenshots and screen recordings until `allowScreenCaptureAsync` is called or the app is restarted. If you are\n * already preventing screen capture, this method does nothing (unless you pass a new and unique `key`).\n *\n * > On iOS, this prevents screen recordings and screenshots, and is only available on iOS 11+ (recordings) and iOS 13+ (screenshots). On older\n * iOS versions, this method does nothing.\n *\n * @param key Optional. If provided, this will help prevent multiple instances of the `preventScreenCaptureAsync`\n * and `allowScreenCaptureAsync` methods (and `usePreventScreenCapture` hook) from conflicting with each other.\n * When using multiple keys, you'll have to re-allow each one in order to re-enable screen capturing.\n *\n * @platform android\n * @platform ios\n */\nexport async function preventScreenCaptureAsync(key: string = 'default'): Promise<void> {\n if (!ExpoScreenCapture.preventScreenCapture) {\n throw new UnavailabilityError('ScreenCapture', 'preventScreenCaptureAsync');\n }\n\n if (!activeTags.has(key)) {\n activeTags.add(key);\n await ExpoScreenCapture.preventScreenCapture();\n }\n}\n\n// @needsAudit\n/**\n * Re-allows the user to screen record or screenshot your app. If you haven't called\n * `preventScreenCapture()` yet, this method does nothing.\n *\n * @param key This will prevent multiple instances of the `preventScreenCaptureAsync` and\n * `allowScreenCaptureAsync` methods from conflicting with each other. If provided, the value must\n * be the same as the key passed to `preventScreenCaptureAsync` in order to re-enable screen\n * capturing.\n */\nexport async function allowScreenCaptureAsync(key: string = 'default'): Promise<void> {\n if (!ExpoScreenCapture.preventScreenCapture) {\n throw new UnavailabilityError('ScreenCapture', 'allowScreenCaptureAsync');\n }\n\n activeTags.delete(key);\n if (activeTags.size === 0) {\n await ExpoScreenCapture.allowScreenCapture();\n }\n}\n\n// @needsAudit\n/**\n * A React hook to prevent screen capturing for as long as the owner component is mounted.\n *\n * @param key If provided, this will prevent multiple instances of this hook or the\n * `preventScreenCaptureAsync` and `allowScreenCaptureAsync` methods from conflicting with each other.\n * This argument is useful if you have multiple active components using the `allowScreenCaptureAsync`\n * hook.\n */\nexport function usePreventScreenCapture(key: string = 'default'): void {\n useEffect(() => {\n preventScreenCaptureAsync(key);\n\n return () => {\n allowScreenCaptureAsync(key);\n };\n }, [key]);\n}\n\n// @needsAudit\n/**\n * Adds a listener that will fire whenever the user takes a screenshot while the app is foregrounded.\n *\n * Permission requirements for this method depend on your device’s Android version:\n * - **Before Android 13**: Requires `READ_EXTERNAL_STORAGE`.\n * - **Android 13**: Switches to `READ_MEDIA_IMAGES`.\n * - **Post-Android 13**: No additional permissions required.\n * You can request the appropriate permissions by using [`MediaLibrary.requestPermissionsAsync()`](./media-library/#medialibraryrequestpermissionsasync).\n *\n * @param listener The function that will be executed when the user takes a screenshot.\n * This function accepts no arguments.\n *\n * @return A `Subscription` object that you can use to unregister the listener, either by calling\n * `remove()` or passing it to `removeScreenshotListener`.\n */\nexport function addScreenshotListener(listener: () => void): EventSubscription {\n return ExpoScreenCapture.addListener(onScreenshotEventName, listener);\n}\n\n// @needsAudit\n/**\n * Removes the subscription you provide, so that you are no longer listening for screenshots.\n * You can also call `remove()` on that `Subscription` object.\n *\n * @param subscription Subscription returned by `addScreenshotListener`.\n *\n * @example\n * ```ts\n * let mySubscription = addScreenshotListener(() => {\n * console.log(\"You took a screenshot!\");\n * });\n * ...\n * mySubscription.remove();\n * // OR\n * removeScreenshotListener(mySubscription);\n * ```\n */\nexport function removeScreenshotListener(subscription: EventSubscription) {\n subscription.remove();\n}\n\n// @needsAudit\n/**\n * A React hook that listens for screenshots taken while the component is mounted.\n *\n * @param listener A function that will be called whenever a screenshot is detected.\n *\n * This hook automatically starts listening when the component mounts, and stops\n * listening when the component unmounts.\n */\nexport function useScreenshotListener(listener: () => void) {\n useEffect(() => {\n const subscription = addScreenshotListener(listener);\n\n return () => {\n removeScreenshotListener(subscription);\n };\n }, [listener]);\n}\n\n/**\n * Checks user's permissions for detecting when a screenshot is taken.\n * > Only Android requires additional permissions to detect screenshots. On iOS devices, this method will always resolve to a `granted` permission response.\n * @return A promise that resolves to a [`PermissionResponse`](#permissionresponse) object.\n */\nexport async function getPermissionsAsync(): Promise<PermissionResponse> {\n if (ExpoScreenCapture.getPermissionsAsync) {\n return ExpoScreenCapture.getPermissionsAsync();\n }\n return defaultPermissionsResponse;\n}\n\n/**\n * Asks the user to grant permissions necessary for detecting when a screenshot is taken.\n * > Only Android requires additional permissions to detect screenshots. On iOS devices, this method will always resolve to a `granted` permission response.\n * @return A promise that resolves to a [`PermissionResponse`](#permissionresponse) object.\n * */\nexport async function requestPermissionsAsync(): Promise<PermissionResponse> {\n if (ExpoScreenCapture.requestPermissionsAsync) {\n return ExpoScreenCapture.requestPermissionsAsync();\n }\n return defaultPermissionsResponse;\n}\n\n/**\n * Check or request permissions necessary for detecting when a screenshot is taken.\n * This uses both [`requestPermissionsAsync`](#screencapturerequestpermissionsasync) and [`getPermissionsAsync`](#screencapturegetpermissionsasync) to interact with the permissions.\n *\n * @example\n * ```js\n * const [status, requestPermission] = ScreenCapture.usePermissions();\n * ```\n */\nexport const usePermissions = createPermissionHook({\n getMethod: getPermissionsAsync,\n requestMethod: requestPermissionsAsync,\n});\n\nconst defaultPermissionsResponse: PermissionResponse = {\n granted: true,\n expires: 'never',\n canAskAgain: true,\n status: PermissionStatus.GRANTED,\n};\n\nexport {\n EventSubscription as Subscription,\n PermissionResponse,\n PermissionStatus,\n PermissionHookOptions,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ScreenCapture.js","sourceRoot":"","sources":["../src/ScreenCapture.ts"],"names":[],"mappings":"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","sourcesContent":["import {\n UnavailabilityError,\n PermissionResponse,\n PermissionStatus,\n createPermissionHook,\n PermissionHookOptions,\n EventSubscription,\n} from 'expo-modules-core';\nimport { useEffect } from 'react';\n\nimport ExpoScreenCapture from './ExpoScreenCapture';\n\nconst activeTags: Set<string> = new Set();\n\nconst onScreenshotEventName = 'onScreenshot';\n\n// @needsAudit\n/**\n * Returns whether the Screen Capture API is available on the current device.\n *\n * @returns A promise that resolves to a `boolean` indicating whether the Screen Capture API is available on the current\n * device.\n */\nexport async function isAvailableAsync(): Promise<boolean> {\n return !!ExpoScreenCapture.preventScreenCapture && !!ExpoScreenCapture.allowScreenCapture;\n}\n\n// @needsAudit\n/**\n * Prevents screenshots and screen recordings until `allowScreenCaptureAsync` is called or the app is restarted. If you are\n * already preventing screen capture, this method does nothing (unless you pass a new and unique `key`).\n *\n * > On iOS, this prevents screen recordings and screenshots, and is only available on iOS 11+ (recordings) and iOS 13+ (screenshots). On older\n * iOS versions, this method does nothing.\n *\n * @param key Optional. If provided, this will help prevent multiple instances of the `preventScreenCaptureAsync`\n * and `allowScreenCaptureAsync` methods (and `usePreventScreenCapture` hook) from conflicting with each other.\n * When using multiple keys, you'll have to re-allow each one in order to re-enable screen capturing.\n *\n * @platform android\n * @platform ios\n */\nexport async function preventScreenCaptureAsync(key: string = 'default'): Promise<void> {\n if (!ExpoScreenCapture.preventScreenCapture) {\n throw new UnavailabilityError('ScreenCapture', 'preventScreenCaptureAsync');\n }\n\n if (!activeTags.has(key)) {\n activeTags.add(key);\n await ExpoScreenCapture.preventScreenCapture();\n }\n}\n\n// @needsAudit\n/**\n * Re-allows the user to screen record or screenshot your app. If you haven't called\n * `preventScreenCapture()` yet, this method does nothing.\n *\n * @param key This will prevent multiple instances of the `preventScreenCaptureAsync` and\n * `allowScreenCaptureAsync` methods from conflicting with each other. If provided, the value must\n * be the same as the key passed to `preventScreenCaptureAsync` in order to re-enable screen\n * capturing.\n */\nexport async function allowScreenCaptureAsync(key: string = 'default'): Promise<void> {\n if (!ExpoScreenCapture.preventScreenCapture) {\n throw new UnavailabilityError('ScreenCapture', 'allowScreenCaptureAsync');\n }\n\n activeTags.delete(key);\n if (activeTags.size === 0) {\n await ExpoScreenCapture.allowScreenCapture();\n }\n}\n\n// @needsAudit\n/**\n * A React hook to prevent screen capturing for as long as the owner component is mounted.\n *\n * @param key If provided, this will prevent multiple instances of this hook or the\n * `preventScreenCaptureAsync` and `allowScreenCaptureAsync` methods from conflicting with each other.\n * This argument is useful if you have multiple active components using the `allowScreenCaptureAsync`\n * hook.\n */\nexport function usePreventScreenCapture(key: string = 'default'): void {\n useEffect(() => {\n preventScreenCaptureAsync(key);\n\n return () => {\n allowScreenCaptureAsync(key);\n };\n }, [key]);\n}\n\n// @needsAudit\n/**\n * Enables a privacy protection blur overlay that hides sensitive content when the app is not in focus.\n * The overlay applies a customizable blur effect when the app is in the app switcher, background, or during interruptions\n * (calls, Siri, Control Center, etc.), and automatically removes it when the app becomes active again.\n *\n * This provides visual privacy protection by preventing sensitive app content from being visible in:\n * - App switcher previews\n * - Background app snapshots\n * - Screenshots taken during inactive states\n *\n * For Android, app switcher protection is automatically provided by `preventScreenCaptureAsync()`\n * using the FLAG_SECURE window flag, which shows a blank screen in the recent apps preview.\n *\n * @param blurIntensity The intensity of the blur effect, from 0.0 (no blur) to 1.0 (maximum blur). Default is 0.5.\n *\n * @platform ios\n *\n */\nexport async function enableAppSwitcherProtectionAsync(blurIntensity: number = 0.5): Promise<void> {\n if (!ExpoScreenCapture.enableAppSwitcherProtection) {\n throw new UnavailabilityError('ScreenCapture', 'enableAppSwitcherProtectionAsync');\n }\n\n await ExpoScreenCapture.enableAppSwitcherProtection(blurIntensity);\n}\n\n// @needsAudit\n/**\n * Disables the privacy protection overlay that was previously enabled with `enableAppSwitcherProtectionAsync`.\n *\n * @platform ios\n */\nexport async function disableAppSwitcherProtectionAsync(): Promise<void> {\n if (!ExpoScreenCapture.disableAppSwitcherProtection) {\n throw new UnavailabilityError('ScreenCapture', 'disableAppSwitcherProtectionAsync');\n }\n\n await ExpoScreenCapture.disableAppSwitcherProtection();\n}\n\n// @needsAudit\n/**\n * Adds a listener that will fire whenever the user takes a screenshot while the app is foregrounded.\n * On Android, this method requires the `READ_EXTERNAL_STORAGE` permission. You can request this\n * with [`MediaLibrary.requestPermissionsAsync()`](./media-library/#medialibraryrequestpermissionsasync).\n *\n * @param listener The function that will be executed when the user takes a screenshot.\n * This function accepts no arguments.\n *\n * @return A `Subscription` object that you can use to unregister the listener, either by calling\n * `remove()` or passing it to `removeScreenshotListener`.\n */\nexport function addScreenshotListener(listener: () => void): EventSubscription {\n return ExpoScreenCapture.addListener(onScreenshotEventName, listener);\n}\n\n// @needsAudit\n/**\n * Removes the subscription you provide, so that you are no longer listening for screenshots.\n * You can also call `remove()` on that `Subscription` object.\n *\n * @param subscription Subscription returned by `addScreenshotListener`.\n *\n * @example\n * ```ts\n * let mySubscription = addScreenshotListener(() => {\n * console.log(\"You took a screenshot!\");\n * });\n * ...\n * mySubscription.remove();\n * // OR\n * removeScreenshotListener(mySubscription);\n * ```\n */\nexport function removeScreenshotListener(subscription: EventSubscription) {\n subscription.remove();\n}\n\n/**\n * Checks user's permissions for detecting when a screenshot is taken.\n * > Only Android requires additional permissions to detect screenshots. On iOS devices, this method will always resolve to a `granted` permission response.\n * @return A promise that resolves to a [`PermissionResponse`](#permissionresponse) object.\n */\nexport async function getPermissionsAsync(): Promise<PermissionResponse> {\n if (ExpoScreenCapture.getPermissionsAsync) {\n return ExpoScreenCapture.getPermissionsAsync();\n }\n return defaultPermissionsResponse;\n}\n\n/**\n * Asks the user to grant permissions necessary for detecting when a screenshot is taken.\n * > Only Android requires additional permissions to detect screenshots. On iOS devices, this method will always resolve to a `granted` permission response.\n * @return A promise that resolves to a [`PermissionResponse`](#permissionresponse) object.\n * */\nexport async function requestPermissionsAsync(): Promise<PermissionResponse> {\n if (ExpoScreenCapture.requestPermissionsAsync) {\n return ExpoScreenCapture.requestPermissionsAsync();\n }\n return defaultPermissionsResponse;\n}\n\n/**\n * Check or request permissions necessary for detecting when a screenshot is taken.\n * This uses both [`requestPermissionsAsync`](#screencapturerequestpermissionsasync) and [`getPermissionsAsync`](#screencapturegetpermissionsasync) to interact with the permissions.\n *\n * @example\n * ```js\n * const [status, requestPermission] = ScreenCapture.usePermissions();\n * ```\n */\nexport const usePermissions = createPermissionHook({\n getMethod: getPermissionsAsync,\n requestMethod: requestPermissionsAsync,\n});\n\nconst defaultPermissionsResponse: PermissionResponse = {\n granted: true,\n expires: 'never',\n canAskAgain: true,\n status: PermissionStatus.GRANTED,\n};\n\nexport {\n EventSubscription as Subscription,\n PermissionResponse,\n PermissionStatus,\n PermissionHookOptions,\n};\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
class AnimatedBlurEffectView: UIVisualEffectView {
|
|
2
|
+
private let blurIntensity: CGFloat
|
|
3
|
+
private let blurStyle: UIBlurEffect.Style
|
|
4
|
+
private var animator = UIViewPropertyAnimator(duration: 1, curve: .linear)
|
|
5
|
+
|
|
6
|
+
private lazy var blurEffect = UIBlurEffect(style: blurStyle)
|
|
7
|
+
|
|
8
|
+
init(style: UIBlurEffect.Style = .light, intensity: CGFloat) {
|
|
9
|
+
self.blurStyle = style
|
|
10
|
+
self.blurIntensity = intensity
|
|
11
|
+
super.init(effect: nil)
|
|
12
|
+
self.backgroundColor = .clear
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
required init?(coder: NSCoder) {
|
|
16
|
+
self.blurStyle = .light
|
|
17
|
+
self.blurIntensity = 0.5
|
|
18
|
+
super.init(coder: coder)
|
|
19
|
+
self.backgroundColor = .clear
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
func setupBlur() {
|
|
23
|
+
animator.stopAnimation(true)
|
|
24
|
+
animator.addAnimations { [weak self] in
|
|
25
|
+
guard let self else {
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
self.effect = self.blurEffect
|
|
29
|
+
}
|
|
30
|
+
animator.fractionComplete = blurIntensity
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -8,6 +8,13 @@ public final class ScreenCaptureModule: Module {
|
|
|
8
8
|
private var blockView = UIView()
|
|
9
9
|
private var protectionTextField: UITextField?
|
|
10
10
|
private var originalParent: CALayer?
|
|
11
|
+
private var blurEffectView: AnimatedBlurEffectView?
|
|
12
|
+
private var blurIntensity: CGFloat = 0.5
|
|
13
|
+
private var keyWindow: UIWindow? {
|
|
14
|
+
return UIApplication.shared.connectedScenes
|
|
15
|
+
.flatMap { ($0 as? UIWindowScene)?.windows ?? [] }
|
|
16
|
+
.last { $0.isKeyWindow }
|
|
17
|
+
}
|
|
11
18
|
|
|
12
19
|
public func definition() -> ModuleDefinition {
|
|
13
20
|
Name("ExpoScreenCapture")
|
|
@@ -22,6 +29,7 @@ public final class ScreenCaptureModule: Module {
|
|
|
22
29
|
|
|
23
30
|
OnDestroy {
|
|
24
31
|
allowScreenshots()
|
|
32
|
+
disableAppSwitcherProtection()
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
OnStartObserving {
|
|
@@ -53,6 +61,15 @@ public final class ScreenCaptureModule: Module {
|
|
|
53
61
|
object: nil
|
|
54
62
|
)
|
|
55
63
|
}.runOnQueue(.main)
|
|
64
|
+
|
|
65
|
+
AsyncFunction("enableAppSwitcherProtection") { (blurIntensity: CGFloat) in
|
|
66
|
+
self.blurIntensity = blurIntensity
|
|
67
|
+
enableAppSwitcherProtection()
|
|
68
|
+
}.runOnQueue(.main)
|
|
69
|
+
|
|
70
|
+
AsyncFunction("disableAppSwitcherProtection") {
|
|
71
|
+
disableAppSwitcherProtection()
|
|
72
|
+
}.runOnQueue(.main)
|
|
56
73
|
}
|
|
57
74
|
|
|
58
75
|
private func setIsBeing(observed: Bool) {
|
|
@@ -79,10 +96,12 @@ public final class ScreenCaptureModule: Module {
|
|
|
79
96
|
|
|
80
97
|
@objc
|
|
81
98
|
func preventScreenRecording() {
|
|
99
|
+
guard let keyWindow = keyWindow,
|
|
100
|
+
let visibleView = keyWindow.subviews.first else { return }
|
|
82
101
|
let isCaptured = UIScreen.main.isCaptured
|
|
83
102
|
|
|
84
103
|
if isCaptured {
|
|
85
|
-
|
|
104
|
+
visibleView.addSubview(blockView)
|
|
86
105
|
} else {
|
|
87
106
|
blockView.removeFromSuperview()
|
|
88
107
|
}
|
|
@@ -96,7 +115,7 @@ public final class ScreenCaptureModule: Module {
|
|
|
96
115
|
}
|
|
97
116
|
|
|
98
117
|
private func preventScreenshots() {
|
|
99
|
-
guard let keyWindow =
|
|
118
|
+
guard let keyWindow = keyWindow,
|
|
100
119
|
let visibleView = keyWindow.subviews.first else { return }
|
|
101
120
|
|
|
102
121
|
let textField = UITextField()
|
|
@@ -136,4 +155,88 @@ public final class ScreenCaptureModule: Module {
|
|
|
136
155
|
protectionTextField = nil
|
|
137
156
|
originalParent = nil
|
|
138
157
|
}
|
|
158
|
+
|
|
159
|
+
private func enableAppSwitcherProtection() {
|
|
160
|
+
NotificationCenter.default.addObserver(
|
|
161
|
+
self,
|
|
162
|
+
selector: #selector(appWillResignActive),
|
|
163
|
+
name: UIApplication.willResignActiveNotification,
|
|
164
|
+
object: nil
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
NotificationCenter.default.addObserver(
|
|
168
|
+
self,
|
|
169
|
+
selector: #selector(appDidBecomeActive),
|
|
170
|
+
name: UIApplication.didBecomeActiveNotification,
|
|
171
|
+
object: nil
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private func disableAppSwitcherProtection() {
|
|
176
|
+
NotificationCenter.default.removeObserver(
|
|
177
|
+
self,
|
|
178
|
+
name: UIApplication.willResignActiveNotification,
|
|
179
|
+
object: nil
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
NotificationCenter.default.removeObserver(
|
|
183
|
+
self,
|
|
184
|
+
name: UIApplication.didBecomeActiveNotification,
|
|
185
|
+
object: nil
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
removePrivacyOverlay()
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@objc
|
|
192
|
+
private func appWillResignActive() {
|
|
193
|
+
showPrivacyOverlay()
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@objc
|
|
197
|
+
private func appDidBecomeActive() {
|
|
198
|
+
removePrivacyOverlay()
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
private func showPrivacyOverlay() {
|
|
202
|
+
if let keyWindow = keyWindow,
|
|
203
|
+
let rootView = keyWindow.subviews.first {
|
|
204
|
+
let blurEffectView = AnimatedBlurEffectView(style: .light, intensity: self.blurIntensity)
|
|
205
|
+
blurEffectView.frame = rootView.bounds
|
|
206
|
+
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
207
|
+
blurEffectView.alpha = 0
|
|
208
|
+
|
|
209
|
+
rootView.addSubview(blurEffectView)
|
|
210
|
+
self.blurEffectView = blurEffectView
|
|
211
|
+
|
|
212
|
+
blurEffectView.setupBlur()
|
|
213
|
+
|
|
214
|
+
UIView.animate(
|
|
215
|
+
withDuration: 0.3,
|
|
216
|
+
delay: 0,
|
|
217
|
+
options: [.curveEaseOut],
|
|
218
|
+
animations: {
|
|
219
|
+
blurEffectView.alpha = 1.0
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
private func removePrivacyOverlay() {
|
|
226
|
+
guard let blurEffectView = self.blurEffectView else {
|
|
227
|
+
return
|
|
228
|
+
}
|
|
229
|
+
UIView.animate(
|
|
230
|
+
withDuration: 0.25,
|
|
231
|
+
delay: 0,
|
|
232
|
+
options: [.curveEaseIn],
|
|
233
|
+
animations: {
|
|
234
|
+
blurEffectView.alpha = 0
|
|
235
|
+
},
|
|
236
|
+
completion: { _ in
|
|
237
|
+
blurEffectView.removeFromSuperview()
|
|
238
|
+
self.blurEffectView = nil
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
}
|
|
139
242
|
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7bd790ffca2e473cce9d80535730ba3c
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7ecf0a53df33e2c96fb06dd301d6a5e0824282f0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e530fcfe5b4c0ca8362bc07e085bfd113e6bb5f9798cde28925b64c238ce77eb
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e43057ceb38b0158e6866e120313f3d2f77ced9e1ac025667c2bebe36e528d537a248d4d7bff6c6db7683287ff777e14b651597b26636f7a1170825e35ea25b9
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "host.exp.exponent",
|
|
5
5
|
"module": "expo.modules.screencapture",
|
|
6
|
-
"version": "7.2.0
|
|
6
|
+
"version": "7.2.0",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
"createdBy": {
|
|
12
12
|
"gradle": {
|
|
13
|
-
"version": "8.
|
|
13
|
+
"version": "8.13"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"variants": [
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
{
|
|
27
|
-
"name": "expo.modules.screencapture-7.2.0
|
|
28
|
-
"url": "expo.modules.screencapture-7.2.0
|
|
29
|
-
"size":
|
|
30
|
-
"sha512": "
|
|
31
|
-
"sha256": "
|
|
32
|
-
"sha1": "
|
|
33
|
-
"md5": "
|
|
27
|
+
"name": "expo.modules.screencapture-7.2.0.aar",
|
|
28
|
+
"url": "expo.modules.screencapture-7.2.0.aar",
|
|
29
|
+
"size": 28229,
|
|
30
|
+
"sha512": "e43057ceb38b0158e6866e120313f3d2f77ced9e1ac025667c2bebe36e528d537a248d4d7bff6c6db7683287ff777e14b651597b26636f7a1170825e35ea25b9",
|
|
31
|
+
"sha256": "e530fcfe5b4c0ca8362bc07e085bfd113e6bb5f9798cde28925b64c238ce77eb",
|
|
32
|
+
"sha1": "7ecf0a53df33e2c96fb06dd301d6a5e0824282f0",
|
|
33
|
+
"md5": "7bd790ffca2e473cce9d80535730ba3c"
|
|
34
34
|
}
|
|
35
35
|
]
|
|
36
36
|
},
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"group": "org.jetbrains.kotlin",
|
|
48
48
|
"module": "kotlin-stdlib-jdk7",
|
|
49
49
|
"version": {
|
|
50
|
-
"requires": "2.
|
|
50
|
+
"requires": "2.0.21"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
{
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
],
|
|
61
61
|
"files": [
|
|
62
62
|
{
|
|
63
|
-
"name": "expo.modules.screencapture-7.2.0
|
|
64
|
-
"url": "expo.modules.screencapture-7.2.0
|
|
65
|
-
"size":
|
|
66
|
-
"sha512": "
|
|
67
|
-
"sha256": "
|
|
68
|
-
"sha1": "
|
|
69
|
-
"md5": "
|
|
63
|
+
"name": "expo.modules.screencapture-7.2.0.aar",
|
|
64
|
+
"url": "expo.modules.screencapture-7.2.0.aar",
|
|
65
|
+
"size": 28229,
|
|
66
|
+
"sha512": "e43057ceb38b0158e6866e120313f3d2f77ced9e1ac025667c2bebe36e528d537a248d4d7bff6c6db7683287ff777e14b651597b26636f7a1170825e35ea25b9",
|
|
67
|
+
"sha256": "e530fcfe5b4c0ca8362bc07e085bfd113e6bb5f9798cde28925b64c238ce77eb",
|
|
68
|
+
"sha1": "7ecf0a53df33e2c96fb06dd301d6a5e0824282f0",
|
|
69
|
+
"md5": "7bd790ffca2e473cce9d80535730ba3c"
|
|
70
70
|
}
|
|
71
71
|
]
|
|
72
72
|
},
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
},
|
|
81
81
|
"files": [
|
|
82
82
|
{
|
|
83
|
-
"name": "expo.modules.screencapture-7.2.0-
|
|
84
|
-
"url": "expo.modules.screencapture-7.2.0-
|
|
83
|
+
"name": "expo.modules.screencapture-7.2.0-sources.jar",
|
|
84
|
+
"url": "expo.modules.screencapture-7.2.0-sources.jar",
|
|
85
85
|
"size": 3601,
|
|
86
86
|
"sha512": "080676e6818f1d063d27b7b460c49e34d7ebeae5e6a6e4c071840008b10a6beaafe0022467b6f556a1a190b22ae6b04ef87de7e7c2a74364b5af845efa1a6b05",
|
|
87
87
|
"sha256": "d2c5b19e0bb1ad883b35525cdce5c665213505bea5b758f0c0c44b735fc960eb",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
523ff46486799acf1b4ad281863b2ab9
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
55903b6aa635785a09db41f65621966d6e86cca8
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
eb7942403db36548e2a30843df9603bbd953b62cde3b1d9135b415f6002b8fad
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1969bccc451e72966f599308a220a7feb7fbdef19714e739a8cbbf06ca26d73b00cf3977433c4cd1177e3cfecabf968f30cd5ac0def264cdd6fada48c2f4e871
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>host.exp.exponent</groupId>
|
|
11
11
|
<artifactId>expo.modules.screencapture</artifactId>
|
|
12
|
-
<version>7.2.0
|
|
12
|
+
<version>7.2.0</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.screencapture</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
<dependency>
|
|
29
29
|
<groupId>org.jetbrains.kotlin</groupId>
|
|
30
30
|
<artifactId>kotlin-stdlib-jdk7</artifactId>
|
|
31
|
-
<version>2.
|
|
31
|
+
<version>2.0.21</version>
|
|
32
32
|
<scope>runtime</scope>
|
|
33
33
|
</dependency>
|
|
34
34
|
<dependency>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ad104865292b12c34ba04dfcd24e8c4b
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
58720a7b376c11cbd1f25220c45345683330236e
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
6e1e7ac4258dd4fce62db26f41a1ec3aac14c50fc81ecf77fcff8bcd8cf09c7f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dcdb1b3595d48386b5c75a6f5190d9e6df246e0ab5bb3421f03fd53e507d1c0bf91aa108fc4a38483d2b8a472cac687f4a9ea6960d4ec0ecac041e1b60899235
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>host.exp.exponent</groupId>
|
|
4
4
|
<artifactId>expo.modules.screencapture</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>7.2.0
|
|
7
|
-
<release>7.2.0
|
|
6
|
+
<latest>7.2.0</latest>
|
|
7
|
+
<release>7.2.0</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>7.2.0
|
|
9
|
+
<version>7.2.0</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20250723214424</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/maven-metadata.xml.md5
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
fd0eb2a064d603d0a6a22df9d654b549
|
package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/maven-metadata.xml.sha1
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
a62b47362da90d7f1104046785b26a1f4b438a82
|
package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/maven-metadata.xml.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
72e99e6db793eafbc5cde6f85f9dfd0277fb07d342b1bdb85ea0db57ffdc8ccc
|
package/local-maven-repo/host/exp/exponent/expo.modules.screencapture/maven-metadata.xml.sha512
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
cf618eb945609a190d48540b8441f561bbfa31c5017c23c5ace91ef3ede4f369a5529b818d459df6e62276dac5c793366580662e95df31ce3178a01d821cee0a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-screen-capture",
|
|
3
|
-
"version": "7.2.0
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "Protects screens in your app from being captured or recorded, and notifies if a screenshot is taken.",
|
|
5
5
|
"main": "build/ScreenCapture.js",
|
|
6
6
|
"types": "build/ScreenCapture.d.ts",
|
|
@@ -35,10 +35,11 @@
|
|
|
35
35
|
"dependencies": {},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@testing-library/react-native": "^13.1.0",
|
|
38
|
-
"expo-module-scripts": "4.1.
|
|
38
|
+
"expo-module-scripts": "^4.1.9"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"expo": "
|
|
41
|
+
"expo": "*",
|
|
42
42
|
"react": "*"
|
|
43
|
-
}
|
|
43
|
+
},
|
|
44
|
+
"gitHead": "365807cb7fa8c0fc7a3f77c1b7bca47cd8dabc55"
|
|
44
45
|
}
|
package/src/ScreenCapture.ts
CHANGED
|
@@ -93,13 +93,50 @@ export function usePreventScreenCapture(key: string = 'default'): void {
|
|
|
93
93
|
|
|
94
94
|
// @needsAudit
|
|
95
95
|
/**
|
|
96
|
-
*
|
|
96
|
+
* Enables a privacy protection blur overlay that hides sensitive content when the app is not in focus.
|
|
97
|
+
* The overlay applies a customizable blur effect when the app is in the app switcher, background, or during interruptions
|
|
98
|
+
* (calls, Siri, Control Center, etc.), and automatically removes it when the app becomes active again.
|
|
99
|
+
*
|
|
100
|
+
* This provides visual privacy protection by preventing sensitive app content from being visible in:
|
|
101
|
+
* - App switcher previews
|
|
102
|
+
* - Background app snapshots
|
|
103
|
+
* - Screenshots taken during inactive states
|
|
104
|
+
*
|
|
105
|
+
* For Android, app switcher protection is automatically provided by `preventScreenCaptureAsync()`
|
|
106
|
+
* using the FLAG_SECURE window flag, which shows a blank screen in the recent apps preview.
|
|
97
107
|
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
|
|
108
|
+
* @param blurIntensity The intensity of the blur effect, from 0.0 (no blur) to 1.0 (maximum blur). Default is 0.5.
|
|
109
|
+
*
|
|
110
|
+
* @platform ios
|
|
111
|
+
*
|
|
112
|
+
*/
|
|
113
|
+
export async function enableAppSwitcherProtectionAsync(blurIntensity: number = 0.5): Promise<void> {
|
|
114
|
+
if (!ExpoScreenCapture.enableAppSwitcherProtection) {
|
|
115
|
+
throw new UnavailabilityError('ScreenCapture', 'enableAppSwitcherProtectionAsync');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
await ExpoScreenCapture.enableAppSwitcherProtection(blurIntensity);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// @needsAudit
|
|
122
|
+
/**
|
|
123
|
+
* Disables the privacy protection overlay that was previously enabled with `enableAppSwitcherProtectionAsync`.
|
|
124
|
+
*
|
|
125
|
+
* @platform ios
|
|
126
|
+
*/
|
|
127
|
+
export async function disableAppSwitcherProtectionAsync(): Promise<void> {
|
|
128
|
+
if (!ExpoScreenCapture.disableAppSwitcherProtection) {
|
|
129
|
+
throw new UnavailabilityError('ScreenCapture', 'disableAppSwitcherProtectionAsync');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
await ExpoScreenCapture.disableAppSwitcherProtection();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// @needsAudit
|
|
136
|
+
/**
|
|
137
|
+
* Adds a listener that will fire whenever the user takes a screenshot while the app is foregrounded.
|
|
138
|
+
* On Android, this method requires the `READ_EXTERNAL_STORAGE` permission. You can request this
|
|
139
|
+
* with [`MediaLibrary.requestPermissionsAsync()`](./media-library/#medialibraryrequestpermissionsasync).
|
|
103
140
|
*
|
|
104
141
|
* @param listener The function that will be executed when the user takes a screenshot.
|
|
105
142
|
* This function accepts no arguments.
|
|
@@ -133,25 +170,6 @@ export function removeScreenshotListener(subscription: EventSubscription) {
|
|
|
133
170
|
subscription.remove();
|
|
134
171
|
}
|
|
135
172
|
|
|
136
|
-
// @needsAudit
|
|
137
|
-
/**
|
|
138
|
-
* A React hook that listens for screenshots taken while the component is mounted.
|
|
139
|
-
*
|
|
140
|
-
* @param listener A function that will be called whenever a screenshot is detected.
|
|
141
|
-
*
|
|
142
|
-
* This hook automatically starts listening when the component mounts, and stops
|
|
143
|
-
* listening when the component unmounts.
|
|
144
|
-
*/
|
|
145
|
-
export function useScreenshotListener(listener: () => void) {
|
|
146
|
-
useEffect(() => {
|
|
147
|
-
const subscription = addScreenshotListener(listener);
|
|
148
|
-
|
|
149
|
-
return () => {
|
|
150
|
-
removeScreenshotListener(subscription);
|
|
151
|
-
};
|
|
152
|
-
}, [listener]);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
173
|
/**
|
|
156
174
|
* Checks user's permissions for detecting when a screenshot is taken.
|
|
157
175
|
* > Only Android requires additional permissions to detect screenshots. On iOS devices, this method will always resolve to a `granted` permission response.
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3a53f7e2c485ed09380013fe5be379c8
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
bff3c51739c45f8a9d1b2184ddfb30538a689344
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
8a9e3dca21a096209a62e8ce26c3733e57135f9d59a41eb237636ae81c744345
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
5d693f6a83cc09074f42ae55d49f7cccfc0c2e1f024e43d866c285e18f0e37648ff966eb7507567538355f6d9f1b6c7d51f6eb45456dbe191ad41f3ae896f930
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
d6ef02dcdfa773bd9f1b07282b22a6b9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
fcc85c23d4996b1dabaec2e9643a41ba3fa9047b
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
822de0fedd14d3706db056d1acd09084efe3c77a9d7d99cc4dea32613a984637
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ce8e03dbb6407252e26ccec35058eb73dead5ae9ea301b3837d17c90671391349b5f3ff9c8c6f36413c64fd0b0cedb23c2f4a1c3134d5e112e7a8bc945b19b03
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
13f76afce4482831eadf81b3efc77544
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2bbdf4344082088a1269402d5663f74b0d38b265
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
348fa91e5bab3d05683414b56f481fed004c703a75a8b0131727bf9b8d9862b4
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7f088ed6f809b6f9520bf1f6e3c4475a0f4b219e6555c58b0ade348378e51d86f2187a3373416757b07e80996da99eead3fa44d0f841d3a6c5f23bdcd530b944
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|