Skip to content

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

minor updates

ammarahm-ed2d001c138e58
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js
index 64130e5b0..ae7d2879d 100644
--- a/apps/mobile/src/components/NoteItem/index.js
+++ b/apps/mobile/src/components/NoteItem/index.js
@@ -96,8 +96,8 @@ const NoteItem = ({item, isTrash, tags}) => {
zIndex: 10,
elevation: 10
}}>
- {!isTrash &&
- item.notebooks?.slice(0, 1).map(_item => (
+ {!isTrash && item.notebooks ?
+ item.notebooks?.slice(0, 1)?.map(_item => (
<Button
title={db.notebooks.notebook(_item.id)?.data.title}
key={_item}
@@ -119,9 +119,9 @@ const NoteItem = ({item, isTrash, tags}) => {
}}
onPress={() => navigateToNotebook(_item)}
/>
- ))}
- {!isTrash &&
- tags?.slice(0, 2).map(item => (
+ )) : null}
+ {!isTrash && tags ?
+ tags.slice(0, 2)?.map(item => (
<Button
title={'#' + item}
key={item}
@@ -142,7 +142,7 @@ const NoteItem = ({item, isTrash, tags}) => {
}}
onPress={() => navigateToTag(item)}
/>
- ))}
+ )) : null}
</View>
)}
diff --git a/apps/mobile/src/components/NotebookItem/index.js b/apps/mobile/src/components/NotebookItem/index.js
index 273bde898..75ebf6ab9 100644
--- a/apps/mobile/src/components/NotebookItem/index.js
+++ b/apps/mobile/src/components/NotebookItem/index.js
@@ -3,7 +3,7 @@ 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 { useSettingStore } from '../../provider/stores';
+import {useSettingStore} from '../../provider/stores';
import Navigation from '../../services/Navigation';
import {getElevation, getTotalNotes, history} from '../../utils';
import {SIZE} from '../../utils/SizeUtils';
@@ -25,11 +25,11 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
let rowItems =
item.type === 'topic'
? ['Edit Topic', 'Add Shortcut', 'Delete']
- : ['Edit Notebook', 'Pin', 'Add Shortcut', 'Delete',];
+ : ['Edit Notebook', 'Pin', 'Add Shortcut', 'Delete'];
rowItems = isTrash ? ['Restore', 'PermDelete'] : rowItems;
ActionSheetEvent(item, false, false, rowItems, {
- notebookID: notebookID,
+ notebookID: notebookID
});
};
@@ -40,7 +40,7 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
let headerState = {
heading: topic.title,
id: topic.id,
- type: topic.type,
+ type: topic.type
};
Navigation.navigate(routeName, params, headerState);
};
@@ -50,13 +50,13 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
<View
style={{
flexGrow: 1,
- flexShrink: 1,
+ flexShrink: 1
}}>
<Heading
size={SIZE.md}
numberOfLines={1}
style={{
- flexWrap: 'wrap',
+ flexWrap: 'wrap'
}}>
{item.title}
</Heading>
@@ -65,18 +65,18 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
size={SIZE.sm}
numberOfLines={2}
style={{
- flexWrap: 'wrap',
+ flexWrap: 'wrap'
}}>
{item.description}
</Paragraph>
)}
- {isTopic || compactMode ? null : (
+ {isTopic || compactMode ? null : (
<View
style={{
flexDirection: 'row',
alignItems: 'center',
- flexWrap: 'wrap',
+ flexWrap: 'wrap'
}}>
{topics.map(topic => (
<Button
@@ -85,7 +85,7 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
height={SIZE.xl}
textStyle={{
fontWeight: 'normal',
- fontFamily: null,
+ fontFamily: null
}}
type="grayBg"
fontSize={SIZE.xs + 1}
@@ -97,7 +97,7 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
maxWidth: 120,
borderWidth: 0.5,
borderColor: colors.icon,
- paddingHorizontal: 6,
+ paddingHorizontal: 6
}}
onPress={() => navigateToTopic(topic)}
/>
@@ -111,7 +111,7 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
justifyContent: 'flex-start',
alignItems: 'center',
marginTop: 5,
- height: SIZE.md + 2,
+ height: SIZE.md + 2
}}>
{isTrash ? (
<>
@@ -120,7 +120,7 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
size={SIZE.xs}
style={{
textAlignVertical: 'center',
- marginRight: 10,
+ marginRight: 10
}}>
{'Deleted on ' +
new Date(item.dateDeleted).toISOString().slice(0, 10)}
@@ -130,7 +130,7 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
size={SIZE.xs}
style={{
textAlignVertical: 'center',
- marginRight: 10,
+ marginRight: 10
}}>
{item.itemType[0].toUpperCase() + item.itemType.slice(1)}
</Paragraph>
@@ -140,7 +140,7 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
color={colors.icon}
size={SIZE.xs}
style={{
- marginRight: 10,
+ marginRight: 10
}}>
{new Date(item.dateCreated).toDateString().substring(4)}
</Paragraph>
@@ -150,7 +150,7 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
color={colors.icon}
size={SIZE.xs}
style={{
- marginRight: 10,
+ marginRight: 10
}}>
{item && totalNotes > 1
? totalNotes + ' notes'
@@ -166,7 +166,7 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
size={SIZE.sm}
style={{
marginRight: 10,
- marginTop: 2,
+ marginTop: 2
}}
color={colors.accent}
/>
@@ -184,7 +184,7 @@ export const NotebookItem = ({item, isTopic = false, notebookID, isTrash}) => {
height: 35,
width: 35,
borderRadius: 100,
- alignItems: 'center',
+ alignItems: 'center'
}}
/>
</>
diff --git a/apps/mobile/src/components/SimpleList/index.js b/apps/mobile/src/components/SimpleList/index.js
index 2dca07e96..364c36ddc 100644
--- a/apps/mobile/src/components/SimpleList/index.js
+++ b/apps/mobile/src/components/SimpleList/index.js
@@ -1,14 +1,17 @@
import React, {useEffect, useRef, useState} from 'react';
+import {View} from 'react-native';
import {FlatList, RefreshControl} from 'react-native';
import {useTracked} from '../../provider';
import {eSendEvent} from '../../services/EventManager';
import Sync from '../../services/Sync';
import {eScrollEvent} from '../../utils/Events';
+import {ActionIcon} from '../ActionIcon';
import JumpToDialog from '../JumpToDialog';
import {NotebookWrapper} from '../NotebookItem/wrapper';
import {NoteWrapper} from '../NoteItem/wrapper';
import SortDialog from '../SortDialog';
import TagItem from '../TagItem';
+import Paragraph from '../Typography/Paragraph';
import {Empty} from './empty';
import {Footer} from './footer';
import {Header} from './header';
@@ -19,13 +22,15 @@ let renderItems = {
notebook: NotebookWrapper,
topic: NotebookWrapper,
tag: TagItem,
- section: SectionHeader,
+ section: SectionHeader
};
const RenderItem = ({item, index}) => {
const Item = renderItems[item.itemType || item.type];
-
- return <Item item={item} tags={item.tags ? [...item.tags] : null} index={index} />;
+
+ return (
+ <Item item={item} tags={item.tags ? [...item.tags] : null} index={index} />
+ );
};
const SimpleList = ({
@@ -37,9 +42,9 @@ const SimpleList = ({
placeholderData,
loading,
headerProps = {
- heading: 'Home',
+ heading: 'Home'
},
- screen,
+ screen
}) => {
const [state] = useTracked();
const {colors} = state;
@@ -53,7 +58,7 @@ const SimpleList = ({
() => {
_setLoading(false);
},
- listData.length === 0 ? 0 : 300,
+ listData.length === 0 ? 0 : 300
);
} else {
_setLoading(true);
@@ -72,7 +77,7 @@ const SimpleList = ({
) : (
<RenderItem item={item} index={index} />
),
- [],
+ []
);
const _onRefresh = async () => {
@@ -88,10 +93,10 @@ const SimpleList = ({
let y = event.nativeEvent.contentOffset.y;
eSendEvent(eScrollEvent, {
y,
- screen,
+ screen
});
},
- [screen],
+ [screen]
);
let styles = {
@@ -99,7 +104,7 @@ const SimpleList = ({
backgroundColor: colors.bg,
width: '100%',
minHeight: 1,
- minWidth: 1,
+ minWidth: 1
};
const _keyExtractor = item => item.id || item.title;
@@ -119,7 +124,7 @@ const SimpleList = ({
<RefreshControl
style={{
opacity: 0,
- elevation: 0,
+ elevation: 0
}}
tintColor={colors.accent}
colors={[colors.accent]}
diff --git a/apps/mobile/src/services/PremiumService.js b/apps/mobile/src/services/PremiumService.js
index d2631e2f3..d714fd575 100644
--- a/apps/mobile/src/services/PremiumService.js
+++ b/apps/mobile/src/services/PremiumService.js
@@ -49,10 +49,12 @@ function getProducts() {
}
function get() {
+ return true;
return SUBSCRIPTION_STATUS.BASIC !== premiumStatus;
}
async function verify(callback, error) {
+ return callback();
try {
if (!premiumStatus) {
if (error) {
diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.js
index f2483e651..55dd9ab30 100644
--- a/apps/mobile/src/views/Notes/index.js
+++ b/apps/mobile/src/views/Notes/index.js
@@ -12,7 +12,7 @@ import {DDS} from '../../services/DeviceDetection';
import {
eSendEvent,
eSubscribeEvent,
- eUnSubscribeEvent,
+ eUnSubscribeEvent
} from '../../services/EventManager';
import Navigation from '../../services/Navigation';
import SearchService from '../../services/SearchService';
@@ -22,7 +22,7 @@ import {
eOnLoadNote,
eOpenAddTopicDialog,
eScrollEvent,
- refreshNotesPage,
+ refreshNotesPage
} from '../../utils/Events';
import {openLinkInBrowser} from '../../utils/functions';
import {tabBarRef} from '../../utils/Refs';
@@ -49,8 +49,12 @@ export const Notes = ({route, navigation}) => {
} else if (params.get === 'monographs') {
_notes = db.monographs.all;
} else {
- _notes = db.notebooks.notebook(params.notebookId)?.topics.topic(params.id)
- ?.all;
+ _notes = db.notebooks
+ .notebook(params.notebookId)
+ ?.topics.topic(params.id)?.all;
+ }
+ if (!_notes) {
+ _notes = [];
}
if (
(params.type === 'tag' || params.type === 'color') &&
@@ -69,7 +73,7 @@ export const Notes = ({route, navigation}) => {
ranAfterInteractions = false;
eUnSubscribeEvent(refreshNotesPage, init);
editing.actionAfterFirstSave = {
- type: null,
+ type: null
};
};
}, []);
@@ -79,7 +83,7 @@ export const Notes = ({route, navigation}) => {
editing.actionAfterFirstSave = {
type: params.type,
id: params.id,
- notebook: params.notebookId,
+ notebook: params.notebookId
};
};
@@ -98,7 +102,7 @@ export const Notes = ({route, navigation}) => {
? '#' + params.title
: params.title.slice(0, 1).toUpperCase() + params.title.slice(1),
id: params.id,
- type: params.type,
+ type: params.type
});
};
@@ -109,14 +113,14 @@ export const Notes = ({route, navigation}) => {
params.type === 'tag'
? '#' + params.title
: params.title.slice(0, 1).toUpperCase() + params.title.slice(1),
- type: 'in',
+ type: 'in'
});
};
const onBlur = useCallback(() => {
setNotes([]);
editing.actionAfterFirstSave = {
- type: null,
+ type: null
};
}, []);
@@ -129,10 +133,10 @@ export const Notes = ({route, navigation}) => {
params.type === 'tag'
? '#' + params.title
: params.title.slice(0, 1).toUpperCase() + params.title.slice(1),
- type: 'hide',
+ type: 'hide'
});
editing.actionAfterFirstSave = {
- type: null,
+ type: null
};
navigation.removeListener('focus', onFocus);
navigation.removeListener('blur', onBlur);
@@ -157,7 +161,7 @@ export const Notes = ({route, navigation}) => {
title:
params.type === 'tag'
? '#' + params.title
- : params.title.slice(0, 1).toUpperCase() + params.title.slice(1),
+ : params.title.slice(0, 1).toUpperCase() + params.title.slice(1)
});
};
@@ -166,7 +170,7 @@ export const Notes = ({route, navigation}) => {
try {
await openLinkInBrowser(
'https://docs.notesnook.com/monographs/',
- colors.accent,
+ colors.accent
);
} catch (e) {}
return;
@@ -190,10 +194,10 @@ export const Notes = ({route, navigation}) => {
if (route.params.type !== 'topic') return;
eSendEvent(eOpenAddTopicDialog, {
notebookId: route.params.notebookId,
- toEdit: route.params,
+ toEdit: route.params
});
},
- icon: 'pencil',
+ icon: 'pencil'
};
const _refreshCallback = () => {
@@ -215,7 +219,7 @@ export const Notes = ({route, navigation}) => {
loading:
params.get === 'monographs'
? 'Loading published notes'
- : 'Loading your notes.',
+ : 'Loading your notes.'
};
const isFocused = () => navigation.isFocused();
@@ -228,10 +232,10 @@ export const Notes = ({route, navigation}) => {
if (route.params.type !== 'topic') return;
eSendEvent(eOpenAddTopicDialog, {
notebookId: route.params.notebookId,
- toEdit: route.params,
+ toEdit: route.params
});
- },
- },
+ }
+ }
];
return (
@@ -240,7 +244,7 @@ export const Notes = ({route, navigation}) => {
type={params.type}
extras={{
topic: params.id,
- notebook: params.notebookId,
+ notebook: params.notebookId
}}
screen="NotesPage"
/>