mobile: don't lock app on showing app review

This commit is contained in:
ammarahm-ed
2023-05-23 08:06:33 +05:00
committed by Ammar Ahmed
parent 874c892986
commit 748953b3eb
5 changed files with 20 additions and 7 deletions

View File

@@ -218,7 +218,8 @@ const Launcher = React.memo(
}, [init, verifyUser]);
useEffect(() => {
if (verifying.current) return;
if (verifying.current || useUserStore.getState().shouldBlockVerifyUser)
return;
if (verifyUser && appState === "active") {
verifying.current = true;
onUnlockBiometrics();

View File

@@ -489,7 +489,8 @@ export const useAppEvents = () => {
if (
SettingsService.get().appLockMode === "background" &&
!useSettingStore.getState().requestBiometrics &&
!useUserStore.getState().verifyUser
!useUserStore.getState().verifyUser &&
!useUserStore.getState().shouldBlockVerifyUser
) {
useUserStore.getState().setVerifyUser(true);
if (Platform.OS === "ios") {

View File

@@ -20,6 +20,7 @@ import InAppReview from "react-native-in-app-review";
import { DatabaseLogger } from "../common/database";
import { MMKV } from "../common/database/mmkv";
import Config from "react-native-config";
import { useUserStore } from "../stores/use-user-store";
const day_ms = 86400000;
export function requestInAppReview() {
@@ -32,6 +33,8 @@ export function requestInAppReview() {
}
if (InAppReview.isAvailable()) {
useUserStore.getState().setShouldBlockVerifyUser(true);
InAppReview.RequestInAppReview()
.then(() => {})
.catch((error) => {

View File

@@ -37,6 +37,8 @@ export interface UserStore extends State {
setLastSynced: (lastSynced: string) => void;
verifyUser: boolean;
setVerifyUser: (verified: boolean) => void;
shouldBlockVerifyUser: boolean;
setShouldBlockVerifyUser: (shouldBlockVerifyUser: boolean) => void;
}
export const useUserStore = create<UserStore>((set) => ({
@@ -52,5 +54,12 @@ export const useUserStore = create<UserStore>((set) => ({
},
setLastSynced: (lastSynced) => set({ lastSynced: lastSynced }),
setVerifyUser: (verified) => set({ verifyUser: verified }),
lastSyncStatus: SyncStatus.Never
lastSyncStatus: SyncStatus.Never,
shouldBlockVerifyUser: false,
setShouldBlockVerifyUser: (shouldBlockVerifyUser) => {
set({ shouldBlockVerifyUser });
setTimeout(() => {
set({ shouldBlockVerifyUser: false });
}, 1000);
}
}));

View File

@@ -1,12 +1,12 @@
{
"name": "@notesnook/mobile",
"version": "2.4.16",
"version": "2.4.17",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@notesnook/mobile",
"version": "2.4.16",
"version": "2.4.17",
"license": "GPL-3.0-or-later",
"workspaces": [
"native/",
@@ -14,8 +14,7 @@
],
"dependencies": {
"react": "18.0.0",
"react-native": "0.69.7",
"react-native-in-app-review": "4.3.3"
"react-native": "0.69.7"
},
"devDependencies": {
"otplib": "12.0.1",