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;
|
||||
console.log(e);
|
||||
}
|
||||
if (!user || !user.id) {
|
||||
if (!user) {
|
||||
setLoginMessage(dispatch);
|
||||
}
|
||||
dispatch({type: Actions.ALL});
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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'
|
||||
)
|
||||
|
||||
@@ -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!',
|
||||
|
||||
@@ -15,7 +15,7 @@ export const defaultState = {
|
||||
},
|
||||
tags: [],
|
||||
colorNotes: [],
|
||||
user: {},
|
||||
user: null,
|
||||
premiumUser:true,
|
||||
settings: {
|
||||
showToolbarOnTop: false,
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user