feature: hide privacy snapshot when app loses focus

This commit is contained in:
Radek Czemerys
2020-07-23 11:20:58 +02:00
parent 6ee761dbec
commit 9ffaf318eb
5 changed files with 19 additions and 0 deletions

View File

@@ -323,6 +323,8 @@ PODS:
- React
- RNKeychain (4.0.5):
- React
- RNPrivacySnapshot (1.0.0):
- React
- RNReanimated (1.9.0):
- React
- RNScreens (2.9.0):
@@ -389,6 +391,7 @@ DEPENDENCIES:
- RNFS (from `../node_modules/react-native-fs`)
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNKeychain (from `../node_modules/react-native-keychain`)
- RNPrivacySnapshot (from `../node_modules/react-native-privacy-snapshot`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
- RNSearchBar (from `../node_modules/react-native-search-bar`)
@@ -492,6 +495,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-gesture-handler"
RNKeychain:
:path: "../node_modules/react-native-keychain"
RNPrivacySnapshot:
:path: "../node_modules/react-native-privacy-snapshot"
RNReanimated:
:path: "../node_modules/react-native-reanimated"
RNScreens:
@@ -559,6 +564,7 @@ SPEC CHECKSUMS:
RNFS: 2bd9eb49dc82fa9676382f0585b992c424cd59df
RNGestureHandler: 8f09cd560f8d533eb36da5a6c5a843af9f056b38
RNKeychain: 840f8e6f13be0576202aefcdffd26a4f54bfe7b5
RNPrivacySnapshot: 71919dde3c6a29dd332115409c2aec564afee8f4
RNReanimated: b5ccb50650ba06f6e749c7c329a1bc3ae0c88b43
RNScreens: c526239bbe0e957b988dacc8d75ac94ec9cb19da
RNSearchBar: 9860431356b7d12a8449d2fddb2b5f3c78d1e99f

View File

@@ -40,6 +40,7 @@
"react-native-gesture-handler": "^1.6.1",
"react-native-keychain": "^4.0.5",
"react-native-mail": "standardnotes/react-native-mail#9862c76",
"react-native-privacy-snapshot": "rhdeck/react-native-privacy-snapshot#529e462",
"react-native-reanimated": "^1.9.0",
"react-native-safe-area-context": "^3.1.1",
"react-native-screens": "^2.9.0",

View File

@@ -7,6 +7,7 @@ import {
NativeModules,
Platform,
} from 'react-native';
import { hide, show } from 'react-native-privacy-snapshot';
import {
ApplicationEvent,
ApplicationService,
@@ -473,6 +474,7 @@ export class ApplicationState extends ApplicationService {
}
if (isResumingFromBackground || isResuming) {
hide(); // hide privacy lock over the app (iOS only)
if (isResumingFromBackground) {
this.notifyOfStateChange(AppStateType.ResumingFromBackground);
}
@@ -482,6 +484,7 @@ export class ApplicationState extends ApplicationService {
}
if (isLosingFocus) {
show(); // show privacy lock over the app (iOS only)
this.notifyOfStateChange(AppStateType.LosingFocus);
// If a privileges authentication session is in progress, we don't want to lock the application

View File

@@ -0,0 +1,5 @@
declare module 'react-native-privacy-snapshot' {
export function show(): void;
export function hide(): void;
export function enabled(enabledFlag: boolean): void;
}

View File

@@ -6205,6 +6205,10 @@ react-native-platform-touchable@^1.1.1:
resolved "https://registry.yarnpkg.com/react-native-platform-touchable/-/react-native-platform-touchable-1.1.1.tgz#fde4acc65eea585d28b164d0c3716a42129a68e4"
integrity sha1-/eSsxl7qWF0osWTQw3FqQhKaaOQ=
react-native-privacy-snapshot@rhdeck/react-native-privacy-snapshot#529e462:
version "1.0.0"
resolved "https://codeload.github.com/rhdeck/react-native-privacy-snapshot/tar.gz/529e4627d93f67752a27e82a040ff7b64dca0783"
react-native-reanimated@^1.9.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-1.9.0.tgz#38676c99dd585504fdc7331efb45e5f48ec7339a"