Skip to content

Commit

Permalink
OTA Update: 1.1.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidHaji-zada committed Dec 13, 2023
2 parents b3835b0 + b82d025 commit d6cc94b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 27 deletions.
4 changes: 1 addition & 3 deletions src/hooks/usePasscodeEntryRevealer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { AirDAOEventType, RootNavigationProp } from '@appTypes';
import { useAppState } from './useAppState';
import usePasscode from '@contexts/Passcode';
import { Cache, CacheKey } from '@lib/cache';
import { DeviceUtils } from '@utils/device';
import { AirDAOEventDispatcher } from '@lib';

export const usePasscodeEntryRevealer = () => {
Expand All @@ -25,8 +24,7 @@ export const usePasscodeEntryRevealer = () => {
return;
}

// hack around old android devices
if (DeviceUtils.isAndroid && isBiometricAuthenticationInProgress) {
if (isBiometricAuthenticationInProgress) {
await Cache.setItem(CacheKey.isBiometricAuthenticationInProgress, false);
return;
}
Expand Down
37 changes: 14 additions & 23 deletions src/screens/PasscodeEntry/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { COLORS } from '@constants/colors';
import usePasscode from '@contexts/Passcode';
import { RootNavigationProp } from '@appTypes';
import { Cache, CacheKey } from '@lib/cache';
import { DeviceUtils } from '@utils/device';

export const PasscodeEntry = () => {
const isAuthSuccessfulRef = useRef(false);
Expand All @@ -28,7 +27,7 @@ export const PasscodeEntry = () => {
const { isFaceIDEnabled } = usePasscode();
const supportedBiometrics = useSupportedBiometrics();
const passcodeRef = useRef<TextInput>(null);
const { appState, prevState } = useAppState();
const { appState } = useAppState();
const automaticFaceIdCalled = useRef(false);

const closePasscodeEntry = useCallback(() => {
Expand All @@ -44,10 +43,7 @@ export const PasscodeEntry = () => {

const authenticateWithFaceID = useCallback(async () => {
automaticFaceIdCalled.current = true;
// This is a hack around older Android versions. They unmounts and remounts app after fingerprint prompt. By holding the value in cache, we can check if app comes from Biometric check
if (DeviceUtils.isAndroid) {
await Cache.setItem(CacheKey.isBiometricAuthenticationInProgress, true);
}
await Cache.setItem(CacheKey.isBiometricAuthenticationInProgress, true);
try {
const result = await LocalAuthentication.authenticateAsync({
promptMessage: t('security.authenticate.with.face.id'),
Expand All @@ -62,33 +58,28 @@ export const PasscodeEntry = () => {
} catch (error) {
// ignore
} finally {
if (DeviceUtils.isAndroid) {
await Cache.setItem(
CacheKey.isBiometricAuthenticationInProgress,
false
);
}
await Cache.setItem(CacheKey.isBiometricAuthenticationInProgress, false);
}
}, [closePasscodeEntry, t]);

useEffect(() => {
if (appState === 'active' && prevState !== 'inactive') {
if (isFaceIDEnabled) {
authenticateWithFaceID();
} else {
passcodeRef.current?.focus();
}
}
// if (automaticFaceIdCalled.current) {
// return;
// }
// if (appState === 'active') {
// if (appState === 'active' && prevState !== 'inactive') {
// if (isFaceIDEnabled) {
// authenticateWithFaceID();
// } else {
// passcodeRef.current?.focus();
// }
// }
if (automaticFaceIdCalled.current) {
return;
}
if (appState === 'active') {
if (isFaceIDEnabled) {
authenticateWithFaceID();
} else {
passcodeRef.current?.focus();
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [appState]);

Expand Down
2 changes: 1 addition & 1 deletion src/screens/Settings/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const SettingsScreen = () => {
<View style={styles.innerContainer}>
{SETTINGS_MENU_ITEMS.map(renderMenu)}
</View>
{isStage && <Text style={{ margin: 20 }}>Build: 1.1.0.12</Text>}
{isStage && <Text style={{ margin: 20 }}>Build: 1.1.0.13</Text>}
</View>
);
};

0 comments on commit d6cc94b

Please sign in to comment.