Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: minor fixes

Ammar Ahmed58c324b2ac6d
diff --git a/apps/mobile/app/components/app-lock-overlay/index.tsx b/apps/mobile/app/components/app-lock-overlay/index.tsx
index a08b2089b..a6f04c28b 100644
--- a/apps/mobile/app/components/app-lock-overlay/index.tsx
+++ b/apps/mobile/app/components/app-lock-overlay/index.tsx
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import React, { useCallback, useEffect, useRef } from "react";
-import { Platform, TextInput, View } from "react-native";
+import { AppStateStatus, Platform, TextInput, View } from "react-native";
//@ts-ignore
import { useThemeColors } from "@notesnook/theme";
import { enabled } from "react-native-privacy-snapshot";
@@ -45,7 +45,6 @@ import Input from "../ui/input";
import Seperator from "../ui/seperator";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
-import { ToastManager } from "../../services/event-manager";
const getUser = () => {
const user = MMKV.getString("user");
@@ -75,6 +74,7 @@ const verifyUserPassword = async (password: string) => {
};
const AppLockedOverlay = () => {
+ const initialLaunchBiometricRequest = useRef(true);
const { colors } = useThemeColors();
const user = getUser();
const appLocked = useUserStore((state) => state.appLocked);
@@ -83,6 +83,7 @@ const AppLockedOverlay = () => {
const passwordInputRef = useRef<TextInput>(null);
const password = useRef<string>();
const appState = useAppState();
+ const lastAppState = useRef<AppStateStatus>(appState);
const biometricUnlockAwaitingUserInput = useRef(false);
const keyboardType = useSettingStore(
(state) => state.settings.applockKeyboardType
@@ -134,7 +135,6 @@ const AppLockedOverlay = () => {
const unlocked = appLockHasPasswordSecurity
? await validateAppLockPassword(password.current)
: await verifyUserPassword(password.current);
- console.log(unlocked);
if (unlocked) {
if (!appLockHasPasswordSecurity) {
await setAppLockVerificationCipher(password.current);
@@ -155,18 +155,46 @@ const AppLockedOverlay = () => {
};
useEffect(() => {
+ if (appState === "active") {
+ enabled(false);
+ }
+
+ const prevState = lastAppState.current;
+ lastAppState.current = appState;
+
if (
- biometricUnlockAwaitingUserInput.current ||
- useUserStore.getState().disableAppLockRequests
- )
- return;
- if (
- appLocked &&
appState === "active" &&
- !useSettingStore.getState().requestBiometrics
+ (prevState === "background" || initialLaunchBiometricRequest.current)
) {
- biometricUnlockAwaitingUserInput.current = true;
- onUnlockAppRequested();
+ if (SettingsService.shouldLockAppOnEnterForeground()) {
+ DatabaseLogger.info("Locking app on entering foreground");
+ useUserStore.getState().lockApp(true);
+ }
+
+ if (
+ !(
+ biometricUnlockAwaitingUserInput.current ||
+ useUserStore.getState().disableAppLockRequests ||
+ !appLocked ||
+ useSettingStore.getState().requestBiometrics ||
+ useSettingStore.getState().appDidEnterBackgroundForAction
+ )
+ ) {
+ initialLaunchBiometricRequest.current = false;
+ DatabaseLogger.info("Biometric unlock request");
+ onUnlockAppRequested();
+ }
+
+ enabled(false);
+ } else {
+ SettingsService.appEnteredBackground();
+
+ if (
+ SettingsService.get().privacyScreen ||
+ SettingsService.getProperty("appLockEnabled")
+ ) {
+ enabled(true);
+ }
}
}, [appState, onUnlockAppRequested, appLocked]);
diff --git a/apps/mobile/app/components/list-items/headers/notebook-header.tsx b/apps/mobile/app/components/list-items/headers/notebook-header.tsx
index 134c10af8..5ffa750a3 100644
--- a/apps/mobile/app/components/list-items/headers/notebook-header.tsx
+++ b/apps/mobile/app/components/list-items/headers/notebook-header.tsx
@@ -148,10 +148,6 @@ export const NotebookHeader = ({
size={SIZE.xs}
color={colors.secondary.paragraph}
>
- {/* {notebook.topics.length === 1
- ? "1 topic"
- : `${notebook.topics.length} topics`}
- ,{" "} */}
{notebook && totalNotes > 1
? totalNotes + " notes"
: totalNotes === 1
diff --git a/apps/mobile/app/components/premium/features.js b/apps/mobile/app/components/premium/features.js
index 649125f6b..bd231d9f4 100644
--- a/apps/mobile/app/components/premium/features.js
+++ b/apps/mobile/app/components/premium/features.js
@@ -162,7 +162,7 @@ export const features = [
platform: "android"
}
],
- info: "* Free users are limited to keeping 3 notebooks (no limit on topics) and 5 tags."
+ info: "* Free users are limited to keeping 3 notebooks and 5 tags."
},
{
diff --git a/apps/mobile/app/components/properties/index.js b/apps/mobile/app/components/properties/index.js
index 9efa255b8..1382cee31 100644
--- a/apps/mobile/app/components/properties/index.js
+++ b/apps/mobile/app/components/properties/index.js
@@ -242,7 +242,6 @@ Properties.present = async (item, buttons = [], isSheet) => {
"attachments",
"lock-unlock",
"trash",
- "remove-from-topic",
"remove-from-notebook",
"history",
"read-only",
@@ -264,7 +263,8 @@ Properties.present = async (item, buttons = [], isSheet) => {
"trash",
"default-notebook",
"add-notebook",
- "move-notes"
+ "move-notes",
+ "move-notebook"
]);
break;
case "tag":
diff --git a/apps/mobile/app/components/selection-header/index.tsx b/apps/mobile/app/components/selection-header/index.tsx
index 197407a76..94b015fee 100644
--- a/apps/mobile/app/components/selection-header/index.tsx
+++ b/apps/mobile/app/components/selection-header/index.tsx
@@ -44,6 +44,7 @@ import ExportNotesSheet from "../sheets/export-notes";
import ManageTagsSheet from "../sheets/manage-tags";
import { IconButton } from "../ui/icon-button";
import Heading from "../ui/typography/heading";
+import { MoveNotebookSheet } from "../sheets/move-notebook";
export const SelectionHeader = React.memo(
({
@@ -213,6 +214,23 @@ export const SelectionHeader = React.memo(
size={SIZE.xl}
/>
+ {renderedInRoute === "Notebooks" ? (
+ <IconButton
+ style={{
+ marginLeft: 10
+ }}
+ onPress={async () => {
+ const ids = selectedItemsList;
+ const notebooks = await db.notebooks.all.items(ids);
+ MoveNotebookSheet.present(notebooks);
+ }}
+ tooltipText="Move notebooks"
+ tooltipPosition={1}
+ name="arrow-right-bold-box-outline"
+ size={SIZE.xl}
+ />
+ ) : null}
+
{type !== "note" ? null : (
<>
<IconButton
diff --git a/apps/mobile/app/components/sheets/add-to/index.tsx b/apps/mobile/app/components/sheets/add-to/index.tsx
index 935dd1cc1..165a4e67b 100644
--- a/apps/mobile/app/components/sheets/add-to/index.tsx
+++ b/apps/mobile/app/components/sheets/add-to/index.tsx
@@ -186,7 +186,7 @@ const MoveNoteSheet = ({
paragraph={
!multiSelect
? "Long press to enable multi-select."
- : "Select topics you want to add note(s) to."
+ : "Select notebooks you want to add note(s) to."
}
/>
diff --git a/apps/mobile/app/components/sheets/move-notebook/index.tsx b/apps/mobile/app/components/sheets/move-notebook/index.tsx
new file mode 100644
index 000000000..b7051db30
--- /dev/null
+++ b/apps/mobile/app/components/sheets/move-notebook/index.tsx
@@ -0,0 +1,344 @@
+/*
+This file is part of the Notesnook project (https://notesnook.com/)
+
+Copyright (C) 2023 Streetwriters (Private) Limited
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+import { Notebook, VirtualizedGrouping } from "@notesnook/core";
+import { useThemeColors } from "@notesnook/theme";
+import React, { useCallback } from "react";
+import { Text, View } from "react-native";
+import { FlatList } from "react-native-actions-sheet";
+import create from "zustand";
+import { db } from "../../../common/database";
+import { useNotebook } from "../../../hooks/use-notebook";
+import { eSendEvent, presentSheet } from "../../../services/event-manager";
+import {
+ useNotebookStore,
+ useNotebooks
+} from "../../../stores/use-notebook-store";
+import { eOnNotebookUpdated } from "../../../utils/events";
+import {
+ findRootNotebookId,
+ getParentNotebookId
+} from "../../../utils/notebooks";
+import { SIZE } from "../../../utils/size";
+import { Dialog } from "../../dialog";
+import DialogHeader from "../../dialog/dialog-header";
+import { presentDialog } from "../../dialog/functions";
+import SheetProvider from "../../sheet-provider";
+import { Button } from "../../ui/button";
+import { IconButton } from "../../ui/icon-button";
+import { Pressable } from "../../ui/pressable";
+import Seperator from "../../ui/seperator";
+import Paragraph from "../../ui/typography/paragraph";
+import { AddNotebookSheet } from "../add-notebook";
+
+const useNotebookExpandedStore = create<{
+ expanded: {
+ [id: string]: boolean;
+ };
+ setExpanded: (id: string) => void;
+}>((set, get) => ({
+ expanded: {},
+ setExpanded(id: string) {
+ set({
+ expanded: {
+ ...get().expanded,
+ [id]: !get().expanded[id]
+ }
+ });
+ }
+}));
+
+export const MoveNotebookSheet = ({
+ selectedNotebooks,
+ close
+}: {
+ selectedNotebooks: Notebook[];
+ close?: () => void;
+}) => {
+ const [notebooks] = useNotebooks();
+ const { colors } = useThemeColors();
+ const renderItem = useCallback(
+ ({ index }: { index: number }) => {
+ return (
+ <NotebookItem
+ id={index}
+ items={notebooks}
+ level={0}
+ selectedNotebooks={selectedNotebooks}
+ onPress={async (selectedNotebook) => {
+ presentDialog({
+ title: `Move ${
+ selectedNotebooks.length > 1
+ ? selectedNotebooks.length + " notebooks"
+ : selectedNotebooks[0].title
+ }`,
+ paragraph: `Are you sure you want to move ${
+ selectedNotebooks.length > 1
+ ? selectedNotebooks.length + " notebooks"
+ : selectedNotebooks[0].title
+ } to ${selectedNotebook.title}?`,
+ positiveText: "Move",
+ positivePress: async () => {
+ for (const notebook of selectedNotebooks) {
+ const parent = await getParentNotebookId(notebook.id);
+ const root = await findRootNotebookId(notebook.id);
+
+ if (selectedNotebook.id === notebook.id) continue;
+
+ if (root !== notebook.id) {
+ await db.relations.unlink(
+ {
+ type: "notebook",
+ id: parent
+ },
+ notebook
+ );
+ eSendEvent(eOnNotebookUpdated, parent);
+ }
+
+ await db.relations.add(selectedNotebook, notebook);
+ eSendEvent(eOnNotebookUpdated, selectedNotebook.id);
+ eSendEvent(eOnNotebookUpdated, notebook.id);
+ }
+ useNotebookStore.getState().refresh();
+ close?.();
+ }
+ });
+ }}
+ />
+ );
+ },
+ [selectedNotebooks, notebooks, close]
+ );
+
+ return (
+ <View>
+ <SheetProvider context="move-notebook" />
+ <Dialog context="move-notebook" />
+
+ <View
+ style={{
+ paddingHorizontal: 12
+ }}
+ >
+ <DialogHeader
+ title={`Moving ${
+ selectedNotebooks.length > 1
+ ? selectedNotebooks.length + " notebooks"
+ : selectedNotebooks[0].title
+ }`}
+ paragraph={"Select the notebook you want to move this notebook to."}
+ />
+ </View>
+ <Seperator />
+
+ <FlatList
+ data={notebooks?.placeholders}
+ renderItem={renderItem}
+ windowSize={1}
+ ListHeaderComponent={
+ <View
+ style={{
+ paddingHorizontal: 12
+ }}
+ >
+ <Button
+ title="Move to top"
+ style={{
+ alignSelf: "flex-start",
+ width: "100%",
+ justifyContent: "space-between"
+ }}
+ icon="arrow-up-bold"
+ iconPosition="right"
+ type="secondaryAccented"
+ onPress={async () => {
+ for (const notebook of selectedNotebooks) {
+ const parent = await getParentNotebookId(notebook.id);
+ const root = await findRootNotebookId(notebook.id);
+ if (root !== notebook.id) {
+ await db.relations.unlink(
+ {
+ type: "notebook",
+ id: parent
+ },
+ notebook
+ );
+ eSendEvent(eOnNotebookUpdated, parent);
+ eSendEvent(eOnNotebookUpdated, notebook.id);
+ }
+ }
+ useNotebookStore.getState().refresh();
+ close?.();
+ }}
+ />
+ </View>
+ }
+ ListEmptyComponent={
+ <View
+ style={{
+ flex: 1,
+ justifyContent: "center",
+ alignItems: "center",
+ height: 200
+ }}
+ >
+ <Text
+ style={{
+ color: colors.secondary.icon
+ }}
+ >
+ No notebooks
+ </Text>
+ </View>
+ }
+ />
+ </View>
+ );
+};
+
+const NotebookItem = ({
+ id,
+ onPress,
+ items,
+ level = 0,
+ selectedNotebooks
+}: {
+ id: string | number;
+ level?: number;
+ items?: VirtualizedGrouping<Notebook>;
+ onPress: (item: Notebook) => void;
+ selectedNotebooks: Notebook[];
+}) => {
+ const { nestedNotebooks, notebook } = useNotebook(id, items, true);
+
+ const isExpanded = useNotebookExpandedStore((state) =>
+ !notebook ? false : state.expanded[notebook.id]
+ );
+ const { colors } = useThemeColors();
+
+ return selectedNotebooks.find(
+ (n) => n.id === notebook?.id
+ ) ? null : !notebook ? (
+ <View
+ style={{
+ height: 45
+ }}
+ />
+ ) : (
+ <View
+ style={{
+ minHeight: 45,
+ borderRadius: 0
+ }}
+ >
+ <Pressable
+ onPress={() => onPress(notebook)}
+ style={{
+ flexDirection: "row",
+ paddingHorizontal: 12,
+ height: 45
+ }}
+ >
+ {nestedNotebooks?.placeholders.length ? (
+ <IconButton
+ name={isExpanded ? "chevron-down" : "chevron-right"}
+ color={colors.primary.icon}
+ size={20}
+ onPress={() => {
+ if (!notebook) return;
+ useNotebookExpandedStore.getState().setExpanded(notebook.id);
+ }}
+ />
+ ) : (
+ <View
+ style={{
+ width: 35,
+ height: 30,
+ justifyContent: "center",
+ alignItems: "center"
+ }}
+ />
+ )}
+
+ <View
+ style={{
+ flexDirection: "row",
+ justifyContent: "space-between",
+ flexGrow: 1,
+ alignItems: "center"
+ }}
+ >
+ <Paragraph
+ numberOfLines={1}
+ style={{
+ color: colors.primary.paragraph,
+ fontSize: 15
+ }}
+ >
+ {notebook.title}
+ </Paragraph>
+
+ <IconButton
+ name="plus"
+ onPress={() => {
+ if (!notebook) return;
+ AddNotebookSheet.present(
+ undefined,
+ notebook,
+ "move-notebooks",
+ undefined,
+ false
+ );
+ }}
+ size={SIZE.lg}
+ />
+ </View>
+ </Pressable>
+
+ {nestedNotebooks?.placeholders?.length && isExpanded ? (
+ <View
+ style={{
+ paddingLeft: level + 1 > 0 && level + 1 < 5 ? 15 : 0,
+ marginTop: 5
+ }}
+ >
+ {nestedNotebooks.placeholders.map((item, index) => (
+ <NotebookItem
+ key={notebook?.id + index}
+ id={index}
+ onPress={onPress}
+ level={level + 1}
+ items={nestedNotebooks}
+ selectedNotebooks={selectedNotebooks}
+ />
+ ))}
+ </View>
+ ) : null}
+ </View>
+ );
+};
+
+MoveNotebookSheet.present = async (notebooks: Notebook[]) => {
+ presentSheet({
+ component: (ref, close) => (
+ <MoveNotebookSheet selectedNotebooks={notebooks} close={close} />
+ ),
+ keyboardHandlerDisabled: true
+ });
+};
diff --git a/apps/mobile/app/components/sheets/notebook-sheet/index.tsx b/apps/mobile/app/components/sheets/notebook-sheet/index.tsx
index 72bf22433..611f518b6 100644
--- a/apps/mobile/app/components/sheets/notebook-sheet/index.tsx
+++ b/apps/mobile/app/components/sheets/notebook-sheet/index.tsx
@@ -44,6 +44,8 @@ import { Pressable } from "../../ui/pressable";
import Paragraph from "../../ui/typography/paragraph";
import { AddNotebookSheet } from "../add-notebook";
import Sort from "../sort";
+import { MoveNotebookSheet } from "../move-notebook";
+import { db } from "../../../common/database";
const useItemSelectionStore = createItemSelectionStore(true, false);
@@ -319,6 +321,26 @@ export const NotebookSheet = () => {
size={22}
/>
+ <IconButton
+ style={{
+ marginLeft: 10,
+ width: 40 * fontScale,
+ height: 40 * fontScale
+ }}
+ onPress={async () => {
+ const ids = useItemSelectionStore
+ .getState()
+ .getSelectedItemIds();
+ const notebooks = await db.notebooks.all.items(ids);
+ MoveNotebookSheet.present(notebooks);
+ }}
+ color={colors.primary.icon}
+ tooltipText="Clear selection"
+ tooltipPosition={1}
+ name="arrow-right-bold-box-outline"
+ size={22}
+ />
+
<IconButton
style={{
marginLeft: 10,
@@ -360,20 +382,6 @@ export const NotebookSheet = () => {
height: 40 * fontScale
}}
/>
- {/* <IconButton
- name="notebook-plus"
- onPress={() => {
- if (!notebook) return;
- AddNotebookSheet.present(undefined, notebook, undefined);
- }}
- testID="add-notebook-button"
- color={colors.primary.icon}
- size={22}
- style={{
- width: 40 * fontScale,
- height: 40 * fontScale
- }}
- /> */}
<IconButton
name={collapsed ? "chevron-up" : "chevron-down"}
diff --git a/apps/mobile/app/components/side-menu/pinned-section.tsx b/apps/mobile/app/components/side-menu/pinned-section.tsx
index 3f5b22b59..db47ee6c0 100644
--- a/apps/mobile/app/components/side-menu/pinned-section.tsx
+++ b/apps/mobile/app/components/side-menu/pinned-section.tsx
@@ -94,7 +94,7 @@ export const PinnedSection = React.memo(
<Notice
size="small"
type="information"
- text="Add shortcuts for notebooks, topics and tags here."
+ text="Add shortcuts for notebooks and tags here."
style={{
marginHorizontal: 12
}}
diff --git a/apps/mobile/app/components/walkthroughs/walkthroughs.tsx b/apps/mobile/app/components/walkthroughs/walkthroughs.tsx
index e3f95b81e..b6e8e6dac 100644
--- a/apps/mobile/app/components/walkthroughs/walkthroughs.tsx
+++ b/apps/mobile/app/components/walkthroughs/walkthroughs.tsx
@@ -129,9 +129,9 @@ const notebooks: { id: string; steps: TStep[] } = {
}
},
{
- title: "Notebook > Topic > Notes",
- text: "Every Notebook has various topics which are like sections that hold all your notes.",
- walkthroughItem: (colors: ThemeStore["colors"]) => (
+ title: "Notebook > Notes",
+ text: "Every Notebook can have notes and sub notebooks.",
+ walkthroughItem: (colors: any) => (
<View
style={{
width: "100%",
@@ -245,7 +245,7 @@ const notebooks: { id: string; steps: TStep[] } = {
},
{
title: "Easy access",
- text: "You can create shortcuts of frequently accessed notebooks or topics in Side Menu",
+ text: "You can create shortcuts of frequently accessed notebooks in the side menu",
walkthroughItem: () => (
<View
style={{
diff --git a/apps/mobile/app/hooks/use-actions.tsx b/apps/mobile/app/hooks/use-actions.tsx
index 74236e3b3..4ae774edc 100644
--- a/apps/mobile/app/hooks/use-actions.tsx
+++ b/apps/mobile/app/hooks/use-actions.tsx
@@ -67,6 +67,7 @@ import { convertNoteToText } from "../utils/note-to-text";
import { sleep } from "../utils/time";
import { ReferencesList } from "../components/sheets/references";
import { createInternalLink } from "@notesnook/core";
+import { MoveNotebookSheet } from "../components/sheets/move-notebook";
export const useActions = ({
close,
@@ -490,6 +491,14 @@ export const useActions = ({
func: () => {
MoveNotes.present(item);
}
+ },
+ {
+ id: "move-notebook",
+ title: "Move notebook",
+ icon: "arrow-right-bold-box-outline",
+ func: () => {
+ MoveNotebookSheet.present([item]);
+ }
}
);
}
diff --git a/apps/mobile/app/hooks/use-app-events.tsx b/apps/mobile/app/hooks/use-app-events.tsx
index 436a46b07..5f52e0643 100644
--- a/apps/mobile/app/hooks/use-app-events.tsx
+++ b/apps/mobile/app/hooks/use-app-events.tsx
@@ -17,12 +17,14 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+import { User } from "@notesnook/core";
import {
EV,
EVENTS,
SYNC_CHECK_IDS,
SyncStatusEvent
} from "@notesnook/core/dist/common";
+import { EventManagerSubscription } from "@notesnook/core/dist/utils/event-manager";
import notifee from "@notifee/react-native";
import NetInfo, {
NetInfoState,
@@ -44,10 +46,6 @@ import RNBootSplash from "react-native-bootsplash";
import { checkVersion } from "react-native-check-version";
import Config from "react-native-config";
import * as RNIap from "react-native-iap";
-import { User } from "@notesnook/core";
-import { EventManagerSubscription } from "@notesnook/core/dist/utils/event-manager";
-//@ts-ignore
-import { enabled } from "react-native-privacy-snapshot";
import { DatabaseLogger, db, setupDatabase } from "../common/database";
import { MMKV } from "../common/database/mmkv";
import Migrate from "../components/sheets/migrate";
@@ -75,6 +73,7 @@ import {
setRecoveryKeyMessage,
setUpdateAvailableMessage
} from "../services/message";
+import Notifications from "../services/notifications";
import PremiumService from "../services/premium";
import SettingsService from "../services/settings";
import Sync from "../services/sync";
@@ -84,6 +83,7 @@ import { useMessageStore } from "../stores/use-message-store";
import { useSettingStore } from "../stores/use-setting-store";
import { SyncStatus, useUserStore } from "../stores/use-user-store";
import { updateStatusBarColor } from "../utils/colors";
+import { BETA } from "../utils/constants";
import {
eClearEditor,
eCloseSheet,
@@ -97,8 +97,6 @@ import {
import { getGithubVersion } from "../utils/github-version";
import { tabBarRef } from "../utils/global-refs";
import { sleep } from "../utils/time";
-import Notifications from "../services/notifications";
-import { BETA } from "../utils/constants";
const onCheckSyncStatus = async (type: SyncStatusEvent) => {
const { disableSync, disableAutoSync } = SettingsService.get();
@@ -259,6 +257,8 @@ async function saveEditorState() {
});
MMKV.setString("appState", state);
+ } else {
+ MMKV.removeItem("appState");
}
}
@@ -516,18 +516,8 @@ export const useAppEvents = () => {
const onAppStateChanged = async (state: AppStateStatus) => {
if (state === "active") {
- if (SettingsService.shouldLockAppOnEnterForeground()) {
- useUserStore.getState().lockApp(true);
- }
-
notifee.setBadgeCount(0);
updateStatusBarColor();
- if (
- !SettingsService.canLockAppInBackground() &&
- !SettingsService.get().privacyScreen
- ) {
- enabled(false);
- }
checkAutoBackup();
await reconnectSSE();
@@ -547,7 +537,6 @@ export const useAppEvents = () => {
//@ts-ignore
globalThis["IS_SHARE_EXTENSION"] = false;
} else {
- SettingsService.appEnteredBackground();
const id = useTabStore.getState().getCurrentNoteId();
const note = id ? await db.notes.note(id) : undefined;
const locked = note && (await db.vaults.itemExists(note));
@@ -561,7 +550,8 @@ export const useAppEvents = () => {
!useUserStore.getState().appLocked &&
!useUserStore.getState().disableAppLockRequests
) {
- if (SettingsService.getProperty("appLockTimer") === 0) {
+ if (SettingsService.shouldLockAppOnEnterForeground()) {
+ DatabaseLogger.log(`AppEvents: Locking app on enter background`);
useUserStore.getState().lockApp(true);
}
@@ -572,13 +562,6 @@ export const useAppEvents = () => {
Keyboard.dismiss();
}
}
- if (
- (SettingsService.get().privacyScreen ||
- SettingsService.canLockAppInBackground()) &&
- !useSettingStore.getState().requestBiometrics
- ) {
- enabled(true);
- }
}
};
diff --git a/apps/mobile/app/navigation/tabs-holder.js b/apps/mobile/app/navigation/tabs-holder.js
index 7ee216bc4..060e25234 100644
--- a/apps/mobile/app/navigation/tabs-holder.js
+++ b/apps/mobile/app/navigation/tabs-holder.js
@@ -272,6 +272,8 @@ const _TabsHolder = () => {
return;
}
setTimeout(() => {
+ console.log("movedAway", editorState().movedAway);
+
switch (current) {
case "tablet":
tabBarRef.current?.goToIndex(0, false);
@@ -294,7 +296,7 @@ const _TabsHolder = () => {
}
break;
}
- }, 1000);
+ }, 300);
}
const onScroll = (scrollOffset) => {
diff --git a/apps/mobile/app/screens/editor/tiptap/utils.ts b/apps/mobile/app/screens/editor/tiptap/utils.ts
index 9441a4400..964ca8ab8 100644
--- a/apps/mobile/app/screens/editor/tiptap/utils.ts
+++ b/apps/mobile/app/screens/editor/tiptap/utils.ts
@@ -165,6 +165,7 @@ export function getAppState() {
if (canRestoreAppState(appState)) {
return appState;
} else {
+ clearAppState();
return null;
}
}
diff --git a/apps/mobile/app/screens/notebooks/index.tsx b/apps/mobile/app/screens/notebooks/index.tsx
index 40c0236e2..a92adf8fd 100644
--- a/apps/mobile/app/screens/notebooks/index.tsx
+++ b/apps/mobile/app/screens/notebooks/index.tsx
@@ -67,7 +67,12 @@ export const Notebooks = ({
return (
<>
- <SelectionHeader id={route.name} items={notebooks} type="notebook" />
+ <SelectionHeader
+ id={route.name}
+ items={notebooks}
+ renderedInRoute={route.name}
+ type="notebook"
+ />
<Header
renderedInRoute={route.name}
title={route.name}
diff --git a/apps/mobile/app/screens/notes/index.tsx b/apps/mobile/app/screens/notes/index.tsx
index f540285c0..0baad781b 100644
--- a/apps/mobile/app/screens/notes/index.tsx
+++ b/apps/mobile/app/screens/notes/index.tsx
@@ -17,32 +17,29 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+import { resolveItems } from "@notesnook/common";
import { VirtualizedGrouping } from "@notesnook/core";
import { Color, Note } from "@notesnook/core/dist/types";
import React, { useEffect, useRef, useState } from "react";
+import { db } from "../../common/database";
import { FloatingButton } from "../../components/container/floating-button";
import DelayLayout from "../../components/delay-layout";
import { Header } from "../../components/header";
import List from "../../components/list";
import { PlaceholderData } from "../../components/list/empty";
+import SelectionHeader from "../../components/selection-header";
import { useNavigationFocus } from "../../hooks/use-navigation-focus";
import {
eSubscribeEvent,
eUnSubscribeEvent
} from "../../services/event-manager";
import Navigation, { NavigationProps } from "../../services/navigation";
-import { resolveItems } from "@notesnook/common";
import useNavigationStore, {
HeaderRightButton,
NotesScreenParams,
RouteName
} from "../../stores/use-navigation-store";
import { setOnFirstSave } from "./common";
-import { db } from "../../common/database";
-import SelectionHeader from "../../components/selection-header";
-export const WARNING_DATA = {
- title: "Some notes in this topic are not synced"
-};
export interface RouteProps<T extends RouteName> extends NavigationProps<T> {
get: (
@@ -71,9 +68,7 @@ const NotesPage = ({
onPressFloatingButton,
focusControl = true,
rightButtons
-}: RouteProps<
- "NotesPage" | "TaggedNotes" | "Monographs" | "ColoredNotes" | "TopicNotes"
->) => {
+}: RouteProps<"NotesPage" | "TaggedNotes" | "Monographs" | "ColoredNotes">) => {
const params = useRef<NotesScreenParams>(route?.params);
const [notes, setNotes] = useState<VirtualizedGrouping<Note>>();
const [loadingNotes, setLoadingNotes] = useState(true);
diff --git a/apps/mobile/app/screens/settings/settings-data.tsx b/apps/mobile/app/screens/settings/settings-data.tsx
index 97cc39884..53f429ff2 100644
--- a/apps/mobile/app/screens/settings/settings-data.tsx
+++ b/apps/mobile/app/screens/settings/settings-data.tsx
@@ -585,8 +585,8 @@ export const settingsGroups: SettingSection[] = [
},
{
id: "default-notebook",
- name: "Clear default notebook/topic",
- description: "Clear the default notebook/topic for new notes",
+ name: "Clear default notebook",
+ description: "Clear the default notebook for new notes",
modifer: () => {
db.settings.setDefaultNotebook(undefined);
},
diff --git a/apps/mobile/app/services/biometrics.ts b/apps/mobile/app/services/biometrics.ts
index 8a51d8cc7..b31069493 100644
--- a/apps/mobile/app/services/biometrics.ts
+++ b/apps/mobile/app/services/biometrics.ts
@@ -72,7 +72,6 @@ async function hasInternetCredentials() {
async function getCredentials(title?: string, description?: string) {
try {
useSettingStore.getState().setRequestBiometrics(true);
-
const options = Platform.select({
ios: {
fallbackEnabled: false,
@@ -87,12 +86,16 @@ async function getCredentials(title?: string, description?: string) {
await FingerprintScanner.authenticate(options as AuthenticateIOS);
setTimeout(() => {
useSettingStore.getState().setRequestBiometrics(false);
- }, 1000);
+ }, 500);
FingerprintScanner.release();
return await Keychain.getInternetCredentials("nn_vault");
} catch (error) {
const e = error as { name: string };
- useSettingStore.getState().setRequestBiometrics(false);
+ setTimeout(() => {
+ useUserStore.setState({
+ disableAppLockRequests: false
+ });
+ }, 500);
FingerprintScanner.release();
let message: ToastOptions = {
heading: "Authentication with biometrics failed.",
@@ -140,18 +143,22 @@ async function validateUser(title: string, description?: string) {
}
}) as AuthenticateIOS
);
- useUserStore.setState({
- disableAppLockRequests: false
- });
- useSettingStore.getState().setAppDidEnterBackgroundForAction(false);
+ setTimeout(() => {
+ useUserStore.setState({
+ disableAppLockRequests: false
+ });
+ useSettingStore.getState().setAppDidEnterBackgroundForAction(false);
+ }, 500);
FingerprintScanner.release();
return true;
} catch (error) {
const e = error as { name: string };
- useUserStore.setState({
- disableAppLockRequests: false
- });
- useSettingStore.getState().setAppDidEnterBackgroundForAction(false);
+ setTimeout(() => {
+ useUserStore.setState({
+ disableAppLockRequests: false
+ });
+ useSettingStore.getState().setAppDidEnterBackgroundForAction(false);
+ }, 500);
FingerprintScanner.release();
if (e.name === "DeviceLocked") {
ToastManager.show({
diff --git a/apps/mobile/native/fonts/MaterialCommunityIcons.ttf b/apps/mobile/native/fonts/MaterialCommunityIcons.ttf
index a1b4fa2fc..592983a4d 100644
Binary files a/apps/mobile/native/fonts/MaterialCommunityIcons.ttf and b/apps/mobile/native/fonts/MaterialCommunityIcons.ttf differ
diff --git a/apps/mobile/scripts/optimize-fonts.mjs b/apps/mobile/scripts/optimize-fonts.mjs
index 35a688f55..f16575735 100644
--- a/apps/mobile/scripts/optimize-fonts.mjs
+++ b/apps/mobile/scripts/optimize-fonts.mjs
@@ -77,7 +77,9 @@ const EXTRA_ICON_NAMES = [
"keyboard",
"numeric",
"vector-link",
- "notebook-plus"
+ "notebook-plus",
+ "arrow-right-bold-box-outline",
+ "arrow-up-bold"
];
const __filename = fileURLToPath(import.meta.url);