Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions RCTPrivacySnapshot.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
DB1744391BC4C14D00D02B05 /* RCTPrivacySnapshot.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB1744381BC4C14D00D02B05 /* RCTPrivacySnapshot.h */; };
DB17443B1BC4C14D00D02B05 /* RCTPrivacySnapshot.m in Sources */ = {isa = PBXBuildFile; fileRef = DB17443A1BC4C14D00D02B05 /* RCTPrivacySnapshot.m */; };
DB1744621BC4CE7C00D02B05 /* UIImage+ImageEffects.m in Sources */ = {isa = PBXBuildFile; fileRef = DB1744611BC4CE7C00D02B05 /* UIImage+ImageEffects.m */; settings = {ASSET_TAGS = (); }; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -29,8 +28,6 @@
DB1744351BC4C14D00D02B05 /* libRCTPrivacySnapshot.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTPrivacySnapshot.a; sourceTree = BUILT_PRODUCTS_DIR; };
DB1744381BC4C14D00D02B05 /* RCTPrivacySnapshot.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTPrivacySnapshot.h; sourceTree = "<group>"; };
DB17443A1BC4C14D00D02B05 /* RCTPrivacySnapshot.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTPrivacySnapshot.m; sourceTree = "<group>"; };
DB1744601BC4CE7C00D02B05 /* UIImage+ImageEffects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+ImageEffects.h"; sourceTree = "<group>"; };
DB1744611BC4CE7C00D02B05 /* UIImage+ImageEffects.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+ImageEffects.m"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -65,8 +62,6 @@
children = (
DB1744381BC4C14D00D02B05 /* RCTPrivacySnapshot.h */,
DB17443A1BC4C14D00D02B05 /* RCTPrivacySnapshot.m */,
DB1744601BC4CE7C00D02B05 /* UIImage+ImageEffects.h */,
DB1744611BC4CE7C00D02B05 /* UIImage+ImageEffects.m */,
);
path = RCTPrivacySnapshot;
sourceTree = "<group>";
Expand Down Expand Up @@ -127,7 +122,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DB1744621BC4CE7C00D02B05 /* UIImage+ImageEffects.m in Sources */,
DB17443B1BC4C14D00D02B05 /* RCTPrivacySnapshot.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
25 changes: 12 additions & 13 deletions RCTPrivacySnapshot/RCTPrivacySnapshot.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
//

#import "RCTPrivacySnapshot.h"
#import "UIImage+ImageEffects.h"

@implementation RCTPrivacySnapshot {
BOOL enabled;
UIImageView *obfuscatingView;
UIVisualEffectView *obfuscatingView;
}

RCT_EXPORT_MODULE();
Expand All @@ -36,17 +35,13 @@ - (instancetype)init {

- (void)handleAppStateResignActive {
if (self->enabled) {
UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
UIImageView *blurredScreenImageView = [[UIImageView alloc] initWithFrame:keyWindow.bounds];

UIGraphicsBeginImageContext(keyWindow.bounds.size);
[keyWindow drawViewHierarchyInRect:keyWindow.frame afterScreenUpdates:NO];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

blurredScreenImageView.image = [viewImage applyLightEffect];

self->obfuscatingView = blurredScreenImageView;

UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;

UIVisualEffectView *view = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
view.frame = keyWindow.bounds;
self->obfuscatingView = view;

[[UIApplication sharedApplication].keyWindow addSubview:self->obfuscatingView];

}
Expand All @@ -72,4 +67,8 @@ - (void)handleAppStateActive {
self->enabled = _enable;
}

+ (BOOL)requiresMainQueueSetup {
return YES;
}

@end
112 changes: 0 additions & 112 deletions RCTPrivacySnapshot/UIImage+ImageEffects.h

This file was deleted.

Loading