mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-24 07:29:30 +01:00
bug fixes
This commit is contained in:
@@ -1,25 +1,19 @@
|
||||
import React, {useState} from 'react';
|
||||
import {View} from 'react-native';
|
||||
import React, { useState } from 'react';
|
||||
import { View } from 'react-native';
|
||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
import {notesnook} from '../../../e2e/test.ids';
|
||||
import {useTracked} from '../../provider';
|
||||
import {Actions} from '../../provider/Actions';
|
||||
import { notesnook } from '../../../e2e/test.ids';
|
||||
import { useMenuStore } from '../../provider/stores';
|
||||
import {DDS} from '../../services/DeviceDetection';
|
||||
import {eSendEvent, sendNoteEditedEvent} from '../../services/EventManager';
|
||||
import { DDS } from '../../services/DeviceDetection';
|
||||
import { eSendEvent } from '../../services/EventManager';
|
||||
import Navigation from '../../services/Navigation';
|
||||
import PremiumService from '../../services/PremiumService';
|
||||
import {dWidth} from '../../utils';
|
||||
import {COLORS_NOTE} from '../../utils/Colors';
|
||||
import {hexToRGBA, RGB_Linear_Shade} from '../../utils/ColorUtils';
|
||||
import {db} from '../../utils/DB';
|
||||
import {eShowGetPremium, refreshNotesPage} from '../../utils/Events';
|
||||
import {SIZE} from '../../utils/SizeUtils';
|
||||
import {sleep} from '../../utils/TimeUtils';
|
||||
import {PressableButton} from '../PressableButton';
|
||||
import { dWidth } from '../../utils';
|
||||
import { COLORS_NOTE } from '../../utils/Colors';
|
||||
import { db } from '../../utils/DB';
|
||||
import { refreshNotesPage } from '../../utils/Events';
|
||||
import { SIZE } from '../../utils/SizeUtils';
|
||||
import { PressableButton } from '../PressableButton';
|
||||
|
||||
export const ActionSheetColorsSection = ({item, close}) => {
|
||||
const [, dispatch] = useTracked();
|
||||
const [note, setNote] = useState(item);
|
||||
const setColorNotes = useMenuStore(state => state.setColorNotes)
|
||||
const localRefresh = () => {
|
||||
|
||||
@@ -1,21 +1,15 @@
|
||||
import React, {createRef, useCallback, useEffect, useState} from 'react';
|
||||
import {TextInput, TouchableOpacity, View} from 'react-native';
|
||||
import {ScrollView} from 'react-native-gesture-handler';
|
||||
import {notesnook} from '../../../e2e/test.ids';
|
||||
import {useTracked} from '../../provider';
|
||||
import {Actions} from '../../provider/Actions';
|
||||
import React, { createRef, useCallback, useEffect, useState } from 'react';
|
||||
import { TextInput, TouchableOpacity, View } from 'react-native';
|
||||
import { ScrollView } from 'react-native-gesture-handler';
|
||||
import { notesnook } from '../../../e2e/test.ids';
|
||||
import { useTracked } from '../../provider';
|
||||
import {
|
||||
eSendEvent,
|
||||
sendNoteEditedEvent,
|
||||
ToastEvent,
|
||||
ToastEvent
|
||||
} from '../../services/EventManager';
|
||||
import Navigation from '../../services/Navigation';
|
||||
import {db} from '../../utils/DB';
|
||||
import {refreshNotesPage} from '../../utils/Events';
|
||||
import {SIZE} from '../../utils/SizeUtils';
|
||||
import {Button} from '../Button';
|
||||
import Heading from '../Typography/Heading';
|
||||
import Paragraph from '../Typography/Paragraph';
|
||||
import { db } from '../../utils/DB';
|
||||
import { SIZE } from '../../utils/SizeUtils';
|
||||
import { Button } from '../Button';
|
||||
|
||||
const tagsInputRef = createRef();
|
||||
let prevQuery = null;
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import {Keyboard} from 'react-native';
|
||||
import {Platform, View} from 'react-native';
|
||||
import Animated, {Easing} from 'react-native-reanimated';
|
||||
import {useTracked} from '../../provider';
|
||||
import {DDS} from '../../services/DeviceDetection';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { View } from 'react-native';
|
||||
import Animated, { Easing } from 'react-native-reanimated';
|
||||
import { useTracked } from '../../provider';
|
||||
import { DDS } from '../../services/DeviceDetection';
|
||||
import {
|
||||
eSendEvent,
|
||||
eSubscribeEvent,
|
||||
eUnSubscribeEvent,
|
||||
eUnSubscribeEvent
|
||||
} from '../../services/EventManager';
|
||||
import {dWidth, editing, getElevation} from '../../utils';
|
||||
import { dWidth, editing, getElevation } from '../../utils';
|
||||
import {
|
||||
eCloseActionSheet,
|
||||
eOpenPremiumDialog,
|
||||
eShowGetPremium,
|
||||
eShowGetPremium
|
||||
} from '../../utils/Events';
|
||||
import {SIZE} from '../../utils/SizeUtils';
|
||||
import {sleep} from '../../utils/TimeUtils';
|
||||
import {EditorWebView, post} from '../../views/Editor/Functions';
|
||||
import { SIZE } from '../../utils/SizeUtils';
|
||||
import { sleep } from '../../utils/TimeUtils';
|
||||
import { EditorWebView } from '../../views/Editor/Functions';
|
||||
import tiny from '../../views/Editor/tiny/tiny';
|
||||
import {Button} from '../Button';
|
||||
import { Button } from '../Button';
|
||||
import Heading from '../Typography/Heading';
|
||||
import Paragraph from '../Typography/Paragraph';
|
||||
|
||||
|
||||
@@ -1,19 +1,8 @@
|
||||
import React, {createRef} from 'react';
|
||||
import {
|
||||
ActionSheetIOS,
|
||||
Keyboard,
|
||||
KeyboardAvoidingView,
|
||||
Modal,
|
||||
Platform,
|
||||
SafeAreaView,
|
||||
StyleSheet,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import {Keyboard, StyleSheet, TouchableOpacity, View} from 'react-native';
|
||||
import {FlatList, TextInput} from 'react-native-gesture-handler';
|
||||
import {notesnook} from '../../../e2e/test.ids';
|
||||
import {Actions} from '../../provider/Actions';
|
||||
import { useMenuStore } from '../../provider/stores';
|
||||
import {useMenuStore} from '../../provider/stores';
|
||||
import {DDS} from '../../services/DeviceDetection';
|
||||
import {ToastEvent} from '../../services/EventManager';
|
||||
import Navigation from '../../services/Navigation';
|
||||
@@ -21,11 +10,9 @@ import {db} from '../../utils/DB';
|
||||
import {ph, pv, SIZE} from '../../utils/SizeUtils';
|
||||
import {sleep} from '../../utils/TimeUtils';
|
||||
import {ActionIcon} from '../ActionIcon';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import BaseDialog from '../Dialog/base-dialog';
|
||||
import DialogButtons from '../Dialog/dialog-buttons';
|
||||
import DialogHeader from '../Dialog/dialog-header';
|
||||
import {updateEvent} from '../DialogManager/recievers';
|
||||
import Input from '../Input';
|
||||
import {Toast} from '../Toast';
|
||||
import Paragraph from '../Typography/Paragraph';
|
||||
|
||||
@@ -3,20 +3,18 @@ import { View } from 'react-native';
|
||||
import Animated, { Easing } from 'react-native-reanimated';
|
||||
import AnimatedProgress from 'react-native-reanimated-progress-bar';
|
||||
import { useTracked } from '../../provider';
|
||||
import { Actions } from '../../provider/Actions';
|
||||
import { useFavoriteStore, useNoteStore } from '../../provider/stores';
|
||||
import {
|
||||
eSendEvent,
|
||||
eSubscribeEvent,
|
||||
eUnSubscribeEvent
|
||||
} from '../../services/EventManager';
|
||||
import { editing, InteractionManager } from '../../utils';
|
||||
import { editing } from '../../utils';
|
||||
import { changeContainerScale, ContainerScale } from '../../utils/Animations';
|
||||
import { db } from '../../utils/DB';
|
||||
import { eOpenRateDialog, eOpenSideMenu } from '../../utils/Events';
|
||||
import { MMKV } from '../../utils/mmkv';
|
||||
import { tabBarRef } from '../../utils/Refs';
|
||||
import { sleep } from '../../utils/TimeUtils';
|
||||
import SplashScreen from '../SplashScreen';
|
||||
|
||||
const scaleV = new Animated.Value(0.95);
|
||||
|
||||
@@ -4,8 +4,6 @@ import Animated from 'react-native-reanimated';
|
||||
import { useTracked } from '../../provider';
|
||||
import { ContainerScale } from '../../utils/Animations';
|
||||
import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard';
|
||||
import SelectionHeader from '../SelectionHeader';
|
||||
import { ContainerTopSection } from './ContainerTopSection';
|
||||
const AnimatedView = Animated.createAnimatedComponent(SafeAreaView);
|
||||
export const Container = ({children, root}) => {
|
||||
const [state] = useTracked();
|
||||
|
||||
@@ -9,6 +9,7 @@ export default class CustomTabs extends Component {
|
||||
this.listRef = createRef();
|
||||
this.scrollOffset = props.initialIndex === 0 ? 0 : this.props.offsets.a;
|
||||
this.page = 0;
|
||||
this.nextPage = 0;
|
||||
this.currentDrawerState = false;
|
||||
this.inputElement = createRef();
|
||||
this.keyboardState = false;
|
||||
@@ -58,6 +59,7 @@ export default class CustomTabs extends Component {
|
||||
};
|
||||
|
||||
hideKeyboardIfVisible() {
|
||||
if (this.nextPage === 1) return;
|
||||
if ((editing.keyboardState || editing.isFocused) && this.scrollOffset < this.props.offsets.b - 50) {
|
||||
editing.isFocused = false;
|
||||
editing.keyboardState = false;
|
||||
@@ -67,6 +69,13 @@ export default class CustomTabs extends Component {
|
||||
}
|
||||
|
||||
goToIndex(index, animated = true) {
|
||||
if (index === 1) {
|
||||
this.nextPage = 0;
|
||||
} else if (index === 2) {
|
||||
this.nextPage = 1
|
||||
} else {
|
||||
this.nextPage = 0;
|
||||
}
|
||||
this.listRef.current?.scrollToIndex({
|
||||
animated: animated,
|
||||
index: index,
|
||||
@@ -110,6 +119,7 @@ export default class CustomTabs extends Component {
|
||||
};
|
||||
|
||||
goToPage = page => {
|
||||
this.nextPage = page;
|
||||
if (page === 0) {
|
||||
this.scrollOffset = this.props.offsets.a;
|
||||
this.hideKeyboardIfVisible();
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
Animated,
|
||||
KeyboardAvoidingView,
|
||||
Modal,
|
||||
Platform,
|
||||
SafeAreaView,
|
||||
StyleSheet,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
TouchableOpacity
|
||||
} from 'react-native';
|
||||
import {useTracked} from '../../provider';
|
||||
import { useTracked } from '../../provider';
|
||||
import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard';
|
||||
|
||||
const BaseDialog = ({
|
||||
|
||||
@@ -84,7 +84,6 @@ const MoveNoteComponent = ({close, note, setNote}) => {
|
||||
const selectedItemsList = useSelectionStore(state => state.selectedItemsList);
|
||||
const setNotebooks = useNotebookStore(state => state.setNotebooks);
|
||||
|
||||
|
||||
const [expanded, setExpanded] = useState('');
|
||||
const [notebookInputFocused, setNotebookInputFocused] = useState(false);
|
||||
const [topicInputFocused, setTopicInputFocused] = useState(false);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import React from 'react';
|
||||
import NoteItem from '.';
|
||||
import { notesnook } from '../../../e2e/test.ids';
|
||||
import { useTracked } from '../../provider';
|
||||
import { Actions } from '../../provider/Actions';
|
||||
import { useSelectionStore } from '../../provider/stores';
|
||||
import { DDS } from '../../services/DeviceDetection';
|
||||
import { eSendEvent, openVault } from '../../services/EventManager';
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import {TouchableOpacity, View} from 'react-native';
|
||||
import React from 'react';
|
||||
import { TouchableOpacity, View } from 'react-native';
|
||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
import {notesnook} from '../../../e2e/test.ids';
|
||||
import {useTracked} from '../../provider';
|
||||
import { notesnook } from '../../../e2e/test.ids';
|
||||
import { useTracked } from '../../provider';
|
||||
import Navigation from '../../services/Navigation';
|
||||
import {getTotalNotes, history} from '../../utils';
|
||||
import {pv, SIZE} from '../../utils/SizeUtils';
|
||||
import {ActionIcon} from '../ActionIcon';
|
||||
import {ActionSheetEvent} from '../DialogManager/recievers';
|
||||
import { getTotalNotes, history } from '../../utils';
|
||||
import { SIZE } from '../../utils/SizeUtils';
|
||||
import { ActionIcon } from '../ActionIcon';
|
||||
import { ActionSheetEvent } from '../DialogManager/recievers';
|
||||
import Heading from '../Typography/Heading';
|
||||
import Paragraph from '../Typography/Paragraph';
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import {SIZE} from '../../utils/SizeUtils';
|
||||
import {sleep} from '../../utils/TimeUtils';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import {Button} from '../Button';
|
||||
import Seperator from '../Seperator';
|
||||
import {Toast} from '../Toast';
|
||||
import Heading from '../Typography/Heading';
|
||||
import Paragraph from '../Typography/Paragraph';
|
||||
@@ -30,7 +31,7 @@ const ProgressDialog = () => {
|
||||
};
|
||||
}, []);
|
||||
|
||||
const open = async (data) => {
|
||||
const open = async data => {
|
||||
setDialogData(data);
|
||||
setVisible(true);
|
||||
await sleep(1);
|
||||
@@ -62,7 +63,7 @@ const ProgressDialog = () => {
|
||||
<ActivityIndicator size={50} color={colors.accent} />
|
||||
) : dialogData?.noIcon ? null : (
|
||||
<Icon
|
||||
color={colors.accent}
|
||||
color={colors[dialogData.iconColor] || colors.accent}
|
||||
name={dialogData.icon || 'check'}
|
||||
size={50}
|
||||
/>
|
||||
@@ -82,17 +83,27 @@ const ProgressDialog = () => {
|
||||
</Paragraph>
|
||||
)}
|
||||
</View>
|
||||
{dialogData?.learnMore ? (
|
||||
<Paragraph
|
||||
style={{
|
||||
alignSelf: 'center',
|
||||
}}
|
||||
onPress={dialogData.learnMorePress}
|
||||
color={colors.icon}>
|
||||
<Icon color={colors.icon} name="information-outline" size={14} />{' '}
|
||||
{dialogData.learnMore}
|
||||
</Paragraph>
|
||||
) : null}
|
||||
<View
|
||||
style={{
|
||||
paddingHorizontal: 12,
|
||||
backgroundColor: colors.shade,
|
||||
marginBottom: 12,
|
||||
}}>
|
||||
{dialogData.valueArray &&
|
||||
dialogData.valueArray.map((v) => (
|
||||
dialogData.valueArray.map(v => (
|
||||
<Button
|
||||
title={v}
|
||||
type="transparent"
|
||||
type="gray"
|
||||
textStyle={{fontWeight: 'normal'}}
|
||||
fontSize={SIZE.sm}
|
||||
icon="check"
|
||||
@@ -113,6 +124,8 @@ const ProgressDialog = () => {
|
||||
<Button
|
||||
onPress={dialogData.action}
|
||||
title={dialogData.actionText}
|
||||
accentColor={dialogData.iconColor || 'accent'}
|
||||
accentText="light"
|
||||
fontSize={SIZE.lg}
|
||||
type="accent"
|
||||
height={50}
|
||||
@@ -122,7 +135,7 @@ const ProgressDialog = () => {
|
||||
) : null}
|
||||
|
||||
{dialogData?.actionsArray &&
|
||||
dialogData?.actionsArray.map((item) => (
|
||||
dialogData?.actionsArray.map(item => (
|
||||
<Button
|
||||
onPress={item.action}
|
||||
title={item.actionText}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Linking, Platform, View } from 'react-native';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import {Linking, Platform, View} from 'react-native';
|
||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||
import BaseDialog from '../../components/Dialog/base-dialog';
|
||||
import { useTracked } from '../../provider';
|
||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||
import { getElevation } from '../../utils';
|
||||
import { eCloseRateDialog, eOpenRateDialog } from '../../utils/Events';
|
||||
import { MMKV } from '../../utils/mmkv';
|
||||
import { SIZE } from '../../utils/SizeUtils';
|
||||
import { Button } from '../Button';
|
||||
import {useTracked} from '../../provider';
|
||||
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
|
||||
import {getElevation} from '../../utils';
|
||||
import {eCloseRateDialog, eOpenRateDialog} from '../../utils/Events';
|
||||
import {MMKV} from '../../utils/mmkv';
|
||||
import {SIZE} from '../../utils/SizeUtils';
|
||||
import {Button} from '../Button';
|
||||
import Heading from '../Typography/Heading';
|
||||
import Paragraph from '../Typography/Paragraph';
|
||||
|
||||
@@ -43,7 +43,7 @@ const RateDialog = () => {
|
||||
await MMKV.setItem(
|
||||
'askForRating',
|
||||
JSON.stringify({
|
||||
timestamp: Date.now() + (86400000 * 2)
|
||||
timestamp: Date.now() + 86400000 * 2,
|
||||
}),
|
||||
);
|
||||
setVisible(false);
|
||||
@@ -62,8 +62,9 @@ const RateDialog = () => {
|
||||
}}>
|
||||
<Heading color={colors.light}>Rate Notesnook</Heading>
|
||||
<Paragraph size={SIZE.md} color={colors.light}>
|
||||
If you find Notesnook useful, please take a moment to rate it. It
|
||||
won't take more than a minute. Thanks for your support.
|
||||
It took us a year to bring Notesnook to life, the best private note
|
||||
taking app. It will take you a moment to rate it to let us know what
|
||||
you think!
|
||||
</Paragraph>
|
||||
|
||||
<View
|
||||
@@ -87,7 +88,7 @@ const RateDialog = () => {
|
||||
await MMKV.setItem(
|
||||
'askForRating',
|
||||
JSON.stringify({
|
||||
timestamp: Date.now() + (86400000 * 2)
|
||||
timestamp: Date.now() + 86400000 * 2,
|
||||
}),
|
||||
);
|
||||
setVisible(false);
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
import React, {createRef, useEffect, useState} from 'react';
|
||||
import {ActivityIndicator, Platform, View} from 'react-native';
|
||||
import React, { createRef, useEffect, useState } from 'react';
|
||||
import { ActivityIndicator, Platform, View } from 'react-native';
|
||||
import DocumentPicker from 'react-native-document-picker';
|
||||
import {FlatList} from 'react-native-gesture-handler';
|
||||
import {useTracked} from '../../provider';
|
||||
import {Actions} from '../../provider/Actions';
|
||||
import { FlatList } from 'react-native-gesture-handler';
|
||||
import { useTracked } from '../../provider';
|
||||
import { initialize } from '../../provider/stores';
|
||||
import {
|
||||
eSubscribeEvent,
|
||||
eUnSubscribeEvent,
|
||||
ToastEvent,
|
||||
ToastEvent
|
||||
} from '../../services/EventManager';
|
||||
import {db} from '../../utils/DB';
|
||||
import {eCloseRestoreDialog, eOpenRestoreDialog} from '../../utils/Events';
|
||||
import {SIZE} from '../../utils/SizeUtils';
|
||||
import { db } from '../../utils/DB';
|
||||
import { eCloseRestoreDialog, eOpenRestoreDialog } from '../../utils/Events';
|
||||
import { SIZE } from '../../utils/SizeUtils';
|
||||
import storage from '../../utils/storage';
|
||||
import {sleep, timeConverter} from '../../utils/TimeUtils';
|
||||
import { sleep, timeConverter } from '../../utils/TimeUtils';
|
||||
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||
import {Button} from '../Button';
|
||||
import { Button } from '../Button';
|
||||
import DialogHeader from '../Dialog/dialog-header';
|
||||
import Seperator from '../Seperator';
|
||||
import Paragraph from '../Typography/Paragraph';
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { FlatList, RefreshControl } from 'react-native';
|
||||
import { useTracked } from '../../provider';
|
||||
import {
|
||||
eSendEvent
|
||||
} from '../../services/EventManager';
|
||||
import { eSendEvent } from '../../services/EventManager';
|
||||
import SettingsService from '../../services/SettingsService';
|
||||
import Sync from '../../services/Sync';
|
||||
import { COLORS_NOTE } from '../../utils/Colors';
|
||||
import { eScrollEvent } from '../../utils/Events';
|
||||
import useAnnouncement from '../../utils/useAnnouncement';
|
||||
import JumpToDialog from '../JumpToDialog';
|
||||
import { NotebookItem } from '../NotebookItem';
|
||||
import { NotebookWrapper } from '../NotebookItem/wrapper';
|
||||
import NoteItem from '../NoteItem';
|
||||
import { NoteWrapper } from '../NoteItem/wrapper';
|
||||
import TagItem from '../TagItem';
|
||||
import { Announcement } from './announcement';
|
||||
@@ -31,16 +27,16 @@ const heights = {
|
||||
|
||||
const TrashI = ({item, index}) => {
|
||||
return item.itemType === 'note' ? (
|
||||
<NoteItem item={item} index={index} />
|
||||
<NoteWrapper item={item} index={index} />
|
||||
) : (
|
||||
<NotebookItem item={item} index={index} />
|
||||
<NoteWrapper item={item} index={index} />
|
||||
);
|
||||
};
|
||||
|
||||
let renderItems = {
|
||||
notes: NoteWrapper,
|
||||
notebooks: NotebookWrapper,
|
||||
topics:NotebookWrapper,
|
||||
topics: NotebookWrapper,
|
||||
tags: TagItem,
|
||||
section: SectionHeader,
|
||||
trash: TrashI,
|
||||
@@ -71,16 +67,10 @@ const SimpleList = ({
|
||||
const RenderItem = renderItems[type];
|
||||
const refreshing = false;
|
||||
|
||||
useEffect(() => {
|
||||
if (!_loading) {
|
||||
setDataProvider(listData);
|
||||
}
|
||||
}, [listData]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!loading) {
|
||||
setDataProvider(
|
||||
listData.length > 1 && SettingsService.get().homepage !== screen
|
||||
listData.length >= 1 && SettingsService.get().homepage !== screen
|
||||
? listData.slice(0, 1)
|
||||
: listData,
|
||||
);
|
||||
@@ -102,7 +92,7 @@ const SimpleList = ({
|
||||
} else {
|
||||
setDataProvider([]);
|
||||
}
|
||||
}, [loading]);
|
||||
}, [loading, listData]);
|
||||
|
||||
const renderItem = React.useCallback(
|
||||
({item, index}) =>
|
||||
|
||||
@@ -138,6 +138,9 @@ export const Toast = ({context = 'global'}) => {
|
||||
|
||||
return (
|
||||
<Animated.View
|
||||
onTouchEnd={() => {
|
||||
hideToastFunc();
|
||||
}}
|
||||
style={{
|
||||
width: DDS.isTab ? 400 : '100%',
|
||||
alignItems: 'center',
|
||||
|
||||
@@ -215,6 +215,7 @@ export class VaultDialog extends Component {
|
||||
onPress = async () => {
|
||||
if (this.state.revokeFingerprintAccess) {
|
||||
await this._revokeFingerprintAccess();
|
||||
|
||||
this.close();
|
||||
return;
|
||||
}
|
||||
@@ -271,7 +272,7 @@ export class VaultDialog extends Component {
|
||||
ToastEvent.show({
|
||||
heading: 'Vault password updated successfully',
|
||||
type: 'success',
|
||||
context: 'local',
|
||||
context: 'global',
|
||||
});
|
||||
this.close();
|
||||
})
|
||||
@@ -337,6 +338,11 @@ export class VaultDialog extends Component {
|
||||
eSendEvent(eClearEditor);
|
||||
}
|
||||
this.close();
|
||||
ToastEvent.show({
|
||||
message: 'Note locked successfully',
|
||||
type: 'error',
|
||||
context: 'local',
|
||||
});
|
||||
this.setState({
|
||||
loading: false,
|
||||
});
|
||||
@@ -452,6 +458,11 @@ export class VaultDialog extends Component {
|
||||
this.close();
|
||||
} else {
|
||||
eSendEvent('vaultUpdated');
|
||||
ToastEvent.show({
|
||||
heading: 'Vault created successfully',
|
||||
type: 'success',
|
||||
context: 'global',
|
||||
});
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
@@ -460,6 +471,11 @@ export class VaultDialog extends Component {
|
||||
db.vault
|
||||
.remove(this.state.note.id, this.password)
|
||||
.then(r => {
|
||||
ToastEvent.show({
|
||||
heading: 'Note permanantly unlocked.',
|
||||
type: 'success',
|
||||
context: 'global',
|
||||
});
|
||||
this.close();
|
||||
})
|
||||
.catch(e => {
|
||||
@@ -486,7 +502,7 @@ export class VaultDialog extends Component {
|
||||
heading: 'Note copied',
|
||||
type: 'success',
|
||||
message: 'Note has been copied to clipboard!',
|
||||
context: 'local',
|
||||
context: 'global',
|
||||
});
|
||||
this.close();
|
||||
}
|
||||
@@ -529,14 +545,14 @@ export class VaultDialog extends Component {
|
||||
ToastEvent.show({
|
||||
heading: 'Biometric unlocking disabled!',
|
||||
type: 'success',
|
||||
context: 'local',
|
||||
context: 'global',
|
||||
});
|
||||
} catch (e) {
|
||||
ToastEvent.show({
|
||||
heading: 'Failed to disable Biometric unlocking.',
|
||||
message: e.message,
|
||||
type: 'success',
|
||||
context: 'local',
|
||||
context: 'global',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Dimensions } from 'react-native';
|
||||
import create, {State} from 'zustand';
|
||||
import {eSendEvent} from '../services/EventManager';
|
||||
import {history, SORT, sortSettings} from '../utils';
|
||||
import {db} from '../utils/DB';
|
||||
import {eOpenSideMenu} from '../utils/Events';
|
||||
import create, { State } from 'zustand';
|
||||
import { eSendEvent } from '../services/EventManager';
|
||||
import { history, SORT, sortSettings } from '../utils';
|
||||
import { db } from '../utils/DB';
|
||||
import { eOpenSideMenu } from '../utils/Events';
|
||||
import {
|
||||
MenuStore,
|
||||
MessageStore,
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
export const useNoteStore = create<NoteStore>((set, get) => ({
|
||||
notes: [],
|
||||
loading: true,
|
||||
setLoading: loading => set({loading: loading}),
|
||||
setLoading: loading => set({ loading: loading }),
|
||||
setNotes: items => {
|
||||
if (!items) {
|
||||
set({
|
||||
@@ -40,9 +40,9 @@ export const useNoteStore = create<NoteStore>((set, get) => ({
|
||||
prev[index] = item;
|
||||
}
|
||||
}
|
||||
set({notes: prev});
|
||||
set({ notes: prev });
|
||||
},
|
||||
clearNotes: () => set({notes: []}),
|
||||
clearNotes: () => set({ notes: [] }),
|
||||
}));
|
||||
|
||||
export const useNotebookStore = create<NotebookStore>((set, get) => ({
|
||||
@@ -62,9 +62,9 @@ export const useNotebookStore = create<NotebookStore>((set, get) => ({
|
||||
prev[index] = item;
|
||||
}
|
||||
}
|
||||
set({notebooks: prev});
|
||||
set({ notebooks: prev });
|
||||
},
|
||||
clearNotebooks: () => set({notebooks: []}),
|
||||
clearNotebooks: () => set({ notebooks: [] }),
|
||||
}));
|
||||
|
||||
export const useFavoriteStore = create<FavoriteStore>((set, get) => ({
|
||||
@@ -84,9 +84,9 @@ export const useFavoriteStore = create<FavoriteStore>((set, get) => ({
|
||||
prev[index] = item;
|
||||
}
|
||||
}
|
||||
set({favorites: prev});
|
||||
set({ favorites: prev });
|
||||
},
|
||||
clearFavorites: () => set({favorites: []}),
|
||||
clearFavorites: () => set({ favorites: [] }),
|
||||
}));
|
||||
|
||||
export const useTagStore = create<TagStore>((set, get) => ({
|
||||
@@ -106,9 +106,9 @@ export const useTagStore = create<TagStore>((set, get) => ({
|
||||
prev[index] = item;
|
||||
}
|
||||
}
|
||||
set({tags: prev});
|
||||
set({ tags: prev });
|
||||
},
|
||||
clearTags: () => set({tags: []}),
|
||||
clearTags: () => set({ tags: [] }),
|
||||
}));
|
||||
|
||||
export const useTrashStore = create<TrashStore>((set, get) => ({
|
||||
@@ -128,9 +128,9 @@ export const useTrashStore = create<TrashStore>((set, get) => ({
|
||||
prev[index] = item;
|
||||
}
|
||||
}
|
||||
set({trash: prev});
|
||||
set({ trash: prev });
|
||||
},
|
||||
clearTrash: () => set({trash: []}),
|
||||
clearTrash: () => set({ trash: [] }),
|
||||
}));
|
||||
|
||||
export const useUserStore = create<UserStore>((set, get) => ({
|
||||
@@ -138,13 +138,13 @@ export const useUserStore = create<UserStore>((set, get) => ({
|
||||
premium: false,
|
||||
lastSynced: 'Never',
|
||||
syncing: false,
|
||||
setUser: user => set({user: user}),
|
||||
setPremium: premium => set({premium: premium}),
|
||||
setSyncing: syncing => set({syncing: syncing}),
|
||||
setLastSynced: lastSynced => set({lastSynced: lastSynced}),
|
||||
setUser: user => set({ user: user }),
|
||||
setPremium: premium => set({ premium: premium }),
|
||||
setSyncing: syncing => set({ syncing: syncing }),
|
||||
setLastSynced: lastSynced => set({ lastSynced: lastSynced }),
|
||||
}));
|
||||
|
||||
let {width, height} = Dimensions.get('window');
|
||||
let { width, height } = Dimensions.get('window');
|
||||
|
||||
export const useSettingStore = create<SettingStore>((set, get) => ({
|
||||
settings: {
|
||||
@@ -164,32 +164,32 @@ export const useSettingStore = create<SettingStore>((set, get) => ({
|
||||
},
|
||||
fullscreen: false,
|
||||
deviceMode: null,
|
||||
dimensions:{width,height},
|
||||
setSettings: settings => set({settings}),
|
||||
setFullscreen: fullscreen => set({fullscreen}),
|
||||
setDeviceMode: mode => set({deviceMode: mode}),
|
||||
setDimensions: dimensions => set({dimensions:dimensions})
|
||||
dimensions: { width, height },
|
||||
setSettings: settings => set({ settings }),
|
||||
setFullscreen: fullscreen => set({ fullscreen }),
|
||||
setDeviceMode: mode => set({ deviceMode: mode }),
|
||||
setDimensions: dimensions => set({ dimensions: dimensions })
|
||||
}));
|
||||
|
||||
export const useMenuStore = create<MenuStore>((set, get) => ({
|
||||
menuPins: [],
|
||||
colorNotes: [],
|
||||
setMenuPins: () => set({menuPins: db.settings.pins}),
|
||||
setColorNotes: () => set({colorNotes: db.colors.all}),
|
||||
setMenuPins: () => set({ menuPins: db.settings.pins }),
|
||||
setColorNotes: () => set({ colorNotes: db.colors.all }),
|
||||
}));
|
||||
|
||||
export const useEditorStore = create<EditorStore>((set, get) => ({
|
||||
currentEditingNote: null,
|
||||
setCurrentlyEditingNote: note => set({currentEditingNote: note}),
|
||||
setCurrentlyEditingNote: note => set({ currentEditingNote: note }),
|
||||
}));
|
||||
|
||||
export const useSearchStore = create<SearchStore>((set, get) => ({
|
||||
searchResults: [],
|
||||
searching: false,
|
||||
searchStatus: null,
|
||||
setSearchResults: results => set({searchResults: results}),
|
||||
setSearchResults: results => set({ searchResults: results }),
|
||||
setSearchStatus: (searching, status) =>
|
||||
set({searching, searchStatus: status}),
|
||||
set({ searching, searchStatus: status }),
|
||||
}));
|
||||
|
||||
export const useSelectionStore = create<SelectionStore>((set, get) => ({
|
||||
@@ -197,12 +197,12 @@ export const useSelectionStore = create<SelectionStore>((set, get) => ({
|
||||
selectionMode: false,
|
||||
setAll: all => {
|
||||
history.selectedItemsList = all;
|
||||
set({selectedItemsList: all});
|
||||
set({ selectedItemsList: all });
|
||||
},
|
||||
setSelectionMode: mode => set({selectionMode: mode}),
|
||||
setSelectionMode: mode => set({ selectionMode: mode }),
|
||||
setSelectedItem: item => {
|
||||
let selectedItems = get().selectedItemsList;
|
||||
let index = selectedItems.findIndex((i:any) => i.id === item.id);
|
||||
let index = selectedItems.findIndex((i: any) => i.id === item.id);
|
||||
if (index !== -1) {
|
||||
selectedItems.splice(index, 1);
|
||||
} else {
|
||||
@@ -223,7 +223,7 @@ export const useSelectionStore = create<SelectionStore>((set, get) => ({
|
||||
},
|
||||
clearSelection: () => {
|
||||
eSendEvent(eOpenSideMenu);
|
||||
set({selectionMode: false, selectedItemsList: []});
|
||||
set({ selectionMode: false, selectedItemsList: [] });
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -232,17 +232,19 @@ export const useMessageStore = create<MessageStore>((set, get) => ({
|
||||
visible: false,
|
||||
message: null,
|
||||
actionText: null,
|
||||
onPress: () => {},
|
||||
onPress: () => { },
|
||||
data: {},
|
||||
icon: 'account-outline',
|
||||
},
|
||||
setMessage: message => set({message:{...message}}),
|
||||
setMessage: message => set({ message: { ...message } }),
|
||||
}));
|
||||
|
||||
export function initialize() {
|
||||
if (!db) return;
|
||||
useMenuStore.getState().setColorNotes();
|
||||
useMenuStore.getState().setMenuPins();
|
||||
useNotebookStore.getState().setNotebooks();
|
||||
useTrashStore.getState().setTrash();
|
||||
useTagStore.getState().setTags();
|
||||
useFavoriteStore.getState().setFavorites();
|
||||
useNoteStore.getState().setNotes();
|
||||
|
||||
@@ -38,6 +38,7 @@ const fixedColors = {
|
||||
blue: '#2196F3',
|
||||
purple: '#673AB7',
|
||||
gray: '#9E9E9E',
|
||||
discord:"#5865F2"
|
||||
};
|
||||
export var COLOR_SCHEME = {
|
||||
...fixedColors,
|
||||
|
||||
@@ -13,6 +13,7 @@ export const deleteItems = async (item) => {
|
||||
history.selectedItemsList.push(item);
|
||||
}
|
||||
|
||||
|
||||
let notes = history.selectedItemsList.filter((i) => i.type === 'note');
|
||||
let notebooks = history.selectedItemsList.filter(
|
||||
(i) => i.type === 'notebook',
|
||||
@@ -21,6 +22,7 @@ export const deleteItems = async (item) => {
|
||||
|
||||
if (notes?.length > 0) {
|
||||
let ids = notes.map((i) => i.id);
|
||||
console.log(ids);
|
||||
await db.notes.delete(...ids);
|
||||
Navigation.setRoutesToUpdate([
|
||||
Navigation.routeNames.Notes,
|
||||
@@ -86,6 +88,7 @@ export const deleteItems = async (item) => {
|
||||
actionText: 'Undo',
|
||||
});
|
||||
}
|
||||
history.selectedItemsList = [];
|
||||
Navigation.setRoutesToUpdate([Navigation.routeNames.Trash]);
|
||||
useSelectionStore.getState().clearSelection();
|
||||
useMenuStore.getState().setColorNotes();
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import React, {useEffect, useState} from 'react';
|
||||
import {KeyboardAvoidingView, Platform, SafeAreaView, View} from 'react-native';
|
||||
import {PanGestureHandler, State} from 'react-native-gesture-handler';
|
||||
import Animated, {Easing} from 'react-native-reanimated';
|
||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||
import React from 'react';
|
||||
import { KeyboardAvoidingView, Platform, SafeAreaView, View } from 'react-native';
|
||||
import { PanGestureHandler, State } from 'react-native-gesture-handler';
|
||||
import Animated, { Easing } from 'react-native-reanimated';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import Editor from '.';
|
||||
import {GetPremium} from '../../components/ActionSheetComponent/GetPremium';
|
||||
import { GetPremium } from '../../components/ActionSheetComponent/GetPremium';
|
||||
import Paragraph from '../../components/Typography/Paragraph';
|
||||
import {useTracked} from '../../provider';
|
||||
import { useTracked } from '../../provider';
|
||||
import { useNoteStore } from '../../provider/stores';
|
||||
import {DDS} from '../../services/DeviceDetection';
|
||||
import {eSendEvent} from '../../services/EventManager';
|
||||
import {eOnLoadNote} from '../../utils/Events';
|
||||
import {editorRef} from '../../utils/Refs';
|
||||
import { DDS } from '../../services/DeviceDetection';
|
||||
import { eSendEvent } from '../../services/EventManager';
|
||||
import { eOnLoadNote } from '../../utils/Events';
|
||||
import { editorRef } from '../../utils/Refs';
|
||||
import useIsFloatingKeyboard from '../../utils/use-is-floating-keyboard';
|
||||
import EditorOverlay from './EditorOverlay';
|
||||
let prevVal = 0;
|
||||
@@ -22,6 +22,7 @@ const op2 = new Animated.Value(0);
|
||||
const op3 = new Animated.Value(0);
|
||||
|
||||
const onHandlerStateChange = (evt) => {
|
||||
console.log('handler here');
|
||||
if (evt.nativeEvent.state === State.END) {
|
||||
if (evt.nativeEvent.translationY >= finalValue) {
|
||||
eSendEvent(eOnLoadNote, {type: 'new'});
|
||||
@@ -42,6 +43,7 @@ const onHandlerStateChange = (evt) => {
|
||||
};
|
||||
|
||||
const onGestureEvent = (event) => {
|
||||
console.log('gesture event');
|
||||
if (event.nativeEvent.translationY < 0) return;
|
||||
|
||||
let v = event.nativeEvent.translationY;
|
||||
@@ -124,6 +126,7 @@ export const EditorWrapper = ({dimensions}) => {
|
||||
/>
|
||||
<PanGestureHandler
|
||||
minPointers={2}
|
||||
|
||||
onHandlerStateChange={onHandlerStateChange}
|
||||
onGestureEvent={onGestureEvent}>
|
||||
<AnimatedKeyboardView
|
||||
|
||||
@@ -41,12 +41,10 @@ export const Notebook = ({route, navigation}) => {
|
||||
eSendEvent(eScrollEvent, {name: params.title, type: 'in'});
|
||||
if (params.menu) {
|
||||
navigation.setOptions({
|
||||
animationEnabled: true,
|
||||
gestureEnabled: false,
|
||||
});
|
||||
} else {
|
||||
navigation.setOptions({
|
||||
animationEnabled: true,
|
||||
gestureEnabled: Platform.OS === 'ios',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ export const Notes = ({route, navigation}) => {
|
||||
) {
|
||||
Navigation.goBack();
|
||||
}
|
||||
console.log('setting notes');
|
||||
setNotes(_notes);
|
||||
if (params.menu) {
|
||||
navigation.setOptions({
|
||||
|
||||
@@ -197,21 +197,6 @@ export const Settings = ({navigation}) => {
|
||||
},
|
||||
desc: `Facing an issue? Report it on our Github`,
|
||||
},
|
||||
{
|
||||
name: `Rate us on ${Platform.OS === 'ios' ? 'Appstore' : 'Playstore'}`,
|
||||
func: async () => {
|
||||
try {
|
||||
await Linking.openURL(
|
||||
Platform.OS === 'ios'
|
||||
? 'https://bit.ly/notesnook-ios'
|
||||
: 'https://bit.ly/notesnook-and',
|
||||
);
|
||||
} catch (e) {}
|
||||
},
|
||||
desc: `Rate and review our app on ${
|
||||
Platform.OS === 'ios' ? 'Appstore' : 'Playstore'
|
||||
} and let us know what you think.`,
|
||||
},
|
||||
{
|
||||
name: 'Join our Discord community',
|
||||
|
||||
@@ -240,6 +225,27 @@ export const Settings = ({navigation}) => {
|
||||
},
|
||||
desc: 'We are not ghosts, chat with us and share your experience.',
|
||||
},
|
||||
{
|
||||
name: 'Documentation',
|
||||
func: async () => {
|
||||
try {
|
||||
await openLinkInBrowser('https://docs.notesnook.com', colors);
|
||||
} catch (e) {}
|
||||
},
|
||||
desc: 'Learn about every feature and how it works.',
|
||||
},
|
||||
{
|
||||
name: 'Roadmap',
|
||||
func: async () => {
|
||||
try {
|
||||
await openLinkInBrowser(
|
||||
'https://docs.notesnook.com/roadmap/',
|
||||
colors,
|
||||
);
|
||||
} catch (e) {}
|
||||
},
|
||||
desc: 'See what the future of Notesnook is going to be like.',
|
||||
},
|
||||
{
|
||||
name: 'About Notesnook',
|
||||
func: async () => {
|
||||
@@ -288,6 +294,46 @@ export const Settings = ({navigation}) => {
|
||||
|
||||
<SectionHeader title="Other" />
|
||||
|
||||
<PressableButton
|
||||
onPress={async () => {
|
||||
try {
|
||||
await Linking.openURL(
|
||||
Platform.OS === 'ios'
|
||||
? 'https://bit.ly/notesnook-ios'
|
||||
: 'https://bit.ly/notesnook-and',
|
||||
);
|
||||
} catch (e) {}
|
||||
}}
|
||||
type="shade"
|
||||
customStyle={{
|
||||
borderWidth: 1,
|
||||
borderRadius: 5,
|
||||
paddingVertical: 10,
|
||||
width: '95%',
|
||||
alignItems: 'flex-start',
|
||||
paddingHorizontal: 12,
|
||||
marginTop: 10,
|
||||
borderColor: colors.accent,
|
||||
}}>
|
||||
<Heading
|
||||
color={colors.accent}
|
||||
style={{
|
||||
fontSize: SIZE.md,
|
||||
}}>
|
||||
{`Rate us on ${Platform.OS === 'ios' ? 'Appstore' : 'Playstore'}`}
|
||||
</Heading>
|
||||
<Paragraph
|
||||
style={{
|
||||
flexWrap: 'wrap',
|
||||
flexBasis: 1,
|
||||
}}
|
||||
color={colors.pri}>
|
||||
It took us a year to bring Notesnook to life, the best private
|
||||
note taking app. It will take you a moment to rate it to let us
|
||||
know what you think!
|
||||
</Paragraph>
|
||||
</PressableButton>
|
||||
|
||||
{otherItems.map(item => (
|
||||
<CustomButton
|
||||
key={item.name}
|
||||
|
||||
Reference in New Issue
Block a user