mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 11:47:54 +01:00
refactor
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
e2e
|
||||
html
|
||||
ios
|
||||
android
|
||||
native
|
||||
rn-build-deps
|
||||
.github
|
||||
patches
|
||||
|
||||
5
apps/mobile/.gitignore
vendored
5
apps/mobile/.gitignore
vendored
@@ -7,9 +7,14 @@
|
||||
build_cache/
|
||||
.yarnrc
|
||||
.npmrc
|
||||
yarnrc.yml
|
||||
.yarn
|
||||
artifacts/
|
||||
|
||||
# Xcode
|
||||
#
|
||||
native/ios/Pods
|
||||
native/ios/DerivedData
|
||||
build/
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import RNBootSplash from 'react-native-bootsplash';
|
||||
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
||||
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { Dialog } from './src/components/dialog';
|
||||
import Launcher from './src/components/launcher';
|
||||
import { Issue } from './src/components/sheets/github/issue';
|
||||
import { ApplicationHolder } from './src/navigation';
|
||||
import Notifications from './src/services/notifications';
|
||||
import SettingsService from './src/services/settings';
|
||||
import { TipManager } from './src/services/tip-manager';
|
||||
import { useUserStore } from './src/stores/use-user-store';
|
||||
import { useAppEvents } from './src/utils/hooks/use-app-events';
|
||||
|
||||
const error =
|
||||
stack => `Please let us know what happened. What steps we can take to reproduce the issue here.
|
||||
|
||||
_______________________________
|
||||
Stacktrace: ${stack}`;
|
||||
|
||||
class ExceptionHandler extends React.Component {
|
||||
state = {
|
||||
hasError: false,
|
||||
error: null
|
||||
};
|
||||
|
||||
static getDerivedStateFromError(error) {
|
||||
return { hasError: true, error: error };
|
||||
}
|
||||
componentDidCatch(error, errorInfo) {
|
||||
// A custom error logging function
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
RNBootSplash.hide();
|
||||
}
|
||||
|
||||
render() {
|
||||
return this.state.hasError ? (
|
||||
<SafeAreaProvider>
|
||||
<SafeAreaView
|
||||
style={{
|
||||
flex: 1,
|
||||
paddingTop: 10
|
||||
}}
|
||||
>
|
||||
<Issue
|
||||
defaultBody={error(this.state.error?.stack)}
|
||||
defaultTitle={this.state.error?.title || 'Unknown Error'}
|
||||
issueTitle="An exception occured"
|
||||
/>
|
||||
<Dialog />
|
||||
</SafeAreaView>
|
||||
</SafeAreaProvider>
|
||||
) : (
|
||||
this.props.children
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SettingsService.init();
|
||||
SettingsService.checkOrientation();
|
||||
const App = () => {
|
||||
useAppEvents();
|
||||
useEffect(() => {
|
||||
let { appLockMode } = SettingsService.get();
|
||||
if (appLockMode && appLockMode !== 'none') {
|
||||
useUserStore.getState().setVerifyUser(true);
|
||||
}
|
||||
setTimeout(() => {
|
||||
SettingsService.onFirstLaunch();
|
||||
Notifications.get();
|
||||
TipManager.init();
|
||||
}, 100);
|
||||
}, []);
|
||||
return (
|
||||
<GestureHandlerRootView
|
||||
style={{
|
||||
flex: 1
|
||||
}}
|
||||
>
|
||||
<SafeAreaProvider>
|
||||
<ApplicationHolder />
|
||||
<Launcher />
|
||||
</SafeAreaProvider>
|
||||
</GestureHandlerRootView>
|
||||
);
|
||||
};
|
||||
|
||||
const AppWithErrorBoundry = () => {
|
||||
return (
|
||||
<ExceptionHandler>
|
||||
<App />
|
||||
</ExceptionHandler>
|
||||
);
|
||||
};
|
||||
|
||||
export default AppWithErrorBoundry;
|
||||
@@ -1 +1,45 @@
|
||||
# notesnook-mobile
|
||||
# Notesnook for Android & iOS
|
||||
|
||||
The Notesnook mobile app is developed with React Native, helping us to keep a shared codebase for iOS and Android apps and provide great feature parity on both platforms.
|
||||
|
||||
## Releases
|
||||
|
||||
Android and iOS apps can be downloaded from their respective appstores.
|
||||
|
||||
<a href="https://play.google.com/store/apps/details?id=chat.rocket.android">
|
||||
<img alt="Download on Google Play" src="https://play.google.com/intl/en_us/badges/images/badge_new.png" height=43>
|
||||
</a>
|
||||
<a href="https://apps.apple.com/us/app/notesnook-take-private-notes/id1544027013">
|
||||
<img alt="Download on App Store" src="https://user-images.githubusercontent.com/7317008/43209852-4ca39622-904b-11e8-8ce1-cdc3aee76ae9.png" height=43>
|
||||
</a>
|
||||
<a href="https://f-droid.org/packages/YOUR.APP.ID">
|
||||
<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
|
||||
alt="Get it on F-Droid"
|
||||
height="43">
|
||||
</a>
|
||||
|
||||
Alternatively on android releases are also available on [Github Releases](https://github.com/streetwriters/notesnook/releases).
|
||||
|
||||
## Architecture overview
|
||||
|
||||
The app codebase is distributed over two primary directories. `native/` and `app/`.
|
||||
|
||||
- `native/`: Includes `android/` and `ios/` folders and everything related to react native core functionality like bundling, development and packaging. Any react-native dependency that has native code i.e android & ios folders, is installed here.
|
||||
|
||||
- `app/`: Includes all the app code other than the native part. All JS only dependencies are installed here.
|
||||
- `components/`: Each component serves a specific purpose in the app UI, for example the `Paragraph` component is used to render paragraphs in the app and a `Header` component is used to render a `header` on all screens.
|
||||
- `common/`: Features that have integral role in app functionality, for example, notesnook core is initialized here.
|
||||
- `hooks/`: Hooks for different app logic
|
||||
- `navigation/`: Includes app navigation specific code. Here the app navigation, editor & side menu are rendered side by side in fluid tabs.
|
||||
- `screens`: Navigator screens.
|
||||
- `services`: Parts of code that do a specific function, for example, the `sync` service is responsibe for running Sync from anywhere in the app.
|
||||
- `stores`: We use `zustand` for global state management in the app. There are multiple stores that provide the state for different parts of the app.
|
||||
- `utils`: General purpose stuff such as constant values, utility functions etc.
|
||||
|
||||
There are several other folders at the root:
|
||||
|
||||
- `share/`: Code for the Share Extension and Android widget.
|
||||
- `e2e/`: Detox End to end tests
|
||||
- `patches/`: Patches for various react native dependencies.
|
||||
|
||||
## Running the app locally
|
||||
|
||||
@@ -2,13 +2,21 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import 'react-native';
|
||||
import React from 'react';
|
||||
import App from '../App';
|
||||
|
||||
import 'react-native';
|
||||
// Note: test renderer must be required after react-native.
|
||||
import renderer from 'react-test-renderer';
|
||||
import Heading from '../app/components/ui/typography/heading';
|
||||
import Paragraph from '../app/components/ui/typography/paragraph';
|
||||
|
||||
it('renders correctly', () => {
|
||||
renderer.create(<App />);
|
||||
it('Heading renders correctly', done => {
|
||||
let instance = renderer.create(<Heading>Heading</Heading>);
|
||||
expect(instance.root.props.children).toBe('Heading');
|
||||
done();
|
||||
});
|
||||
|
||||
it('Paragraph renders correctly', done => {
|
||||
let instance = renderer.create(<Paragraph>Paragraph</Paragraph>);
|
||||
expect(instance.root.props.children).toBe('Paragraph');
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
1. Determine who your customer is
|
||||
2. Determine the persona you want to take on to appeal to that customer
|
||||
3. Write emotional ad copy from that persona
|
||||
|
||||
|
||||
Your privacy is at risk
|
||||
Stop giving them so much
|
||||
Your data is not for sale
|
||||
Say NO to privacy invasive apps
|
||||
Keep all intruders away
|
||||
Take the first step towards privacy
|
||||
|
||||
Password protected note taking app for journaling & daily notes with secure sync
|
||||
Take private notes, make lists, capture ideas and sync them anywhere.
|
||||
|
||||
to-do,list,markdown,note,draft,locked,secret,journal,memo,thought,encrypted,notebook,writing,planner
|
||||
|
||||
// Title
|
||||
keywords:
|
||||
online notes,
|
||||
online note taking,
|
||||
note taking
|
||||
:::::
|
||||
Notesnook - Online note taking
|
||||
|
||||
// Short description
|
||||
keywords:
|
||||
online notepad,
|
||||
diary with lock,
|
||||
private notes,
|
||||
notes writer,
|
||||
personal diary
|
||||
online journaling,
|
||||
@@ -1,2 +0,0 @@
|
||||
!fonts/*
|
||||
*
|
||||
@@ -1,7 +0,0 @@
|
||||
- Added /date, /time & /now shortcuts in editor
|
||||
- Fix exporting to markdown not working
|
||||
- Fix app crashes after export on some devices
|
||||
- Fix glitches when opening note widget
|
||||
- Fix + button in header not working on tablets
|
||||
|
||||
Thank you for using Notesnook!
|
||||
@@ -1,10 +0,0 @@
|
||||
rootProject.name = 'Notesnook'
|
||||
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
|
||||
include ':app'
|
||||
includeBuild('../node_modules/react-native-gradle-plugin')
|
||||
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
|
||||
include(":ReactAndroid")
|
||||
project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid');
|
||||
include(":ReactAndroid:hermes-engine")
|
||||
project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
|
||||
}
|
||||
42
apps/mobile/app/app.js
Normal file
42
apps/mobile/app/app.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
||||
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
||||
import { withErrorBoundry } from './components/exception-handler';
|
||||
import Launcher from './components/launcher';
|
||||
import { ApplicationHolder } from './navigation';
|
||||
import Notifications from './services/notifications';
|
||||
import SettingsService from './services/settings';
|
||||
import { TipManager } from './services/tip-manager';
|
||||
import { useUserStore } from './stores/use-user-store';
|
||||
import { useAppEvents } from './hooks/use-app-events';
|
||||
|
||||
SettingsService.init();
|
||||
SettingsService.checkOrientation();
|
||||
const App = () => {
|
||||
useAppEvents();
|
||||
useEffect(() => {
|
||||
let { appLockMode } = SettingsService.get();
|
||||
if (appLockMode && appLockMode !== 'none') {
|
||||
useUserStore.getState().setVerifyUser(true);
|
||||
}
|
||||
setTimeout(() => {
|
||||
SettingsService.onFirstLaunch();
|
||||
Notifications.get();
|
||||
TipManager.init();
|
||||
}, 100);
|
||||
}, []);
|
||||
return (
|
||||
<GestureHandlerRootView
|
||||
style={{
|
||||
flex: 1
|
||||
}}
|
||||
>
|
||||
<SafeAreaProvider>
|
||||
<ApplicationHolder />
|
||||
<Launcher />
|
||||
</SafeAreaProvider>
|
||||
</GestureHandlerRootView>
|
||||
);
|
||||
};
|
||||
|
||||
export default withErrorBoundry(App, 'App');
|
||||
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
@@ -3,10 +3,11 @@ import { initalize, logger as dbLogger } from '@streetwriters/notesnook-core/log
|
||||
import { Platform } from 'react-native';
|
||||
import { MMKVLoader } from 'react-native-mmkv-storage';
|
||||
import filesystem from '../filesystem';
|
||||
import EventSource from '../sse/even-source-ios';
|
||||
import AndroidEventSource from '../sse/event-source';
|
||||
import EventSource from '../../utils/sse/even-source-ios';
|
||||
import AndroidEventSource from '../../utils/sse/event-source';
|
||||
import Storage, { KV } from './storage';
|
||||
const LoggerStorage = new MMKVLoader().withInstanceID('notesnook_logs').initialize();
|
||||
console.log(LoggerStorage);
|
||||
initalize(new KV(LoggerStorage));
|
||||
export const DatabaseLogger = dbLogger;
|
||||
|
||||
@@ -8,10 +8,10 @@ import PremiumService from '../../services/premium';
|
||||
import { useAttachmentStore } from '../../stores/use-attachment-store';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { formatBytes } from '../../utils';
|
||||
import { db } from '../../utils/database';
|
||||
import { db } from '../../common/database';
|
||||
import { eCloseAttachmentDialog, eCloseProgressDialog } from '../../utils/events';
|
||||
import filesystem from '../../utils/filesystem';
|
||||
import { useAttachmentProgress } from '../../utils/hooks/use-attachment-progress';
|
||||
import filesystem from '../../common/filesystem';
|
||||
import { useAttachmentProgress } from '../../hooks/use-attachment-progress';
|
||||
import { SIZE } from '../../utils/size';
|
||||
import { sleep } from '../../utils/time';
|
||||
import { Dialog } from '../dialog';
|
||||
@@ -4,8 +4,8 @@ import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
import { useAttachmentStore } from '../../stores/use-attachment-store';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { formatBytes } from '../../utils';
|
||||
import { db } from '../../utils/database';
|
||||
import { useAttachmentProgress } from '../../utils/hooks/use-attachment-progress';
|
||||
import { db } from '../../common/database';
|
||||
import { useAttachmentProgress } from '../../hooks/use-attachment-progress';
|
||||
import { SIZE } from '../../utils/size';
|
||||
import SheetProvider from '../sheet-provider';
|
||||
import { IconButton } from '../ui/icon-button';
|
||||
@@ -4,9 +4,9 @@ import { FlatList } from 'react-native-gesture-handler';
|
||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/event-manager';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { db } from '../../utils/database';
|
||||
import { db } from '../../common/database';
|
||||
import { eCloseAttachmentDialog, eOpenAttachmentsDialog } from '../../utils/events';
|
||||
import filesystem from '../../utils/filesystem';
|
||||
import filesystem from '../../common/filesystem';
|
||||
import { SIZE } from '../../utils/size';
|
||||
import DialogHeader from '../dialog/dialog-header';
|
||||
import { Toast } from '../toast';
|
||||
@@ -3,7 +3,7 @@ import { View } from 'react-native';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { useUserStore } from '../../stores/use-user-store';
|
||||
import { eSendEvent, presentSheet, ToastEvent } from '../../services/event-manager';
|
||||
import { db } from '../../utils/database';
|
||||
import { db } from '../../common/database';
|
||||
import { eCloseProgressDialog } from '../../utils/events';
|
||||
import { Button } from '../ui/button';
|
||||
import DialogHeader from '../dialog/dialog-header';
|
||||
@@ -5,7 +5,7 @@ import { DDS } from '../../services/device-detection';
|
||||
import { ToastEvent } from '../../services/event-manager';
|
||||
import SettingsService from '../../services/settings';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { db } from '../../utils/database';
|
||||
import { db } from '../../common/database';
|
||||
import DialogHeader from '../dialog/dialog-header';
|
||||
import { Button } from '../ui/button';
|
||||
import { IconButton } from '../ui/icon-button';
|
||||
@@ -3,7 +3,7 @@ import { View } from 'react-native';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { tabBarRef } from '../../utils/global-refs';
|
||||
import { useNavigationFocus } from '../../utils/hooks/use-navigation-focus';
|
||||
import { useNavigationFocus } from '../../hooks/use-navigation-focus';
|
||||
import { Toast } from '../toast';
|
||||
import { initialAuthMode } from './common';
|
||||
import { Login } from './login';
|
||||
@@ -9,7 +9,7 @@ import PremiumService from '../../services/premium';
|
||||
import SettingsService from '../../services/settings';
|
||||
import { useUserStore } from '../../stores/use-user-store';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { db } from '../../utils/database';
|
||||
import { db } from '../../common/database';
|
||||
import { eCloseLoginDialog } from '../../utils/events';
|
||||
import { SIZE } from '../../utils/size';
|
||||
import { sleep } from '../../utils/time';
|
||||
@@ -13,8 +13,8 @@ import {
|
||||
import { clearMessage } from '../../services/message';
|
||||
import PremiumService from '../../services/premium';
|
||||
import Sync from '../../services/sync';
|
||||
import { db } from '../../utils/database';
|
||||
import { MMKV } from '../../utils/database/mmkv';
|
||||
import { db } from '../../common/database';
|
||||
import { MMKV } from '../../common/database/mmkv';
|
||||
import { SIZE } from '../../utils/size';
|
||||
import { sleep } from '../../utils/time';
|
||||
import { IconButton } from '../ui/icon-button';
|
||||
@@ -9,8 +9,8 @@ import PremiumService from '../../services/premium';
|
||||
import SettingsService from '../../services/settings';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { useUserStore } from '../../stores/use-user-store';
|
||||
import umami from '../../utils/analytics';
|
||||
import { db } from '../../utils/database';
|
||||
import umami from '../../common/analytics';
|
||||
import { db } from '../../common/database';
|
||||
import { eCloseLoginDialog } from '../../utils/events';
|
||||
import { openLinkInBrowser } from '../../utils/functions';
|
||||
import { SIZE } from '../../utils/size';
|
||||
@@ -3,7 +3,7 @@ import { View } from 'react-native';
|
||||
import { eSendEvent, presentSheet } from '../../services/event-manager';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { eCloseProgressDialog } from '../../utils/events';
|
||||
import useTimer from '../../utils/hooks/use-timer';
|
||||
import useTimer from '../../hooks/use-timer';
|
||||
import { SIZE } from '../../utils/size';
|
||||
import { Button } from '../ui/button';
|
||||
import { IconButton } from '../ui/icon-button';
|
||||
@@ -12,7 +12,7 @@ import { PressableButton } from '../ui/pressable';
|
||||
import Seperator from '../ui/seperator';
|
||||
import Heading from '../ui/typography/heading';
|
||||
import Paragraph from '../ui/typography/paragraph';
|
||||
import { db } from '../../utils/database/index';
|
||||
import { db } from '../../common/database/index';
|
||||
import { ToastEvent } from '../../services/event-manager';
|
||||
|
||||
const TwoFactorVerification = ({ onMfaLogin, mfaInfo }) => {
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { KeyboardAvoidingView, Platform, SafeAreaView } from 'react-native';
|
||||
import { useSettingStore } from '../../stores/use-setting-store';
|
||||
import useIsFloatingKeyboard from '../../utils/hooks/use-is-floating-keyboard';
|
||||
import useIsFloatingKeyboard from '../../hooks/use-is-floating-keyboard';
|
||||
import { Header } from '../header';
|
||||
import SelectionHeader from '../selection-header';
|
||||
export const Container = ({ children }) => {
|
||||
@@ -2,7 +2,7 @@ import React from 'react';
|
||||
import { ViewProps } from 'react-native';
|
||||
import Animated, { FadeOutUp } from 'react-native-reanimated';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { useDelayLayout } from '../../utils/hooks/use-delay-layout';
|
||||
import { useDelayLayout } from '../../hooks/use-delay-layout';
|
||||
import { DefaultPlaceholder } from './default-placeholder';
|
||||
import { SettingsPlaceholder } from './settings-placeholder';
|
||||
|
||||
@@ -33,7 +33,7 @@ export default function DelayLayout({ animated = true, ...props }: IDelayLayoutP
|
||||
paddingTop: 20
|
||||
}}
|
||||
>
|
||||
<Placeholder color={props.color} />
|
||||
<Placeholder color={props.color || colors.accent} />
|
||||
</Animated.View>
|
||||
) : (
|
||||
<>{props.children}</>
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
View
|
||||
} from 'react-native';
|
||||
import { useSettingStore } from '../../stores/use-setting-store';
|
||||
import useIsFloatingKeyboard from '../../utils/hooks/use-is-floating-keyboard';
|
||||
import useIsFloatingKeyboard from '../../hooks/use-is-floating-keyboard';
|
||||
import { BouncingView } from '../ui/transitions/bouncing-view';
|
||||
|
||||
const BaseDialog = ({
|
||||
@@ -4,7 +4,7 @@ import { Transition, Transitioning, TransitioningView } from 'react-native-reani
|
||||
import { useMenuStore } from '../../../stores/use-menu-store';
|
||||
import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../../services/event-manager';
|
||||
import Navigation from '../../../services/navigation';
|
||||
import { db } from '../../../utils/database';
|
||||
import { db } from '../../../common/database';
|
||||
import { eCloseAddTopicDialog, eOpenAddTopicDialog } from '../../../utils/events';
|
||||
import { sleep } from '../../../utils/time';
|
||||
import BaseDialog from '../../dialog/base-dialog';
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
import Navigation from '../../../services/navigation';
|
||||
import SearchService from '../../../services/search';
|
||||
import { getElevation, toTXT } from '../../../utils';
|
||||
import { db } from '../../../utils/database';
|
||||
import { db } from '../../../common/database';
|
||||
import {
|
||||
eClearEditor,
|
||||
eCloseActionSheet,
|
||||
69
apps/mobile/app/components/exception-handler/index.tsx
Normal file
69
apps/mobile/app/components/exception-handler/index.tsx
Normal file
@@ -0,0 +1,69 @@
|
||||
import React from 'react';
|
||||
import RNBootSplash from 'react-native-bootsplash';
|
||||
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
|
||||
import { Dialog } from '../dialog';
|
||||
import { Issue } from '../sheets/github/issue';
|
||||
|
||||
const error = (
|
||||
stack: string,
|
||||
component: string
|
||||
) => `Please let us know what happened. What steps we can take to reproduce the issue here.
|
||||
|
||||
_______________________________
|
||||
Stacktrace: In ${component}::${stack}`;
|
||||
|
||||
class ExceptionHandler extends React.Component<{ children: React.ReactNode; component: string }> {
|
||||
state: {
|
||||
error: {
|
||||
title: string;
|
||||
stack: string;
|
||||
} | null;
|
||||
hasError: boolean;
|
||||
} = {
|
||||
hasError: false,
|
||||
error: null
|
||||
};
|
||||
|
||||
static getDerivedStateFromError(error: Error) {
|
||||
return { hasError: true, error: error };
|
||||
}
|
||||
componentDidCatch(error: Error, errorInfo: any) {
|
||||
// A custom error logging function
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
RNBootSplash.hide();
|
||||
}
|
||||
|
||||
render() {
|
||||
return this.state.hasError ? (
|
||||
<SafeAreaProvider>
|
||||
<SafeAreaView
|
||||
style={{
|
||||
flex: 1,
|
||||
paddingTop: 10
|
||||
}}
|
||||
>
|
||||
<Issue
|
||||
defaultBody={error(this.state.error?.stack || '', this.props.component)}
|
||||
defaultTitle={this.state.error?.title || 'Unknown Error'}
|
||||
issueTitle="An exception occured"
|
||||
/>
|
||||
<Dialog />
|
||||
</SafeAreaView>
|
||||
</SafeAreaProvider>
|
||||
) : (
|
||||
this.props.children
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export const withErrorBoundry = (Element: React.ElementType, name: string) => {
|
||||
return () => {
|
||||
return (
|
||||
<ExceptionHandler component={name}>
|
||||
<Element />
|
||||
</ExceptionHandler>
|
||||
);
|
||||
};
|
||||
};
|
||||
@@ -4,7 +4,7 @@ import Notebook from '../../screens/notebook';
|
||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/event-manager';
|
||||
import useNavigationStore from '../../stores/use-navigation-store';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { db } from '../../utils/database';
|
||||
import { db } from '../../common/database';
|
||||
import { eScrollEvent } from '../../utils/events';
|
||||
import { SIZE } from '../../utils/size';
|
||||
import Heading from '../ui/typography/heading';
|
||||
@@ -7,9 +7,9 @@ import SettingsService from '../../services/settings';
|
||||
import { useSettingStore } from '../../stores/use-setting-store';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { getElevation } from '../../utils';
|
||||
import umami from '../../utils/analytics';
|
||||
import umami from '../../common/analytics';
|
||||
import { tabBarRef } from '../../utils/global-refs';
|
||||
import { useNavigationFocus } from '../../utils/hooks/use-navigation-focus';
|
||||
import { useNavigationFocus } from '../../hooks/use-navigation-focus';
|
||||
import { SIZE } from '../../utils/size';
|
||||
import { Button } from '../ui/button';
|
||||
import { SvgView } from '../ui/svg';
|
||||
@@ -6,7 +6,7 @@ import Navigation from '../../services/navigation';
|
||||
import SettingsService from '../../services/settings';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { getElevation } from '../../utils';
|
||||
import umami from '../../utils/analytics';
|
||||
import umami from '../../common/analytics';
|
||||
import { eOpenLoginDialog } from '../../utils/events';
|
||||
import { SIZE } from '../../utils/size';
|
||||
import { AuthMode } from '../auth';
|
||||
@@ -17,8 +17,8 @@ import { useNoteStore } from '../../stores/use-notes-store';
|
||||
import { useSettingStore } from '../../stores/use-setting-store';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { useUserStore } from '../../stores/use-user-store';
|
||||
import { DatabaseLogger, db, loadDatabase } from '../../utils/database';
|
||||
import { MMKV } from '../../utils/database/mmkv';
|
||||
import { DatabaseLogger, db, loadDatabase } from '../../common/database';
|
||||
import { MMKV } from '../../common/database/mmkv';
|
||||
import { eOpenAnnouncementDialog } from '../../utils/events';
|
||||
import { tabBarRef } from '../../utils/global-refs';
|
||||
import { SIZE } from '../../utils/size';
|
||||
@@ -35,7 +35,7 @@ import { SvgView } from '../ui/svg';
|
||||
import Heading from '../ui/typography/heading';
|
||||
import Paragraph from '../ui/typography/paragraph';
|
||||
import { Walkthrough } from '../walkthroughs';
|
||||
import { useAppState } from '../../utils/hooks/use-app-state';
|
||||
import { useAppState } from '../../hooks/use-app-state';
|
||||
|
||||
const Launcher = React.memo(
|
||||
() => {
|
||||
@@ -4,7 +4,7 @@ import { useThemeStore } from '../../../stores/use-theme-store';
|
||||
import { useMenuStore } from '../../../stores/use-menu-store';
|
||||
import { ToastEvent } from '../../../services/event-manager';
|
||||
import { getTotalNotes } from '../../../utils';
|
||||
import { db } from '../../../utils/database';
|
||||
import { db } from '../../../common/database';
|
||||
import { SIZE } from '../../../utils/size';
|
||||
import { IconButton } from '../../ui/icon-button';
|
||||
import Heading from '../../ui/typography/heading';
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
import SettingsService from '../../../services/settings';
|
||||
import { GROUP } from '../../../utils/constants';
|
||||
import { COLORS_NOTE } from '../../../utils/color-scheme';
|
||||
import { db } from '../../../utils/database';
|
||||
import { db } from '../../../common/database';
|
||||
import { eOpenJumpToDialog } from '../../../utils/events';
|
||||
import { SIZE } from '../../../utils/size';
|
||||
import { IconButton } from '../../ui/icon-button';
|
||||
@@ -9,7 +9,7 @@ import useNavigationStore from '../../../stores/use-navigation-store';
|
||||
import { useSettingStore } from '../../../stores/use-setting-store';
|
||||
import { useThemeStore } from '../../../stores/use-theme-store';
|
||||
import { COLORS_NOTE } from '../../../utils/color-scheme';
|
||||
import { db } from '../../../utils/database';
|
||||
import { db } from '../../../common/database';
|
||||
import { SIZE } from '../../../utils/size';
|
||||
import { Properties } from '../../properties';
|
||||
import { Button } from '../../ui/button';
|
||||
@@ -8,7 +8,7 @@ import { DDS } from '../../../services/device-detection';
|
||||
import { eSendEvent, openVault, ToastEvent } from '../../../services/event-manager';
|
||||
import Navigation from '../../../services/navigation';
|
||||
import { history } from '../../../utils';
|
||||
import { db } from '../../../utils/database';
|
||||
import { db } from '../../../common/database';
|
||||
import { eOnLoadNote, eShowMergeDialog } from '../../../utils/events';
|
||||
import { tabBarRef } from '../../../utils/global-refs';
|
||||
import { presentDialog } from '../../dialog/functions';
|
||||
@@ -7,7 +7,7 @@ import Navigation from '../../../services/navigation';
|
||||
import { useSelectionStore } from '../../../stores/use-selection-store';
|
||||
import { useTrashStore } from '../../../stores/use-trash-store';
|
||||
import { history } from '../../../utils';
|
||||
import { db } from '../../../utils/database';
|
||||
import { db } from '../../../common/database';
|
||||
import { presentDialog } from '../../dialog/functions';
|
||||
import SelectionWrapper from '../selection-wrapper';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useMenuStore } from '../../../stores/use-menu-store';
|
||||
import { useNotebookStore } from '../../../stores/use-notebook-store';
|
||||
import { useThemeStore } from '../../../stores/use-theme-store';
|
||||
import { dWidth, getElevation, toTXT } from '../../../utils';
|
||||
import { db } from '../../../utils/database';
|
||||
import { db } from '../../../common/database';
|
||||
import { deleteItems } from '../../../utils/functions';
|
||||
import { presentDialog } from '../../dialog/functions';
|
||||
import { Button } from '../../ui/button';
|
||||
@@ -3,7 +3,7 @@ import { View } from 'react-native';
|
||||
import { notesnook } from '../../../../e2e/test.ids';
|
||||
import { TaggedNotes } from '../../../screens/notes/tagged';
|
||||
import { useThemeStore } from '../../../stores/use-theme-store';
|
||||
import { db } from '../../../utils/database';
|
||||
import { db } from '../../../common/database';
|
||||
import { SIZE } from '../../../utils/size';
|
||||
import { Properties } from '../../properties';
|
||||
import { IconButton } from '../../ui/icon-button';
|
||||
@@ -5,7 +5,7 @@ import { notesnook } from '../../../e2e/test.ids';
|
||||
import { eSendEvent } from '../../services/event-manager';
|
||||
import Sync from '../../services/sync';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { db } from '../../utils/database';
|
||||
import { db } from '../../common/database';
|
||||
import { eScrollEvent } from '../../utils/events';
|
||||
import { tabBarRef } from '../../utils/global-refs';
|
||||
import JumpToSectionDialog from '../dialogs/jump-to-section';
|
||||
@@ -11,7 +11,7 @@ import Navigation from '../../services/navigation';
|
||||
import Sync from '../../services/sync';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { dHeight } from '../../utils';
|
||||
import { db } from '../../utils/database';
|
||||
import { db } from '../../common/database';
|
||||
import { eOnLoadNote, eShowMergeDialog } from '../../utils/events';
|
||||
import { SIZE } from '../../utils/size';
|
||||
import { timeConverter } from '../../utils/time';
|
||||
@@ -4,7 +4,7 @@ import { FlatList } from 'react-native-gesture-handler';
|
||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { presentSheet } from '../../services/event-manager';
|
||||
import { db } from '../../utils/database';
|
||||
import { db } from '../../common/database';
|
||||
import { openLinkInBrowser } from '../../utils/functions';
|
||||
import { SIZE } from '../../utils/size';
|
||||
import { timeConverter, timeSince } from '../../utils/time';
|
||||
@@ -7,7 +7,7 @@ import { eSendEvent, ToastEvent } from '../../services/event-manager';
|
||||
import Navigation from '../../services/navigation';
|
||||
import { useEditorStore } from '../../stores/use-editor-store';
|
||||
import { useThemeStore } from '../../stores/use-theme-store';
|
||||
import { db } from '../../utils/database';
|
||||
import { db } from '../../common/database';
|
||||
import { eCloseProgressDialog, eOnLoadNote } from '../../utils/events';
|
||||
import DialogHeader from '../dialog/dialog-header';
|
||||
import { Button } from '../ui/button';
|
||||
@@ -7,7 +7,7 @@ import { DDS } from '../../services/device-detection';
|
||||
import { eSendEvent, presentSheet } from '../../services/event-manager';
|
||||
import PremiumService from '../../services/premium';
|
||||
import { getElevation } from '../../utils';
|
||||
import { db } from '../../utils/database';
|
||||
import { db } from '../../common/database';
|
||||
import {
|
||||
eClosePremiumDialog,
|
||||
eCloseProgressDialog,
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
} from '../../utils/events';
|
||||
import { SIZE } from '../../utils/size';
|
||||
import { sleep } from '../../utils/time';
|
||||
import umami from '../../utils/analytics';
|
||||
import umami from '../../common/analytics';
|
||||
import { IconButton } from '../ui/icon-button';
|
||||
import { AuthMode } from '../auth';
|
||||
import { Button } from '../ui/button';
|
||||
@@ -30,7 +30,7 @@ import { Walkthrough } from '../walkthroughs';
|
||||
import { features } from './features';
|
||||
import { Group } from './group';
|
||||
import { PricingPlans } from './pricing-plans';
|
||||
import { usePricing } from '../../utils/hooks/use-pricing';
|
||||
import { usePricing } from '../../hooks/use-pricing';
|
||||
|
||||
export const Component = ({ close, promo, getRef }) => {
|
||||
const colors = useThemeStore(state => state.colors);
|
||||
@@ -14,7 +14,7 @@ import Heading from '../ui/typography/heading';
|
||||
import Paragraph from '../ui/typography/paragraph';
|
||||
import { CompactFeatures } from './compact-features';
|
||||
import { Offer } from './offer';
|
||||
import { usePricing } from '../../utils/hooks/use-pricing';
|
||||
import { usePricing } from '../../hooks/use-pricing';
|
||||
|
||||
export const Expiring = () => {
|
||||
const colors = useThemeStore(state => state.colors);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user