diff --git a/apps/mobile/android/app/src/main/res/xml/network_security_config.xml b/apps/mobile/android/app/src/main/res/xml/network_security_config.xml index 5c9723d2e..6cce7d10f 100644 --- a/apps/mobile/android/app/src/main/res/xml/network_security_config.xml +++ b/apps/mobile/android/app/src/main/res/xml/network_security_config.xml @@ -3,6 +3,7 @@ 10.0.2.2 localhost - 192.168.10.5 + 192.168.10.5 + 192.168.10.10 \ No newline at end of file diff --git a/apps/mobile/src/components/LoginDialog/index.js b/apps/mobile/src/components/LoginDialog/index.js index 030f839d6..d5fa218a2 100644 --- a/apps/mobile/src/components/LoginDialog/index.js +++ b/apps/mobile/src/components/LoginDialog/index.js @@ -14,7 +14,7 @@ import { eUnSubscribeEvent, ToastEvent, } from '../../services/EventManager'; -import {clearMessage} from '../../services/Message'; +import {clearMessage, setEmailVerifyMessage} from '../../services/Message'; import {getElevation} from '../../utils'; import {db} from '../../utils/DB'; import { @@ -177,8 +177,10 @@ const LoginDialog = () => { try { await db.user.login(email.toLowerCase(), password, true); } catch (e) { + console.log(e); ToastEvent.show(e.message, 'error', 'local'); setLoading(false); + setStatus(null) return; } @@ -197,6 +199,7 @@ const LoginDialog = () => { ToastEvent.show(`Logged in as ${email}`, 'success', 'local'); } catch (e) { console.warn(e); + setStatus(null); ToastEvent.show(e.message, 'error', 'local'); } finally { setLoading(false); @@ -241,6 +244,8 @@ const LoginDialog = () => { await db.user.signup(email, password); } catch (e) { setLoading(false); + setStatus(null); + console.log(e); ToastEvent.show('Signup failed, Network Error', 'error', 'local'); return; } @@ -253,10 +258,12 @@ const LoginDialog = () => { dispatch({type: Actions.LAST_SYNC, lastSync: await db.lastSynced()}); eSendEvent(eStartSyncer); clearMessage(dispatch); + setEmailVerifyMessage(dispatch) close(); await sleep(500); eSendEvent(eOpenRecoveryKeyDialog, true); } catch (e) { + setStatus(null); ToastEvent.show('Login Failed, try again', 'error', 'local'); } finally { setLoading(false); @@ -559,7 +566,6 @@ const LoginDialog = () => { onPress={current.buttonAltFunc} width="100%" type="shade" - loading={loading} fontSize={SIZE.md} style={{ marginTop: 10, diff --git a/apps/mobile/src/components/Menu/MenuListItem.js b/apps/mobile/src/components/Menu/MenuListItem.js index 5630d77d3..cd958d442 100644 --- a/apps/mobile/src/components/Menu/MenuListItem.js +++ b/apps/mobile/src/components/Menu/MenuListItem.js @@ -83,7 +83,7 @@ export const MenuListItem = ({item, index, noTextMode, testID}) => { /> {headerTextState?.id === item.name.toLowerCase() + '_navigation' ? ( - {item.name} + {item.name} ) : ( {item.name} diff --git a/apps/mobile/src/components/RecoveryKeyDialog/index.js b/apps/mobile/src/components/RecoveryKeyDialog/index.js index 2c9aa4866..8cb902038 100644 --- a/apps/mobile/src/components/RecoveryKeyDialog/index.js +++ b/apps/mobile/src/components/RecoveryKeyDialog/index.js @@ -125,7 +125,7 @@ class RecoveryKeyDialog extends React.Component { }; onOpen = async () => { - let k = await db.user.key(); + let k = await db.user.getEncryptionKey(); this.user = await db.user.getUser(); if (k) { diff --git a/apps/mobile/src/utils/DB.js b/apps/mobile/src/utils/DB.js index e25f378e9..25976cdda 100644 --- a/apps/mobile/src/utils/DB.js +++ b/apps/mobile/src/utils/DB.js @@ -1,12 +1,19 @@ -import {Platform} from "react-native"; -import Storage from "./Storage"; -import EventSource from "rn-eventsource"; -import AndroidEventSource from "./EventSource"; -import Database from "notes-core/api/index"; +import {Platform} from 'react-native'; +import Storage from './storage'; +import EventSource from 'rn-eventsource'; +import AndroidEventSource from './event-source'; +import Database from 'notes-core/api/index'; global.Buffer = require('buffer').Buffer; export const db = new Database( - Storage, - Platform.OS === 'ios' ? EventSource : AndroidEventSource, + Storage, + Platform.OS === 'ios' ? EventSource : AndroidEventSource, ); -db.host("https://api.notesnook.com") + +//"https://api.notesnook.com" + +db.host({ + API_HOST: 'http://192.168.10.10:5264', + AUTH_HOST: 'http://192.168.10.10:8264', + SSE_HOST: 'http://192.168.10.10:7264', +}); diff --git a/apps/mobile/src/utils/index.js b/apps/mobile/src/utils/index.js index 32c4e1d4b..d2dd50f56 100755 --- a/apps/mobile/src/utils/index.js +++ b/apps/mobile/src/utils/index.js @@ -143,11 +143,11 @@ export const SUBSCRIPTION_STATUS = { }; export const SUBSCRIPTION_STATUS_STRINGS = { - 0: 'Expired', + 0: 'Basic', 1: 'Trial', - 2: 'Pro', - 3: 'Pro', - 4: 'Cancelled', + 2: 'Beta', + 3: 'Trial Expired', + 4: 'Beta Expired', }; export const BUTTON_TYPES = { diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js index 7767d12d2..d79f6e363 100644 --- a/apps/mobile/src/views/Settings/index.js +++ b/apps/mobile/src/views/Settings/index.js @@ -327,7 +327,7 @@ const CustomButton = ({ const SettingsUserSection = () => { const [state] = useTracked(); - const {colors, user,messageBoardState} = state; + const {colors, user, messageBoardState} = state; const getTimeLeft = (t2) => { let d1 = new Date(Date.now()); @@ -340,51 +340,65 @@ const SettingsUserSection = () => { return ( <> - {messageBoardState && - - - + + + - - - {messageBoardState.message} - - {messageBoardState.actionText} - + + + {messageBoardState.message} + + + {messageBoardState.actionText} + + - - - - } + + + + + )} {user ? ( <> @@ -396,7 +410,6 @@ const SettingsUserSection = () => { style={{ alignSelf: 'center', width: '100%', - borderRadius: 5, paddingVertical: 12, }}> { justifyContent: 'space-between', alignItems: 'center', flexDirection: 'row', + borderBottomWidth:1, + paddingBottom:2.5, + borderBottomColor:colors.nav }}> { paddingVertical: 2.5, }}> - {SUBSCRIPTION_STATUS_STRINGS[user.subscription.status]} + {SUBSCRIPTION_STATUS_STRINGS[user.subscription.type]} - - {user.subscription.status === 1 ? ( + {user.subscription.type === 1 || + user.subscription.type === 2 ? ( + { ) : null} - - -