react-native-screen-blocker 1.0.6 → 1.0.8

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/README.md CHANGED
@@ -62,13 +62,13 @@ react-native link react-native-screen-blocker
62
62
  import { enableScreenBlock, disableScreenBlock } from 'react-native-screen-blocker';
63
63
  ```
64
64
 
65
- ### Enable SSL pinning
65
+ ### Enable Screen Block
66
66
  Call early in the app lifecycle.
67
67
  ```bash
68
68
  enableScreenBlock();
69
69
  ```
70
70
 
71
- ### Disable SSL pinning
71
+ ### Disable Screen Block
72
72
  ```bash
73
73
  disableScreenBlock();
74
74
  ```
@@ -23,9 +23,14 @@ public class ScreenBlockerModule extends ReactContextBaseJavaModule {
23
23
  public void enable() {
24
24
  Activity activity = getCurrentActivity();
25
25
  if (activity != null) {
26
- Window window = activity.getWindow();
27
- window.setFlags(WindowManager.LayoutParams.FLAG_SECURE,
28
- WindowManager.LayoutParams.FLAG_SECURE);
26
+ activity.runOnUiThread(new Runnable() {
27
+ @Override
28
+ public void run() {
29
+ Window window = activity.getWindow();
30
+ window.setFlags(WindowManager.LayoutParams.FLAG_SECURE,
31
+ WindowManager.LayoutParams.FLAG_SECURE);
32
+ }
33
+ });
29
34
  }
30
35
  }
31
36
 
@@ -33,8 +38,13 @@ public class ScreenBlockerModule extends ReactContextBaseJavaModule {
33
38
  public void disable() {
34
39
  Activity activity = getCurrentActivity();
35
40
  if (activity != null) {
36
- Window window = activity.getWindow();
37
- window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
41
+ activity.runOnUiThread(new Runnable() {
42
+ @Override
43
+ public void run() {
44
+ Window window = activity.getWindow();
45
+ window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
46
+ }
47
+ });
38
48
  }
39
49
  }
40
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-screen-blocker",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "React Native module to block screenshots and screen recording on Android and iOS",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -35,9 +35,7 @@
35
35
  "packageImportPath": "import com.screenblocker.ScreenBlockerPackage;",
36
36
  "packageInstance": "new ScreenBlockerPackage()"
37
37
  },
38
- "ios": {
39
- "podspecPath": "ios/react-native-screen-blocker.podspec"
40
- }
38
+ "ios": {}
41
39
  }
42
40
  }
43
41
  }
@@ -5,9 +5,7 @@ module.exports = {
5
5
  packageImportPath: 'import com.screenblocker.ScreenBlockerPackage;',
6
6
  packageInstance: 'new ScreenBlockerPackage()',
7
7
  },
8
- ios: {
9
- podspecPath: 'ios/react-native-screen-blocker.podspec',
10
- },
8
+ ios: {},
11
9
  },
12
10
  },
13
11
  };