Skip to content
Merged
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
13 changes: 13 additions & 0 deletions android/app/src/main/java/co/edgesecure/app/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package co.edgesecure.app

import android.content.pm.ActivityInfo
import android.os.Build
import android.os.Bundle
import android.view.WindowManager
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
Expand Down Expand Up @@ -34,6 +36,17 @@ class MainActivity : ReactActivity() {
// Do not pass the saved state, as required by react-native-screens:
super.onCreate(null)

// Hide app contents in the background:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
setRecentsScreenshotEnabled(false);
} else {
getWindow()
.setFlags(
WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE
) ;
}

// Lock the app to portrait mode:
if (resources.getBoolean(R.bool.portrait_only)) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
Expand Down
35 changes: 34 additions & 1 deletion ios/edge/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
#import <sys/errno.h>
#import <UserNotifications/UserNotifications.h>

@implementation AppDelegate
@implementation AppDelegate {
// Edge addition:
UIView *securityView;
}

// From https://reactnative.dev/docs/0.71/linking#enabling-deep-links
- (BOOL)application:(UIApplication *)application
Expand Down Expand Up @@ -148,4 +151,34 @@ - (void)application:(UIApplication *)application
}];
}

/**
* Hides the app when we go into the background.
* Edge addition.
*/
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"LaunchScreen" bundle:nil];
UIViewController *launchScreen = [storyboard instantiateInitialViewController];
if (launchScreen == nil) return;
UIView *launchView = launchScreen.view;
if (launchView == nil) return;

launchView.frame = self.window.bounds;
[self.window addSubview:launchView];
[self.window makeKeyAndVisible];
securityView = launchView;
}

/**
* Shows the app when we come into the foreground.
* Edge addition.
*/
- (void)applicationWillEnterForeground:(UIApplication *)application
{
if (securityView != nil) {
[securityView removeFromSuperview];
securityView = nil;
}
}

@end