diff --git a/apps/mobile/app/common/filesystem/index.ts b/apps/mobile/app/common/filesystem/index.ts
index 676ec46654..e236bbe3a6 100644
--- a/apps/mobile/app/common/filesystem/index.ts
+++ b/apps/mobile/app/common/filesystem/index.ts
@@ -47,7 +47,8 @@ export default {
deleteCacheFileByPath,
getCacheSize,
requestPermission,
- checkAndCreateDir
+ checkAndCreateDir,
+ getUploadedFileSize
};
export const FileStorage: IFileStorage = {
diff --git a/apps/mobile/app/components/dialog/base-dialog.tsx b/apps/mobile/app/components/dialog/base-dialog.tsx
index f6be7ea6b1..0ffa62fb4a 100644
--- a/apps/mobile/app/components/dialog/base-dialog.tsx
+++ b/apps/mobile/app/components/dialog/base-dialog.tsx
@@ -38,7 +38,7 @@ import { useAppState } from "../../hooks/use-app-state";
export interface BaseDialogProps extends PropsWithChildren {
animation?: "fade" | "none" | "slide" | undefined;
- visible: boolean;
+ visible?: boolean;
onRequestClose?: () => void;
onShow?: () => void;
premium?: boolean;
diff --git a/apps/mobile/app/components/dialogs/color-picker/index.tsx b/apps/mobile/app/components/dialogs/color-picker/index.tsx
index d6b29f2fde..734c7e3f0c 100644
--- a/apps/mobile/app/components/dialogs/color-picker/index.tsx
+++ b/apps/mobile/app/components/dialogs/color-picker/index.tsx
@@ -179,6 +179,7 @@ const ColorPicker = ({
title: title.current,
colorCode: selectedColor
});
+ if (!id) return;
useRelationStore.getState().update();
useMenuStore.getState().setColorNotes();
setVisible(false);
diff --git a/apps/mobile/app/components/list/list-item.wrapper.tsx b/apps/mobile/app/components/list/list-item.wrapper.tsx
index 209b00ee4f..aad1361706 100644
--- a/apps/mobile/app/components/list/list-item.wrapper.tsx
+++ b/apps/mobile/app/components/list/list-item.wrapper.tsx
@@ -297,7 +297,6 @@ function getDate(item: Item, groupType?: GroupingKey): number {
groupType
? db.settings.getGroupOptions(groupType)
: {
- groupBy: "default",
sortBy: "dateEdited",
sortDirection: "desc"
},
diff --git a/apps/mobile/app/components/premium/pricing-plans.tsx b/apps/mobile/app/components/premium/pricing-plans.tsx
index a7ce08fd75..d0ef060da4 100644
--- a/apps/mobile/app/components/premium/pricing-plans.tsx
+++ b/apps/mobile/app/components/premium/pricing-plans.tsx
@@ -129,7 +129,10 @@ export const PricingPlans = ({
if (code.startsWith("com.streetwriters.notesnook")) {
skuId = code;
} else {
- skuId = await db.offers?.getCode(code.split(":")[0], Platform.OS);
+ skuId = await db.offers?.getCode(
+ code.split(":")[0],
+ Platform.OS as "ios" | "android"
+ );
}
const products = await PremiumService.getProducts();
diff --git a/apps/mobile/app/components/sheets/export-notes/share.js b/apps/mobile/app/components/sheets/export-notes/share.jsx
similarity index 100%
rename from apps/mobile/app/components/sheets/export-notes/share.js
rename to apps/mobile/app/components/sheets/export-notes/share.jsx
diff --git a/apps/mobile/app/components/sheets/publish-note/index.tsx b/apps/mobile/app/components/sheets/publish-note/index.tsx
index 581d21cba6..042c7b6e76 100644
--- a/apps/mobile/app/components/sheets/publish-note/index.tsx
+++ b/apps/mobile/app/components/sheets/publish-note/index.tsx
@@ -150,7 +150,7 @@ const PublishNoteSheet = ({
) : (
<>
- {isPublished && (
+ {isPublished && publishUrl ? (
- )}
+ ) : null}
{
diff --git a/apps/mobile/app/components/sheets/reminder/index.tsx b/apps/mobile/app/components/sheets/reminder/index.tsx
index b100d0d687..f9669e2d74 100644
--- a/apps/mobile/app/components/sheets/reminder/index.tsx
+++ b/apps/mobile/app/components/sheets/reminder/index.tsx
@@ -556,9 +556,9 @@ export default function ReminderSheet({
{Object.keys(ReminderNotificationModes).map((mode) => (
.
-*/
-
-import React from "react";
-import { ActivityIndicator, DimensionValue, ViewStyle } from "react-native";
-import Animated, {
- FadeIn,
- FadeOut,
- Layout,
- LightSpeedInLeft
-} from "react-native-reanimated";
-import Icon from "react-native-vector-icons/MaterialCommunityIcons";
-import { SIZE } from "../../../utils/size";
-import NativeTooltip from "../../../utils/tooltip";
-import { ButtonProps } from "../button";
-import { Pressable, useButton } from "../pressable";
-import Heading from "../typography/heading";
-import Paragraph from "../typography/paragraph";
-const AnimatedIcon = Animated.createAnimatedComponent(Icon);
-
-export const AnimatedButton = ({
- height = 45,
- width = null,
- onPress,
- loading = false,
- title = null,
- icon,
- fontSize = SIZE.sm,
- type = "transparent",
- iconSize = SIZE.md,
- style = {},
- accentColor = "accent",
- accentText = "light",
- onLongPress,
- tooltipText,
- textStyle,
- iconPosition = "left",
- buttonType,
- bold,
- iconColor,
- fwdRef,
- ...restProps
-}: ButtonProps) => {
- const { text } = useButton({
- type,
- accent: accentColor,
- text: accentText
- });
- const textColor = buttonType?.text ? buttonType.text : text;
- const Component = bold ? Heading : Paragraph;
-
- return (
-
- {
- if (onLongPress) {
- onLongPress(event);
- return;
- }
- if (tooltipText) {
- NativeTooltip.show(event, tooltipText, NativeTooltip.POSITIONS.TOP);
- }
- }}
- disabled={loading}
- type={type}
- accentColor={accentColor}
- accentText={accentText}
- customColor={buttonType?.color}
- customSelectedColor={buttonType?.selected}
- customOpacity={buttonType?.opacity}
- customAlpha={buttonType?.alpha}
- style={{
- height: height,
- width: (width as DimensionValue) || undefined,
- paddingHorizontal: 12,
- borderRadius: 5,
- alignSelf: "center",
- justifyContent: "center",
- alignItems: "center",
- flexDirection: "row",
- ...(style as ViewStyle)
- }}
- >
- {loading ? (
-
- ) : null}
- {icon && !loading && iconPosition === "left" ? (
-
- ) : null}
-
- {!title ? null : (
-
- {title}
-
- )}
-
- {icon && !loading && iconPosition === "right" ? (
-
- ) : null}
-
-
- );
-};
diff --git a/apps/mobile/app/components/ui/svg/index.tsx b/apps/mobile/app/components/ui/svg/index.tsx
index d51c6929f0..2746f3c01d 100644
--- a/apps/mobile/app/components/ui/svg/index.tsx
+++ b/apps/mobile/app/components/ui/svg/index.tsx
@@ -18,15 +18,15 @@ along with this program. If not, see .
*/
import React from "react";
-import { View } from "react-native";
+import { DimensionValue, View } from "react-native";
import { SvgXml } from "./lazy";
export const SvgView = ({
width = 250,
height = 250,
src
}: {
- width?: number | string;
- height?: number | number;
+ width?: DimensionValue;
+ height?: DimensionValue;
src?: string;
}) => {
if (!src) return null;
diff --git a/apps/mobile/app/hooks/use-app-state.ts b/apps/mobile/app/hooks/use-app-state.ts
index 7275b21352..4f36df8611 100644
--- a/apps/mobile/app/hooks/use-app-state.ts
+++ b/apps/mobile/app/hooks/use-app-state.ts
@@ -32,18 +32,11 @@ export function useAppState() {
const subscription = AppState.addEventListener("change", onChange);
return () => {
- // @ts-expect-error - React Native >= 0.65
- if (typeof subscription?.remove === "function") {
- // @ts-expect-error - need update @types/react-native@0.65.x
- subscription.remove();
- } else {
- // React Native < 0.65
- AppState.removeEventListener("change", onChange);
- }
+ subscription.remove();
};
}, []);
return appState;
}
-export { AppStateStatus };
+export type { AppStateStatus };
diff --git a/apps/mobile/app/hooks/use-keyboard.ts b/apps/mobile/app/hooks/use-keyboard.ts
index 04b04a4d35..4d08206153 100644
--- a/apps/mobile/app/hooks/use-keyboard.ts
+++ b/apps/mobile/app/hooks/use-keyboard.ts
@@ -18,7 +18,7 @@ along with this program. If not, see .
*/
import { useEffect, useState } from "react";
-import { Keyboard, KeyboardEventListener, ScreenRect } from "react-native";
+import { Keyboard, KeyboardEventListener, KeyboardMetrics } from "react-native";
const emptyCoordinates = Object.freeze({
screenX: 0,
@@ -34,8 +34,8 @@ const initialValue = {
export default function useKeyboard() {
const [shown, setShown] = useState(false);
const [coordinates, setCoordinates] = useState<{
- start: undefined | ScreenRect;
- end: ScreenRect;
+ start: undefined | KeyboardMetrics;
+ end: KeyboardMetrics;
}>(initialValue);
const [keyboardHeight, setKeyboardHeight] = useState(0);
diff --git a/apps/mobile/app/screens/search/index.tsx b/apps/mobile/app/screens/search/index.tsx
index 1b591ef8a5..df1870a609 100644
--- a/apps/mobile/app/screens/search/index.tsx
+++ b/apps/mobile/app/screens/search/index.tsx
@@ -59,15 +59,38 @@ export const Search = ({ route, navigation }: NavigationProps<"Search">) => {
}
try {
setLoading(true);
- const type =
- route.params.type === "trash"
- ? "trash"
- : ((route.params?.type + "s") as keyof typeof db.lookup);
- console.log(`Searching in ${type} for ${query}`);
- const results = await db.lookup[type](
- query,
- route.params.items as FilteredSelector
- ).sorted();
+ let results: VirtualizedGrouping- | undefined;
+
+ switch (route.params.type) {
+ case "note":
+ results = await db.lookup
+ .notes(query, route.params.items as FilteredSelector)
+ .sorted();
+ break;
+ case "notebook":
+ results = await db.lookup.notebooks(query).sorted();
+ break;
+ case "tag":
+ results = await db.lookup.tags(query).sorted();
+ break;
+ case "reminder":
+ results = await db.lookup.reminders(query).sorted();
+ break;
+ case "trash":
+ results = await db.lookup.trash(query).sorted();
+ break;
+ case "attachment":
+ results = await db.lookup.attachments(query).sorted();
+ break;
+ default:
+ results = undefined;
+ }
+
+ if (!results) {
+ setSearchStatus(strings.noResultsFound(query));
+ setLoading(false);
+ return;
+ }
console.log(
`Found ${results.placeholders?.length} results for ${query}`
diff --git a/apps/mobile/native/package.json b/apps/mobile/native/package.json
index cd570b69cf..502527f02d 100644
--- a/apps/mobile/native/package.json
+++ b/apps/mobile/native/package.json
@@ -88,7 +88,6 @@
"@tsconfig/react-native": "^3.0.2",
"@types/html-to-text": "^8.0.1",
"@types/metro-config": "^0.76.3",
- "@types/react": "^18.2.6",
"@types/react-native": "^0.69.1",
"@types/react-native-vector-icons": "^6.4.10",
"@types/react-test-renderer": "^18.0.0",
diff --git a/apps/mobile/package-lock.json b/apps/mobile/package-lock.json
index 365e1be884..85260ec2b0 100644
--- a/apps/mobile/package-lock.json
+++ b/apps/mobile/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@notesnook/mobile",
- "version": "3.0.23",
+ "version": "3.0.24",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@notesnook/mobile",
- "version": "3.0.23",
+ "version": "3.0.24",
"hasInstallScript": true,
"license": "GPL-3.0-or-later",
"workspaces": [
@@ -27,11 +27,13 @@
"@trpc/client": "^10.45.2",
"@trpc/react-query": "^10.45.2",
"@trpc/server": "^10.45.2",
+ "@types/validator": "^13.12.2",
"diffblazer": "^1.0.1",
"react": "18.2.0",
"react-native": "0.74.5"
},
"devDependencies": {
+ "@types/react": "^18.2.39",
"fonteditor-core": "^2.1.11",
"listr": "^0.14.3",
"otplib": "12.0.1",
@@ -29007,7 +29009,6 @@
"@types/html-to-text": "^8.0.1",
"@types/jest": "^29.5.14",
"@types/metro-config": "^0.76.3",
- "@types/react": "^18.2.6",
"@types/react-native": "^0.69.1",
"@types/react-native-vector-icons": "^6.4.10",
"@types/react-test-renderer": "^18.0.0",
@@ -34355,12 +34356,13 @@
"license": "MIT"
},
"node_modules/@types/react": {
- "version": "18.2.13",
+ "version": "18.3.18",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.18.tgz",
+ "integrity": "sha512-t4yC+vtgnkYjNSKlFx1jkAhH8LgTo2N/7Qvi83kdEaUtMDiwpbLAktKDaAMlRcJ5eSxZkH74eEGt1ky31d7kfQ==",
"devOptional": true,
"license": "MIT",
"dependencies": {
"@types/prop-types": "*",
- "@types/scheduler": "*",
"csstype": "^3.0.2"
}
},
@@ -34397,11 +34399,6 @@
"@types/react": "*"
}
},
- "node_modules/@types/scheduler": {
- "version": "0.16.3",
- "devOptional": true,
- "license": "MIT"
- },
"node_modules/@types/semver": {
"version": "7.5.0",
"dev": true,
@@ -34411,6 +34408,12 @@
"version": "2.0.1",
"license": "MIT"
},
+ "node_modules/@types/validator": {
+ "version": "13.12.2",
+ "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.12.2.tgz",
+ "integrity": "sha512-6SlHBzUW8Jhf3liqrGGXyTJSIFe4nqlJ5A5KaMZ2l/vbM3Wh3KSybots/wfWVzNLK4D1NZluDlSQIbIEPx6oyA==",
+ "license": "MIT"
+ },
"node_modules/@types/yargs": {
"version": "17.0.24",
"license": "MIT",
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index 07f85a0e8b..12e9d72dd3 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -24,6 +24,7 @@
"release-android-bundle": "cd native/android && ./gradlew bundleRelease --no-daemon"
},
"devDependencies": {
+ "@types/react": "^18.2.39",
"fonteditor-core": "^2.1.11",
"listr": "^0.14.3",
"otplib": "12.0.1",
@@ -37,19 +38,20 @@
"dependencies": {
"@notesnook/common": "file:../../packages/common",
"@notesnook/core": "file:../../packages/core",
+ "@notesnook/crypto": "file:../../packages/crypto",
"@notesnook/editor": "file:../../packages/editor",
"@notesnook/editor-mobile": "file:../../packages/editor-mobile",
"@notesnook/intl": "file:../../packages/intl",
"@notesnook/logger": "file:../../packages/logger",
"@notesnook/theme": "file:../../packages/theme",
"@notesnook/themes-server": "file:../../servers/themes",
- "@notesnook/crypto": "file:../../packages/crypto",
- "diffblazer": "^1.0.1",
- "react": "18.2.0",
- "react-native": "0.74.5",
+ "@tanstack/react-query": "^4.36.1",
"@trpc/client": "^10.45.2",
"@trpc/react-query": "^10.45.2",
"@trpc/server": "^10.45.2",
- "@tanstack/react-query": "^4.36.1"
+ "@types/validator": "^13.12.2",
+ "diffblazer": "^1.0.1",
+ "react": "18.2.0",
+ "react-native": "0.74.5"
}
-}
\ No newline at end of file
+}
diff --git a/apps/mobile/share/search.tsx b/apps/mobile/share/search.tsx
index b6f5d46164..90f2f46421 100644
--- a/apps/mobile/share/search.tsx
+++ b/apps/mobile/share/search.tsx
@@ -496,6 +496,7 @@ export const Search = ({
const tagId = await db.tags.add({
title: searchKeyword
});
+ if (!tagId) return;
SearchSetters.selectTags(tagId);
onSearch();
checkQueryExists(searchKeyword);
diff --git a/apps/mobile/tsconfig.json b/apps/mobile/tsconfig.json
index 815fbc48fa..d2aad52bc8 100644
--- a/apps/mobile/tsconfig.json
+++ b/apps/mobile/tsconfig.json
@@ -20,5 +20,5 @@
"maxNodeModuleJsDepth": 5,
"downlevelIteration": true
},
- "exclude": ["native"]
+ "exclude": ["native", "e2e"]
}
diff --git a/packages/core/src/api/index.ts b/packages/core/src/api/index.ts
index 5301da7bef..0f2533f5bd 100644
--- a/packages/core/src/api/index.ts
+++ b/packages/core/src/api/index.ts
@@ -189,7 +189,7 @@ class Database {
tokenManager = new TokenManager(this.kv);
mfa = new MFAManager(this.tokenManager);
subscriptions = new Subscriptions(this.tokenManager);
- offers = new Offers();
+ offers = Offers;
debug = new Debug();
pricing = Pricing;