Skip to content

Commit

Permalink
Merge pull request #33 from gbumps/hotfix/0.3.2
Browse files Browse the repository at this point in the history
Hotfix version 0.3.2
  • Loading branch information
gbumps committed Oct 28, 2023
2 parents 9e160fc + b54136b commit 36d8ef1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
21 changes: 14 additions & 7 deletions android/src/main/java/com/screenguard/ScreenGuardModule.java
Expand Up @@ -70,13 +70,16 @@ public void activateShield(String hexColor) {
if (mHandlerBlockScreenShot == null) {
mHandlerBlockScreenShot = new Handler(Looper.getMainLooper());
}
mHandlerBlockScreenShot.post(() -> Objects.requireNonNull(
getReactApplicationContext().getCurrentActivity()
).getWindow().setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
));

if (
getReactApplicationContext().getCurrentActivity() != null
) {
mHandlerBlockScreenShot.post(() -> Objects.requireNonNull(
getReactApplicationContext().getCurrentActivity()
).getWindow().setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
));
}
} catch (Exception e) {
e.printStackTrace();
}
Expand All @@ -98,10 +101,14 @@ public void activateWithoutShield() {
public void deactivateShield() {
try {
if (mHandlerBlockScreenShot != null) {
if (
getReactApplicationContext().getCurrentActivity() != null
) {
mHandlerBlockScreenShot.post(() -> Objects.requireNonNull(
getReactApplicationContext().getCurrentActivity()
).getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SECURE));
mHandlerBlockScreenShot = null;
}
}
} catch (Exception e) {
e.printStackTrace();
Expand Down
5 changes: 0 additions & 5 deletions ios/ScreenGuard.mm
@@ -1,5 +1,4 @@
#import "ScreenGuard.h"
#import <SDWebImage/SDWebImage.h>
#import <React/RCTRootView.h>

@implementation ScreenGuard
Expand Down Expand Up @@ -52,10 +51,6 @@ - (void) initTextField {
- (void)removeScreenShot {
UIWindow *window = [UIApplication sharedApplication].keyWindow;
if (textField != nil) {
// if (imageView != nil) {
// [imageView setImage: nil];
// [imageView removeFromSuperview];
// }
[textField setSecureTextEntry: FALSE];
[textField setBackgroundColor: [UIColor clearColor]];
[textField setBackground: nil];
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "react-native-screenguard",
"version": "0.3.0",
"version": "0.3.2",
"private": false,
"description": "A Native screenshot blocking library for React-Native developer, with background customizable after captured. Screenshot detector are also supported.",
"main": "index",
Expand Down

0 comments on commit 36d8ef1

Please sign in to comment.