File tree Expand file tree Collapse file tree 2 files changed +47
-1
lines changed
android/app/src/main/java/co/edgesecure/app Expand file tree Collapse file tree 2 files changed +47
-1
lines changed Original file line number Diff line number Diff line change 11package co.edgesecure.app
22
33import android.content.pm.ActivityInfo
4+ import android.os.Build
45import android.os.Bundle
6+ import android.view.WindowManager
57import com.facebook.react.ReactActivity
68import com.facebook.react.ReactActivityDelegate
79import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
@@ -34,6 +36,17 @@ class MainActivity : ReactActivity() {
3436 // Do not pass the saved state, as required by react-native-screens:
3537 super .onCreate(null )
3638
39+ // Hide app contents in the background:
40+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .TIRAMISU ) {
41+ setRecentsScreenshotEnabled(false );
42+ } else {
43+ getWindow()
44+ .setFlags(
45+ WindowManager .LayoutParams .FLAG_SECURE ,
46+ WindowManager .LayoutParams .FLAG_SECURE
47+ ) ;
48+ }
49+
3750 // Lock the app to portrait mode:
3851 if (resources.getBoolean(R .bool.portrait_only)) {
3952 requestedOrientation = ActivityInfo .SCREEN_ORIENTATION_PORTRAIT
Original file line number Diff line number Diff line change 1616#import < sys/errno.h>
1717#import < UserNotifications/UserNotifications.h>
1818
19- @implementation AppDelegate
19+ @implementation AppDelegate {
20+ // Edge addition:
21+ UIView *securityView;
22+ }
2023
2124// From https://reactnative.dev/docs/0.71/linking#enabling-deep-links
2225- (BOOL )application : (UIApplication *)application
@@ -148,4 +151,34 @@ - (void)application:(UIApplication *)application
148151 }];
149152}
150153
154+ /* *
155+ * Hides the app when we go into the background.
156+ * Edge addition.
157+ */
158+ - (void )applicationDidEnterBackground : (UIApplication *)application
159+ {
160+ UIStoryboard *storyboard = [UIStoryboard storyboardWithName: @" LaunchScreen" bundle: nil ];
161+ UIViewController *launchScreen = [storyboard instantiateInitialViewController ];
162+ if (launchScreen == nil ) return ;
163+ UIView *launchView = launchScreen.view ;
164+ if (launchView == nil ) return ;
165+
166+ launchView.frame = self.window .bounds ;
167+ [self .window addSubview: launchView];
168+ [self .window makeKeyAndVisible ];
169+ securityView = launchView;
170+ }
171+
172+ /* *
173+ * Shows the app when we come into the foreground.
174+ * Edge addition.
175+ */
176+ - (void )applicationWillEnterForeground : (UIApplication *)application
177+ {
178+ if (securityView != nil ) {
179+ [securityView removeFromSuperview ];
180+ securityView = nil ;
181+ }
182+ }
183+
151184@end
You can’t perform that action at this time.
0 commit comments