Skip to content

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

some minor changes

ammarahm-ed6134ec842ac3
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js
index 21d94259f..ef2e41210 100644
--- a/apps/mobile/src/components/NoteItem/index.js
+++ b/apps/mobile/src/components/NoteItem/index.js
@@ -5,9 +5,10 @@ import {ph, pv, SIZE, WEIGHT} from '../../common/common';
import {eSendEvent, openVault} from '../../services/eventManager';
import {eOnLoadNote, eShowMergeDialog} from '../../services/events';
import {openEditorAnimation} from '../../utils/animations';
-import {DDS, timeSince} from '../../utils/utils';
+import {DDS, timeSince, db} from '../../utils/utils';
import {ActionSheetEvent, simpleDialogEvent} from '../DialogManager/recievers';
import {TEMPLATE_TRASH} from '../DialogManager/templates';
+import storage from '../../utils/storage';
const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height;
@@ -83,7 +84,8 @@ export default class NoteItem extends React.Component {
<TouchableOpacity
activeOpacity={0.8}
onLongPress={() => onLongPress()}
- onPress={() => {
+ onPress={async () => {
+ return;
if (item.conflicted) {
eSendEvent(eShowMergeDialog, item);
diff --git a/apps/mobile/src/utils/storage.js b/apps/mobile/src/utils/storage.js
index 0bc4dc5cb..fd158f2fc 100644
--- a/apps/mobile/src/utils/storage.js
+++ b/apps/mobile/src/utils/storage.js
@@ -1,5 +1,5 @@
import MMKV from 'react-native-mmkv-storage';
-import Sodium from "react-native-sodium";
+import Sodium from 'react-native-sodium';
async function read(key, isArray = false) {
let data;
@@ -9,7 +9,7 @@ async function read(key, isArray = false) {
} catch (e) {
data = [];
}
- } else if (key === "hasConflicts") {
+ } else if (key === 'hasConflicts') {
return await MMKV.getBoolAsync(key);
} else {
try {
@@ -19,7 +19,6 @@ async function read(key, isArray = false) {
}
}
-
return isArray ? data.slice() : data;
}
@@ -31,7 +30,6 @@ async function write(key, data) {
} else {
return await MMKV.setMapAsync(key, data);
}
-
}
async function readMulti(keys) {
@@ -53,28 +51,28 @@ async function clear() {
}
function encrypt(password, data) {
-
return Sodium.encrypt(password, data).then(result => result);
}
function decrypt(password, data) {
-
return Sodium.decrypt(password, data).then(result => result);
-
}
async function deriveKey(password, salt) {
-
try {
+ let data = await Sodium.deriveKey(password, salt);
- let data = await Sodium.deriveKey(password, salt)
-
- return data.key
- } catch (e) {
-
- }
-
+ return data.key;
+ } catch (e) {}
}
-
-export default { read, write, readMulti, remove, clear, encrypt, decrypt, deriveKey };
+export default {
+ read,
+ write,
+ readMulti,
+ remove,
+ clear,
+ encrypt,
+ decrypt,
+ deriveKey,
+};
diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.js
index c82da6bb8..8bb076c7a 100755
--- a/apps/mobile/src/views/Home/index.js
+++ b/apps/mobile/src/views/Home/index.js
@@ -18,7 +18,14 @@ let count = 0;
export const Home = ({navigation}) => {
const [state, dispatch] = useTracked();
const [refreshing, setRefreshing] = useState(false);
- const {colors, selectionMode, currentEditingNote, loading, notes} = state;
+ const {
+ colors,
+ selectionMode,
+ currentEditingNote,
+ loading,
+ notes,
+ pinned,
+ } = state;
const isFocused = useIsFocused();
useEffect(() => {
@@ -27,11 +34,10 @@ export const Home = ({navigation}) => {
type: ACTIONS.CURRENT_SCREEN,
screen: 'home',
});
+ eSendEvent(eScrollEvent, 0);
+ dispatch({type: ACTIONS.COLORS});
+ dispatch({type: ACTIONS.NOTES});
}
-
- eSendEvent(eScrollEvent, 0);
- dispatch({type: ACTIONS.COLORS});
- dispatch({type: ACTIONS.NOTES});
}, [isFocused]);
const _onRefresh = async () => {
@@ -109,6 +115,7 @@ export const Home = ({navigation}) => {
data={notes}
type="notes"
isHome={true}
+ pinned={pinned}
refreshing={refreshing}
focused={isFocused}
onRefresh={_onRefresh}
diff --git a/apps/mobile/src/views/Trash/index.js b/apps/mobile/src/views/Trash/index.js
index 81c29edf1..34298bad2 100644
--- a/apps/mobile/src/views/Trash/index.js
+++ b/apps/mobile/src/views/Trash/index.js
@@ -14,13 +14,11 @@ import {TEMPLATE_EMPTY_TRASH} from '../../components/DialogManager/templates';
export const Trash = ({navigation}) => {
const [state, dispatch] = useTracked();
- const {colors, selectionMode} = state;
- const trash = [...trash];
+ const {colors, selectionMode, trash} = state;
const [refreshing, setRefreshing] = useState(false);
const isFocused = useIsFocused();
useEffect(() => {
- console.log(trash);
if (isFocused) {
dispatch({
type: ACTIONS.TRASH,