Skip to content

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

fix minor bugs

ammarahm-ed834bf31b39f1
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index 66e7e6f93..d1c575fa0 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -154,7 +154,7 @@ const App = () => {
error = e;
console.log(e);
}
- if (!user || !user.id) {
+ if (!user) {
setLoginMessage(dispatch);
}
dispatch({type: Actions.ALL});
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js
index d2fb7a4ea..16d23ee3a 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/ActionSheetComponent/index.js
@@ -579,7 +579,7 @@ export const ActionSheetComponent = ({
) : null;
const onPressSync = async () => {
- if (!user || !user.Id) {
+ if (!user) {
ToastEvent.show(
'You must login to sync',
'error',
diff --git a/apps/mobile/src/components/LoginDialog/index.js b/apps/mobile/src/components/LoginDialog/index.js
index 49aa96157..5e69cc761 100644
--- a/apps/mobile/src/components/LoginDialog/index.js
+++ b/apps/mobile/src/components/LoginDialog/index.js
@@ -34,7 +34,7 @@ import {Loading} from '../Loading';
import {opacity, ph, pv, SIZE, WEIGHT} from '../../utils/SizeUtils';
import {db} from '../../utils/DB';
import {DDS} from '../../services/DeviceDetection';
-import { sleep } from '../../utils/TimeUtils';
+import {sleep} from '../../utils/TimeUtils';
const LoginDialog = () => {
const [state, dispatch] = useTracked();
@@ -121,10 +121,9 @@ const LoginDialog = () => {
try {
let user = await db.user.get();
- if (!user) throw new Error('Username or password incorrect');
+ if (!user) throw new Error('Username or passoword incorrect!');
setStatus('Syncing your notes');
dispatch({type: Actions.USER, user: user});
- dispatch({type: Actions.SYNCING, syncing: true});
await db.sync();
eSendEvent(eStartSyncer);
dispatch({type: Actions.ALL});
@@ -134,7 +133,6 @@ const LoginDialog = () => {
} catch (e) {
ToastEvent.show(e.message, 'error', 'local');
} finally {
- dispatch({type: Actions.SYNCING, syncing: false});
setLoggingIn(false);
}
};
@@ -191,14 +189,12 @@ const LoginDialog = () => {
let user;
try {
user = await db.user.get();
- let k = await db.user.key();
- setKey(k.key);
setStatus('Setting up crenditials');
dispatch({type: Actions.USER, user: user});
eSendEvent(eStartSyncer);
close();
await sleep(500);
- eSendEvent(eOpenRecoveryKeyDialog);
+ eSendEvent(eOpenRecoveryKeyDialog, true);
} catch (e) {
setFailed(true);
ToastEvent.show('Login Failed, try again', 'error', 'local');
diff --git a/apps/mobile/src/components/Menu/UserSection.js b/apps/mobile/src/components/Menu/UserSection.js
index 6f7fdbea0..825dbdffb 100644
--- a/apps/mobile/src/components/Menu/UserSection.js
+++ b/apps/mobile/src/components/Menu/UserSection.js
@@ -116,7 +116,7 @@ export const UserSection = ({noTextMode}) => {
{syncing ? 'Syncing ' : 'Synced '}
{!syncing ? (
user?.notesnook?.lastSynced ? (
- <TimeSince time={user.notesnook.lastSynced} />
+ <TimeSince time={user.lastSynced} />
) : (
'never'
)
diff --git a/apps/mobile/src/components/RecoveryKeyDialog/index.js b/apps/mobile/src/components/RecoveryKeyDialog/index.js
index 92163edd7..6ead77832 100644
--- a/apps/mobile/src/components/RecoveryKeyDialog/index.js
+++ b/apps/mobile/src/components/RecoveryKeyDialog/index.js
@@ -40,7 +40,7 @@ class RecoveryKeyDialog extends React.Component {
close = () => {
this.actionSheetRef.current?._setModalVisible(false);
- if (!this.signup) {
+ if (this.signup) {
setTimeout(() => {
eSendEvent(eOpenResultDialog, {
title: 'Welcome!',
diff --git a/apps/mobile/src/provider/DefaultState.js b/apps/mobile/src/provider/DefaultState.js
index 3b3eb8c8b..6315b870e 100644
--- a/apps/mobile/src/provider/DefaultState.js
+++ b/apps/mobile/src/provider/DefaultState.js
@@ -15,7 +15,7 @@ export const defaultState = {
},
tags: [],
colorNotes: [],
- user: {},
+ user: null,
premiumUser:true,
settings: {
showToolbarOnTop: false,
diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js
index 44c7cc86c..ad56be0b0 100644
--- a/apps/mobile/src/views/Settings/index.js
+++ b/apps/mobile/src/views/Settings/index.js
@@ -211,7 +211,7 @@ export const Settings = ({navigation}) => {
style={{
paddingHorizontal: 0,
}}>
- {user && user.Id ? (
+ {user ? (
<>
<View
style={{
@@ -267,19 +267,19 @@ export const Settings = ({navigation}) => {
fontFamily: WEIGHT.regular,
fontSize: SIZE.xs,
}}>
- {user.notesnook.subscription.isTrial ? 'Trial' : 'Pro'}
+ {user.subscription.isTrial ? 'Trial' : 'Pro'}
</Text>
</View>
</View>
<Seperator />
<View>
- {user.notesnook.subscription.isTrial ? (
+ {user.subscription.isTrial ? (
<Text
style={{
color:
getTimeLeft(
- user.notesnook.subscription.start,
- user.notesnook.subscription.expiry,
+ user.subscription.start,
+ user.subscription.expiry,
) > 5
? colors.pri
: colors.errorText,
@@ -287,8 +287,8 @@ export const Settings = ({navigation}) => {
fontSize: SIZE.xxl,
}}>
{getTimeLeft(
- user.notesnook.subscription.start,
- user.notesnook.subscription.expiry,
+ user.subscription.start,
+ user.subscription.expiry,
) + ' Days Remaining'}
</Text>
) : null}
@@ -739,7 +739,7 @@ export const Settings = ({navigation}) => {
title="Encrypted Backups"
tagline="Encrypt your data before backup"
onPress={async () => {
- if (!user || !user.id) {
+ if (user) {
ToastEvent.show(
'You must login to enable encryption',
'error',