mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
mobile: don't lock app on showing app review
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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") {
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}));
|
||||
|
||||
7
apps/mobile/package-lock.json
generated
7
apps/mobile/package-lock.json
generated
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user