mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
fix minor bugs
This commit is contained in:
@@ -154,7 +154,7 @@ const App = () => {
|
|||||||
error = e;
|
error = e;
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
if (!user || !user.id) {
|
if (!user) {
|
||||||
setLoginMessage(dispatch);
|
setLoginMessage(dispatch);
|
||||||
}
|
}
|
||||||
dispatch({type: Actions.ALL});
|
dispatch({type: Actions.ALL});
|
||||||
|
|||||||
@@ -579,7 +579,7 @@ export const ActionSheetComponent = ({
|
|||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
const onPressSync = async () => {
|
const onPressSync = async () => {
|
||||||
if (!user || !user.Id) {
|
if (!user) {
|
||||||
ToastEvent.show(
|
ToastEvent.show(
|
||||||
'You must login to sync',
|
'You must login to sync',
|
||||||
'error',
|
'error',
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import {Loading} from '../Loading';
|
|||||||
import {opacity, ph, pv, SIZE, WEIGHT} from '../../utils/SizeUtils';
|
import {opacity, ph, pv, SIZE, WEIGHT} from '../../utils/SizeUtils';
|
||||||
import {db} from '../../utils/DB';
|
import {db} from '../../utils/DB';
|
||||||
import {DDS} from '../../services/DeviceDetection';
|
import {DDS} from '../../services/DeviceDetection';
|
||||||
import { sleep } from '../../utils/TimeUtils';
|
import {sleep} from '../../utils/TimeUtils';
|
||||||
|
|
||||||
const LoginDialog = () => {
|
const LoginDialog = () => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
@@ -121,10 +121,9 @@ const LoginDialog = () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
let user = await db.user.get();
|
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');
|
setStatus('Syncing your notes');
|
||||||
dispatch({type: Actions.USER, user: user});
|
dispatch({type: Actions.USER, user: user});
|
||||||
dispatch({type: Actions.SYNCING, syncing: true});
|
|
||||||
await db.sync();
|
await db.sync();
|
||||||
eSendEvent(eStartSyncer);
|
eSendEvent(eStartSyncer);
|
||||||
dispatch({type: Actions.ALL});
|
dispatch({type: Actions.ALL});
|
||||||
@@ -134,7 +133,6 @@ const LoginDialog = () => {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
ToastEvent.show(e.message, 'error', 'local');
|
ToastEvent.show(e.message, 'error', 'local');
|
||||||
} finally {
|
} finally {
|
||||||
dispatch({type: Actions.SYNCING, syncing: false});
|
|
||||||
setLoggingIn(false);
|
setLoggingIn(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -191,14 +189,12 @@ const LoginDialog = () => {
|
|||||||
let user;
|
let user;
|
||||||
try {
|
try {
|
||||||
user = await db.user.get();
|
user = await db.user.get();
|
||||||
let k = await db.user.key();
|
|
||||||
setKey(k.key);
|
|
||||||
setStatus('Setting up crenditials');
|
setStatus('Setting up crenditials');
|
||||||
dispatch({type: Actions.USER, user: user});
|
dispatch({type: Actions.USER, user: user});
|
||||||
eSendEvent(eStartSyncer);
|
eSendEvent(eStartSyncer);
|
||||||
close();
|
close();
|
||||||
await sleep(500);
|
await sleep(500);
|
||||||
eSendEvent(eOpenRecoveryKeyDialog);
|
eSendEvent(eOpenRecoveryKeyDialog, true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setFailed(true);
|
setFailed(true);
|
||||||
ToastEvent.show('Login Failed, try again', 'error', 'local');
|
ToastEvent.show('Login Failed, try again', 'error', 'local');
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ export const UserSection = ({noTextMode}) => {
|
|||||||
{syncing ? 'Syncing ' : 'Synced '}
|
{syncing ? 'Syncing ' : 'Synced '}
|
||||||
{!syncing ? (
|
{!syncing ? (
|
||||||
user?.notesnook?.lastSynced ? (
|
user?.notesnook?.lastSynced ? (
|
||||||
<TimeSince time={user.notesnook.lastSynced} />
|
<TimeSince time={user.lastSynced} />
|
||||||
) : (
|
) : (
|
||||||
'never'
|
'never'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class RecoveryKeyDialog extends React.Component {
|
|||||||
|
|
||||||
close = () => {
|
close = () => {
|
||||||
this.actionSheetRef.current?._setModalVisible(false);
|
this.actionSheetRef.current?._setModalVisible(false);
|
||||||
if (!this.signup) {
|
if (this.signup) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
eSendEvent(eOpenResultDialog, {
|
eSendEvent(eOpenResultDialog, {
|
||||||
title: 'Welcome!',
|
title: 'Welcome!',
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export const defaultState = {
|
|||||||
},
|
},
|
||||||
tags: [],
|
tags: [],
|
||||||
colorNotes: [],
|
colorNotes: [],
|
||||||
user: {},
|
user: null,
|
||||||
premiumUser:true,
|
premiumUser:true,
|
||||||
settings: {
|
settings: {
|
||||||
showToolbarOnTop: false,
|
showToolbarOnTop: false,
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ export const Settings = ({navigation}) => {
|
|||||||
style={{
|
style={{
|
||||||
paddingHorizontal: 0,
|
paddingHorizontal: 0,
|
||||||
}}>
|
}}>
|
||||||
{user && user.Id ? (
|
{user ? (
|
||||||
<>
|
<>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@@ -267,19 +267,19 @@ export const Settings = ({navigation}) => {
|
|||||||
fontFamily: WEIGHT.regular,
|
fontFamily: WEIGHT.regular,
|
||||||
fontSize: SIZE.xs,
|
fontSize: SIZE.xs,
|
||||||
}}>
|
}}>
|
||||||
{user.notesnook.subscription.isTrial ? 'Trial' : 'Pro'}
|
{user.subscription.isTrial ? 'Trial' : 'Pro'}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<Seperator />
|
<Seperator />
|
||||||
<View>
|
<View>
|
||||||
{user.notesnook.subscription.isTrial ? (
|
{user.subscription.isTrial ? (
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
color:
|
color:
|
||||||
getTimeLeft(
|
getTimeLeft(
|
||||||
user.notesnook.subscription.start,
|
user.subscription.start,
|
||||||
user.notesnook.subscription.expiry,
|
user.subscription.expiry,
|
||||||
) > 5
|
) > 5
|
||||||
? colors.pri
|
? colors.pri
|
||||||
: colors.errorText,
|
: colors.errorText,
|
||||||
@@ -287,8 +287,8 @@ export const Settings = ({navigation}) => {
|
|||||||
fontSize: SIZE.xxl,
|
fontSize: SIZE.xxl,
|
||||||
}}>
|
}}>
|
||||||
{getTimeLeft(
|
{getTimeLeft(
|
||||||
user.notesnook.subscription.start,
|
user.subscription.start,
|
||||||
user.notesnook.subscription.expiry,
|
user.subscription.expiry,
|
||||||
) + ' Days Remaining'}
|
) + ' Days Remaining'}
|
||||||
</Text>
|
</Text>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -739,7 +739,7 @@ export const Settings = ({navigation}) => {
|
|||||||
title="Encrypted Backups"
|
title="Encrypted Backups"
|
||||||
tagline="Encrypt your data before backup"
|
tagline="Encrypt your data before backup"
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
if (!user || !user.id) {
|
if (user) {
|
||||||
ToastEvent.show(
|
ToastEvent.show(
|
||||||
'You must login to enable encryption',
|
'You must login to enable encryption',
|
||||||
'error',
|
'error',
|
||||||
|
|||||||
Reference in New Issue
Block a user