diff --git a/android/app/build.gradle b/android/app/build.gradle index 473b10c..65d3969 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -85,6 +85,10 @@ android { versionCode 1 versionName "1.0" } + + buildFeatures { + prefab true + } signingConfigs { debug { storeFile file('debug.keystore') diff --git a/babel.config.js b/babel.config.js index f7b3da3..b6e4e1b 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,6 @@ module.exports = { presets: ['module:@react-native/babel-preset'], + plugins: [ + 'react-native-worklets-core/plugin', + ], }; diff --git a/package-lock.json b/package-lock.json index d86595c..f9acbe2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "react-native-keychain": "^10.0.0", "react-native-safe-area-context": "^5.5.2", "react-native-vision-camera": "^4.7.3", + "react-native-worklets-core": "^1.1.0", "vision-camera-face-detector": "^0.1.8" }, "devDependencies": { @@ -10161,6 +10162,19 @@ } } }, + "node_modules/react-native-worklets-core": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/react-native-worklets-core/-/react-native-worklets-core-1.6.2.tgz", + "integrity": "sha512-zw73JfL40ZL/OD2TOil1El4D9ZwS3l6AFPeFfUWXh+V2/dHN8i28jHX8QXlz5DYtAkR+Ju3U1h4yiaODi/igZw==", + "license": "MIT", + "dependencies": { + "string-hash-64": "^1.0.3" + }, + "peerDependencies": { + "react": "*", + "react-native": "*" + } + }, "node_modules/react-native/node_modules/commander": { "version": "12.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", @@ -11046,6 +11060,12 @@ "safe-buffer": "~5.2.0" } }, + "node_modules/string-hash-64": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string-hash-64/-/string-hash-64-1.0.3.tgz", + "integrity": "sha512-D5OKWKvDhyVWWn2x5Y9b+37NUllks34q1dCDhk/vYcso9fmhs+Tl3KR/gE4v5UNj2UA35cnX4KdVVGkG1deKqw==", + "license": "MIT" + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", diff --git a/package.json b/package.json index 9e457e8..d99d84f 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "react-native-keychain": "^10.0.0", "react-native-safe-area-context": "^5.5.2", "react-native-vision-camera": "^4.7.3", + "react-native-worklets-core": "^1.6.2", "vision-camera-face-detector": "^0.1.8" }, "devDependencies": { diff --git a/src/screen/LockScreen.tsx b/src/screen/LockScreen.tsx index 3be0454..de57e8c 100644 --- a/src/screen/LockScreen.tsx +++ b/src/screen/LockScreen.tsx @@ -6,8 +6,8 @@ import { TextInput, Alert, } from 'react-native'; -import { verifyPin } from '../auth/AppPinService'; -import { unlockWithDevice, unlockApp } from '../auth/AuthManager'; +import { verifyPin } from './authorised/AppPinService'; +import { unlockWithDevice, unlockApp } from './authorised/AuthManager'; const LockScreen = ({ onUnlock }: any) => { const [pin, setPin] = useState(''); diff --git a/src/screen/Managelock.tsx b/src/screen/Managelock.tsx index 91a70ce..dff1b80 100644 --- a/src/screen/Managelock.tsx +++ b/src/screen/Managelock.tsx @@ -1,5 +1,9 @@ import React, { useEffect, useState } from 'react'; import { AppState, View, Text } from 'react-native'; +import { isPinSet } from './authorised/AppPinService'; +import { isAppLocked, lockApp } from './authorised/AuthManager'; +import SetPinScreen from './SetPinScreen'; +import LockScreen from './LockScreen'; const App = () => { const [locked, setLocked] = useState(true); diff --git a/src/screen/SetPinScreen.tsx b/src/screen/SetPinScreen.tsx index 18946ad..dae99c0 100644 --- a/src/screen/SetPinScreen.tsx +++ b/src/screen/SetPinScreen.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { View, TextInput, Text, TouchableOpacity } from 'react-native'; -import { savePin } from '../auth/AppPinService'; +import { savePin } from './authorised/AppPinService'; const SetPinScreen = ({ onDone }: any) => { const [pin, setPin] = useState(''); diff --git a/src/screen/authorised/AuthManager.ts b/src/screen/authorised/AuthManager.ts index d8adade..93af3e1 100644 --- a/src/screen/authorised/AuthManager.ts +++ b/src/screen/authorised/AuthManager.ts @@ -1,5 +1,5 @@ import AsyncStorage from '@react-native-async-storage/async-storage'; -import { deviceAuthenticate } from './DeviceAuth'; +import { authenticateWithDeviceLock } from './deviceAuth'; const LOCK_KEY = 'APP_LOCKED'; @@ -17,5 +17,5 @@ export const isAppLocked = async () => { }; export const unlockWithDevice = async () => { - return await deviceAuthenticate(); + return await authenticateWithDeviceLock(); };