mobile: fix selecting image from gallery when applock is on

This commit is contained in:
Ammar Ahmed
2025-01-15 12:22:30 +05:00
parent 77a2f86119
commit 5cd9d48bef
2 changed files with 15 additions and 1 deletions

View File

@@ -100,7 +100,10 @@ const SheetWrapper = ({
useEffect(() => {
if (useUserStore.getState().disableAppLockRequests) return;
if (SettingsService.canLockAppInBackground()) {
if (
SettingsService.canLockAppInBackground() &&
SettingsService.shouldLockAppOnEnterForeground()
) {
if (appState === "background") {
const ref = fwdRef || localRef;
ref?.current?.hide();

View File

@@ -43,6 +43,8 @@ import { eCloseSheet } from "../../../utils/events";
import { useTabStore } from "./use-tab-store";
import { editorController, editorState } from "./utils";
import { strings } from "@notesnook/intl";
import { useUserStore } from "../../../stores/use-user-store";
import { sleep } from "../../../utils/time";
const showEncryptionSheet = (file: DocumentPickerResponse) => {
presentSheet({
@@ -241,6 +243,13 @@ const gallery = async (options: PickerOptions) => {
const pick = async (options: PickerOptions) => {
if (!PremiumService.get()) {
const user = await db.user.getUser();
if (!user) {
ToastManager.show({
heading: strings.loginRequired(),
type: "error"
});
return;
}
if (editorState().isFocused) {
editorState().isFocused = true;
}
@@ -251,6 +260,7 @@ const pick = async (options: PickerOptions) => {
}
return;
}
useUserStore.getState().setDisableAppLockRequests(true);
if (options?.type.startsWith("image") || options?.type === "camera") {
if (options.type.startsWith("image")) {
gallery(options);
@@ -267,6 +277,7 @@ const handleImageResponse = async (
options: PickerOptions
) => {
const result = await AttachImage.present(response, options.context);
if (!result) return;
const compress = result.compress;