A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: cleanup and fix errors
Ammar Ahmed1ad199ce5388
diff --git a/apps/mobile/app/components/auth/two-factor.js b/apps/mobile/app/components/auth/two-factor.jsindex 38da96e01..902f158fd 100644--- a/apps/mobile/app/components/auth/two-factor.js+++ b/apps/mobile/app/components/auth/two-factor.js@@ -17,8 +17,11 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-import React, { useEffect, useRef, useState } from "react";+import { strings } from "@notesnook/intl";+import { useThemeColors } from "@notesnook/theme";+import React, { useCallback, useEffect, useRef, useState } from "react";import { View } from "react-native";+import { ScrollView } from "react-native-actions-sheet";import { db } from "../../common/database/index";import useTimer from "../../hooks/use-timer";import {@@ -26,19 +29,14 @@ import {presentSheet,ToastManager} from "../../services/event-manager";-import { useThemeColors } from "@notesnook/theme";import { eCloseSheet } from "../../utils/events";import { SIZE } from "../../utils/size";import { Button } from "../ui/button";import { IconButton } from "../ui/icon-button";import Input from "../ui/input";import { Pressable } from "../ui/pressable";-import Seperator from "../ui/seperator";import Heading from "../ui/typography/heading";import Paragraph from "../ui/typography/paragraph";-import { useCallback } from "react";-import { ScrollView } from "react-native-actions-sheet";-import { strings } from "@notesnook/intl";const TwoFactorVerification = ({ onMfaLogin, mfaInfo, onCancel }) => {const { colors } = useThemeColors();diff --git a/apps/mobile/app/components/header/index.tsx b/apps/mobile/app/components/header/index.tsxindex 2485f9a2c..bb59dfe37 100644--- a/apps/mobile/app/components/header/index.tsx+++ b/apps/mobile/app/components/header/index.tsx@@ -33,7 +33,6 @@ import { eScrollEvent } from "../../utils/events";import { LeftMenus } from "./left-menus";import { RightMenus } from "./right-menus";import { Title } from "./title";-import { useNavigation } from "@react-navigation/native";type HeaderRightButton = {title: string;diff --git a/apps/mobile/app/components/intro/index.js b/apps/mobile/app/components/intro/index.jsindex 7b1b2ea54..5b5160aa6 100644--- a/apps/mobile/app/components/intro/index.js+++ b/apps/mobile/app/components/intro/index.js@@ -17,30 +17,23 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/+import { strings } from "@notesnook/intl";import { useThemeColors } from "@notesnook/theme";import React from "react";-import {- Linking,- ScrollView,- TouchableOpacity,- useWindowDimensions,- View-} from "react-native";+import { Linking, ScrollView, useWindowDimensions, View } from "react-native";import { SwiperFlatList } from "react-native-swiper-flatlist";-import Icon from "react-native-vector-icons/MaterialCommunityIcons";-import { getElevationStyle } from "../../utils/elevation";import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";+import { eSendEvent } from "../../services/event-manager";+import Navigation from "../../services/navigation";import SettingsService from "../../services/settings";import { useSettingStore } from "../../stores/use-setting-store";+import { getElevationStyle } from "../../utils/elevation";+import { eOpenLoginDialog } from "../../utils/events";import { SIZE } from "../../utils/size";+import { AuthMode } from "../auth";import { Button } from "../ui/button";import Heading from "../ui/typography/heading";import Paragraph from "../ui/typography/paragraph";-import Navigation from "../../services/navigation";-import { eOpenLoginDialog } from "../../utils/events";-import { AuthMode } from "../auth";-import { eSendEvent } from "../../services/event-manager";-import { strings } from "@notesnook/intl";const Intro = ({ navigation }) => {const { colors } = useThemeColors();diff --git a/apps/mobile/app/components/list/list-item.wrapper.tsx b/apps/mobile/app/components/list/list-item.wrapper.tsxindex 9c9e5552d..209b00ee4 100644--- a/apps/mobile/app/components/list/list-item.wrapper.tsx+++ b/apps/mobile/app/components/list/list-item.wrapper.tsx@@ -34,12 +34,13 @@ import {Reminder,Tag,TrashItem,- VirtualizedGrouping+ VirtualizedGrouping,+ getSortValue} from "@notesnook/core";-import { getSortValue } from "@notesnook/core";import React, { useCallback, useEffect, useRef, useState } from "react";import { View } from "react-native";import { db } from "../../common/database";+import { useIsCompactModeEnabled } from "../../hooks/use-is-compact-mode-enabled";import { eSendEvent } from "../../services/event-manager";import { RouteName } from "../../stores/use-navigation-store";import { eOpenJumpToDialog } from "../../utils/events";@@ -48,7 +49,6 @@ import { NoteWrapper } from "../list-items/note/wrapper";import { NotebookWrapper } from "../list-items/notebook/wrapper";import ReminderItem from "../list-items/reminder";import TagItem from "../list-items/tag";-import { useIsCompactModeEnabled } from "../../hooks/use-is-compact-mode-enabled";type ListItemWrapperProps<TItem = Item> = {group?: GroupingKey;diff --git a/apps/mobile/app/components/sheets/add-notebook/index.tsx b/apps/mobile/app/components/sheets/add-notebook/index.tsxindex 0189106f8..6a73e57ef 100644--- a/apps/mobile/app/components/sheets/add-notebook/index.tsx+++ b/apps/mobile/app/components/sheets/add-notebook/index.tsx@@ -81,7 +81,7 @@ export const AddNotebookSheet = ({id: notebook?.id});- if (parentNotebook) {+ if (parentNotebook && id) {await db.relations.add(parentNotebook, {type: "notebook",id: id@@ -94,7 +94,8 @@ export const AddNotebookSheet = ({useNotebookStore.getState().refresh();const parent =- parentNotebook?.id || (await getParentNotebookId(notebook?.id || id));+ parentNotebook?.id ||+ (await getParentNotebookId(notebook?.id || (id as string)));eSendEvent(eOnNotebookUpdated, parent);if (notebook) {@@ -104,7 +105,7 @@ export const AddNotebookSheet = ({});}- if (!notebook && showMoveNotesOnComplete) {+ if (!notebook && showMoveNotesOnComplete && id) {MoveNotes.present(await db.notebooks.notebook(id));} else {close?.(true);diff --git a/apps/mobile/app/components/sheets/add-to/index.tsx b/apps/mobile/app/components/sheets/add-to/index.tsxindex d8061781c..662945f7a 100644--- a/apps/mobile/app/components/sheets/add-to/index.tsx+++ b/apps/mobile/app/components/sheets/add-to/index.tsx@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.*/import { Note } from "@notesnook/core";+import { strings } from "@notesnook/intl";import { useThemeColors } from "@notesnook/theme";import React, {RefObject,@@ -49,13 +50,11 @@ import DialogHeader from "../../dialog/dialog-header";import SheetProvider from "../../sheet-provider";import { Button } from "../../ui/button";import { IconButton } from "../../ui/icon-button";+import Input from "../../ui/input";import Paragraph from "../../ui/typography/paragraph";+import { AddNotebookSheet } from "../add-notebook";import { NotebookItem } from "./notebook-item";import { useNotebookItemSelectionStore } from "./store";-import { AddNotebookSheet } from "../add-notebook";-import Input from "../../ui/input";-import { presentDialog } from "../../dialog/functions";-import { strings } from "@notesnook/intl";async function updateInitialSelectionState(items: string[]) {const relations = await db.relationsdiff --git a/apps/mobile/app/components/sheets/new-feature/index.tsx b/apps/mobile/app/components/sheets/new-feature/index.tsxindex 4f540f6d0..63a66153a 100644--- a/apps/mobile/app/components/sheets/new-feature/index.tsx+++ b/apps/mobile/app/components/sheets/new-feature/index.tsx@@ -43,7 +43,7 @@ const NewFeature = ({version}: {features: FeatureType[];- version?: string | null;+ version?: string;}) => {const { colors } = useThemeColors();@@ -122,7 +122,7 @@ NewFeature.present = () => {component: (<NewFeaturefeatures={features}- version={SettingsService.getProperty("version")}+ version={SettingsService.getProperty("version") || undefined}/>),disableClosing: truediff --git a/apps/mobile/app/components/sheets/relations-list/index.tsx b/apps/mobile/app/components/sheets/relations-list/index.tsxindex 49843af8e..8b8153c1d 100644--- a/apps/mobile/app/components/sheets/relations-list/index.tsx+++ b/apps/mobile/app/components/sheets/relations-list/index.tsx@@ -16,8 +16,8 @@ GNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-import { VirtualizedGrouping } from "@notesnook/core";-import { Item, ItemReference } from "@notesnook/core";+import { Item, ItemReference, VirtualizedGrouping } from "@notesnook/core";+import { strings } from "@notesnook/intl";import { useThemeColors } from "@notesnook/theme";import React, { RefObject, useEffect, useState } from "react";import { View } from "react-native";@@ -37,8 +37,6 @@ import SheetProvider from "../../sheet-provider";import { Button } from "../../ui/button";import { PressableProps } from "../../ui/pressable";import Paragraph from "../../ui/typography/paragraph";-import { isStringLiteralOrJsxExpression } from "typescript";-import { strings } from "@notesnook/intl";type RelationsListProps = {actionSheetRef: RefObject<ActionSheetRef>;@@ -125,7 +123,9 @@ export const RelationsList = ({// width="100%"type="inverted"icon="plus"- title={strings.addItem(referenceType)}+ title={strings.addItem(+ referenceType as "notebook" | "tag" | "reminder" | "note"+ )}/></View>) : (diff --git a/apps/mobile/app/components/ui/input/index.tsx b/apps/mobile/app/components/ui/input/index.tsxindex 6316354ad..3f396f352 100644--- a/apps/mobile/app/components/ui/input/index.tsx+++ b/apps/mobile/app/components/ui/input/index.tsx@@ -70,7 +70,6 @@ interface InputProps extends TextInputProps {};buttons?: React.ReactNode;onBlurInput?: () => void;- onPress?: () => void;height?: number;fontSize?: number;onFocusInput?: () => void;diff --git a/apps/mobile/app/hooks/use-actions.tsx b/apps/mobile/app/hooks/use-actions.tsxindex 19a21a25f..9b55e636e 100644--- a/apps/mobile/app/hooks/use-actions.tsx+++ b/apps/mobile/app/hooks/use-actions.tsx@@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*//* eslint-disable no-inner-declarations */-import { VAULT_ERRORS } from "@notesnook/core";import {Color,ItemReference,@@ -25,8 +24,11 @@ import {Notebook,Reminder,Tag,- TrashItem+ TrashItem,+ VAULT_ERRORS,+ createInternalLink} from "@notesnook/core";+import { strings } from "@notesnook/intl";import { DisplayedNotification } from "@notifee/react-native";import Clipboard from "@react-native-clipboard/clipboard";import React, { useCallback, useEffect, useRef, useState } from "react";@@ -39,8 +41,10 @@ import NoteHistory from "../components/note-history";import { AddNotebookSheet } from "../components/sheets/add-notebook";import MoveNoteSheet from "../components/sheets/add-to";import ExportNotesSheet from "../components/sheets/export-notes";+import { MoveNotebookSheet } from "../components/sheets/move-notebook";import { MoveNotes } from "../components/sheets/move-notes/movenote";import PublishNoteSheet from "../components/sheets/publish-note";+import { ReferencesList } from "../components/sheets/references";import { RelationsList } from "../components/sheets/relations-list/index";import ReminderSheet from "../components/sheets/reminder";import { useSideBarDraggingStore } from "../components/side-menu/dragging-store";@@ -60,15 +64,10 @@ import { useRelationStore } from "../stores/use-relation-store";import { useSelectionStore } from "../stores/use-selection-store";import { useTagStore } from "../stores/use-tag-store";import { useUserStore } from "../stores/use-user-store";-import Errors from "../utils/errors";import { eOpenLoginDialog, eUpdateNoteInEditor } from "../utils/events";import { deleteItems } from "../utils/functions";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";-import { strings } from "@notesnook/intl";export const useActions = ({close,@@ -314,7 +313,10 @@ export const useActions = ({Navigation.queueRoutesForUpdate();useSelectionStore.getState().setSelectionMode(undefined);ToastManager.show({- heading: strings.actions.deleted[item.itemType](1),+ heading:+ strings.actions.deleted[+ item.itemType as keyof typeof strings.actions.deleted+ ](1),type: "success",context: "local"});@@ -955,7 +957,9 @@ export const useActions = ({id: "trash",title:item.type !== "notebook" && item.type !== "note"- ? strings.doActions.delete[item.type](1)+ ? strings.doActions.delete[+ item.type as keyof typeof strings.doActions.delete+ ](1): strings.moveToTrash(),icon: "delete-outline",type: "error",diff --git a/apps/mobile/app/screens/settings/subscription.js b/apps/mobile/app/screens/settings/subscription.jsindex 0e0ddf604..fda262927 100644--- a/apps/mobile/app/screens/settings/subscription.js+++ b/apps/mobile/app/screens/settings/subscription.js@@ -17,8 +17,10 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/+import { strings } from "@notesnook/intl";import React from "react";import { Linking, Platform, View } from "react-native";+import Config from "react-native-config";import { Button } from "../../components/ui/button";import { usePricing } from "../../hooks/use-pricing";import {@@ -28,14 +30,9 @@ import {} from "../../services/event-manager";import PremiumService from "../../services/premium";import { useUserStore } from "../../stores/use-user-store";-import {- SUBSCRIPTION_PROVIDER,- SUBSCRIPTION_STATUS-} from "../../utils/constants";+import { SUBSCRIPTION_STATUS } from "../../utils/constants";import { eOpenPremiumDialog } from "../../utils/events";import { SIZE } from "../../utils/size";-import Config from "react-native-config";-import { strings } from "@notesnook/intl";export const Subscription = () => {const user = useUserStore((state) => state.user);const monthlyPlan = usePricing("monthly");diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.tsindex 39af3b92a..fc3ced0a2 100644--- a/packages/intl/src/strings.ts+++ b/packages/intl/src/strings.ts@@ -24,18 +24,18 @@ import { actionErrors } from "../generated/action-errors";import { actionConfirmations } from "../generated/action-confirmations";const SEARCH_IN_ROUTE_STRINGS = {- Notes: () => t`Type a keyword to search in Notes`,- Notebooks: () => t`Type a keyword to search in Notebooks`,- Notebook: () => t`Type a keyword to search in Notebook`,- Favorites: () => t`Type a keyword to search in Favorites`,- Reminders: () => t`Type a keyword to search in Reminders`,- Trash: () => t`Type a keyword to search in Trash`,- Settings: () => t`Type a keyword to search in Settings`,- Tags: () => t`Type a keyword to search in Tags`,- Editor: () => t`Type a keyword to search in Editor`,- Home: () => t`Type a keyword to search in Home`,- Search: () => t`Type a keyword to search in Search`,- Monographs: () => t`Type a keyword to search in Monographs`+ Notes: () => t`Search in in Notes`,+ Notebooks: () => t`Search in in Notebooks`,+ Notebook: () => t`Search in in Notebook`,+ Favorites: () => t`Search in in Favorites`,+ Reminders: () => t`Search in in Reminders`,+ Trash: () => t`Search in in Trash`,+ Settings: () => t`Search in in Settings`,+ Tags: () => t`Search in in Tags`,+ Editor: () => t`Search in in Editor`,+ Home: () => t`Search in in Home`,+ Search: () => t`Search in in Search`,+ Monographs: () => t`Search in in Monographs`};export const strings = {@@ -1474,8 +1474,14 @@ For example:Search: () => t`Search`,Monographs: () => t`Monographs`},- searchInRoute: (routeName: keyof typeof SEARCH_IN_ROUTE_STRINGS) => {- return SEARCH_IN_ROUTE_STRINGS[routeName]();+ searchInRoute: (+ routeName: keyof typeof SEARCH_IN_ROUTE_STRINGS | ({} & string)+ ) => {+ return (+ SEARCH_IN_ROUTE_STRINGS[+ routeName as keyof typeof SEARCH_IN_ROUTE_STRINGS+ ]() || t`Search in ${routeName}`+ );},logoutConfirmation: () =>t`Are you sure you want to logout and clear all data stored on THIS DEVICE?`,