A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
update last synced value every 1 minute
ammarahm-edba7a803f218d
diff --git a/apps/mobile/App.js b/apps/mobile/App.jsindex 07a885ebd..482c68bb7 100644--- a/apps/mobile/App.js+++ b/apps/mobile/App.js@@ -48,6 +48,7 @@ const App = () => {await db.sync();let u = await db.user.get();dispatch({type: ACTIONS.USER, user: u});+ dispatch({type: ACTIONS.ALL});dispatch({type: ACTIONS.SYNCING, syncing:false});})}@@ -95,7 +96,6 @@ const App = () => {scale.fontScale = 1;}updateSize();-dispatch({type: ACTIONS.SETTINGS, settings: {...s}});}diff --git a/apps/mobile/src/components/Menu/TimeSince.js b/apps/mobile/src/components/Menu/TimeSince.jsnew file mode 100644index 000000000..51b539f09--- /dev/null+++ b/apps/mobile/src/components/Menu/TimeSince.js@@ -0,0 +1,22 @@+import React, {useEffect, useState} from 'react';+import {Text} from 'react-native';+import {timeSince} from '../../utils/utils';++export const TimeSince = ({time}) => {+ const [timeAgo, setTimeAgo] = useState(null);++ useEffect(() => {+ let t = timeSince(time);+ setTimeAgo(t);+ let interval = setInterval(() => {+ t = timeSince(time);+ setTimeAgo(t);+ }, 60000);+ return () => {+ clearInterval(interval);+ interval = null;+ };+ });++ return <Text>{timeAgo}</Text>;+};diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.jsindex 654f77fe7..bb433481c 100644--- a/apps/mobile/src/components/Menu/index.js+++ b/apps/mobile/src/components/Menu/index.js@@ -36,6 +36,7 @@ import NavigationService from '../../services/NavigationService';import {db, DDS, hexToRGBA, timeSince, ToastEvent} from '../../utils/utils';import {sideMenuOverlayRef} from '../../utils/refs';import {createAnimatableComponent} from 'react-native-animatable';+import { TimeSince } from './TimeSince';const AnimatedSafeAreaView = createAnimatableComponent(SafeAreaView);@@ -643,7 +644,7 @@ export const Menu = ({{syncing ? 'Syncing ' : 'Synced '}{!syncing? user.lastSynced && user.lastSynced !== 0- ? timeSince(user.lastSynced)+ ? <TimeSince time={user.lastSynced} />: 'never': null}{'\n'}diff --git a/apps/mobile/src/views/Login/index.js b/apps/mobile/src/views/Login/index.jsindex b62d91bb7..7758014f1 100644--- a/apps/mobile/src/views/Login/index.js+++ b/apps/mobile/src/views/Login/index.js@@ -18,6 +18,7 @@ import {eCloseSideMenu,refreshNotesPage,eOpenSideMenu,+ eStartSyncer,} from '../../services/events';import {validatePass, validateUsername} from '../../services/validation';import {db, DDS, ToastEvent, getElevation} from '../../utils/utils';@@ -103,14 +104,15 @@ export const Login = ({route, navigation}) => {user = await db.user.get();eSendEvent(eStartSyncer);console.log('user', user);+ dispatch({type:ACTIONS.SYNCING,syncing:true});dispatch({type: ACTIONS.USER, user: user});ToastEvent.show(`Logged in as ${username}`, 'success');-- navigation.goBack();-await db.sync();- eSendEvent(refreshNotesPage);+ navigation.goBack();dispatch({type: ACTIONS.ALL});+ eSendEvent(refreshNotesPage);+ dispatch({type:ACTIONS.SYNCING,syncing:false});+} catch (e) {console.log(e, 'getUSer');ToastEvent.show(e.message, 'error');diff --git a/apps/mobile/src/views/Signup/index.js b/apps/mobile/src/views/Signup/index.jsindex e1ec08246..14d94328a 100644--- a/apps/mobile/src/views/Signup/index.js+++ b/apps/mobile/src/views/Signup/index.js@@ -46,7 +46,7 @@ export const Signup = ({route,navigation}) => {const [failed, setFailed] = useState(false);const [modalVisible, setModalVisible] = useState(false);const [confirmPassword, setConfirmPassword] = useState(false);- const [key, setKey] = useState('');+ const [key, setKey] = useState('xyzLLbr1tafjdfklsdfjlksafjhklfadsafsljkfsfadfljkdfassafsafaffasdfsafafs');const [passwordReEnter, setPasswordReEnter] = useState(null);const [secureEntry, setSecureEntry] = useState(true);let isFocused = useIsFocused();@@ -138,10 +138,10 @@ export const Signup = ({route,navigation}) => {style={{fontFamily: WEIGHT.bold,fontSize: SIZE.xl,- color: 'white',+ color: colors.accent,marginBottom: 25,}}>- Account Created!+ Hi there!</Text><Text@@ -152,7 +152,7 @@ export const Signup = ({route,navigation}) => {textAlign: 'center',color: colors.pri,}}>- Hello {username}! All your data is end-to-end encrypted. This+ All your data is end-to-end encrypted. Thismeans that we cannot read your data or recover your password ifyou forget it.{' '}<Text@@ -190,18 +190,19 @@ export const Signup = ({route,navigation}) => {borderWidth: 1,borderRadius: 5,paddingVertical: 8,- paddingHorizontal: 6,+ paddingHorizontal: 10,marginTop: 15,alignItems: 'center',borderColor: colors.nav,}}><Text- numberOfLines={1}+ numberOfLines={2}style={{fontFamily: WEIGHT.regular,- fontSize: 16,+ fontSize: SIZE.sm,width: '85%',maxWidth: '85%',+ paddingRight:10,color: colors.icon,}}>{key}@@ -227,6 +228,7 @@ export const Signup = ({route,navigation}) => {}}activeOpacity={opacity}style={{+ ...getElevation(5),paddingVertical: pv + 5,paddingHorizontal: ph,borderRadius: 5,