Skip to content

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

fix signup user

ammarahm-ed1e01974635d6
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 @@
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">10.0.2.2</domain>
<domain includeSubdomains="true">localhost</domain>
- <domain includeSubdomains="true">192.168.10.5</domain>
+ <domain includeSubdomains="true">192.168.10.5</domain>
+ <domain includeSubdomains="true">192.168.10.10</domain>
</domain-config>
</network-security-config>
\ 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' ? (
<Heading color={colors.accent} size={SIZE.md}>
- {item.name}
+ {item.name}
</Heading>
) : (
<Paragraph size={SIZE.md}>{item.name}</Paragraph>
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 && <PressableButton
- onPress={messageBoardState.onPress}
- customStyle={{
- paddingVertical: 12,
- width: '100%',
- flexDirection: 'row',
- alignItems: 'center',
- justifyContent: 'flex-start',
- paddingHorizontal: 6,
- }}>
- <View
- style={{
- width: 40,
- backgroundColor:messageBoardState.type === "error"? colors.red: colors.accent,
- height: 40,
- marginLeft: 10,
- borderRadius: 100,
+ {messageBoardState && messageBoardState?.visible && (
+ <PressableButton
+ onPress={messageBoardState.onPress}
+ customStyle={{
+ paddingVertical: 12,
+ width: '100%',
+ flexDirection: 'row',
alignItems: 'center',
- justifyContent: 'center',
+ justifyContent: 'flex-start',
+ paddingHorizontal: 0,
}}>
- <Icon size={SIZE.lg} color="white" name={messageBoardState.icon} />
- </View>
+ <View
+ style={{
+ width: 40,
+ backgroundColor:
+ messageBoardState.type === 'error' ? colors.red : colors.accent,
+ height: 40,
+ marginLeft: 10,
+ borderRadius: 100,
+ alignItems: 'center',
+ justifyContent: 'center',
+ }}>
+ <Icon size={SIZE.lg} color="white" name={messageBoardState.icon} />
+ </View>
- <View
- style={{
- marginLeft: 10,
- }}>
- <Paragraph color={colors.icon} size={SIZE.xs}>
- {messageBoardState.message}
- </Paragraph>
- <Paragraph color={messageBoardState.type === "error"? colors.red: colors.accent}>{messageBoardState.actionText}</Paragraph>
- </View>
+ <View
+ style={{
+ marginLeft: 10,
+ }}>
+ <Paragraph color={colors.icon} size={SIZE.xs}>
+ {messageBoardState.message}
+ </Paragraph>
+ <Paragraph
+ color={
+ messageBoardState.type === 'error' ? colors.red : colors.accent
+ }>
+ {messageBoardState.actionText}
+ </Paragraph>
+ </View>
- <View
- style={{
- width: 40,
- height: 40,
- justifyContent: 'center',
- alignItems: 'center',
- position: 'absolute',
- right: 6,
- }}>
- <Icon name="chevron-right" color={messageBoardState.type === "error"? colors.red: colors.accent} size={SIZE.lg} />
- </View>
- </PressableButton>}
+ <View
+ style={{
+ width: 40,
+ height: 40,
+ justifyContent: 'center',
+ alignItems: 'center',
+ position: 'absolute',
+ right: 6,
+ }}>
+ <Icon
+ name="chevron-right"
+ color={
+ messageBoardState.type === 'error' ? colors.red : colors.accent
+ }
+ size={SIZE.lg}
+ />
+ </View>
+ </PressableButton>
+ )}
{user ? (
<>
@@ -396,7 +410,6 @@ const SettingsUserSection = () => {
style={{
alignSelf: 'center',
width: '100%',
- borderRadius: 5,
paddingVertical: 12,
}}>
<View
@@ -404,6 +417,9 @@ const SettingsUserSection = () => {
justifyContent: 'space-between',
alignItems: 'center',
flexDirection: 'row',
+ borderBottomWidth:1,
+ paddingBottom:2.5,
+ borderBottomColor:colors.nav
}}>
<View
style={{
@@ -443,14 +459,15 @@ const SettingsUserSection = () => {
paddingVertical: 2.5,
}}>
<Heading color={colors.accent} size={SIZE.sm}>
- {SUBSCRIPTION_STATUS_STRINGS[user.subscription.status]}
+ {SUBSCRIPTION_STATUS_STRINGS[user.subscription.type]}
</Heading>
</View>
</View>
- <Seperator />
<View>
- {user.subscription.status === 1 ? (
+ {user.subscription.type === 1 ||
+ user.subscription.type === 2 ? (
<View>
+ <Seperator />
<Paragraph
size={SIZE.lg}
color={
@@ -470,18 +487,21 @@ const SettingsUserSection = () => {
</View>
) : null}
- <Seperator />
-
- <Button
- onPress={() => {
- eSendEvent(eOpenPremiumDialog);
- }}
- width="100%"
- fontSize={SIZE.md}
- title="Subscribe to Notesnook Pro"
- height={50}
- type="accent"
- />
+ {user.isEmailConfirmed && (
+ <>
+ <Seperator />
+ <Button
+ onPress={() => {
+ eSendEvent(eOpenPremiumDialog);
+ }}
+ width="100%"
+ fontSize={SIZE.md}
+ title="Subscribe to Notesnook Pro"
+ height={50}
+ type="accent"
+ />
+ </>
+ )}
</View>
</View>
</View>