expo-app-blocker 0.1.49 → 0.1.50

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-app-blocker",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
4
4
  "description": "Expo module for cross-platform app blocking. Android: UsageStatsManager + Overlay. iOS: Screen Time API (FamilyControls + ManagedSettings + DeviceActivity).",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -14,6 +14,32 @@ const {
14
14
  const fs = require("fs");
15
15
  const path = require("path");
16
16
 
17
+ // ──────────────────────────────────────────────────────────────────────────────
18
+ // Privacy manifest helper
19
+ // ──────────────────────────────────────────────────────────────────────────────
20
+
21
+ // Merges expo-app-blocker's required UserDefaults entry into config.ios.privacyManifests
22
+ // so Expo's built-in withPrivacyInfo plugin writes it to PrivacyInfo.xcprivacy on prebuild.
23
+ // Required for App Store submission: the blocker uses UserDefaults extensively for
24
+ // AppGroup state sharing between the main app and Shield/DeviceActivityMonitor extensions.
25
+ function mergeBlockerPrivacyManifest(config) {
26
+ const ios = config.ios ?? {};
27
+ const privacyManifests = ios.privacyManifests ?? {};
28
+ const apiTypes = [...(privacyManifests.NSPrivacyAccessedAPITypes ?? [])];
29
+ const TYPE = "NSPrivacyAccessedAPICategoryUserDefaults";
30
+ const REASON = "CA92.1";
31
+ const existing = apiTypes.find((t) => t.NSPrivacyAccessedAPIType === TYPE);
32
+ if (!existing) {
33
+ apiTypes.push({ NSPrivacyAccessedAPIType: TYPE, NSPrivacyAccessedAPITypeReasons: [REASON] });
34
+ } else if (!existing.NSPrivacyAccessedAPITypeReasons.includes(REASON)) {
35
+ existing.NSPrivacyAccessedAPITypeReasons = [...existing.NSPrivacyAccessedAPITypeReasons, REASON];
36
+ }
37
+ return {
38
+ ...config,
39
+ ios: { ...ios, privacyManifests: { ...privacyManifests, NSPrivacyAccessedAPITypes: apiTypes } },
40
+ };
41
+ }
42
+
17
43
  // ──────────────────────────────────────────────────────────────────────────────
18
44
  // Android
19
45
  // ──────────────────────────────────────────────────────────────────────────────
@@ -185,6 +211,8 @@ function withAppBlockerAndroid(config, pluginConfig) {
185
211
  // ──────────────────────────────────────────────────────────────────────────────
186
212
 
187
213
  function withAppBlockerIOS(config, pluginConfig) {
214
+ config = mergeBlockerPrivacyManifest(config);
215
+
188
216
  const bundleId = config.ios?.bundleIdentifier || "expo.app-blocker";
189
217
  const appGroup = pluginConfig?.ios?.appGroup || `group.${bundleId}`;
190
218