Skip to content

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

feat: implement new trial flow

ammarahm-ed39f70736f233
diff --git a/apps/mobile/html/Web.bundle/site/init.js b/apps/mobile/html/Web.bundle/site/init.js
index 77232b994..1c1ec14d9 100755
--- a/apps/mobile/html/Web.bundle/site/init.js
+++ b/apps/mobile/html/Web.bundle/site/init.js
@@ -62,7 +62,7 @@ function loadFontSize() {
let changeTimer = null;
const COLLAPSED_KEY = 'c';
const HIDDEN_KEY = 'h';
-const collapsibleTags = {HR: 1, H2: 2, H3: 3, H4: 4, H5: 5, H6: 6};
+const collapsibleTags = { HR: 1, H2: 2, H3: 3, H4: 4, H5: 5, H6: 6 };
let styleElement;
function addStyle() {
@@ -142,12 +142,12 @@ function init_callback(_editor) {
editor.on('BeforeAddUndo', onUndoChange);
editor.on('AddUndo', onUndoChange);
editor.on('cut', function () {
- onChange({type: 'cut'});
+ onChange({ type: 'cut' });
onUndoChange();
});
editor.on('copy', onUndoChange);
editor.on('paste', function () {
- onChange({type: 'paste'});
+ onChange({ type: 'paste' });
});
editor.on('focus', function () {
@@ -169,7 +169,7 @@ function init_callback(_editor) {
editor.on('NewBlock', function (e) {
console.log('New Block', e);
- const {newBlock} = e;
+ const { newBlock } = e;
let target;
if (newBlock) {
target = newBlock.previousElementSibling;
@@ -182,7 +182,7 @@ function init_callback(_editor) {
});
editor.on('touchstart mousedown', function (e) {
- const {target} = e;
+ const { target } = e;
if (
e.offsetX < 6 &&
collapsibleTags[target.tagName] &&
@@ -212,10 +212,7 @@ function init_callback(_editor) {
});
editor.on('tap', function (e) {
- if (
- e.target.classList.contains('mce-content-body') &&
- !e.target.innerText.length > 0
- ) {
+ if (e.target.classList.contains('mce-content-body') && !e.target.innerText.length > 0) {
e.preventDefault();
}
});
@@ -409,8 +406,7 @@ function init_tiny(size) {
autoresize_bottom_margin: 120,
table_toolbar:
'tcellprops trowprops | tableinsertrowafter tableinsertcolafter tabledeleterow tabledeletecol | tableconfig',
- imagetools_toolbar:
- 'imagedownload | rotateleft rotateright flipv fliph | imageopts ',
+ imagetools_toolbar: 'imagedownload | rotateleft rotateright flipv fliph | imageopts ',
placeholder: 'Start writing your note here',
object_resizing: true,
table_responsive_width: false,
@@ -558,10 +554,7 @@ function setup_tiny(_editor) {
};
reader.readAsDataURL(recoveredBlob);
};
- xhr.open(
- 'GET',
- tinymce.activeEditor.selection.getNode().getAttribute('src')
- );
+ xhr.open('GET', tinymce.activeEditor.selection.getNode().getAttribute('src'));
xhr.send();
}
}
@@ -592,7 +585,7 @@ function scrollSelectionIntoView(event) {
let node = editor.selection.getNode();
if (node) {
console.log(node, 'scrolling into view');
- node.scrollIntoView({behavior: 'smooth', block: 'nearest'});
+ node.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}
}, 1);
}
diff --git a/apps/mobile/src/components/AppLoader/index.js b/apps/mobile/src/components/AppLoader/index.js
index 32702c09b..d1e62c46c 100644
--- a/apps/mobile/src/components/AppLoader/index.js
+++ b/apps/mobile/src/components/AppLoader/index.js
@@ -33,7 +33,7 @@ import { ActionIcon } from '../ActionIcon';
import { Button } from '../Button';
import Input from '../Input';
import { SvgToPngView } from '../ListPlaceholders';
-import { SVG } from '../LoginDialog/background';
+import { SVG } from '../Auth/background';
import Seperator from '../Seperator';
import SplashScreen from '../SplashScreen';
import Heading from '../Typography/Heading';
diff --git a/apps/mobile/src/components/LoginDialog/background.js b/apps/mobile/src/components/Auth/background.js
similarity index 100%
rename from apps/mobile/src/components/LoginDialog/background.js
rename to apps/mobile/src/components/Auth/background.js
diff --git a/apps/mobile/src/components/LoginDialog/changepassword.js b/apps/mobile/src/components/Auth/changepassword.js
similarity index 100%
rename from apps/mobile/src/components/LoginDialog/changepassword.js
rename to apps/mobile/src/components/Auth/changepassword.js
diff --git a/apps/mobile/src/components/LoginDialog/forgotpassword.js b/apps/mobile/src/components/Auth/forgotpassword.js
similarity index 100%
rename from apps/mobile/src/components/LoginDialog/forgotpassword.js
rename to apps/mobile/src/components/Auth/forgotpassword.js
diff --git a/apps/mobile/src/components/LoginDialog/index.js b/apps/mobile/src/components/Auth/index.js
similarity index 68%
rename from apps/mobile/src/components/LoginDialog/index.js
rename to apps/mobile/src/components/Auth/index.js
index 86cc6142d..0ca2478ad 100644
--- a/apps/mobile/src/components/LoginDialog/index.js
+++ b/apps/mobile/src/components/Auth/index.js
@@ -8,17 +8,18 @@ import { Toast } from '../Toast';
import { Login } from './login';
import { Signup } from './signup';
-const MODES = {
+export const AuthMode = {
login: 0,
signup: 1,
- welcomeSignup: 2
+ welcomeSignup: 2,
+ trialSignup: 3
};
-const LoginDialog = () => {
+const Auth = () => {
const [state] = useTracked();
const colors = state.colors;
const [visible, setVisible] = useState(false);
- const [mode, setMode] = useState(MODES.login);
+ const [currentAuthMode, setCurrentAuthMode] = useState(AuthMode.login);
const actionSheetRef = useRef();
useEffect(() => {
@@ -31,7 +32,7 @@ const LoginDialog = () => {
}, []);
async function open(mode) {
- setMode(mode ? mode : MODES.login);
+ setCurrentAuthMode(mode ? mode : AuthMode.login);
setVisible(true);
await sleep(10);
actionSheetRef.current?.show();
@@ -39,7 +40,7 @@ const LoginDialog = () => {
const close = () => {
actionSheetRef.current?.hide();
- setMode(MODES.login);
+ setCurrentAuthMode(AuthMode.login);
setVisible(false);
};
@@ -47,7 +48,7 @@ const LoginDialog = () => {
<BaseDialog
overlayOpacity={0}
statusBarTranslucent={false}
- onRequestClose={mode !== MODES.welcomeSignup && close}
+ onRequestClose={currentAuthMode !== AuthMode.welcomeSignup && close}
visible={true}
onClose={close}
useSafeArea={false}
@@ -57,13 +58,17 @@ const LoginDialog = () => {
>
<Toast context="local" />
- {mode === MODES.signup || mode === MODES.welcomeSignup ? (
- <Signup changeMode={mode => setMode(mode)} welcome={mode === MODES.welcomeSignup} />
+ {currentAuthMode !== AuthMode.login ? (
+ <Signup
+ changeMode={mode => setCurrentAuthMode(mode)}
+ trial={AuthMode.trialSignup === currentAuthMode}
+ welcome={currentAuthMode === AuthMode.welcomeSignup}
+ />
) : (
- <Login changeMode={mode => setMode(mode)} />
+ <Login changeMode={mode => setCurrentAuthMode(mode)} />
)}
</BaseDialog>
);
};
-export default LoginDialog;
+export default Auth;
diff --git a/apps/mobile/src/components/LoginDialog/login.js b/apps/mobile/src/components/Auth/login.js
similarity index 53%
rename from apps/mobile/src/components/LoginDialog/login.js
rename to apps/mobile/src/components/Auth/login.js
index 8034422a9..2d42e3a38 100644
--- a/apps/mobile/src/components/LoginDialog/login.js
+++ b/apps/mobile/src/components/Auth/login.js
@@ -1,5 +1,5 @@
import React, { useEffect, useRef, useState } from 'react';
-import { View } from 'react-native';
+import { LayoutAnimation, Platform, View } from 'react-native';
import { SheetManager } from 'react-native-actions-sheet';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { useTracked } from '../../provider';
@@ -18,6 +18,7 @@ import { Button } from '../Button';
import BaseDialog from '../Dialog/base-dialog';
import Input from '../Input';
import { SvgToPngView } from '../ListPlaceholders';
+import { BouncingView } from '../Transitions/bouncing-view';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
import { SVG } from './background';
@@ -67,7 +68,7 @@ export const Login = ({ changeMode }) => {
setLoading(true);
let user;
try {
- await db.user.login(email.toLowerCase(), password);
+ await db.user.login(email.current.toLowerCase(), password.current);
user = await db.user.getUser();
if (!user) throw new Error('Email or password incorrect!');
PremiumService.setPremiumStatus();
@@ -89,6 +90,7 @@ export const Login = ({ changeMode }) => {
progress: true
});
} catch (e) {
+ console.log(e.stack);
setLoading(false);
ToastEvent.show({
heading: user ? 'Failed to sync' : 'Login failed',
@@ -111,7 +113,7 @@ export const Login = ({ changeMode }) => {
position: 'absolute',
zIndex: 999,
left: 12,
- top: 12 + insets.top
+ top: Platform.OS === 'ios' ? 12 + insets.top : 12
}}
/>
@@ -133,121 +135,124 @@ export const Login = ({ changeMode }) => {
overflow: 'hidden'
}}
>
- <SvgToPngView src={SVG(colors.night ? 'white' : 'black')} height={700} />
+ <BouncingView initialScale={1.2} duration={5000}>
+ <SvgToPngView src={SVG(colors.night ? 'white' : 'black')} height={700} />
+ </BouncingView>
</View>
-
- <View
- style={{
- width: '100%',
- justifyContent: 'center',
- alignSelf: 'center',
- paddingHorizontal: 12,
- marginBottom: 30,
- marginTop: 15
- }}
- >
- <Heading
- style={{
- textAlign: 'center'
- }}
- size={30}
- color={colors.heading}
- >
- Welcome back!
- </Heading>
- <Paragraph
+ <BouncingView initialScale={0.95} duration={3000}>
+ <View
style={{
- textDecorationLine: 'underline',
- textAlign: 'center',
- marginTop: 5
- }}
- onPress={() => {
- changeMode(1);
+ width: '100%',
+ justifyContent: 'center',
+ alignSelf: 'center',
+ paddingHorizontal: 12,
+ marginBottom: 30,
+ marginTop: 15
}}
- size={SIZE.md}
>
- Don't have an account? Sign up
- </Paragraph>
- </View>
- <View
- style={{
- width: focused ? '100%' : '99.9%',
- padding: 12,
- backgroundColor: colors.bg,
- flexGrow: 1
- }}
- >
- <Input
- fwdRef={emailInputRef}
- onChangeText={value => {
- email.current = value;
- }}
- onErrorCheck={e => setError(e)}
- returnKeyLabel="Next"
- returnKeyType="next"
- autoCompleteType="email"
- validationType="email"
- autoCorrect={false}
- autoCapitalize="none"
- errorMessage="Email is invalid"
- placeholder="Email"
- onSubmit={() => {}}
- />
-
- <Input
- fwdRef={passwordInputRef}
- onChangeText={value => {
- password.current = value;
- }}
- onErrorCheck={e => setError(e)}
- returnKeyLabel="Done"
- returnKeyType="done"
- secureTextEntry
- autoCompleteType="password"
- autoCapitalize="none"
- validationType="password"
- autoCorrect={false}
- placeholder="Password"
- marginBottom={0}
- />
- <Button
- title="Forgot your password?"
- style={{
- alignSelf: 'flex-end',
- height: 30,
- paddingHorizontal: 0
- }}
- onPress={() => {
- SheetManager.show('forgotpassword_sheet', email.current);
- }}
- textStyle={{
- textDecorationLine: 'underline'
- }}
- fontSize={SIZE.xs}
- type="gray"
- />
-
+ <Heading
+ style={{
+ textAlign: 'center'
+ }}
+ size={30}
+ color={colors.heading}
+ >
+ Welcome back!
+ </Heading>
+ <Paragraph
+ style={{
+ textDecorationLine: 'underline',
+ textAlign: 'center',
+ marginTop: 5
+ }}
+ onPress={() => {
+ changeMode(1);
+ }}
+ size={SIZE.md}
+ >
+ Don't have an account? Sign up
+ </Paragraph>
+ </View>
<View
style={{
- // position: 'absolute',
- marginTop: 50,
- alignSelf: 'center'
+ width: focused ? '100%' : '99.9%',
+ padding: 12,
+ backgroundColor: colors.bg,
+ flexGrow: 1
}}
>
+ <Input
+ fwdRef={emailInputRef}
+ onChangeText={value => {
+ email.current = value;
+ }}
+ onErrorCheck={e => setError(e)}
+ returnKeyLabel="Next"
+ returnKeyType="next"
+ autoCompleteType="email"
+ validationType="email"
+ autoCorrect={false}
+ autoCapitalize="none"
+ errorMessage="Email is invalid"
+ placeholder="Email"
+ onSubmit={() => {}}
+ />
+
+ <Input
+ fwdRef={passwordInputRef}
+ onChangeText={value => {
+ password.current = value;
+ }}
+ onErrorCheck={e => setError(e)}
+ returnKeyLabel="Done"
+ returnKeyType="done"
+ secureTextEntry
+ autoCompleteType="password"
+ autoCapitalize="none"
+ validationType="password"
+ autoCorrect={false}
+ placeholder="Password"
+ marginBottom={0}
+ />
<Button
+ title="Forgot your password?"
style={{
- marginTop: 10,
- width: 250,
- borderRadius: 100
+ alignSelf: 'flex-end',
+ height: 30,
+ paddingHorizontal: 0
+ }}
+ onPress={() => {
+ SheetManager.show('forgotpassword_sheet', email.current);
}}
- loading={loading}
- onPress={login}
- // width="100%"
- type="accent"
- title={loading ? null : 'Login to your account'}
+ textStyle={{
+ textDecorationLine: 'underline'
+ }}
+ fontSize={SIZE.xs}
+ type="gray"
/>
+
+ <View
+ style={{
+ // position: 'absolute',
+ marginTop: 50,
+ alignSelf: 'center'
+ }}
+ >
+ <Button
+ style={{
+ marginTop: 10,
+ width: 250,
+ borderRadius: 100
+ }}
+ loading={loading}
+ onPress={login}
+ // width="100%"
+ type="accent"
+ title={loading ? null : 'Login to your account'}
+ />
+ </View>
</View>
- </View>
+ </BouncingView>
</View>
</>
);
diff --git a/apps/mobile/src/components/LoginDialog/sessionexpired.js b/apps/mobile/src/components/Auth/sessionexpired.js
similarity index 100%
rename from apps/mobile/src/components/LoginDialog/sessionexpired.js
rename to apps/mobile/src/components/Auth/sessionexpired.js
diff --git a/apps/mobile/src/components/Auth/signup.js b/apps/mobile/src/components/Auth/signup.js
new file mode 100644
index 000000000..dd27d92da
--- /dev/null
+++ b/apps/mobile/src/components/Auth/signup.js
@@ -0,0 +1,258 @@
+import React, { useRef, useState } from 'react';
+import { Dimensions, Platform, View } from 'react-native';
+import { useSafeAreaInsets } from 'react-native-safe-area-context';
+import { useTracked } from '../../provider';
+import { useUserStore } from '../../provider/stores';
+import { DDS } from '../../services/DeviceDetection';
+import { eSendEvent, ToastEvent } from '../../services/EventManager';
+import { clearMessage, setEmailVerifyMessage } from '../../services/Message';
+import PremiumService from '../../services/PremiumService';
+import { db } from '../../utils/database';
+import { eCloseLoginDialog, eOpenResultDialog } from '../../utils/Events';
+import { SIZE } from '../../utils/SizeUtils';
+import { sleep } from '../../utils/TimeUtils';
+import umami from '../../utils/umami';
+import { ActionIcon } from '../ActionIcon';
+import { Button } from '../Button';
+import BaseDialog from '../Dialog/base-dialog';
+import Input from '../Input';
+import { SvgToPngView } from '../ListPlaceholders';
+import { BouncingView } from '../Transitions/bouncing-view';
+import Heading from '../Typography/Heading';
+import Paragraph from '../Typography/Paragraph';
+import { SVG } from './background';
+
+export const Signup = ({ changeMode, welcome, trial }) => {
+ const [state] = useTracked();
+ const colors = state.colors;
+ const email = useRef();
+ const emailInputRef = useRef();
+ const passwordInputRef = useRef();
+ const password = useRef();
+ const confirmPasswordInputRef = useRef();
+ const confirmPassword = useRef();
+ const [error, setError] = useState(false);
+ const [loading, setLoading] = useState(false);
+
+ const insets = useSafeAreaInsets();
+
+ const setUser = useUserStore(state => state.setUser);
+ const setLastSynced = useUserStore(state => state.setLastSynced);
+
+ const validateInfo = () => {
+ if (!password.current || !email.current || !confirmPassword.current) {
+ ToastEvent.show({
+ heading: 'All fields required',
+ message: 'Fill all the fields and try again',
+ type: 'error',
+ context: 'local'
+ });
+
+ return false;
+ }
+
+ return true;
+ };
+
+ const signup = async () => {
+ if (!validateInfo() || error) return;
+ setLoading(true);
+ try {
+ await db.user.signup(email.toLowerCase(), password);
+ let user = await db.user.getUser();
+ setUser(user);
+ setLastSynced(await db.lastSynced());
+ clearMessage();
+ setEmailVerifyMessage();
+ eSendEvent(eCloseLoginDialog);
+ umami.pageView('/account-created', '/welcome/signup');
+ await sleep(300);
+ if (trial) {
+ PremiumService.sheet(null, null, true);
+ } else {
+ PremiumService.showVerifyEmailDialog();
+ }
+ } catch (e) {
+ setLoading(false);
+ ToastEvent.show({
+ heading: 'Signup failed',
+ message: e.message,
+ type: 'error',
+ context: 'local'
+ });
+ }
+ };
+
+ return (
+ <>
+ {!welcome && (
+ <ActionIcon
+ name="arrow-left"
+ onPress={() => {
+ eSendEvent(eCloseLoginDialog);
+ }}
+ color={colors.pri}
+ customStyle={{
+ position: 'absolute',
+ zIndex: 999,
+ left: 12,
+ top: Platform.OS === 'ios' ? 12 + insets.top : 12
+ }}
+ />
+ )}
+
+ {loading ? <BaseDialog transparent={true} visible={true} animation="fade" /> : null}
+ <View
+ style={{
+ borderRadius: DDS.isTab ? 5 : 0,
+ backgroundColor: colors.bg,
+ zIndex: 10,
+ width: '100%',
+ minHeight: '100%'
+ }}
+ >
+ <View
+ style={{
+ height: 250,
+ overflow: 'hidden'
+ }}
+ >
+ <BouncingView initialScale={1.2} duration={5000}>
+ <SvgToPngView src={SVG(colors.night ? 'white' : 'black')} height={700} />
+ </BouncingView>
+ </View>
+
+ <BouncingView initialScale={0.95} duration={5000}>
+ <View
+ style={{
+ width: '100%',
+ justifyContent: 'center',
+ alignSelf: 'center',
+ paddingHorizontal: 12,
+ marginBottom: 30,
+ marginTop: Dimensions.get('window').height < 700 ? -75 : 15
+ }}
+ >
+ <Heading
+ style={{
+ textAlign: 'center'
+ }}
+ size={30}
+ color={colors.heading}
+ >
+ Create your account
+ </Heading>
+ <Paragraph
+ style={{
+ textDecorationLine: 'underline',
+ textAlign: 'center'
+ }}
+ onPress={() => {
+ changeMode(0);
+ }}
+ size={SIZE.md}
+ >
+ Already have an account? Log in
+ </Paragraph>
+ </View>
+ <View
+ style={{
+ width: '100%',
+ padding: 12,
+ backgroundColor: colors.bg,
+ flexGrow: 1
+ }}
+ >
+ <Input
+ fwdRef={emailInputRef}
+ onChangeText={value => {
+ email.current = value;
+ }}
+ onErrorCheck={e => setError(e)}
+ returnKeyLabel="Next"
+ returnKeyType="next"
+ autoCompleteType="email"
+ validationType="email"
+ autoCorrect={false}
+ autoCapitalize="none"
+ errorMessage="Email is invalid"
+ placeholder="Email"
+ onSubmit={() => {}}
+ />
+
+ <Input
+ fwdRef={passwordInputRef}
+ onChangeText={value => {
+ password.current = value;
+ }}
+ onErrorCheck={e => setError(e)}
+ returnKeyLabel="Next"
+ returnKeyType="next"
+ secureTextEntry
+ autoCompleteType="password"
+ autoCapitalize="none"
+ validationType="password"
+ autoCorrect={false}
+ placeholder="Password"
+ />
+
+ <Input
+ fwdRef={confirmPasswordInputRef}
+ onChangeText={value => {
+ confirmPassword.current = value;
+ }}
+ onErrorCheck={e => setError(e)}
+ returnKeyLabel="Signup"
+ returnKeyType="done"
+ secureTextEntry
+ autoCompleteType="password"
+ autoCapitalize="none"
+ autoCorrect={false}
+ validationType="confirmPassword"
+ customValidator={() => password.current}
+ placeholder="Confirm password"
+ marginBottom={5}
+ />
+ <Paragraph size={SIZE.xs} color={colors.icon}>
+ By signing up, you agree to our terms of service and privacy policy.
+ </Paragraph>
+
+ <View
+ style={{
+ marginTop: 50,
+ alignSelf: 'center'
+ }}
+ >
+ <Button
+ style={{
+ marginTop: 10,
+ width: 250,
+ borderRadius: 100
+ }}
+ loading={loading}
+ onPress={signup}
+ type="accent"
+ title={loading ? null : 'Agree and continue'}
+ />
+
+ {loading || !welcome ? null : (
+ <Button
+ style={{
+ marginTop: 10,
+ width: 250,
+ borderRadius: 100
+ }}
+ onPress={() => {
+ eSendEvent(eCloseLoginDialog);
+ }}
+ type="grayBg"
+ title="Skip for now"
+ />
+ )}
+ </View>
+ </View>
+ </BouncingView>
+ </View>
+ </>
+ );
+};
diff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.js
index db5a93af0..87c72fb4b 100644
--- a/apps/mobile/src/components/DialogManager/index.js
+++ b/apps/mobile/src/components/DialogManager/index.js
@@ -11,8 +11,8 @@ import { Dialog } from '../Dialog';
import ExportDialog from '../ExportDialog';
import GeneralSheet from '../GeneralSheet';
import ImagePreview from '../ImagePreview';
-import LoginDialog from '../LoginDialog';
-import { SessionExpired } from '../LoginDialog/session-expired';
+import Auth from '../Auth';
+import { SessionExpired } from '../Auth/session-expired';
import MergeEditor from '../MergeEditor';
import MoveNoteDialog from '../MoveNoteDialog';
import PremiumDialog from '../Premium';
@@ -59,7 +59,7 @@ export class DialogManager extends Component {
<AddTopicDialog colors={colors} />
<AddNotebookDialog colors={colors} />
<PremiumDialog colors={colors} />
- <LoginDialog colors={colors} />
+ <Auth colors={colors} />
<MergeEditor />
<ExportDialog />
<RecoveryKeyDialog colors={colors} />
diff --git a/apps/mobile/src/components/LoginDialog/signup.js b/apps/mobile/src/components/LoginDialog/signup.js
deleted file mode 100644
index 084caab0c..000000000
--- a/apps/mobile/src/components/LoginDialog/signup.js
+++ /dev/null
@@ -1,248 +0,0 @@
-import React, { useRef, useState } from 'react';
-import { Dimensions, View } from 'react-native';
-import { useSafeAreaInsets } from 'react-native-safe-area-context';
-import { useTracked } from '../../provider';
-import { useUserStore } from '../../provider/stores';
-import { DDS } from '../../services/DeviceDetection';
-import { eSendEvent, ToastEvent } from '../../services/EventManager';
-import { clearMessage, setEmailVerifyMessage } from '../../services/Message';
-import { db } from '../../utils/database';
-import { eCloseLoginDialog, eOpenResultDialog } from '../../utils/Events';
-import { SIZE } from '../../utils/SizeUtils';
-import { sleep } from '../../utils/TimeUtils';
-import umami from '../../utils/umami';
-import { ActionIcon } from '../ActionIcon';
-import { Button } from '../Button';
-import BaseDialog from '../Dialog/base-dialog';
-import Input from '../Input';
-import { SvgToPngView } from '../ListPlaceholders';
-import Heading from '../Typography/Heading';
-import Paragraph from '../Typography/Paragraph';
-import { SVG } from './background';
-
-export const Signup = ({ changeMode, welcome }) => {
- const [state, dispatch] = useTracked();
- const colors = state.colors;
- const email = useRef();
- const emailInputRef = useRef();
- const passwordInputRef = useRef();
- const password = useRef();
- const confirmPasswordInputRef = useRef();
- const confirmPassword = useRef();
- const [error, setError] = useState(false);
- const [loading, setLoading] = useState(false);
-
- const insets = useSafeAreaInsets();
-
- const setUser = useUserStore(state => state.setUser);
- const setLastSynced = useUserStore(state => state.setLastSynced);
-
- const validateInfo = () => {
- if (!password.current || !email.current || !confirmPassword.current) {
- ToastEvent.show({
- heading: 'All fields required',
- message: 'Fill all the fields and try again',
- type: 'error',
- context: 'local'
- });
-
- return false;
- }
-
- return true;
- };
-
- const signup = async () => {
- if (!validateInfo() || error) return;
- setLoading(true);
- try {
- await db.user.signup(email.toLowerCase(), password);
- let user = await db.user.getUser();
- setUser(user);
- setLastSynced(await db.lastSynced());
- clearMessage();
- setEmailVerifyMessage();
- eSendEvent(eCloseLoginDialog);
- umami.pageView('/account-created', '/welcome/signup');
- await sleep(300);
- eSendEvent(eOpenResultDialog);
- } catch (e) {
- setLoading(false);
- ToastEvent.show({
- heading: 'Signup failed',
- message: e.message,
- type: 'error',
- context: 'local'
- });
- }
- };
-
- return (
- <>
- {!welcome && (
- <ActionIcon
- name="arrow-left"
- onPress={() => {
- eSendEvent(eCloseLoginDialog);
- }}
- color={colors.pri}
- customStyle={{
- position: 'absolute',
- zIndex: 999,
- left: 12,
- top: 12 + insets.top
- }}
- />
- )}
-
- {loading ? <BaseDialog transparent={true} visible={true} animation="fade" /> : null}
- <View
- style={{
- borderRadius: DDS.isTab ? 5 : 0,
- backgroundColor: colors.bg,
- zIndex: 10,
- width: '100%',
- minHeight: '100%'
- }}
- >
- <View
- style={{
- height: 250,
- overflow: 'hidden'
- }}
- >
- <SvgToPngView src={SVG(colors.night ? 'white' : 'black')} height={700} />
- </View>
-
- <View
- style={{
- width: '100%',
- justifyContent: 'center',
- alignSelf: 'center',
- paddingHorizontal: 12,
- marginBottom: 30,
- marginTop: Dimensions.get('window').height < 700 ? -75 : 15
- }}
- >
- <Heading
- style={{
- textAlign: 'center'
- }}
- size={30}
- color={colors.heading}
- >
- Create your account
- </Heading>
- <Paragraph
- style={{
- textDecorationLine: 'underline',
- textAlign: 'center'
- }}
- onPress={() => {
- changeMode(0);
- }}
- size={SIZE.md}
- >
- Already have an account? Log in
- </Paragraph>
- </View>
- <View
- style={{
- width: '100%',
- padding: 12,
- backgroundColor: colors.bg,
- flexGrow: 1
- }}
- >
- <Input
- fwdRef={emailInputRef}
- onChangeText={value => {
- email.current = value;
- }}
- onErrorCheck={e => setError(e)}
- returnKeyLabel="Next"
- returnKeyType="next"
- autoCompleteType="email"
- validationType="email"
- autoCorrect={false}
- autoCapitalize="none"
- errorMessage="Email is invalid"
- placeholder="Email"
- onSubmit={() => {}}
- />
-
- <Input
- fwdRef={passwordInputRef}
- onChangeText={value => {
- password.current = value;
- }}
- onErrorCheck={e => setError(e)}
- returnKeyLabel="Next"
- returnKeyType="next"
- secureTextEntry
- autoCompleteType="password"
- autoCapitalize="none"
- validationType="password"
- autoCorrect={false}
- placeholder="Password"
- />
-
- <Input
- fwdRef={confirmPasswordInputRef}
- onChangeText={value => {
- confirmPassword.current = value;
- }}
- onErrorCheck={e => setError(e)}
- returnKeyLabel="Signup"
- returnKeyType="done"
- secureTextEntry
- autoCompleteType="password"
- autoCapitalize="none"
- autoCorrect={false}
- validationType="confirmPassword"
- customValidator={() => password.current}
- placeholder="Confirm password"
- marginBottom={5}
- />
- <Paragraph size={SIZE.xs} color={colors.icon}>
- By signing up, you agree to our terms of service and privacy policy.
- </Paragraph>
-
- <View
- style={{
- marginTop: 50,
- alignSelf: 'center'
- }}
- >
- <Button
- style={{
- marginTop: 10,
- width: 250,
- borderRadius: 100
- }}
- loading={loading}
- onPress={signup}
- type="accent"
- title={loading ? null : 'Agree and continue'}
- />
-
- {loading || !welcome ? null : (
- <Button
- style={{
- marginTop: 10,
- width: 250,
- borderRadius: 100
- }}
- onPress={() => {
- eSendEvent(eCloseLoginDialog);
- }}
- type="grayBg"
- title="Skip for now"
- />
- )}
- </View>
- </View>
- </View>
- </>
- );
-};
diff --git a/apps/mobile/src/components/Premium/component.js b/apps/mobile/src/components/Premium/component.js
index da7f017c2..d9acb7e86 100644
--- a/apps/mobile/src/components/Premium/component.js
+++ b/apps/mobile/src/components/Premium/component.js
@@ -1,16 +1,17 @@
import React, { useState } from 'react';
import { ScrollView, View } from 'react-native';
-import PremiumService from '../../services/PremiumService';
import { LAUNCH_ROCKET } from '../../assets/images/assets';
import { useTracked } from '../../provider';
import { useUserStore } from '../../provider/stores';
import { DDS } from '../../services/DeviceDetection';
import { eSendEvent, presentSheet } from '../../services/EventManager';
+import PremiumService from '../../services/PremiumService';
import { getElevation } from '../../utils';
-import { eOpenLoginDialog } from '../../utils/Events';
+import { eOpenLoginDialog, eOpenResultDialog } from '../../utils/Events';
import { SIZE } from '../../utils/SizeUtils';
import umami from '../../utils/umami';
import { ActionIcon } from '../ActionIcon';
+import { AuthMode } from '../Auth';
import { Button } from '../Button';
import GeneralSheet from '../GeneralSheet';
import { SvgToPngView } from '../ListPlaceholders';
@@ -26,6 +27,8 @@ export const Component = ({ close, promo, getRef }) => {
const [state, dispatch] = useTracked();
const colors = state.colors;
const user = useUserStore(state => state.user);
+ const userCanRequestTrial =
+ user && (!user.subscription || !user.subscription.expiry) ? true : false;
const [floatingButton, setFloatingButton] = useState(false);
const onPress = async () => {
@@ -33,13 +36,13 @@ export const Component = ({ close, promo, getRef }) => {
umami.pageView('/pro-plans', `/pro-screen`);
presentSheet({
context: 'pricing_plans',
- component: <PricingPlans marginTop={1} promo={promo} />
+ component: <PricingPlans showTrialOption={false} marginTop={1} promo={promo} />
});
} else {
close();
umami.pageView('/signup', `/pro-screen`);
setTimeout(() => {
- eSendEvent(eOpenLoginDialog, 1);
+ eSendEvent(eOpenLoginDialog, AuthMode.trialSignup);
}, 400);
}
};
@@ -140,18 +143,37 @@ export const Component = ({ close, promo, getRef }) => {
Ready to take the next step on your private note taking journey?
</Paragraph>
+ {userCanRequestTrial ? (
+ <Button
+ key="calltoaction"
+ onPress={() => {
+ eSendEvent(eOpenResultDialog);
+ }}
+ title="Try free for 14 days"
+ type="accent"
+ width={250}
+ style={{
+ paddingHorizontal: 12,
+ marginBottom: 15,
+ borderRadius: 100
+ }}
+ />
+ ) : null}
+
<Button
key="calltoaction"
onPress={onPress}
title={promo ? promo.text : user ? `See all plans` : `Sign up for free`}
- type="accent"
+ type={userCanRequestTrial ? 'grayAccent' : 'accent'}
+ width={250}
style={{
- paddingHorizontal: 24,
- marginBottom: 10
+ paddingHorizontal: 12,
+ marginBottom: 15,
+ borderRadius: 100
}}
/>
- {!user ? (
+ {!user || userCanRequestTrial ? (
<Paragraph
color={colors.icon}
size={SIZE.xs}
@@ -162,7 +184,9 @@ export const Component = ({ close, promo, getRef }) => {
maxWidth: '80%'
}}
>
- Your 14 day free trial will activate when you sign up.{' '}
+ {user
+ ? `On clicking "Try free for 14 days", your free trial will be activated.`
+ : `After sign up you will be asked to activate your free trial.`}{' '}
<Paragraph size={SIZE.xs} style={{ fontWeight: 'bold' }}>
No credit card is required.
</Paragraph>
@@ -181,7 +205,7 @@ export const Component = ({ close, promo, getRef }) => {
paddingHorizontal: 12
}}
>
- <PricingPlans promo={promo} />
+ <PricingPlans showTrialOption={false} promo={promo} />
</View>
</ScrollView>
@@ -193,6 +217,7 @@ export const Component = ({ close, promo, getRef }) => {
style={{
paddingHorizontal: 24,
position: 'absolute',
+ borderRadius: 100,
bottom: 30,
...getElevation(10)
}}
diff --git a/apps/mobile/src/components/Premium/index.js b/apps/mobile/src/components/Premium/index.js
index d0c139a0c..7fba66ac3 100644
--- a/apps/mobile/src/components/Premium/index.js
+++ b/apps/mobile/src/components/Premium/index.js
@@ -46,7 +46,12 @@ class PremiumDialog extends React.Component {
render() {
return !this.state.visible ? null : (
- <BaseDialog bounce background={this.props.colors.bg} onRequestClose={this.onClose}>
+ <BaseDialog
+ animation="slide"
+ bounce={false}
+ background={this.props.colors.bg}
+ onRequestClose={this.onClose}
+ >
<Component getRef={() => this.actionSheetRef} promo={this.state.promo} close={this.close} />
</BaseDialog>
);
diff --git a/apps/mobile/src/components/Premium/pricingplans.js b/apps/mobile/src/components/Premium/pricingplans.js
index ceea82e85..75498bfc6 100644
--- a/apps/mobile/src/components/Premium/pricingplans.js
+++ b/apps/mobile/src/components/Premium/pricingplans.js
@@ -36,8 +36,15 @@ const promoCyclesYearly = {
3: 'first 3 years'
};
-export const PricingPlans = ({ promo, marginTop, heading = true, compact = false }) => {
- const [state, dispatch] = useTracked();
+export const PricingPlans = ({
+ promo,
+ marginTop,
+ heading = true,
+ compact = false,
+ trial = false,
+ showTrialOption = true
+}) => {
+ const [state] = useTracked();
const colors = state.colors;
const user = useUserStore(state => state.user);
const [product, setProduct] = useState(null);
@@ -45,6 +52,7 @@ export const PricingPlans = ({ promo, marginTop, heading = true, compact = false
const [offers, setOffers] = useState(null);
const [buying, setBuying] = useState(false);
const [loading, setLoading] = useState(false);
+ const [upgrade, setUpgrade] = useState(!showTrialOption);
const getSkus = async () => {
try {
@@ -160,201 +168,252 @@ export const PricingPlans = ({ promo, marginTop, heading = true, compact = false
<ActivityIndicator size={50} color="white" />
</BaseDialog>
) : null}
- {product?.type === 'promo' ? (
- <Heading
- style={{
- paddingVertical: 15,
- alignSelf: 'center',
- textAlign: 'center'
- }}
- size={SIZE.lg - 4}
- >
- {product.data.introductoryPrice}
+
+ {!upgrade ? (
+ <>
<Paragraph
style={{
- textDecorationLine: 'line-through',
- color: colors.icon
+ alignSelf: 'center'
}}
- size={SIZE.sm}
+ size={SIZE.lg}
>
- ({product.data.localizedPrice})
- </Paragraph>{' '}
- for {product.cycleText}
- </Heading>
- ) : null}
+ {PremiumService.getMontlySub().localizedPrice} / mo
+ </Paragraph>
+ <Button
+ onPress={() => {
+ setUpgrade(true);
+ }}
+ title={`Upgrade now`}
+ type="accent"
+ width={250}
+ style={{
+ paddingHorizontal: 12,
+ marginBottom: 15,
+ marginTop: 15,
+ borderRadius: 100
+ }}
+ />
- {user && !product ? (
+ <Button
+ onPress={() => {
+ eSendEvent(eClosePremiumDialog);
+ eSendEvent(eCloseProgressDialog);
+ setTimeout(() => {
+ eSendEvent(eOpenLoginDialog, 1);
+ }, 400);
+ }}
+ title={`Try free for 14 days`}
+ type="grayAccent"
+ width={250}
+ style={{
+ paddingHorizontal: 12,
+ marginBottom: 15,
+ borderRadius: 100
+ }}
+ />
+ </>
+ ) : (
<>
- {heading ? (
+ {product?.type === 'promo' ? (
<Heading
style={{
+ paddingVertical: 15,
alignSelf: 'center',
- marginTop: marginTop || 20,
- marginBottom: 20
+ textAlign: 'center'
}}
+ size={SIZE.lg - 4}
>
- Choose a plan
+ {product.data.introductoryPrice}
+ <Paragraph
+ style={{
+ textDecorationLine: 'line-through',
+ color: colors.icon
+ }}
+ size={SIZE.sm}
+ >
+ ({product.data.localizedPrice})
+ </Paragraph>{' '}
+ for {product.cycleText}
</Heading>
) : null}
- <View
- style={{
- flexDirection: !compact ? 'column' : 'row',
- flexWrap: 'wrap',
- justifyContent: 'space-around'
- }}
- >
- <PricingItem
- onPress={() => buySubscription(offers?.monthly)}
- compact={compact}
- product={{
- type: 'monthly',
- data: offers?.monthly,
- info: 'Pay monthly, cancel anytime.'
- }}
- />
+ {user && !product ? (
+ <>
+ {heading ? (
+ <Heading
+ style={{
+ alignSelf: 'center',
+ marginTop: marginTop || 20,
+ marginBottom: 20
+ }}
+ >
+ Choose a plan
+ </Heading>
+ ) : null}
- {!compact && (
<View
style={{
- height: 1,
- marginVertical: 5
+ flexDirection: !compact ? 'column' : 'row',
+ flexWrap: 'wrap',
+ justifyContent: 'space-around'
}}
- />
- )}
+ >
+ <PricingItem
+ onPress={() => buySubscription(offers?.monthly)}
+ compact={compact}
+ product={{
+ type: 'monthly',
+ data: offers?.monthly,
+ info: 'Pay monthly, cancel anytime.'
+ }}
+ />
- <PricingItem
- onPress={() => buySubscription(offers?.yearly)}
- compact={compact}
- product={{
- type: 'yearly',
- data: offers?.yearly,
- info: 'Pay yearly'
- }}
- />
- </View>
+ {!compact && (
+ <View
+ style={{
+ height: 1,
+ marginVertical: 5
+ }}
+ />
+ )}
- {Platform.OS !== 'ios' ? (
- <Button
- height={35}
- style={{
- marginTop: 10
- }}
- onPress={() => {
- presentDialog({
- context: 'local',
- input: true,
- inputPlaceholder: 'Enter code',
- positiveText: 'Apply',
- positivePress: async value => {
- if (!value) return;
- console.log(value);
- eSendEvent(eCloseSimpleDialog);
- setBuying(true);
- try {
- if (!(await getPromo(value))) throw new Error('Error applying promo code');
- ToastEvent.show({
- heading: 'Discount applied!',
- type: 'success',
- context: 'local'
- });
- setBuying(false);
- } catch (e) {
- setBuying(false);
- ToastEvent.show({
- heading: 'Promo code invalid or expired',
- message: e.message,
- type: 'error',
- context: 'local'
- });
- }
- },
- title: 'Have a promo code?',
- paragraph: 'Enter your promo code to get a special discount.'
- });
- }}
- title="I have a promo code"
- />
- ) : (
- <View
- style={{
- height: 15
- }}
- />
- )}
- </>
- ) : (
- <View>
- {!user ? (
- <>
- <Button
- onPress={() => {
- eSendEvent(eClosePremiumDialog);
- eSendEvent(eCloseProgressDialog);
- setTimeout(() => {
- eSendEvent(eOpenLoginDialog, 1);
- }, 400);
- }}
- title={`Sign up for free`}
- type="accent"
- style={{
- paddingHorizontal: 24,
- marginTop: 20,
- marginBottom: 10
- }}
- />
- {Platform.OS !== 'ios' &&
- promo &&
- !promo.promoCode.startsWith('com.streetwriters.notesnook') ? (
- <Paragraph
- size={SIZE.md}
- textBreakStrategy="balanced"
+ <PricingItem
+ onPress={() => buySubscription(offers?.yearly)}
+ compact={compact}
+ product={{
+ type: 'yearly',
+ data: offers?.yearly,
+ info: 'Pay yearly'
+ }}
+ />
+ </View>
+
+ {Platform.OS !== 'ios' ? (
+ <Button
+ height={35}
style={{
- alignSelf: 'center',
- justifyContent: 'center',
- textAlign: 'center'
+ marginTop: 10
}}
- >
- Use promo code{' '}
- <Text
- style={{
- fontFamily: 'OpenSans-SemiBold'
- }}
- >
- {promo.promoCode}
- </Text>{' '}
- at checkout
- </Paragraph>
- ) : null}
+ onPress={() => {
+ presentDialog({
+ context: 'local',
+ input: true,
+ inputPlaceholder: 'Enter code',
+ positiveText: 'Apply',
+ positivePress: async value => {
+ if (!value) return;
+ console.log(value);
+ eSendEvent(eCloseSimpleDialog);
+ setBuying(true);
+ try {
+ if (!(await getPromo(value)))
+ throw new Error('Error applying promo code');
+ ToastEvent.show({
+ heading: 'Discount applied!',
+ type: 'success',
+ context: 'local'
+ });
+ setBuying(false);
+ } catch (e) {
+ setBuying(false);
+ ToastEvent.show({
+ heading: 'Promo code invalid or expired',
+ message: e.message,
+ type: 'error',
+ context: 'local'
+ });
+ }
+ },
+ title: 'Have a promo code?',
+ paragraph: 'Enter your promo code to get a special discount.'
+ });
+ }}
+ title="I have a promo code"
+ />
+ ) : (
+ <View
+ style={{
+ height: 15
+ }}
+ />
+ )}
</>
) : (
- <>
- <Button
- onPress={() => buySubscription(product.data)}
- height={40}
- width="50%"
- type="accent"
- title="Subscribe now"
- />
+ <View>
+ {!user ? (
+ <>
+ <Button
+ onPress={() => {
+ eSendEvent(eClosePremiumDialog);
+ eSendEvent(eCloseProgressDialog);
+ setTimeout(() => {
+ eSendEvent(eOpenLoginDialog, 1);
+ }, 400);
+ }}
+ title={`Sign up for free`}
+ type="accent"
+ width={250}
+ style={{
+ paddingHorizontal: 12,
+ marginTop: 30,
+ marginBottom: 10,
+ borderRadius: 100
+ }}
+ />
+ {Platform.OS !== 'ios' &&
+ promo &&
+ !promo.promoCode.startsWith('com.streetwriters.notesnook') ? (
+ <Paragraph
+ size={SIZE.md}
+ textBreakStrategy="balanced"
+ style={{
+ alignSelf: 'center',
+ justifyContent: 'center',
+ textAlign: 'center'
+ }}
+ >
+ Use promo code{' '}
+ <Text
+ style={{
+ fontFamily: 'OpenSans-SemiBold'
+ }}
+ >
+ {promo.promoCode}
+ </Text>{' '}
+ at checkout
+ </Paragraph>
+ ) : null}
+ </>
+ ) : (
+ <>
+ <Button
+ onPress={() => buySubscription(product.data)}
+ height={40}
+ width="50%"
+ type="accent"
+ title="Subscribe now"
+ />
- <Button
- onPress={() => {
- setProduct(null);
- }}
- style={{
- marginTop: 5
- }}
- height={30}
- fontSize={13}
- type="errorShade"
- title="Cancel promo code"
- />
- </>
+ <Button
+ onPress={() => {
+ setProduct(null);
+ }}
+ style={{
+ marginTop: 5
+ }}
+ height={30}
+ fontSize={13}
+ type="errorShade"
+ title="Cancel promo code"
+ />
+ </>
+ )}
+ </View>
)}
- </View>
+ </>
)}
- {!user ? (
+ {!user || !upgrade ? (
<Paragraph
color={colors.icon}
size={SIZE.xs}
@@ -365,14 +424,16 @@ export const PricingPlans = ({ promo, marginTop, heading = true, compact = false
maxWidth: '80%'
}}
>
- Your 14 day free trial will activate when you sign up.{' '}
+ {user
+ ? `On clicking "Try free for 14 days", your free trial will be activated.`
+ : `After sign up you will be asked to activate your free trial.`}{' '}
<Paragraph size={SIZE.xs} style={{ fontWeight: 'bold' }}>
No credit card is required.
</Paragraph>
</Paragraph>
) : null}
- {user ? (
+ {user && upgrade ? (
<>
{Platform.OS === 'ios' ? (
<Paragraph
diff --git a/apps/mobile/src/components/SimpleList/empty.js b/apps/mobile/src/components/SimpleList/empty.js
index d4bde0b7c..17f50a8f3 100644
--- a/apps/mobile/src/components/SimpleList/empty.js
+++ b/apps/mobile/src/components/SimpleList/empty.js
@@ -1,8 +1,8 @@
import React from 'react';
import { ActivityIndicator, useWindowDimensions, View } from 'react-native';
-import * as Progress from 'react-native-progress';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { useTracked } from '../../provider';
+import { useSettingStore } from '../../provider/stores';
import { useTip } from '../../services/tip-manager';
import { COLORS_NOTE } from '../../utils/Colors';
import { SIZE } from '../../utils/SizeUtils';
@@ -12,82 +12,89 @@ import { Tip } from '../Tip';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
-export const Empty = ({ loading = true, placeholderData, headerProps, type, screen }) => {
- const [state] = useTracked();
- const { colors } = state;
- const insets = useSafeAreaInsets();
- const { height } = useWindowDimensions();
- const tip = useTip(
- screen === 'Notes' ? 'first-note' : placeholderData.type || type,
- screen === 'Notes' ? 'notes' : null
- );
- const color =
- colors[COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'];
+export const Empty = React.memo(
+ ({ loading = true, placeholderData, headerProps, type, screen }) => {
+ const [state] = useTracked();
+ const { colors } = state;
+ const insets = useSafeAreaInsets();
+ const { height } = useWindowDimensions();
+ const introCompleted = useSettingStore(state => state.isIntroCompleted);
+ const tip = useTip(
+ screen === 'Notes' && introCompleted ? 'first-note' : placeholderData.type || type,
+ screen === 'Notes' ? 'notes' : null
+ );
- return (
- <View
- style={[
- {
- height: height - (140 + insets.top),
- width: '80%',
- justifyContent: 'center',
- alignSelf: 'center'
- }
- ]}
- >
- {!loading ? (
- <>
- <Tip
- color={COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'}
- tip={tip}
- style={{
- backgroundColor: 'transparent',
- paddingHorizontal: 0
- }}
- />
- {placeholderData.button && (
- <Button
- type="grayAccent"
- title={placeholderData.button}
- iconPosition="right"
- icon="arrow-right"
- onPress={placeholderData.action}
- accentColor={
- COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'
- }
- accentText="light"
+ const color =
+ colors[COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'];
+ return (
+ <View
+ style={[
+ {
+ height: height - (140 + insets.top),
+ width: '80%',
+ justifyContent: 'center',
+ alignSelf: 'center'
+ }
+ ]}
+ >
+ {!loading ? (
+ <>
+ <Tip
+ color={COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'}
+ tip={tip}
style={{
- alignSelf: 'flex-start',
- borderRadius: 5,
- height: 40
+ backgroundColor: 'transparent',
+ paddingHorizontal: 0
}}
/>
- )}
- </>
- ) : (
- <>
- <View
- style={{
- alignSelf: 'center',
- alignItems: 'flex-start',
- width: '100%'
- }}
- >
- <Heading>{placeholderData.heading}</Heading>
- <Paragraph size={SIZE.sm} textBreakStrategy="balanced">
- {placeholderData.loading}
- </Paragraph>
- <Seperator />
- <ActivityIndicator
- size={SIZE.lg}
- color={COLORS_NOTE[headerProps.color?.toLowerCase()] || colors.accent}
- />
- </View>
- </>
- )}
- </View>
- );
-};
+ {placeholderData.button && (
+ <Button
+ type="grayAccent"
+ title={placeholderData.button}
+ iconPosition="right"
+ icon="arrow-right"
+ onPress={placeholderData.action}
+ accentColor={
+ COLORS_NOTE[headerProps.color?.toLowerCase()] ? headerProps.color : 'accent'
+ }
+ accentText="light"
+ style={{
+ alignSelf: 'flex-start',
+ borderRadius: 5,
+ height: 40
+ }}
+ />
+ )}
+ </>
+ ) : (
+ <>
+ <View
+ style={{
+ alignSelf: 'center',
+ alignItems: 'flex-start',
+ width: '100%'
+ }}
+ >
+ <Heading>{placeholderData.heading}</Heading>
+ <Paragraph size={SIZE.sm} textBreakStrategy="balanced">
+ {placeholderData.loading}
+ </Paragraph>
+ <Seperator />
+ <ActivityIndicator
+ size={SIZE.lg}
+ color={COLORS_NOTE[headerProps.color?.toLowerCase()] || colors.accent}
+ />
+ </View>
+ </>
+ )}
+ </View>
+ );
+ },
+ (prev, next) => {
+ if (prev.loading === next.loading) return true;
+ return false;
+ }
+);
/**
* Make a tips manager.
diff --git a/apps/mobile/src/components/Transitions/bouncingview.js b/apps/mobile/src/components/Transitions/bouncingview.js
index 8477fd155..0300d69cb 100644
--- a/apps/mobile/src/components/Transitions/bouncingview.js
+++ b/apps/mobile/src/components/Transitions/bouncingview.js
@@ -18,6 +18,7 @@ export const BouncingView = ({
duration: duration,
easing: Easing.elastic(1)
}).start();
+
return () => {
if (!animated) return;
scale.setValue(initialScale);
diff --git a/apps/mobile/src/services/PremiumService.js b/apps/mobile/src/services/PremiumService.js
index 06464a719..11cf46698 100644
--- a/apps/mobile/src/services/PremiumService.js
+++ b/apps/mobile/src/services/PremiumService.js
@@ -317,7 +317,7 @@ const features_list = [
}
];
-const sheet = (context, promo) => {
+const sheet = (context, promo, trial) => {
presentSheet({
context: context,
component: ref => (
@@ -332,7 +332,7 @@ const sheet = (context, promo) => {
<Seperator />
<CompactFeatures scrollRef={ref} maxHeight={300} features={features_list} vertical />
<Seperator half />
- <PricingPlans compact heading={false} promo={promo} />
+ <PricingPlans trial={trial} compact heading={false} promo={promo} />
</>
)
});