Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5062b07934 |
@@ -3,6 +3,7 @@
|
||||
#import "React/RCTEventDispatcher.h"
|
||||
#import "Statusgo.h"
|
||||
#import "Utils.h"
|
||||
#import "UIHelper.h"
|
||||
|
||||
@implementation EncryptionUtils
|
||||
|
||||
@@ -101,6 +102,13 @@ RCT_EXPORT_METHOD(setBlankPreviewFlag:(BOOL *)newValue)
|
||||
[userDefaults setBool:newValue forKey:@"BLANK_PREVIEW"];
|
||||
|
||||
[userDefaults synchronize];
|
||||
|
||||
if (newValue) {
|
||||
[UIHelper addScreenshotBlock];
|
||||
} else {
|
||||
[UIHelper removeScreenshotBlock];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(hashTransaction:(NSString *)txArgsJSON
|
||||
|
||||
@@ -5,4 +5,7 @@
|
||||
|
||||
@interface UIHelper : NSObject <RCTBridgeModule>
|
||||
|
||||
+ (void)addScreenshotBlock;
|
||||
+ (void)removeScreenshotBlock;
|
||||
|
||||
@end
|
||||
|
||||
@@ -8,6 +8,9 @@ RCT_EXPORT_MODULE();
|
||||
|
||||
#pragma mark - only android methods
|
||||
|
||||
UITextField *textField;
|
||||
UIView *guardView;
|
||||
|
||||
RCT_EXPORT_METHOD(setSoftInputMode: (NSInteger) i) {
|
||||
#if DEBUG
|
||||
NSLog(@"setSoftInputMode() works only on Android");
|
||||
@@ -35,5 +38,75 @@ RCT_EXPORT_METHOD(clearStorageAPIs) {
|
||||
}
|
||||
}
|
||||
|
||||
+ (void) addScreenshotBlock {
|
||||
// create new secure text field and append to the window layer to prevent screenshot
|
||||
if (textField == nil) {
|
||||
UIWindow *window = [UIApplication sharedApplication].keyWindow;
|
||||
|
||||
textField = [[UITextField alloc] initWithFrame:window.frame];
|
||||
textField.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
|
||||
[textField setTextAlignment:NSTextAlignmentCenter];
|
||||
[textField setUserInteractionEnabled: NO];
|
||||
|
||||
[window makeKeyAndVisible];
|
||||
[window.layer.superlayer addSublayer:textField.layer];
|
||||
|
||||
if (textField.layer.sublayers.firstObject) {
|
||||
[textField.layer.sublayers.firstObject addSublayer: window.layer];
|
||||
}
|
||||
}
|
||||
[textField setSecureTextEntry: TRUE];
|
||||
[textField setBackgroundColor: [UIColor blackColor]];
|
||||
|
||||
// create event listener for screen captures and add a view to prevent the app content from exposed if recorded
|
||||
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
||||
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
|
||||
[center removeObserver:self
|
||||
name:UIScreenCapturedDidChangeNotification
|
||||
object:nil];
|
||||
[center addObserverForName:UIScreenCapturedDidChangeNotification
|
||||
object:nil
|
||||
queue:mainQueue
|
||||
usingBlock:^(NSNotification *notification) {
|
||||
if (UIScreen.mainScreen.captured){
|
||||
UIWindow *window = [UIApplication sharedApplication].keyWindow;
|
||||
if (guardView == nil) {
|
||||
guardView = [[UIView alloc]initWithFrame:window.frame];
|
||||
guardView.backgroundColor = [UIColor blackColor];
|
||||
guardView.alpha = 0;
|
||||
}
|
||||
|
||||
[window addSubview:guardView];
|
||||
[window bringSubviewToFront:guardView];
|
||||
[UIView animateWithDuration:0.5 animations:^{
|
||||
guardView.alpha = 1;
|
||||
}];
|
||||
} else {
|
||||
[UIView animateWithDuration:0.5 animations:^{
|
||||
guardView.alpha = 0;
|
||||
} completion:^(BOOL finished) {
|
||||
[guardView removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
+ (void) removeScreenshotBlock {
|
||||
UIWindow *window = [UIApplication sharedApplication].keyWindow;
|
||||
if (textField != nil) {
|
||||
[textField setSecureTextEntry: FALSE];
|
||||
[textField setBackgroundColor: [UIColor clearColor]];
|
||||
CALayer *textFieldLayer = textField.layer.sublayers.firstObject;
|
||||
if ([window.layer.superlayer.sublayers containsObject:textFieldLayer]) {
|
||||
[textFieldLayer removeFromSuperlayer];
|
||||
}
|
||||
}
|
||||
|
||||
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
||||
[center removeObserver:self
|
||||
name:UIScreenCapturedDidChangeNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -135,8 +135,7 @@
|
||||
(>= (- now app-in-background-since)
|
||||
constants/ms-in-bg-for-require-bioauth))]
|
||||
(rf/merge cofx
|
||||
{:db (dissoc db :app-in-background-since)
|
||||
:effects.biometric/get-supported-type nil}
|
||||
{:db (dissoc db :app-in-background-since)}
|
||||
(mailserver/process-next-messages-request)
|
||||
(when-not new-account?
|
||||
(universal-links/process-stored-event))
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
(defn get-label-by-type
|
||||
[biometric-type]
|
||||
(condp = biometric-type
|
||||
constants/biometrics-type-android (i18n/label :t/biometric-fingerprint)
|
||||
constants/biometrics-type-face-id (i18n/label :t/biometric-faceid)
|
||||
constants/biometrics-type-touch-id (i18n/label :t/biometric-touchid)
|
||||
(i18n/label :t/biometric)))
|
||||
constants/biometrics-type-android (i18n/label :t/biometric-fingerprint)
|
||||
constants/biometrics-type-face-id (i18n/label :t/biometric-faceid)
|
||||
(i18n/label :t/biometric-touchid)))
|
||||
|
||||
(defn get-icon-by-type
|
||||
[biometric-type]
|
||||
|
||||
@@ -70,7 +70,6 @@
|
||||
"bio-added": "Bio added",
|
||||
"bio-is-too-long": "Bio is too long",
|
||||
"bio-updated": "Bio updated",
|
||||
"biometric": "Biometric",
|
||||
"biometric-auth-android-sensor-desc": "Touch sensor",
|
||||
"biometric-auth-android-sensor-error-desc": "Failed",
|
||||
"biometric-auth-android-title": "Authentication Required",
|
||||
|
||||
Reference in New Issue
Block a user