Skip to content

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

refactor intro and auth flow

Ammar Ahmedadd947315743
diff --git a/apps/mobile/android/app/src/main/res/values/styles.xml b/apps/mobile/android/app/src/main/res/values/styles.xml
index 26caeb236..4c4efa2a6 100644
--- a/apps/mobile/android/app/src/main/res/values/styles.xml
+++ b/apps/mobile/android/app/src/main/res/values/styles.xml
@@ -5,6 +5,10 @@
<!-- Customize your theme here. -->
<item name="android:windowDisablePreview">true</item>
<item name="android:editTextBackground">@drawable/edit_text</item>
+
+ <item name="android:windowTranslucentStatus">true</item>
+ <item name="android:statusBarColor">@android:color/transparent</item>
+ <item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
<style name="Share.Window" parent="Theme.AppCompat">
diff --git a/apps/mobile/src/components/auth/authmodal.js b/apps/mobile/src/components/auth/authmodal.js
new file mode 100644
index 000000000..a747c3def
--- /dev/null
+++ b/apps/mobile/src/components/auth/authmodal.js
@@ -0,0 +1,93 @@
+import React, { useEffect, useRef, useState } from 'react';
+import { Platform, StatusBar } from 'react-native';
+import { useSafeAreaInsets } from 'react-native-safe-area-context';
+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/event-manager';
+import { useThemeStore } from '../../stores/use-theme-store';
+import { eCloseLoginDialog, eOpenLoginDialog } from '../../utils/events';
+import { sleep } from '../../utils/time';
+import BaseDialog from '../dialog/base-dialog';
+import { Toast } from '../toast';
+import { IconButton } from '../ui/icon-button';
+import { initialAuthMode } from './common';
+import { Login } from './login';
+import { Signup } from './signup';
+
+export const AuthMode = {
+ login: 0,
+ signup: 1,
+ welcomeSignup: 2,
+ trialSignup: 3
+};
+
+const AuthModal = () => {
+ const colors = useThemeStore(state => state.colors);
+ const [visible, setVisible] = useState(false);
+ const [currentAuthMode, setCurrentAuthMode] = useState(AuthMode.login);
+ const actionSheetRef = useRef();
+ const insets = useSafeAreaInsets();
+
+ useEffect(() => {
+ eSubscribeEvent(eOpenLoginDialog, open);
+ eSubscribeEvent(eCloseLoginDialog, close);
+ return () => {
+ eUnSubscribeEvent(eOpenLoginDialog, open);
+ eUnSubscribeEvent(eCloseLoginDialog, close);
+ };
+ }, []);
+
+ async function open(mode) {
+ setCurrentAuthMode(mode ? mode : AuthMode.login);
+ initialAuthMode.current = -1;
+ setVisible(true);
+ await sleep(10);
+ actionSheetRef.current?.show();
+ }
+
+ const close = () => {
+ actionSheetRef.current?.hide();
+ setCurrentAuthMode(AuthMode.login);
+ setVisible(false);
+ };
+
+ return !visible ? null : (
+ <BaseDialog
+ overlayOpacity={0}
+ statusBarTranslucent={false}
+ onRequestClose={currentAuthMode !== AuthMode.welcomeSignup && close}
+ visible={true}
+ onClose={close}
+ useSafeArea={false}
+ bounce={false}
+ background={colors.bg}
+ transparent={false}
+ >
+ {currentAuthMode !== AuthMode.login ? (
+ <Signup
+ changeMode={mode => setCurrentAuthMode(mode)}
+ trial={AuthMode.trialSignup === currentAuthMode}
+ welcome={currentAuthMode === AuthMode.welcomeSignup}
+ />
+ ) : (
+ <Login changeMode={mode => setCurrentAuthMode(mode)} />
+ )}
+
+ <IconButton
+ name="arrow-left"
+ onPress={() => {
+ eSendEvent(eCloseLoginDialog);
+ }}
+ color={colors.pri}
+ customStyle={{
+ position: 'absolute',
+ zIndex: 999,
+ left: 12,
+ top: Platform.OS === 'ios' ? 12 + insets.top : 12
+ }}
+ />
+
+ <Toast context="local" />
+ </BaseDialog>
+ );
+};
+
+export default AuthModal;
diff --git a/apps/mobile/src/components/auth/common.js b/apps/mobile/src/components/auth/common.js
new file mode 100644
index 000000000..f1b148bf3
--- /dev/null
+++ b/apps/mobile/src/components/auth/common.js
@@ -0,0 +1,33 @@
+import { createRef } from 'react';
+import { eSendEvent } from '../../services/event-manager';
+import Navigation from '../../services/navigation';
+import SettingsService from '../../services/settings';
+import { eCloseLoginDialog } from '../../utils/events';
+import { tabBarRef } from '../../utils/global-refs';
+
+export const initialAuthMode = createRef(0);
+export function hideAuth() {
+ if (initialAuthMode.current === -1) {
+ eSendEvent(eCloseLoginDialog);
+ return;
+ }
+ if (initialAuthMode.current === 2) {
+ Navigation.replace(
+ {
+ name: 'Notes'
+ },
+ {
+ menu: true
+ }
+ );
+ } else {
+ Navigation.goBack();
+ }
+
+ tabBarRef.current?.unlock();
+ if (!SettingsService.get().introCompleted) {
+ SettingsService.set({
+ introCompleted: true
+ });
+ }
+}
diff --git a/apps/mobile/src/components/auth/index.js b/apps/mobile/src/components/auth/index.js
index 35205adc7..69b01f422 100644
--- a/apps/mobile/src/components/auth/index.js
+++ b/apps/mobile/src/components/auth/index.js
@@ -1,13 +1,11 @@
-import React, { useEffect, useRef, useState } from 'react';
-import { Platform } from 'react-native';
+import React, { useState } from 'react';
+import { View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
-import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../../services/event-manager';
import { useThemeStore } from '../../stores/use-theme-store';
-import { eCloseLoginDialog, eOpenLoginDialog } from '../../utils/events';
-import { sleep } from '../../utils/time';
-import BaseDialog from '../dialog/base-dialog';
+import { tabBarRef } from '../../utils/global-refs';
+import { useNavigationFocus } from '../../utils/hooks/use-navigation-focus';
import { Toast } from '../toast';
-import { IconButton } from '../ui/icon-button';
+import { initialAuthMode } from './common';
import { Login } from './login';
import { Signup } from './signup';
@@ -18,75 +16,48 @@ export const AuthMode = {
trialSignup: 3
};
-const Auth = () => {
+const Auth = ({ navigation, route }) => {
const colors = useThemeStore(state => state.colors);
- const [visible, setVisible] = useState(false);
- const [currentAuthMode, setCurrentAuthMode] = useState(AuthMode.login);
- const actionSheetRef = useRef();
+ const [currentAuthMode, setCurrentAuthMode] = useState(route?.params?.mode || AuthMode.login);
const insets = useSafeAreaInsets();
+ initialAuthMode.current = route?.params.mode || AuthMode.login;
+ useNavigationFocus(navigation, {
+ onFocus: () => {
+ tabBarRef?.current.lock();
+ initialAuthMode.current = route?.params.mode || AuthMode.login;
+ }
+ });
- useEffect(() => {
- eSubscribeEvent(eOpenLoginDialog, open);
- eSubscribeEvent(eCloseLoginDialog, close);
- return () => {
- eUnSubscribeEvent(eOpenLoginDialog, open);
- eUnSubscribeEvent(eCloseLoginDialog, close);
- };
- }, []);
-
- async function open(mode) {
- setCurrentAuthMode(mode ? mode : AuthMode.login);
- setVisible(true);
- await sleep(10);
- actionSheetRef.current?.show();
- }
-
- const close = () => {
- actionSheetRef.current?.hide();
- setCurrentAuthMode(AuthMode.login);
- setVisible(false);
- };
-
- return !visible ? null : (
- <BaseDialog
- overlayOpacity={0}
- statusBarTranslucent={false}
- onRequestClose={currentAuthMode !== AuthMode.welcomeSignup && close}
- visible={true}
- onClose={close}
- useSafeArea={false}
- bounce={false}
- background={colors.bg}
- transparent={false}
- >
+ return (
+ <View style={{ flex: 1 }}>
{currentAuthMode !== AuthMode.login ? (
<Signup
changeMode={mode => setCurrentAuthMode(mode)}
trial={AuthMode.trialSignup === currentAuthMode}
- welcome={currentAuthMode === AuthMode.welcomeSignup}
+ welcome={initialAuthMode.current === AuthMode.welcomeSignup}
/>
) : (
- <Login changeMode={mode => setCurrentAuthMode(mode)} />
+ <Login welcome={initialAuthMode.current} changeMode={mode => setCurrentAuthMode(mode)} />
)}
- {currentAuthMode === AuthMode.welcomeSignup ? null : (
+ {/* {initialAuthMode.current === AuthMode.welcomeSignup ? null : (
<IconButton
name="arrow-left"
onPress={() => {
- eSendEvent(eCloseLoginDialog);
+ hideAuth();
}}
color={colors.pri}
customStyle={{
position: 'absolute',
zIndex: 999,
left: 12,
- top: Platform.OS === 'ios' ? 12 + insets.top : 12
+ top: Platform.OS === 'ios' ? 12 + insets.top : insets.top
}}
/>
- )}
+ )} */}
<Toast context="local" />
- </BaseDialog>
+ </View>
);
};
diff --git a/apps/mobile/src/components/auth/login.js b/apps/mobile/src/components/auth/login.js
index d686e924c..a5789cf5f 100644
--- a/apps/mobile/src/components/auth/login.js
+++ b/apps/mobile/src/components/auth/login.js
@@ -26,7 +26,10 @@ import Paragraph from '../ui/typography/paragraph';
import { SVG } from './background';
import { ForgotPassword } from './forgot-password';
import TwoFactorVerification from './two-factor';
-export const Login = ({ changeMode }) => {
+import Animated, { FadeInDown, FadeOutDown, FadeOutUp } from 'react-native-reanimated';
+import Navigation from '../../services/navigation';
+import { hideAuth } from './common';
+export const Login = ({ changeMode, welcome }) => {
const colors = useThemeStore(state => state.colors);
const email = useRef();
const emailInputRef = useRef();
@@ -87,8 +90,8 @@ export const Login = ({ changeMode }) => {
type: 'success',
context: 'global'
});
- eSendEvent(eCloseLoginDialog);
- await SettingsService.set({
+ hideAuth();
+ SettingsService.set({
sessionExpired: false,
userEmailConfirmed: user.isEmailConfirmed
});
@@ -131,10 +134,11 @@ export const Login = ({ changeMode }) => {
return (
<>
<ForgotPassword />
-
<SheetProvider context="two_factor_verify" />
{loading ? <BaseDialog transparent={true} visible={true} animation="fade" /> : null}
- <View
+ <Animated.View
+ entering={FadeInDown}
+ exiting={FadeOutUp}
style={{
borderRadius: DDS.isTab ? 5 : 0,
backgroundColor: colors.bg,
@@ -149,9 +153,7 @@ export const Login = ({ changeMode }) => {
overflow: 'hidden'
}}
>
- <BouncingView initialScale={1.05} duration={5000}>
- <SvgView src={SVG(colors.night ? colors.icon : 'black')} height={700} />
- </BouncingView>
+ <SvgView src={SVG(colors.night ? colors.icon : 'black')} height={700} />
</View>
<View
style={{
@@ -250,13 +252,12 @@ export const Login = ({ changeMode }) => {
<View
style={{
// position: 'absolute',
- marginTop: 50,
+ marginTop: 25,
alignSelf: 'center'
}}
>
<Button
style={{
- marginTop: 10,
width: 250,
borderRadius: 100
}}
@@ -266,9 +267,24 @@ export const Login = ({ changeMode }) => {
type="accent"
title={loading ? null : 'Login to your account'}
/>
+
+ {loading || !welcome ? null : (
+ <Button
+ style={{
+ marginTop: 10,
+ width: 250,
+ borderRadius: 100
+ }}
+ onPress={() => {
+ hideAuth();
+ }}
+ type="grayBg"
+ title="Skip for now"
+ />
+ )}
</View>
</View>
- </View>
+ </Animated.View>
</>
);
};
diff --git a/apps/mobile/src/components/auth/signup.js b/apps/mobile/src/components/auth/signup.js
index b59295372..eb9e4a0df 100644
--- a/apps/mobile/src/components/auth/signup.js
+++ b/apps/mobile/src/components/auth/signup.js
@@ -1,12 +1,14 @@
import React, { useRef, useState } from 'react';
-import { Dimensions, Platform, View } from 'react-native';
-import { useSafeAreaInsets } from 'react-native-safe-area-context';
+import { Dimensions, View } from 'react-native';
+import Animated, { FadeInDown, FadeOutDown, FadeOutUp } from 'react-native-reanimated';
import { DDS } from '../../services/device-detection';
import { eSendEvent, ToastEvent } from '../../services/event-manager';
import { clearMessage, setEmailVerifyMessage } from '../../services/message';
+import Navigation from '../../services/navigation';
import PremiumService from '../../services/premium';
-import { useUserStore } from '../../stores/use-user-store';
+import SettingsService from '../../services/settings';
import { useThemeStore } from '../../stores/use-theme-store';
+import { useUserStore } from '../../stores/use-user-store';
import umami from '../../utils/analytics';
import { db } from '../../utils/database';
import { eCloseLoginDialog } from '../../utils/events';
@@ -15,13 +17,13 @@ import { SIZE } from '../../utils/size';
import { sleep } from '../../utils/time';
import BaseDialog from '../dialog/base-dialog';
import { Button } from '../ui/button';
-import { IconButton } from '../ui/icon-button';
import Input from '../ui/input';
import { SvgView } from '../ui/svg';
import { BouncingView } from '../ui/transitions/bouncing-view';
import Heading from '../ui/typography/heading';
import Paragraph from '../ui/typography/paragraph';
import { SVG } from './background';
+import { hideAuth } from './common';
export const Signup = ({ changeMode, welcome, trial }) => {
const colors = useThemeStore(state => state.colors);
@@ -33,9 +35,6 @@ export const Signup = ({ changeMode, welcome, trial }) => {
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);
@@ -64,7 +63,7 @@ export const Signup = ({ changeMode, welcome, trial }) => {
setLastSynced(await db.lastSynced());
clearMessage();
setEmailVerifyMessage();
- eSendEvent(eCloseLoginDialog);
+ hideAuth();
umami.pageView('/account-created', '/welcome/signup');
await sleep(300);
if (trial) {
@@ -86,7 +85,9 @@ export const Signup = ({ changeMode, welcome, trial }) => {
return (
<>
{loading ? <BaseDialog transparent={true} visible={true} animation="fade" /> : null}
- <View
+ <Animated.View
+ entering={FadeInDown}
+ exiting={FadeOutUp}
style={{
borderRadius: DDS.isTab ? 5 : 0,
backgroundColor: colors.bg,
@@ -101,9 +102,7 @@ export const Signup = ({ changeMode, welcome, trial }) => {
overflow: 'hidden'
}}
>
- <BouncingView initialScale={1.05}>
- <SvgView src={SVG(colors.night ? colors.icon : 'black')} height={700} />
- </BouncingView>
+ <SvgView src={SVG(colors.night ? colors.icon : 'black')} height={700} />
</View>
<View
@@ -205,48 +204,14 @@ export const Signup = ({ changeMode, welcome, trial }) => {
marginBottom={5}
onSubmit={signup}
/>
- <Paragraph size={SIZE.xs} color={colors.icon}>
- By signing up, you agree to our{' '}
- <Paragraph
- size={SIZE.xs}
- onPress={() => {
- openLinkInBrowser('https://notesnook.com/tos', colors)
- .catch(e => {})
- .then(r => {});
- }}
- style={{
- textDecorationLine: 'underline'
- }}
- color={colors.accent}
- >
- terms of service{' '}
- </Paragraph>
- and{' '}
- <Paragraph
- size={SIZE.xs}
- onPress={() => {
- openLinkInBrowser('https://notesnook.com/privacy', colors)
- .catch(e => {})
- .then(r => {});
- }}
- style={{
- textDecorationLine: 'underline'
- }}
- color={colors.accent}
- >
- privacy policy.
- </Paragraph>
- </Paragraph>
-
<View
style={{
- marginTop: 50,
+ marginTop: 25,
alignSelf: 'center'
}}
>
<Button
style={{
- marginTop: 10,
width: 250,
borderRadius: 100
}}
@@ -264,15 +229,54 @@ export const Signup = ({ changeMode, welcome, trial }) => {
borderRadius: 100
}}
onPress={() => {
- eSendEvent(eCloseLoginDialog);
+ hideAuth();
}}
type="grayBg"
title="Skip for now"
/>
)}
</View>
+
+ <Paragraph
+ style={{
+ textAlign: 'center',
+ position: 'absolute',
+ bottom: 0,
+ alignSelf: 'center',
+ marginBottom: 20
+ }}
+ size={SIZE.xs}
+ color={colors.icon}
+ >
+ By signing up, you agree to our{' '}
+ <Paragraph
+ size={SIZE.xs}
+ onPress={() => {
+ openLinkInBrowser('https://notesnook.com/tos', colors);
+ }}
+ style={{
+ textDecorationLine: 'underline'
+ }}
+ color={colors.accent}
+ >
+ terms of service{' '}
+ </Paragraph>
+ and{' '}
+ <Paragraph
+ size={SIZE.xs}
+ onPress={() => {
+ openLinkInBrowser('https://notesnook.com/privacy', colors);
+ }}
+ style={{
+ textDecorationLine: 'underline'
+ }}
+ color={colors.accent}
+ >
+ privacy policy.
+ </Paragraph>
+ </Paragraph>
</View>
- </View>
+ </Animated.View>
</>
);
};
diff --git a/apps/mobile/src/components/container/index.js b/apps/mobile/src/components/container/index.js
index 6703de15b..0ce308b35 100644
--- a/apps/mobile/src/components/container/index.js
+++ b/apps/mobile/src/components/container/index.js
@@ -1,10 +1,12 @@
import React from 'react';
import { KeyboardAvoidingView, Platform, SafeAreaView } from 'react-native';
+import { useSettingStore } from '../../stores/use-setting-store';
import useIsFloatingKeyboard from '../../utils/hooks/use-is-floating-keyboard';
import { Header } from '../header';
import SelectionHeader from '../selection-header';
export const Container = ({ children }) => {
const floating = useIsFloatingKeyboard();
+ const introCompleted = useSettingStore(state => state.settings.introCompleted);
return (
<KeyboardAvoidingView
behavior="padding"
@@ -19,8 +21,13 @@ export const Container = ({ children }) => {
overflow: 'hidden'
}}
>
- <SelectionHeader />
- <Header title="Header" screen="Header" />
+ {!introCompleted ? null : (
+ <>
+ <SelectionHeader />
+ <Header title="Header" screen="Header" />
+ </>
+ )}
+
{children}
</SafeAreaView>
</KeyboardAvoidingView>
diff --git a/apps/mobile/src/components/dialogprovider/index.js b/apps/mobile/src/components/dialogprovider/index.js
index 3b5192ed3..60fd288f1 100644
--- a/apps/mobile/src/components/dialogprovider/index.js
+++ b/apps/mobile/src/components/dialogprovider/index.js
@@ -3,6 +3,7 @@ import { useThemeStore } from '../../stores/use-theme-store';
import { AnnouncementDialog } from '../announcements';
import { AttachmentDialog } from '../attachments';
import Auth from '../auth';
+import AuthModal from '../auth/auth-modal';
import { SessionExpired } from '../auth/session-expired';
import { Dialog } from '../dialog';
import { AddTopicDialog } from '../dialogs/add-topic';
@@ -32,7 +33,7 @@ const DialogProvider = React.memo(
<AddTopicDialog colors={colors} />
<AddNotebookSheet colors={colors} />
<PremiumDialog colors={colors} />
- <Auth colors={colors} />
+ <AuthModal colors={colors} />
<MergeConflicts />
<ExportNotesSheet />
<RecoveryKeySheet colors={colors} />
diff --git a/apps/mobile/src/components/header/leftmenus.js b/apps/mobile/src/components/header/leftmenus.js
index 934f675d9..b71d9f8e0 100644
--- a/apps/mobile/src/components/header/leftmenus.js
+++ b/apps/mobile/src/components/header/leftmenus.js
@@ -5,6 +5,7 @@ import Navigation from '../../services/navigation';
import useNavigationStore from '../../stores/use-navigation-store';
import { useSettingStore } from '../../stores/use-setting-store';
import { useThemeStore } from '../../stores/use-theme-store';
+import { tabBarRef } from '../../utils/global-refs';
import { IconButton } from '../ui/icon-button';
export const LeftMenus = () => {
@@ -19,6 +20,12 @@ export const LeftMenus = () => {
return;
}
Navigation.goBack();
+ if (
+ useNavigationStore.getState().currentScreen.name === 'Signup' ||
+ useNavigationStore.getState().currentScreen.name === 'Login'
+ ) {
+ tabBarRef.current.unlock();
+ }
};
return isTablet ? null : (
diff --git a/apps/mobile/src/components/header/rightmenus.js b/apps/mobile/src/components/header/rightmenus.js
index 73e89bf09..6148fe33b 100644
--- a/apps/mobile/src/components/header/rightmenus.js
+++ b/apps/mobile/src/components/header/rightmenus.js
@@ -20,7 +20,10 @@ export const RightMenus = () => {
return (
<View style={styles.rightBtnContainer}>
- {!currentScreen.startsWith('Settings') ? (
+ {!currentScreen.startsWith('Settings') &&
+ currentScreen !== 'Auth' &&
+ currentScreen !== 'Signup' &&
+ currentScreen !== 'Login' ? (
<IconButton
onPress={async () => {
SearchService.prepareSearch();
diff --git a/apps/mobile/src/components/intro/index.js b/apps/mobile/src/components/intro/index.js
index e88c49cff..732010065 100644
--- a/apps/mobile/src/components/intro/index.js
+++ b/apps/mobile/src/components/intro/index.js
@@ -1,16 +1,15 @@
import React, { useEffect } from 'react';
import { Dimensions, Image, TouchableOpacity, useWindowDimensions, View } from 'react-native';
-import Animated, { FadeIn } from 'react-native-reanimated';
-import { SafeAreaView } from 'react-native-safe-area-context';
+import { useSafeAreaInsets } from 'react-native-safe-area-context';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
-import AppLock from '../../screens/settings/app-lock';
import SettingsService from '../../services/settings';
import { useSettingStore } from '../../stores/use-setting-store';
import { useThemeStore } from '../../stores/use-theme-store';
import { getElevation } from '../../utils';
import umami from '../../utils/analytics';
+import { tabBarRef } from '../../utils/global-refs';
+import { useNavigationFocus } from '../../utils/hooks/use-navigation-focus';
import { SIZE } from '../../utils/size';
-import { sleep } from '../../utils/time';
import { Button } from '../ui/button';
import { SvgView } from '../ui/svg';
import { BouncingView } from '../ui/transitions/bouncing-view';
@@ -19,14 +18,19 @@ import Paragraph from '../ui/typography/paragraph';
let SVG_D = `<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="485.83373" height="483.5" viewBox="0 0 485.83373 483.5" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M677.54186,336.34717H597.80041a11.47812,11.47812,0,0,1-9.06567-4.39356h0a11.62154,11.62154,0,0,1-2.17652-9.96777,201.63052,201.63052,0,0,0-.00049-93.647,11.62425,11.62425,0,0,1,2.17676-9.96729,11.47753,11.47753,0,0,1,9.06592-4.39355h79.74145a11.6235,11.6235,0,0,1,11.439,9.75537,337.96108,337.96108,0,0,1,0,102.8584A11.6235,11.6235,0,0,1,677.54186,336.34717Z" transform="translate(-357.08314 -208.25)" fill="#e6e6e6"/><path d="M597.80041,219.978a5.51264,5.51264,0,0,0-4.35449,2.1084,5.65943,5.65943,0,0,0-1.05371,4.85351,207.656,207.656,0,0,1,.00048,96.44531,5.65638,5.65638,0,0,0,1.053,4.85254l.00049.00049a5.5112,5.5112,0,0,0,4.35425,2.10889h79.74145a5.58248,5.58248,0,0,0,5.50879-4.667,331.9854,331.9854,0,0,0,0-101.03516,5.58248,5.58248,0,0,0-5.50879-4.667Z" transform="translate(-357.08314 -208.25)" fill="#fff"/><path d="M660.14054,248.82872h-41.845a6.00633,6.00633,0,0,1-5.99977-5.99977v-2.34463a6.00633,6.00633,0,0,1,5.99977-5.99977h41.845a6.00633,6.00633,0,0,1,5.99976,5.99977V242.829A6.00632,6.00632,0,0,1,660.14054,248.82872Z" transform="translate(-357.08314 -208.25)" fill="#e6e6e6"/><path d="M660.14054,278.4545h-41.845a6.00632,6.00632,0,0,1-5.99977-5.99976V270.1101a6.00632,6.00632,0,0,1,5.99977-5.99976h41.845a6.00632,6.00632,0,0,1,5.99976,5.99976v2.34464A6.00632,6.00632,0,0,1,660.14054,278.4545Z" transform="translate(-357.08314 -208.25)" fill="#e6e6e6"/><path d="M660.14054,308.08029h-41.845a6.00633,6.00633,0,0,1-5.99977-5.99977v-2.34463a6.00632,6.00632,0,0,1,5.99977-5.99976h41.845a6.00632,6.00632,0,0,1,5.99976,5.99976v2.34463A6.00632,6.00632,0,0,1,660.14054,308.08029Z" transform="translate(-357.08314 -208.25)" fill="#e6e6e6"/><path d="M827.54186,412.34717H747.80041a11.47812,11.47812,0,0,1-9.06567-4.39356h0a11.62154,11.62154,0,0,1-2.17652-9.96777,201.63052,201.63052,0,0,0-.00049-93.647,11.62425,11.62425,0,0,1,2.17676-9.96729,11.47753,11.47753,0,0,1,9.06592-4.39355h79.74145a11.6235,11.6235,0,0,1,11.439,9.75537,337.96108,337.96108,0,0,1,0,102.8584A11.6235,11.6235,0,0,1,827.54186,412.34717Z" transform="translate(-357.08314 -208.25)" fill="#e6e6e6"/><path d="M747.80041,295.978a5.51264,5.51264,0,0,0-4.35449,2.1084,5.65943,5.65943,0,0,0-1.05371,4.85351,207.656,207.656,0,0,1,.00048,96.44531,5.65638,5.65638,0,0,0,1.053,4.85254l.00049.00049a5.5112,5.5112,0,0,0,4.35425,2.10889h79.74145a5.58248,5.58248,0,0,0,5.50879-4.667,331.9854,331.9854,0,0,0,0-101.03516,5.58248,5.58248,0,0,0-5.50879-4.667Z" transform="translate(-357.08314 -208.25)" fill="#fff"/><path d="M668.54186,498.84717H588.80041a11.97546,11.97546,0,0,1-9.45825-4.584,12.1192,12.1192,0,0,1-2.27-10.394,201.13112,201.13112,0,0,0-.00049-93.41357,12.12077,12.12077,0,0,1,2.27026-10.39356,11.97561,11.97561,0,0,1,9.4585-4.584h79.74145a12.12667,12.12667,0,0,1,11.93311,10.1792,338.45925,338.45925,0,0,1,0,103.01074A12.12668,12.12668,0,0,1,668.54186,498.84717Z" transform="translate(-357.08314 -208.25)" fill="#f2f2f2"/><path d="M810.14054,339.82872h-41.845a6.00633,6.00633,0,0,1-5.99977-5.99977v-2.34463a6.00633,6.00633,0,0,1,5.99977-5.99977h41.845a6.00633,6.00633,0,0,1,5.99976,5.99977V333.829A6.00632,6.00632,0,0,1,810.14054,339.82872Z" transform="translate(-357.08314 -208.25)" fill="#e6e6e6"/><path d="M810.14054,369.4545h-41.845a6.00632,6.00632,0,0,1-5.99977-5.99976V361.1101a6.00632,6.00632,0,0,1,5.99977-5.99976h41.845a6.00632,6.00632,0,0,1,5.99976,5.99976v2.34464A6.00632,6.00632,0,0,1,810.14054,369.4545Z" transform="translate(-357.08314 -208.25)" fill="#e6e6e6"/><circle cx="271.81102" cy="228.5" r="23" fill="#fff"/><path d="M639.89416,433.75h-8v-8a3,3,0,0,0-6,0v8h-8a3,3,0,0,0,0,6h8v8a3,3,0,0,0,6,0v-8h8a3,3,0,0,0,0-6Z" transform="translate(-357.08314 -208.25)" fill="#e6e6e6"/><path d="M657.89416,225.25h-42a4.50508,4.50508,0,0,1-4.5-4.5v-8a4.50508,4.50508,0,0,1,4.5-4.5h42a4.50508,4.50508,0,0,1,4.5,4.5v8A4.50508,4.50508,0,0,1,657.89416,225.25Z" transform="translate(-357.08314 -208.25)" fill="#ccc"/><path d="M809.89416,302.25h-42a4.50508,4.50508,0,0,1-4.5-4.5v-8a4.50508,4.50508,0,0,1,4.5-4.5h42a4.50508,4.50508,0,0,1,4.5,4.5v8A4.50508,4.50508,0,0,1,809.89416,302.25Z" transform="translate(-357.08314 -208.25)" fill="#ccc"/><polygon points="88.596 471.061 100.856 471.061 104.689 423.773 88.594 423.773 88.596 471.061" fill="#ffb8b8"/><path d="M442.55234,675.30845l24.1438-.001h.001a15.38605,15.38605,0,0,1,15.38647,15.38623v.5l-39.53051.00146Z" transform="translate(-357.08314 -208.25)" fill="#2f2e41"/><polygon points="22.596 471.061 34.856 471.061 40.689 423.773 22.594 423.773 22.596 471.061" fill="#ffb8b8"/><path d="M376.55234,675.30845l24.1438-.001h.001a15.38605,15.38605,0,0,1,15.38647,15.38623v.5l-39.53051.00146Z" transform="translate(-357.08314 -208.25)" fill="#2f2e41"/><path d="M381.85436,664.37256a4.98141,4.98141,0,0,1-3.375-1.31836h0a4.961,4.961,0,0,1-1.61572-3.53711L371.947,483.30371l69.81115,17.45215,21.53955,64.61768a70.461,70.461,0,0,1,3.54541,25.82421l-2.67456,62.63672a4.996,4.996,0,0,1-4.99438,4.75879h-11.709a5.02349,5.02349,0,0,1-4.95483-4.32959l-8.3689-69.1416a37.82338,37.82338,0,0,0-5.53173-15.16406l-16.46949-26.07617a1.00011,1.00011,0,0,0-1.83764.41015L397.378,659.38037a4.99328,4.99328,0,0,1-4.687,4.39649l-10.552.58691C382.04406,664.36914,381.94934,664.37256,381.85436,664.37256Z" transform="translate(-357.08314 -208.25)" fill="#2f2e41"/><circle cx="73.05767" cy="136.40609" r="24.56103" fill="#ffb8b8"/><path d="M441.4237,507.92236a5.07628,5.07628,0,0,1-1.25293-.15918H440.17l-69.26428-17.75976a4.9985,4.9985,0,0,1-3.66285-5.81543L383.15,398.49707a31.21377,31.21377,0,0,1,18.24975-22.53955,30.11308,30.11308,0,0,1,28.26563,2.07519c.96973.605,1.94653,1.26465,2.90259,1.96094a30.96046,30.96046,0,0,1,12.57885,24.5293l1.2649,98.32861a5.00656,5.00656,0,0,1-4.988,5.0708Z" transform="translate(-357.08314 -208.25)" fill="#f0f0f0"/><path d="M378.03248,508.93008a10.05576,10.05576,0,0,1,4.214-14.83233l-3.08079-35.6018,16.326,8.84848.42262,32.4515a10.11027,10.11027,0,0,1-17.8818,9.13415Z" transform="translate(-357.08314 -208.25)" fill="#ffb8b8"/><path d="M383.86511,489.38916a5.53224,5.53224,0,0,1-1.36573-.17285,5.49559,5.49559,0,0,1-3.97192-3.98633l-8.02319-31.88379a47.37028,47.37028,0,0,1,3.76123-33.13476l16.80884-32.88184a15.54083,15.54083,0,0,1,18.8081-11.01855,15.35574,15.35574,0,0,1,9.47485,7.10058,15.56707,15.56707,0,0,1,1.65406,11.91309l-23.92749,53.50586.28418,32.03564a5.5186,5.5186,0,0,1-3.58448,5.20459l-8.00732,2.97363A5.48,5.48,0,0,1,383.86511,489.38916Z" transform="translate(-357.08314 -208.25)" fill="#f0f0f0"/><path d="M498.40087,495.83467a10.05578,10.05578,0,0,1-8.493-12.86954l-28.99341-20.88926,17.35654-6.60182,24.8717,20.84893a10.11027,10.11027,0,0,1-4.74186,19.51169Z" transform="translate(-357.08314 -208.25)" fill="#ffb8b8"/><path d="M483.223,480.58057a5.52249,5.52249,0,0,1-2.46265-.58155L451.3612,465.28174a47.381,47.381,0,0,1-22.66064-24.46533L414.74328,406.626a15.54363,15.54363,0,0,1,3.91772-21.44434,15.35158,15.35158,0,0,1,11.59034-2.54346,15.56975,15.56975,0,0,1,10.08081,6.51221l24.94507,53.03955L489.743,462.87256a5.51764,5.51764,0,0,1,1.60669,6.11182l-2.96973,8.0083a5.474,5.474,0,0,1-2.00684,2.59619,5.49717,5.49717,0,0,1-3.15014.9917Z" transform="translate(-357.08314 -208.25)" fill="#f0f0f0"/><path d="M424.98332,369.5931c1.305.571,3.97732-9.82732,2.78025-11.90707-1.78025-3.09293-1.675-3.07072-2.85681-5.117s-1.44623-4.84712.08417-6.64761,5.072-1.56163,5.77042.69581c-.4493-4.2878,3.79189-7.73454,7.993-8.70313s8.63244-.36723,12.85668-1.22917c4.90243-1.00032,10.00316-5.10972,8.04719-10.5007a7.5931,7.5931,0,0,0-1.48106-2.43408c-2.25993-2.54094-5.42117-3.62594-8.512-4.675-6.43006-2.18246-13.036-4.39233-19.82212-4.15141A28.7977,28.7977,0,0,0,404.3967,333.533a26.15571,26.15571,0,0,0-1.08344,4.02534c-2.32924,12.52423,4.94368,24.87794,16.75623,29.64715Z" transform="translate(-357.08314 -208.25)" fill="#2f2e41"/><polygon points="38.9 273.343 39.457 240.414 56.9 205.343 42.9 241.343 38.9 273.343" opacity="0.2"/><path d="M554.16035,564.23244,480.522,533.63692a11.47817,11.47817,0,0,1-6.68609-7.53565h0a11.62155,11.62155,0,0,1,1.81454-10.04,201.63062,201.63062,0,0,0,35.9304-86.47983,11.62422,11.62422,0,0,1,5.83445-8.36925,11.47751,11.47751,0,0,1,10.05779-.57884l73.63839,30.59552a11.62349,11.62349,0,0,1,6.8205,13.39769,337.96147,337.96147,0,0,1-39.46512,94.98607A11.6235,11.6235,0,0,1,554.16035,564.23244Z" transform="translate(-357.08314 -208.25)" fill="#e6e6e6"/><path d="M525.17093,426.17415a5.51263,5.51263,0,0,0-4.83017.27629,5.65945,5.65945,0,0,0-2.83529,4.07775,207.65608,207.65608,0,0,1-37.00407,89.064,5.65636,5.65636,0,0,0-.88946,4.88515l.00027.00064a5.51116,5.51116,0,0,0,3.21185,3.61814l73.63839,30.59552a5.58247,5.58247,0,0,0,6.87782-2.19616,331.98566,331.98566,0,0,0,38.76558-93.30238,5.58248,5.58248,0,0,0-3.29652-6.42343Z" transform="translate(-357.08314 -208.25)" fill="#fff"/><path d="M564.38028,494.28148l-38.6424-16.05527a6.00633,6.00633,0,0,1-3.23855-7.84259l.8996-2.16518a6.00632,6.00632,0,0,1,7.84258-3.23856l38.6424,16.05527a6.00634,6.00634,0,0,1,3.23855,7.84259l-.8996,2.16518A6.00632,6.00632,0,0,1,564.38028,494.28148Z" transform="translate(-357.08314 -208.25)" fill="#808080"/><path d="M553.01334,521.63984l-38.6424-16.05527a6.00633,6.00633,0,0,1-3.23855-7.84259l.89959-2.16518a6.00634,6.00634,0,0,1,7.84259-3.23856L558.517,508.39351a6.00633,6.00633,0,0,1,3.23856,7.84258l-.8996,2.16519A6.00632,6.00632,0,0,1,553.01334,521.63984Z" transform="translate(-357.08314 -208.25)" fill="#808080"/><path d="M579.86437,455.832a4.48944,4.48944,0,0,1-1.68725-.33057l-38.938-15.74267a4.50518,4.50518,0,0,1-2.48535-5.8584l2.99878-7.417a4.50027,4.50027,0,0,1,5.85864-2.48486l38.938,15.74267a4.50518,4.50518,0,0,1,2.48535,5.8584l-2.99878,7.417a4.51079,4.51079,0,0,1-4.17139,2.81543Z" transform="translate(-357.08314 -208.25)" fill="#ccc"/><path d="M498.08314,691.75h-140a1,1,0,1,1,0-2h140a1,1,0,0,1,0,2Z" transform="translate(-357.08314 -208.25)" fill="#ccc"/></svg>`;
-const SVG_Z = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245.487 113.9115"><g transform="translate(15.9581 -70.1437)"><path fill="#f2f2f2" d="M181.8672 183.796H88.3134v-54.8973l-.43-.2765 15.1857-14.7907a41.4878 41.4878 0 0 1 28.6939-11.8174l27.916-.2551.04.0477 22.2131 26.426-.0655.7316z" style="stroke-width:.264583"/><path fill="#fff" d="M105.9334 112.1178h55.9519v.5292h-55.9519zM100.3772 117.6741h55.9519v.5292h-55.9519z" style="stroke-width:.264583"/><path fill="#fff" d="M178.6826 154.0514h10.1706v8.9897h-10.1706z" data-name="Rectangle 371" style="stroke-width:.264583"/><path fill="#fff" d="M178.6826 138.4916h10.1706v8.8471h-10.1706z" data-name="Rectangle 372" style="stroke-width:.264583"/><path fill="#f2f2f2" d="M166.653 102.649h9.1202v31.5648h-9.1202z" style="stroke-width:.264583"/><path fill="#e6e6e6" d="M181.8672 183.7957h-50.0656v-36.3798a35.3975 35.3975 0 0 1 8.4588-22.9515l19.3804-22.7213 22.2264 26.4599z" style="stroke-width:.264583"/><path fill="#fff" d="M155.3064 156.4369h10.1706v8.9897h-10.1706z" data-name="Rectangle 374" style="stroke-width:.264583"/><path fill="#fff" d="M155.3064 140.8768h10.1706v8.8471h-10.1706z" data-name="Rectangle 375" style="stroke-width:.264583"/><path fill="#fff" d="M106.7252 154.0514h10.1706v8.9897h-10.1706z" data-name="Rectangle 378" style="stroke-width:.264583"/><path fill="#fff" d="M106.7252 138.4916h10.1706v8.8471h-10.1706z" data-name="Rectangle 379" style="stroke-width:.264583"/><path fill="#f2f2f2" d="M91.7626 85.332h11.0675v38.3117H91.7626z" style="stroke-width:.264583"/><path fill="#f2f2f2" d="M110.199 183.7954H-3.295v-66.6167l-.5047-.325.119-.116 20.73-20.1916A41.863 41.863 0 0 1 46.0038 84.621l37.2782-.3406.0402.0477 26.9535 32.0651-.0773.8764z" style="stroke-width:.264583"/><path fill="#e6e6e6" d="M110.199 183.7954H49.4881V134.88a29.9322 29.9322 0 0 1 7.1528-19.408l26.6087-31.1956 26.9492 32.0815Z" style="stroke-width:.264583"/><path fill="#fff" d="M80.3413 150.6172h9.8174v8.6775h-9.8174zM80.3413 135.5359h9.8174v8.6775h-9.8174z" data-name="Rectangle 381" style="stroke-width:.264583"/><path fill="#fff" d="M19.0243 147.7216H31.369v10.9112H19.0243z" data-name="Rectangle 385" style="stroke-width:.264583"/><path fill="#fff" d="M19.0243 128.8356H31.369v10.7381H19.0243z" data-name="Rectangle 386" style="stroke-width:.264583"/><ellipse cx="20.8891" cy="154.324" fill="#3f3d56" data-name="Ellipse 519" rx="8.7979" ry="17.9515" style="stroke-width:.264583"/><path fill="#808080" d="M21.7016 183.7075c-3.5237-21.1402-.0354-42.2063 0-42.4164l.6856.1162c-.0355.209-3.5036 21.1635 0 42.1862z" data-name="Path 2702" style="fill:#999;stroke-width:.264583"/><path fill="#808080" d="M-54.7406 146.1809h9.0223v.6953h-9.0223z" data-name="Rectangle 388" style="fill:#b3b3b3;stroke-width:.264583" transform="rotate(-28.142)"/><path fill="#808080" d="M-129.2795 83.128h.6953v9.0226h-.6953z" data-name="Rectangle 389" style="fill:#b3b3b3;stroke-width:.264583" transform="rotate(-61.842)"/><ellipse cx="-.4146" cy="141.6901" fill="#808080" data-name="Ellipse 520" rx="12.6968" ry="25.9067" style="fill:#333;stroke-width:.264583"/><path fill="#3f3d56" d="M.9996 184.0552c-5.0784-30.47-.0514-60.829 0-61.1323l.5056.0857c-.0513.3025-5.0636 30.5798 0 60.9624z" data-name="Path 2703" style="fill:#e6e6e6;stroke-width:.264583"/><path fill="#3f3d56" d="M-67.7316 125.3486h13.0209v.513h-13.0209z" data-name="Rectangle 390" style="fill:#ccc;stroke-width:.264583" transform="rotate(-28.142)"/><path fill="#3f3d56" d="M-129.3145 54.7885h.513v13.0209h-.513z" data-name="Rectangle 391" style="fill:#b3b3b3;stroke-width:.264583" transform="rotate(-61.842)"/><path fill="#3f3d56" d="m159.149 89.5463 2.7831-2.2262c-2.1621-.2381-3.0506.9406-3.413 1.874-1.6892-.7014-3.5283.2178-3.5283.2178l5.5687 2.0217a4.2137 4.2137 0 0 0-1.4097-1.8876z" data-name="Path 2708" style="stroke-width:.264583"/><path fill="#3f3d56" d="m108.853 72.401 2.7831-2.2262c-2.1621-.2381-3.0506.9406-3.413 1.874-1.6892-.7013-3.5283.2178-3.5283.2178l5.5687 2.0217a4.214 4.214 0 0 0-1.4105-1.8873z" data-name="Path 2709" style="stroke-width:.264583"/><path fill="#3f3d56" d="m178.9044 76.546 2.7831-2.2262c-2.1622-.2381-3.0506.9406-3.4131 1.874-1.6891-.7014-3.5282.2178-3.5282.2178l5.5687 2.0217a4.2138 4.2138 0 0 0-1.4097-1.8876z" data-name="Path 2710" style="stroke-width:.264583"/><path fill="#3f3d56" d="M60.5922 179.896a4.2088 4.2088 0 0 0-2.1077.5656 4.5297 4.5297 0 0 0-7.567 3.365h13.8924a4.2299 4.2299 0 0 0-4.2174-3.9304z" data-name="Path 2712" style="stroke-width:.264583"/><path fill="#3f3d56" d="M132.852 179.896a4.2088 4.2088 0 0 0-2.1076.5656 4.5297 4.5297 0 0 0-7.5671 3.365h13.8925a4.2299 4.2299 0 0 0-4.2178-3.9307z" data-name="Path 2713" style="stroke-width:.264583"/><g fill="#3f3d56" data-name="Group 204"><path d="M97.2576 176.8633H77.5234v.6366h3.0777v6.0476h.6365v-6.0476H93.225v6.0476h.6365v-6.0476h3.396z" data-name="Path 2714"/><path d="M77.5623 174.9588h19.7342v.6366H77.5623z" data-name="Rectangle 400"/><path d="M77.5623 173.3674h19.7342v.6365H77.5623z" data-name="Rectangle 401"/></g><ellipse cx="215.2396" cy="158.3491" fill="#e6e6e6" data-name="Ellipse 525" rx="7.7041" ry="15.7197" style="stroke-width:.264583"/><path fill="#3f3d56" d="M214.3815 184.0552c3.0816-18.4886.031-36.9094 0-37.0946l-.3069.053c.031.1833 3.0726 18.5551 0 36.9908z" data-name="Path 2716" style="stroke-width:.264583"/><path fill="#3f3d56" d="M-38.7353 256.9106h.3115v7.9035h-.3115z" data-name="Rectangle 406" style="stroke-width:.264583" transform="rotate(-61.847)"/><path fill="#3f3d56" d="M114.2645 243.4071h7.9035v.3115h-7.9035z" data-name="Rectangle 407" style="stroke-width:.264583" transform="rotate(-28.153)"/><g fill="#3f3d56" data-name="Group 205"><path d="M169.5172 176.8633H149.783v.6366h3.0776v6.0476h.6366v-6.0476h11.9872v6.0476h.6366v-6.0476h3.396z" data-name="Path 2714-2"/><path d="M149.8219 174.9588h19.7342v.6366h-19.7342z" data-name="Rectangle 400-2"/><path d="M149.8219 173.3674h19.7342v.6365h-19.7342z" data-name="Rectangle 401-2"/></g><path fill="#f2f2f2" d="m90.2625 105.5306-2.3728-5.5049-4.763.085-2.8892 5.488.0583.0732h-.0208v11.4152h9.981v-11.4153zM164.4423 119.3093l-1.9175-4.0238-3.849.062-2.3348 4.0115.0471.0535h-.0168v8.3438h8.0658v-8.3438z" data-name="Path 2700" style="stroke-width:.264583"/><path fill="#fff" d="M10.3066 102.6488h55.9519v.5292H10.3066zM10.3066 103.178h55.9519v.5292H10.3066zM166.653 104.181h9.1202v.5292h-9.1202zM166.653 109.7372h9.1202v.5292h-9.1202zM91.7626 87.2476h11.0675v.5292H91.7626zM91.7626 92.8039h11.0675v.5292H91.7626z" style="stroke-width:.264583"/></g></svg>`;
+export const SVG_Z = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245.487 113.9115"><g transform="translate(15.9581 -70.1437)"><path fill="#f2f2f2" d="M181.8672 183.796H88.3134v-54.8973l-.43-.2765 15.1857-14.7907a41.4878 41.4878 0 0 1 28.6939-11.8174l27.916-.2551.04.0477 22.2131 26.426-.0655.7316z" style="stroke-width:.264583"/><path fill="#fff" d="M105.9334 112.1178h55.9519v.5292h-55.9519zM100.3772 117.6741h55.9519v.5292h-55.9519z" style="stroke-width:.264583"/><path fill="#fff" d="M178.6826 154.0514h10.1706v8.9897h-10.1706z" data-name="Rectangle 371" style="stroke-width:.264583"/><path fill="#fff" d="M178.6826 138.4916h10.1706v8.8471h-10.1706z" data-name="Rectangle 372" style="stroke-width:.264583"/><path fill="#f2f2f2" d="M166.653 102.649h9.1202v31.5648h-9.1202z" style="stroke-width:.264583"/><path fill="#e6e6e6" d="M181.8672 183.7957h-50.0656v-36.3798a35.3975 35.3975 0 0 1 8.4588-22.9515l19.3804-22.7213 22.2264 26.4599z" style="stroke-width:.264583"/><path fill="#fff" d="M155.3064 156.4369h10.1706v8.9897h-10.1706z" data-name="Rectangle 374" style="stroke-width:.264583"/><path fill="#fff" d="M155.3064 140.8768h10.1706v8.8471h-10.1706z" data-name="Rectangle 375" style="stroke-width:.264583"/><path fill="#fff" d="M106.7252 154.0514h10.1706v8.9897h-10.1706z" data-name="Rectangle 378" style="stroke-width:.264583"/><path fill="#fff" d="M106.7252 138.4916h10.1706v8.8471h-10.1706z" data-name="Rectangle 379" style="stroke-width:.264583"/><path fill="#f2f2f2" d="M91.7626 85.332h11.0675v38.3117H91.7626z" style="stroke-width:.264583"/><path fill="#f2f2f2" d="M110.199 183.7954H-3.295v-66.6167l-.5047-.325.119-.116 20.73-20.1916A41.863 41.863 0 0 1 46.0038 84.621l37.2782-.3406.0402.0477 26.9535 32.0651-.0773.8764z" style="stroke-width:.264583"/><path fill="#e6e6e6" d="M110.199 183.7954H49.4881V134.88a29.9322 29.9322 0 0 1 7.1528-19.408l26.6087-31.1956 26.9492 32.0815Z" style="stroke-width:.264583"/><path fill="#fff" d="M80.3413 150.6172h9.8174v8.6775h-9.8174zM80.3413 135.5359h9.8174v8.6775h-9.8174z" data-name="Rectangle 381" style="stroke-width:.264583"/><path fill="#fff" d="M19.0243 147.7216H31.369v10.9112H19.0243z" data-name="Rectangle 385" style="stroke-width:.264583"/><path fill="#fff" d="M19.0243 128.8356H31.369v10.7381H19.0243z" data-name="Rectangle 386" style="stroke-width:.264583"/><ellipse cx="20.8891" cy="154.324" fill="#3f3d56" data-name="Ellipse 519" rx="8.7979" ry="17.9515" style="stroke-width:.264583"/><path fill="#808080" d="M21.7016 183.7075c-3.5237-21.1402-.0354-42.2063 0-42.4164l.6856.1162c-.0355.209-3.5036 21.1635 0 42.1862z" data-name="Path 2702" style="fill:#999;stroke-width:.264583"/><path fill="#808080" d="M-54.7406 146.1809h9.0223v.6953h-9.0223z" data-name="Rectangle 388" style="fill:#b3b3b3;stroke-width:.264583" transform="rotate(-28.142)"/><path fill="#808080" d="M-129.2795 83.128h.6953v9.0226h-.6953z" data-name="Rectangle 389" style="fill:#b3b3b3;stroke-width:.264583" transform="rotate(-61.842)"/><ellipse cx="-.4146" cy="141.6901" fill="#808080" data-name="Ellipse 520" rx="12.6968" ry="25.9067" style="fill:#333;stroke-width:.264583"/><path fill="#3f3d56" d="M.9996 184.0552c-5.0784-30.47-.0514-60.829 0-61.1323l.5056.0857c-.0513.3025-5.0636 30.5798 0 60.9624z" data-name="Path 2703" style="fill:#e6e6e6;stroke-width:.264583"/><path fill="#3f3d56" d="M-67.7316 125.3486h13.0209v.513h-13.0209z" data-name="Rectangle 390" style="fill:#ccc;stroke-width:.264583" transform="rotate(-28.142)"/><path fill="#3f3d56" d="M-129.3145 54.7885h.513v13.0209h-.513z" data-name="Rectangle 391" style="fill:#b3b3b3;stroke-width:.264583" transform="rotate(-61.842)"/><path fill="#3f3d56" d="m159.149 89.5463 2.7831-2.2262c-2.1621-.2381-3.0506.9406-3.413 1.874-1.6892-.7014-3.5283.2178-3.5283.2178l5.5687 2.0217a4.2137 4.2137 0 0 0-1.4097-1.8876z" data-name="Path 2708" style="stroke-width:.264583"/><path fill="#3f3d56" d="m108.853 72.401 2.7831-2.2262c-2.1621-.2381-3.0506.9406-3.413 1.874-1.6892-.7013-3.5283.2178-3.5283.2178l5.5687 2.0217a4.214 4.214 0 0 0-1.4105-1.8873z" data-name="Path 2709" style="stroke-width:.264583"/><path fill="#3f3d56" d="m178.9044 76.546 2.7831-2.2262c-2.1622-.2381-3.0506.9406-3.4131 1.874-1.6891-.7014-3.5282.2178-3.5282.2178l5.5687 2.0217a4.2138 4.2138 0 0 0-1.4097-1.8876z" data-name="Path 2710" style="stroke-width:.264583"/><path fill="#3f3d56" d="M60.5922 179.896a4.2088 4.2088 0 0 0-2.1077.5656 4.5297 4.5297 0 0 0-7.567 3.365h13.8924a4.2299 4.2299 0 0 0-4.2174-3.9304z" data-name="Path 2712" style="stroke-width:.264583"/><path fill="#3f3d56" d="M132.852 179.896a4.2088 4.2088 0 0 0-2.1076.5656 4.5297 4.5297 0 0 0-7.5671 3.365h13.8925a4.2299 4.2299 0 0 0-4.2178-3.9307z" data-name="Path 2713" style="stroke-width:.264583"/><g fill="#3f3d56" data-name="Group 204"><path d="M97.2576 176.8633H77.5234v.6366h3.0777v6.0476h.6365v-6.0476H93.225v6.0476h.6365v-6.0476h3.396z" data-name="Path 2714"/><path d="M77.5623 174.9588h19.7342v.6366H77.5623z" data-name="Rectangle 400"/><path d="M77.5623 173.3674h19.7342v.6365H77.5623z" data-name="Rectangle 401"/></g><ellipse cx="215.2396" cy="158.3491" fill="#e6e6e6" data-name="Ellipse 525" rx="7.7041" ry="15.7197" style="stroke-width:.264583"/><path fill="#3f3d56" d="M214.3815 184.0552c3.0816-18.4886.031-36.9094 0-37.0946l-.3069.053c.031.1833 3.0726 18.5551 0 36.9908z" data-name="Path 2716" style="stroke-width:.264583"/><path fill="#3f3d56" d="M-38.7353 256.9106h.3115v7.9035h-.3115z" data-name="Rectangle 406" style="stroke-width:.264583" transform="rotate(-61.847)"/><path fill="#3f3d56" d="M114.2645 243.4071h7.9035v.3115h-7.9035z" data-name="Rectangle 407" style="stroke-width:.264583" transform="rotate(-28.153)"/><g fill="#3f3d56" data-name="Group 205"><path d="M169.5172 176.8633H149.783v.6366h3.0776v6.0476h.6366v-6.0476h11.9872v6.0476h.6366v-6.0476h3.396z" data-name="Path 2714-2"/><path d="M149.8219 174.9588h19.7342v.6366h-19.7342z" data-name="Rectangle 400-2"/><path d="M149.8219 173.3674h19.7342v.6365h-19.7342z" data-name="Rectangle 401-2"/></g><path fill="#f2f2f2" d="m90.2625 105.5306-2.3728-5.5049-4.763.085-2.8892 5.488.0583.0732h-.0208v11.4152h9.981v-11.4153zM164.4423 119.3093l-1.9175-4.0238-3.849.062-2.3348 4.0115.0471.0535h-.0168v8.3438h8.0658v-8.3438z" data-name="Path 2700" style="stroke-width:.264583"/><path fill="#fff" d="M10.3066 102.6488h55.9519v.5292H10.3066zM10.3066 103.178h55.9519v.5292H10.3066zM166.653 104.181h9.1202v.5292h-9.1202zM166.653 109.7372h9.1202v.5292h-9.1202zM91.7626 87.2476h11.0675v.5292H91.7626zM91.7626 92.8039h11.0675v.5292H91.7626z" style="stroke-width:.264583"/></g></svg>`;
-const Intro = () => {
+const Intro = ({ navigation, route }) => {
const colors = useThemeStore(state => state.colors);
-
- const introCompleted = useSettingStore(state => state.settings.introCompleted);
+ const introCompleted = SettingsService.get().introCompleted;
const isTelemetryEnabled = useSettingStore(state => state.settings.telemetry);
const { height } = useWindowDimensions();
+ const insets = useSafeAreaInsets();
+ useNavigationFocus(navigation, {
+ onFocus: () => {
+ tabBarRef.current.lock();
+ }
+ });
useEffect(() => {
if (!introCompleted) {
@@ -34,164 +38,133 @@ const Intro = () => {
}
}, [introCompleted]);
- const hide = async () => {
- SettingsService.set({
- introCompleted: true
- });
- };
-
return (
- !introCompleted && (
+ <View
+ style={{
+ width: '100%',
+ height: '100%',
+ justifyContent: 'center',
+ alignItems: 'center',
+ marginTop: insets.top
+ }}
+ >
+ <Image
+ source={require('../../assets/images/notesnook.png')}
+ style={{
+ width: 40,
+ height: 40,
+ position: 'absolute',
+ top: 0
+ }}
+ />
+ <View
+ style={{
+ flexGrow: 1,
+ alignItems: 'center',
+ justifyContent: 'center',
+ marginBottom: 100
+ }}
+ >
+ <SvgView
+ width={height / 4 > 200 ? 200 : height / 4}
+ height={height / 4 > 200 ? 200 : height / 4}
+ src={SVG_D}
+ />
+
+ <View
+ style={{
+ marginTop: 40,
+ marginBottom: 20,
+ maxWidth: '80%',
+ opacity: 0.8
+ }}
+ >
+ <Heading>Safe & encrypted notes</Heading>
+ <Paragraph
+ size={SIZE.md + 4}
+ >{`Write with freedom.\nNever compromise on\nprivacy again.`}</Paragraph>
+ </View>
+ </View>
+
<View
- testID="notesnook.splashscreen"
style={{
- zIndex: 999,
width: '100%',
- height: '100%',
+ zIndex: 20,
position: 'absolute',
- backgroundColor: colors.bg
+ bottom: height / 10
}}
>
- <SafeAreaView
+ <TouchableOpacity
+ activeOpacity={1}
style={{
- width: '100%',
- height: '100%',
- marginTop: 25,
- maxWidth: 600,
- alignSelf: 'center'
+ flexDirection: 'row',
+ alignSelf: 'center',
+ width: '90%',
+ marginBottom: 12,
+ paddingHorizontal: 12,
+ justifyContent: 'center',
+ padding: 12,
+ maxWidth: 500
+ }}
+ onPress={async () => {
+ await SettingsService.set({ telemetry: !isTelemetryEnabled });
}}
>
- <Animated.View
- layout={FadeIn.duration(500)}
+ <Icon
+ size={SIZE.lg}
+ name={isTelemetryEnabled ? 'checkbox-marked' : 'checkbox-blank-outline'}
+ color={isTelemetryEnabled ? colors.accent : colors.icon}
+ />
+
+ <Paragraph
style={{
- width: '100%',
- height: '100%',
- justifyContent: 'center',
- alignItems: 'center'
+ flexShrink: 1,
+ marginLeft: 12
}}
+ size={SIZE.md}
>
- <Image
- source={require('../../assets/images/notesnook.png')}
- style={{
- width: 40,
- height: 40,
- position: 'absolute',
- top: 0
- }}
- />
- <View
- style={{
- flexGrow: 1,
- alignItems: 'center',
- justifyContent: 'center',
- marginBottom: 100
- }}
- >
- <SvgView
- width={height / 4 > 200 ? 200 : height / 4}
- height={height / 4 > 200 ? 200 : height / 4}
- src={SVG_D}
- />
-
- <View
- style={{
- marginTop: 40,
- marginBottom: 20,
- maxWidth: '80%',
- opacity: 0.8
- }}
- >
- <Heading>Safe & encrypted notes</Heading>
- <Paragraph
- size={SIZE.md + 4}
- >{`Write with freedom.\nNever compromise on\nprivacy again.`}</Paragraph>
- </View>
- </View>
+ Help improve Notesnook by sending completely anonymized{' '}
+ <Heading size={SIZE.md}>private analytics and bug reports.</Heading>
+ </Paragraph>
+ </TouchableOpacity>
- <View
- style={{
- width: '100%',
- zIndex: 20,
- position: 'absolute',
- bottom: height / 10
- }}
- >
- <TouchableOpacity
- activeOpacity={1}
- style={{
- flexDirection: 'row',
- alignSelf: 'center',
- width: '90%',
- marginBottom: 12,
- paddingHorizontal: 12,
- justifyContent: 'center',
- padding: 12,
- maxWidth: 500
- }}
- onPress={async () => {
- await SettingsService.set({ telemetry: !isTelemetryEnabled });
- }}
- >
- <Icon
- size={SIZE.lg}
- name={isTelemetryEnabled ? 'checkbox-marked' : 'checkbox-blank-outline'}
- color={isTelemetryEnabled ? colors.accent : colors.icon}
- />
+ <Button
+ fontSize={SIZE.md}
+ height={45}
+ width={250}
+ onPress={async () => {
+ navigation.navigate('AppLock', {
+ welcome: true
+ });
- <Paragraph
- style={{
- flexShrink: 1,
- marginLeft: 12
- }}
- size={SIZE.md}
- >
- Help improve Notesnook by sending completely anonymized{' '}
- <Heading size={SIZE.md}>private analytics and bug reports.</Heading>
- </Paragraph>
- </TouchableOpacity>
-
- <Button
- fontSize={SIZE.md}
- height={45}
- width={250}
- onPress={async () => {
- AppLock.present(true);
- await sleep(500);
- await hide();
- SettingsService.set({
- introCompleted: true
- });
- umami.pageView('/home', '/welcome');
- }}
- style={{
- paddingHorizontal: 24,
- alignSelf: 'center',
- borderRadius: 100,
- ...getElevation(5)
- }}
- type="accent"
- title="Get started"
- />
- </View>
-
- <BouncingView
- style={{
- position: 'absolute',
- bottom: -100,
- zIndex: -1
- }}
- duration={3000}
- >
- <SvgView
- width={Dimensions.get('window').width}
- height={Dimensions.get('window').width}
- src={SVG_Z}
- />
- </BouncingView>
- </Animated.View>
- </SafeAreaView>
+ umami.pageView('/home', '/welcome');
+ }}
+ style={{
+ paddingHorizontal: 24,
+ alignSelf: 'center',
+ borderRadius: 100,
+ ...getElevation(5)
+ }}
+ type="accent"
+ title="Get started"
+ />
</View>
- )
+
+ <BouncingView
+ style={{
+ position: 'absolute',
+ bottom: -100,
+ zIndex: -1
+ }}
+ duration={3000}
+ >
+ <SvgView
+ width={Dimensions.get('window').width}
+ height={Dimensions.get('window').width}
+ src={SVG_Z}
+ />
+ </BouncingView>
+ </View>
);
};
diff --git a/apps/mobile/src/components/intro/welcome.js b/apps/mobile/src/components/intro/welcome.js
index b13b32f48..39b0b9909 100644
--- a/apps/mobile/src/components/intro/welcome.js
+++ b/apps/mobile/src/components/intro/welcome.js
@@ -1,23 +1,23 @@
import React from 'react';
-import { View } from 'react-native';
-import umami from '../../utils/analytics';
+import Animated, { FadeInDown } from 'react-native-reanimated';
+import Navigation from '../../services/navigation';
import { useThemeStore } from '../../stores/use-theme-store';
-import { eSendEvent } from '../../services/event-manager';
import { getElevation } from '../../utils';
-import { eCloseProgressDialog, eOpenLoginDialog } from '../../utils/events';
+import umami from '../../utils/analytics';
import { SIZE } from '../../utils/size';
+import { AuthMode } from '../auth';
import { Button } from '../ui/button';
import { SvgView } from '../ui/svg';
import Heading from '../ui/typography/heading';
import Paragraph from '../ui/typography/paragraph';
-import { sleep } from '../../utils/time';
const IMAGE = color =>
`<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" width="1100.50064" height="691.70682" viewBox="0 0 1100.50064 691.70682" xmlns:xlink="http://www.w3.org/1999/xlink"><title>two_factor_authentication</title><path d="M1150.25032,388.23743h-1.85859V337.32194a29.4685,29.4685,0,0,0-29.46859-29.46853H1011.05186a29.4685,29.4685,0,0,0-29.46859,29.46853V616.64827a29.46851,29.46851,0,0,0,29.46859,29.46854h107.87128a29.46851,29.46851,0,0,0,29.46859-29.46854V424.47994h1.85859Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><path d="M1142.121,339.05342v278.92a22.01111,22.01111,0,0,1-22.01,22.01h-108.39a22.00248,22.00248,0,0,1-22-22.01v-278.92a22.00031,22.00031,0,0,1,22-22h13.15a10.4608,10.4608,0,0,0,9.68,14.4h61.8a10.44027,10.44027,0,0,0,9.67993-14.4H1120.111A22.00894,22.00894,0,0,1,1142.121,339.05342Z" transform="translate(-49.74968 -104.14659)" fill="#d0cde1"/><rect x="945.85129" y="355.70682" width="126" height="34" fill="${color}"/><path d="M1126.601,487.85341h-122a3.00328,3.00328,0,0,1-3-3v-30a3.00328,3.00328,0,0,1,3-3h122a3.00328,3.00328,0,0,1,3,3v30A3.00328,3.00328,0,0,1,1126.601,487.85341Zm-122-34a1.001,1.001,0,0,0-1,1v30a1.00067,1.00067,0,0,0,1,1h122a1.00067,1.00067,0,0,0,1-1v-30a1.001,1.001,0,0,0-1-1Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><rect x="959.85129" y="374.70682" width="16" height="2" fill="#3f3d56"/><rect x="981.85129" y="374.70682" width="16" height="2" fill="#3f3d56"/><rect x="1003.85129" y="374.70682" width="16" height="2" fill="#3f3d56"/><rect x="1025.85129" y="374.70682" width="16" height="2" fill="#3f3d56"/><rect x="1047.85129" y="374.70682" width="16" height="2" fill="#3f3d56"/><path d="M1142.121,589.61342v28.36a22.01111,22.01111,0,0,1-22.01,22.01h-108.39a22.00248,22.00248,0,0,1-22-22.01v-130.46Z" transform="translate(-49.74968 -104.14659)" opacity="0.1"/><rect x="99.85129" y="459.70682" width="473" height="232" fill="#d0cde1"/><path d="M502.351,795.85341H151.601a2.00591,2.00591,0,0,1-2-2v-228a2.00587,2.00587,0,0,1,2-2h4.44Z" transform="translate(-49.74968 -104.14659)" opacity="0.1"/><rect x="318.85129" y="490.70682" width="732.99951" height="2" fill="#3f3d56"/><path d="M600.34268,108.46435H390.853v-4.31776H295.86217v4.31776H85.5089a14.17039,14.17039,0,0,0-14.1704,14.1704V409.4906a14.17043,14.17043,0,0,0,14.1704,14.17045H600.34268a14.17044,14.17044,0,0,0,14.1704-14.17045V122.63475A14.17039,14.17039,0,0,0,600.34268,108.46435Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><rect x="40.59128" y="29.35679" width="505.16998" height="284.98004" fill="#d0cde1"/><circle cx="292.74433" cy="16.4075" r="5.18132" fill="${color}"/><path d="M240.601,239.85341h-12a3.00328,3.00328,0,0,1-3-3v-12a3.00328,3.00328,0,0,1,3-3h12a3.00328,3.00328,0,0,1,3,3v12A3.00328,3.00328,0,0,1,240.601,239.85341Zm-12-16a1.0013,1.0013,0,0,0-1,1v12a1.0013,1.0013,0,0,0,1,1h12a1.0013,1.0013,0,0,0,1-1v-12a1.0013,1.0013,0,0,0-1-1Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><rect x="176.85129" y="133.70682" width="228" height="2" fill="#3f3d56"/><rect x="345.85129" y="188.70682" width="53" height="16" fill="${color}"/><path d="M452.601,304.85341h-49a3.00328,3.00328,0,0,1-3-3v-12a3.00328,3.00328,0,0,1,3-3h49a3.00328,3.00328,0,0,1,3,3v12A3.00328,3.00328,0,0,1,452.601,304.85341Zm-49-16a1.0013,1.0013,0,0,0-1,1v12a1.0013,1.0013,0,0,0,1,1h49a1.0013,1.0013,0,0,0,1-1v-12a1.0013,1.0013,0,0,0-1-1Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><rect x="703.85129" y="206.70682" width="100" height="70" fill="${color}"/><path d="M863.601,375.35341h-96a4.00427,4.00427,0,0,1-4-4v-66a4.00427,4.00427,0,0,1,4-4h96a4.00426,4.00426,0,0,1,4,4v66A4.00426,4.00426,0,0,1,863.601,375.35341Zm-96-70v66H863.6039l-.00293-66Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><path d="M852.601,302.85341h-4a33,33,0,1,0-66,0h-4a37,37,0,1,1,74,0Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><path d="M825.601,330.35341a10.00023,10.00023,0,1,0-15.29412,8.47258V349.5593a5.29411,5.29411,0,0,0,5.29412,5.29411h0a5.29411,5.29411,0,0,0,5.29411-5.29411V338.826A9.98327,9.98327,0,0,0,825.601,330.35341Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><rect x="284.35129" y="562.70682" width="16" height="2" fill="#3f3d56"/><rect x="306.35129" y="562.70682" width="16" height="2" fill="#3f3d56"/><rect x="328.35129" y="562.70682" width="16" height="2" fill="#3f3d56"/><rect x="350.35129" y="562.70682" width="16" height="2" fill="#3f3d56"/><rect x="372.35129" y="562.70682" width="16" height="2" fill="#3f3d56"/><path d="M643.60059,778.85352H174.60107a4.00428,4.00428,0,0,1-4-4v-228a4.00427,4.00427,0,0,1,4-4H643.60059a4.004,4.004,0,0,1,4,4v228A4.004,4.004,0,0,1,643.60059,778.85352Zm-468.99952-232v228H643.60352l-.00293-228Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><circle cx="145.85129" cy="470.70682" r="6" fill="#3f3d56"/><circle cx="166.85129" cy="470.70682" r="6" fill="#3f3d56"/><circle cx="187.85129" cy="470.70682" r="6" fill="#3f3d56"/><path d="M453.601,680.85341h-135a3.00328,3.00328,0,0,1-3-3v-34a3.00328,3.00328,0,0,1,3-3h135a3.00328,3.00328,0,0,1,3,3v34A3.00328,3.00328,0,0,1,453.601,680.85341Zm-135-38a1.001,1.001,0,0,0-1,1v34a1.001,1.001,0,0,0,1,1h135a1.001,1.001,0,0,0,1-1v-34a1.001,1.001,0,0,0-1-1Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><circle cx="437.85129" cy="559.70682" r="18" fill="${color}"/><path d="M493.601,679.85341a19,19,0,1,1,19-19A19.02162,19.02162,0,0,1,493.601,679.85341Zm0-36a17,17,0,1,0,17,17A17.019,17.019,0,0,0,493.601,643.85341Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><polygon points="444.118 563.803 434.437 554.121 437.265 551.293 443.584 557.611 461.216 532.555 464.487 534.858 444.118 563.803" fill="#3f3d56"/><polygon points="433.761 314.337 40.591 314.337 40.591 50.947 433.761 314.337" opacity="0.1"/><path d="M628.69739,413.2984H579.39527v-3.55218a.7043.7043,0,0,0-.70431-.70432H561.78737a.70429.70429,0,0,0-.70431.70432v3.55218H550.51832v-3.55218a.7043.7043,0,0,0-.70432-.70432H532.91042a.7043.7043,0,0,0-.70432.70432v3.55218H521.64136v-3.55218a.70429.70429,0,0,0-.70431-.70432H504.03347a.7043.7043,0,0,0-.70432.70432v3.55218H492.76441v-3.55218a.7043.7043,0,0,0-.70432-.70432H475.15651a.70429.70429,0,0,0-.70431.70432v3.55218H463.88746v-3.55218a.7043.7043,0,0,0-.70432-.70432H446.27956a.7043.7043,0,0,0-.70432.70432v3.55218H435.0105v-3.55218a.70429.70429,0,0,0-.70431-.70432H417.4026a.7043.7043,0,0,0-.70431.70432v3.55218H406.13355v-3.55218a.7043.7043,0,0,0-.70432-.70432H273.01784a.7043.7043,0,0,0-.70432.70432v3.55218H261.74878v-3.55218a.7043.7043,0,0,0-.70432-.70432H244.14088a.70429.70429,0,0,0-.70431.70432v3.55218H232.87183v-3.55218a.7043.7043,0,0,0-.70432-.70432H215.26393a.7043.7043,0,0,0-.70432.70432v3.55218H203.99487v-3.55218a.70429.70429,0,0,0-.70431-.70432H186.387a.7043.7043,0,0,0-.70431.70432v3.55218H175.11792v-3.55218a.7043.7043,0,0,0-.70432-.70432H157.51a.7043.7043,0,0,0-.70432.70432v3.55218H146.241v-3.55218a.7043.7043,0,0,0-.70432-.70432H128.63307a.7043.7043,0,0,0-.70432.70432v3.55218H117.364v-3.55218a.7043.7043,0,0,0-.70431-.70432H99.75611a.70429.70429,0,0,0-.70431.70432v3.55218H66.65326A16.90359,16.90359,0,0,0,49.74968,430.202v7.6434a16.90358,16.90358,0,0,0,16.90358,16.90354H628.69739A16.90358,16.90358,0,0,0,645.601,437.84539V430.202A16.90359,16.90359,0,0,0,628.69739,413.2984Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><path d="M474.601,321.85341h-264a3.00328,3.00328,0,0,1-3-3v-110a3.00328,3.00328,0,0,1,3-3h264a3.00328,3.00328,0,0,1,3,3v110A3.00328,3.00328,0,0,1,474.601,321.85341Zm-264-114a1.0013,1.0013,0,0,0-1,1v110a1.0013,1.0013,0,0,0,1,1h264a1.0013,1.0013,0,0,0,1-1v-110a1.0013,1.0013,0,0,0-1-1Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><path d="M240.601,269.85341h-12a3.00328,3.00328,0,0,1-3-3v-12a3.00328,3.00328,0,0,1,3-3h12a3.00328,3.00328,0,0,1,3,3v12A3.00328,3.00328,0,0,1,240.601,269.85341Zm-12-16a1.0013,1.0013,0,0,0-1,1v12a1.0013,1.0013,0,0,0,1,1h12a1.0013,1.0013,0,0,0,1-1v-12a1.0013,1.0013,0,0,0-1-1Z" transform="translate(-49.74968 -104.14659)" fill="#3f3d56"/><rect x="176.85129" y="163.70682" width="228" height="2" fill="#3f3d56"/><rect x="264.85129" y="269.70682" width="732.99951" height="2" fill="#3f3d56"/><circle cx="264.85129" cy="269.70682" r="14" fill="#3f3d56"/><circle cx="997.85129" cy="271.70682" r="11" fill="#3f3d56"/><circle cx="1051.85129" cy="492.70682" r="11" fill="#3f3d56"/><circle cx="321.85129" cy="492.70682" r="11" fill="#3f3d56"/></svg>`;
export const WelcomeNotice = () => {
const colors = useThemeStore(state => state.colors);
return (
- <View
+ <Animated.View
+ entering={FadeInDown}
style={{
padding: 12,
alignItems: 'center',
@@ -44,9 +44,14 @@ export const WelcomeNotice = () => {
height={45}
width={250}
onPress={async () => {
- eSendEvent(eCloseProgressDialog);
- await sleep(500);
- eSendEvent(eOpenLoginDialog, 2);
+ Navigation.navigate(
+ {
+ name: 'Auth'
+ },
+ {
+ mode: AuthMode.welcomeSignup
+ }
+ );
umami.pageView('/encryptionnotice', '/welcome/privacymode');
}}
style={{
@@ -59,6 +64,6 @@ export const WelcomeNotice = () => {
type="accent"
title="Create your account"
/>
- </View>
+ </Animated.View>
);
};
diff --git a/apps/mobile/src/components/launcher/index.js b/apps/mobile/src/components/launcher/index.js
index d2ff7e801..325c548da 100644
--- a/apps/mobile/src/components/launcher/index.js
+++ b/apps/mobile/src/components/launcher/index.js
@@ -46,11 +46,7 @@ const Launcher = React.memo(
const deviceMode = useSettingStore(state => state.deviceMode);
const passwordInputRef = useRef();
const password = useRef();
- const introCompleted = SettingsService.get().introCompleted;
- const [requireIntro, setRequireIntro] = useState({
- updated: introCompleted,
- value: !introCompleted
- });
+ const introCompleted = false; //SettingsService.get().introCompleted;
const dbInitCompleted = useRef(false);
const loadNotes = async () => {
@@ -62,13 +58,17 @@ const Launcher = React.memo(
db.notes.init().then(() => {
Walkthrough.init();
initialize();
- setImmediate(() => setLoading(false));
+ setImmediate(() => {
+ setLoading(false);
+ setImmediate(() => doAppLoadActions());
+ });
});
});
};
const init = async () => {
if (!dbInitCompleted.current) {
+ await RNBootSplash.hide();
await db.init();
dbInitCompleted.current = true;
}
@@ -78,24 +78,9 @@ const Launcher = React.memo(
}
};
- const hideSplashScreen = async () => {
- if (requireIntro.value) await sleep(500);
- await RNBootSplash.hide({ fade: true });
- };
-
- useEffect(() => {
- console.log('hide splash', requireIntro.updated);
- if (requireIntro.updated) {
- hideSplashScreen();
- return;
- }
- let introCompleted = SettingsService.get().introCompleted;
- console.log(requireIntro);
- setRequireIntro({
- updated: true,
- value: !introCompleted
- });
- }, [requireIntro, verifyUser]);
+ // useEffect(() => {
+ // hideSplashScreen();
+ // }, [verifyUser]);
useEffect(() => {
if (!loading) {
@@ -129,7 +114,7 @@ const Launcher = React.memo(
}
}
- if (!requireIntro?.value) {
+ if (introCompleted) {
useMessageStore.subscribe(state => {
let dialogs = state.dialogs;
if (dialogs.length > 0) {
@@ -141,17 +126,17 @@ const Launcher = React.memo(
const checkAppUpdateAvailable = async () => {
return;
- try {
- const version = await checkVersion();
- if (!version.needsUpdate) return false;
- presentSheet({
- component: ref => <Update version={version} fwdRef={ref} />
- });
+ // try {
+ // const version = await checkVersion();
+ // if (!version.needsUpdate) return false;
+ // presentSheet({
+ // component: ref => <Update version={version} fwdRef={ref} />
+ // });
- return true;
- } catch (e) {
- return false;
- }
+ // return true;
+ // } catch (e) {
+ // return false;
+ // }
};
const restoreEditorState = async () => {
@@ -354,8 +339,6 @@ const Launcher = React.memo(
</View>
</View>
</View>
- ) : requireIntro.value && !loading ? (
- <Intro />
) : null;
},
() => true
diff --git a/apps/mobile/src/components/sheets/update/index.js b/apps/mobile/src/components/sheets/update/index.js
index c657cfeab..1d5f7cb9d 100644
--- a/apps/mobile/src/components/sheets/update/index.js
+++ b/apps/mobile/src/components/sheets/update/index.js
@@ -1,5 +1,5 @@
-import React from 'react';
-import { Linking, View } from 'react-native';
+import React, { useEffect, useState } from 'react';
+import { ActivityIndicator, Linking, View } from 'react-native';
import { ScrollView } from 'react-native-gesture-handler';
import { useThemeStore } from '../../../stores/use-theme-store';
import { STORE_LINK } from '../../../utils/constants';
@@ -11,16 +11,19 @@ import Heading from '../../ui/typography/heading';
import Paragraph from '../../ui/typography/paragraph';
import Config from 'react-native-config';
import deviceInfoModule from 'react-native-device-info';
+import { checkVersion } from 'react-native-check-version';
+import * as Progress from 'react-native-progress';
const UPDATE_SVG = color =>
`<svg data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="774" height="669.5" viewBox="0 0 774 669.5" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M938.2145,322.3829C936.73266,207.5841,878.16775,115.25,806.13079,115.25c-43.29082,0-81.71777,33.346-105.81477,84.87331l28.33157,71.08654-39.15446-43.81576c-9.876,29.64743-15.48115,63.49569-15.48115,99.44475a324.20917,324.20917,0,0,0,9.98686,80.80891l75.92761-12.24058-67.9507,37.99628c22.13728,60.69069,62.59851,102.1414,109.23586,104.87608l-8.988,244.5184,27.81449.99338-5.94527-245.75716c66.41162-6.32443,119.60967-91.20375,123.8712-197.42794l-45.89372-25.66252Z" transform="translate(-213 -115.25)" fill="#f0f0f0"/><rect x="157.51532" y="354.40187" width="6.60151" height="49.25266" fill="${color}"/><polygon points="187.815 376.276 182.98 380.779 160.823 356.936 138.658 380.779 133.823 376.276 160.823 347.243 187.815 376.276" fill="${color}"/><path d="M371.9876,543.6602a52.8121,52.8121,0,1,1,52.8121-52.81209A52.87183,52.87183,0,0,1,371.9876,543.6602Zm0-99.02268a46.21059,46.21059,0,1,0,46.21058,46.21059A46.26275,46.26275,0,0,0,371.9876,444.63752Z" transform="translate(-213 -115.25)" fill="${color}"/><rect x="212.75248" y="253.9314" width="3.63974" height="27.15545" fill="#e4e4e4"/><polygon points="229.458 265.992 226.793 268.475 214.576 255.328 202.356 268.475 199.69 265.992 214.576 249.984 229.458 265.992" fill="#e4e4e4"/><path d="M426.56422,409.9859a29.118,29.118,0,1,1,29.118-29.118A29.15089,29.15089,0,0,1,426.56422,409.9859Zm0-54.59616A25.47821,25.47821,0,1,0,452.04243,380.868,25.507,25.507,0,0,0,426.56422,355.38974Z" transform="translate(-213 -115.25)" fill="#e4e4e4"/><rect x="99.52274" y="186.73872" width="3.63974" height="27.15545" fill="#e4e4e4"/><polygon points="116.229 198.799 113.563 201.282 101.346 188.136 89.126 201.282 86.46 198.799 101.346 182.792 116.229 198.799" fill="#e4e4e4"/><path d="M313.33448,342.79321a29.118,29.118,0,1,1,29.118-29.118A29.15088,29.15088,0,0,1,313.33448,342.79321Zm0-54.59615a25.47821,25.47821,0,1,0,25.47821,25.4782A25.507,25.507,0,0,0,313.33448,288.19706Z" transform="translate(-213 -115.25)" fill="#e4e4e4"/><path d="M518.7325,635.91942a8.22484,8.22484,0,0,1,.958-12.302,9.56322,9.56322,0,0,1,1.26081-.83521l-6.99347-30.13439,16.26512,5.84042,4.14749,27.72073a8.21849,8.21849,0,0,1-2.21462,10.58849A10.12952,10.12952,0,0,1,518.7325,635.91942Z" transform="translate(-213 -115.25)" fill="#ffb8b8"/><path d="M516.88531,612.40706l-.08727-.29605c-8.79267-29.805-17.88169-60.6154-28.97824-94.16236l-.0728-.21977.2448-.13088c6.18493-3.30762,15.48114-3.08736,21.62358.51183,5.68293,3.33,8.55569,9.77159,7.0024,15.68347l8.09328,38.67327c3.29039,12.64158,6.69574,25.72668,9.95036,38.62892l.09229.36576-.504.0295c-5.92592.34536-12.04821.70254-16.95322.89973Z" transform="translate(-213 -115.25)" fill="#ccc"/><polygon points="229.16 657.57 217.627 657.57 212.138 616.801 229.16 616.801 229.16 657.57" fill="#ffb8b8"/><path d="M445.10175,783.06559H407.9141v-.43107c0-7.31472,6.49345-13.26551,14.47493-13.26551h22.71272Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><polygon points="337.837 648.851 326.848 652.06 308.113 614.743 324.331 610.006 337.837 648.851" fill="#ffb8b8"/><path d="M521.60173,783.39141l-.14262-.41086c-2.42325-6.96953,1.79234-14.4459,9.39693-16.66692l21.64062-6.31955,4.53736,13.05Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><ellipse cx="279.46347" cy="354.21043" rx="23.10522" ry="21.17504" fill="#ffb8b8"/><path d="M502.83713,465.536c.13132-8.54065-3.76885-16.99907-9.79916-21.25171a16.77762,16.77762,0,0,0-19.87954.322c-5.937,4.44645-9.65428,13.02823-9.33974,21.56167C477.12124,466.20257,490.42379,466.23726,502.83713,465.536Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><path d="M448.74454,759.69687l-.46255-.04125c-10.03358-.90255-20.40891-1.83457-30.21419-1.9415l-.5333-.00589.07281-.48411c2.32311-15.42,3.30793-31.45044,4.26037-46.9538.9405-15.308,1.91269-31.13682,4.17769-46.17039.95818-4.0257,1.892-8.00342,2.82264-11.96682,7.70037-32.79837,14.97378-63.77816,29.98728-94.44433l.14194-.28963.34381.03789c14.08679,1.56221,27.62283,6.27241,38.11391,13.26256l.20326.13513-.00988.23027a131.25944,131.25944,0,0,0-.10174,14.17269,44.82523,44.82523,0,0,1,7.48241,42.489c4.13084,12.65215,8.40154,25.73075,12.75907,38.63212,10.5818,26.587,21.53153,54.10056,32.75594,81.99045l.1842.45717-.51791.11114c-8.07587,1.73775-16.40668,3.52938-24.62518,4.22482l-.31028.0261-.14745-.25174a587.30717,587.30717,0,0,1-50.88262-112.12662c-2.80473,7.83882-6.84508,14.91443-10.75934,21.76819a157.11556,157.11556,0,0,0-9.86087,19.31354c-1.73239,13.0365-2.192,27.16078-2.63591,40.81947-.42007,12.91442-.81671,25.11236-2.19312,36.582Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><path d="M484.57528,444.67592c10.01507-1.97751,21.093-.09617,28.95819,6.09651s11.85919,16.9058,8.62805,26.09364-14.20114,15.65236-24.12,13.27969c2.84131-7.33881-.35623-16.34918-7.302-20.57639C482.50242,464.55626,480.23475,452.58775,484.57528,444.67592Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><path d="M496.73471,571.62025l-.36633-.15281c-12.77629-5.34207-25.30408-9.441-37.04181-13.18089l-.35989-.07114-.00092-.95644.23358.07451c.04915-.09935.1045-.21217.16008-.32456.16031-.325.26963-.54642.36264-.69292l-.00252-.00126c.97862-1.82742,1.75651-3.59337,2.50868-5.30123.77628-1.76259,1.5776-3.58243,2.61295-5.50793a15.68833,15.68833,0,0,1-4.02289-17.95719c2.593-5.63211,9.20424-10.01859,16.15083-10.74644,2.54543-6.42185,8.21712-19.91552,8.21712-19.91552s11.92674-.30015,16.72316-.85793l.08062-.00926.07923.016c10.4711,2.10273,19.213,11.1834,21.25846,22.08265,1.72665,9.199-.89525,19.721-7.38227,29.62807A128.7532,128.7532,0,0,1,504.93,561.61682c-2.92186,3.34837-5.68157,6.51067-7.97367,9.69571Z" transform="translate(-213 -115.25)" fill="#ccc"/><path d="M519.3919,459.10521v0Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><path d="M519.861,457.22412c-7.01076-.95907-12.51527-7.52688-11.71835-13.982s7.76344-11.72977,14.83079-11.22907,13.06654,6.694,12.77147,13.18459S528.81221,458.44864,519.861,457.22412Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><path d="M518.76646,453.03852c-7.01067-.95906-12.51516-7.52688-11.71821-13.98194.54524-4.41578,3.9788-8.27657,8.35539-10.11667-5.65378,1.13408-10.51956,5.64916-11.17757,10.97881-.79695,6.45506,4.70754,13.02288,11.71821,13.98195a14.465,14.465,0,0,0,7.6875-.98538A14.866,14.866,0,0,1,518.76646,453.03852Z" transform="translate(-213 -115.25)" fill="#2f2e41"/><path d="M382.77632,566.82181a9.99626,9.99626,0,0,1,12.97554-3.271,9.61149,9.61149,0,0,1,1.27935.81118l28.67233-16.08336-.58936,16.00057-27.13738,12.82a10.15042,10.15042,0,0,1-11.63139,1.61428A8.34216,8.34216,0,0,1,382.77632,566.82181Z" transform="translate(-213 -115.25)" fill="#ffb8b8"/><path d="M406.35053,557.3917l.2755-.17406c27.73394-17.52829,56.40359-35.64765,87.2197-56.41349l.20185-.13613.21621.16792c5.46363,4.24233,8.33439,12.34854,6.67808,18.85539-1.5324,6.02009-7.20243,10.64869-13.80215,11.27624L450.049,550.84631c-11.90943,7.05521-24.23685,14.35751-36.42636,21.46865l-.34555.20162-.19828-.42571c-2.32974-5.0055-4.73707-10.17674-6.57422-14.34943Z" transform="translate(-213 -115.25)" fill="#ccc"/><path d="M986,784.75H214a1,1,0,0,1,0-2H986a1,1,0,0,1,0,2Z" transform="translate(-213 -115.25)" fill="#cacaca"/></svg>`;
-export const Update = ({ version, fwdRef }) => {
+export const Update = ({ version: appVersion, fwdRef }) => {
const colors = useThemeStore(state => state.colors);
- let notes = version.notes
+ const [version, setVersion] = useState(appVersion);
+ let notes = version?.notes
? version.notes.replace('Thank you for using Notesnook!', '').split('- ')
: ['Bug fixes and performance improvements'];
- notes = notes.map(n => n.replace(/\n/g, ''));
+ notes = notes?.map(n => n.replace(/\n/g, ''));
const isGithubRelease = Config.GITHUB_RELEASE === 'true';
const getSupportedAbi = () => {
@@ -31,10 +34,32 @@ export const Update = ({ version, fwdRef }) => {
return armv8a || armv7 || abi[0];
};
- const GITHUB_URL = `https://github.com/streetwriters/notesnook/releases/download/${
- version.version
- }-android/notesnook-${getSupportedAbi()}.apk`;
- const GITHUB_PAGE_URL = `https://github.com/streetwriters/notesnook/releases/tag/${version.version}-android`;
+ const GITHUB_URL =
+ !version || !version.needsUpdate
+ ? null
+ : `https://github.com/streetwriters/notesnook/releases/download/${
+ version.version
+ }-android/notesnook-${getSupportedAbi()}.apk`;
+ const GITHUB_PAGE_URL =
+ !version || !version.needsUpdate
+ ? null
+ : `https://github.com/streetwriters/notesnook/releases/tag/${version.version}-android`;
+
+ useEffect(() => {
+ if (!version) {
+ (async () => {
+ try {
+ console.log('checking for new version');
+ let v = await checkVersion();
+ setVersion(v);
+ } catch (e) {
+ setVersion({
+ needsUpdate: false
+ });
+ }
+ })();
+ }
+ }, []);
return (
<View
@@ -46,75 +71,112 @@ export const Update = ({ version, fwdRef }) => {
maxHeight: '97%'
}}
>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'flex-end',
- justifyContent: 'space-between',
- width: '100%',
- backgroundColor: colors.nav,
- borderRadius: 10,
- padding: 12
- }}
- >
- <View>
- <Heading>Update available</Heading>
- <Paragraph>
- v{version.version} has been released {isGithubRelease ? 'on Github' : ''}
- </Paragraph>
- </View>
+ {!version || !version?.needsUpdate ? (
+ <>
+ <View
+ style={{
+ paddingVertical: 60,
+ justifyContent: 'center',
+ alignItems: 'center'
+ }}
+ >
+ {!version ? (
+ <>
+ <Progress.Bar
+ size={SIZE.xxl}
+ indeterminate={true}
+ color={colors.accent}
+ borderWidth={0}
+ height={5}
+ width={250}
+ />
+ <Paragraph
+ style={{
+ marginTop: 5
+ }}
+ size={SIZE.md}
+ >
+ Checking for new version
+ </Paragraph>
+ </>
+ ) : (
+ <Paragraph size={SIZE.md}>No new updates are available</Paragraph>
+ )}
+ </View>
+ </>
+ ) : (
+ <>
+ <View
+ style={{
+ flexDirection: 'row',
+ alignItems: 'flex-end',
+ justifyContent: 'space-between',
+ width: '100%',
+ backgroundColor: colors.nav,
+ borderRadius: 10,
+ padding: 12
+ }}
+ >
+ <View>
+ <Heading>Update available</Heading>
+ <Paragraph>
+ v{version.version} has been released {isGithubRelease ? 'on Github' : ''}
+ </Paragraph>
+ </View>
+
+ <SvgView src={UPDATE_SVG(colors.accent)} width={100} height={100} />
+ </View>
- <SvgView src={UPDATE_SVG(colors.accent)} width={100} height={100} />
- </View>
+ <Seperator />
+ <ScrollView
+ nestedScrollEnabled={true}
+ onMomentumScrollEnd={() => {
+ fwdRef?.current?.handleChildScrollEnd();
+ }}
+ style={{
+ width: '100%'
+ }}
+ >
+ <Heading size={SIZE.md}>Release notes:</Heading>
+ {notes.map(item => (
+ <Paragraph
+ key={item}
+ color={colors.icon}
+ style={{
+ marginBottom: 5
+ }}
+ >
+ • {item}
+ </Paragraph>
+ ))}
+ </ScrollView>
+ <Seperator />
+ <Button
+ title={isGithubRelease ? `Download update` : `Update now`}
+ onPress={() => {
+ Linking.openURL(isGithubRelease ? GITHUB_URL : STORE_LINK).catch(console.log);
+ }}
+ type="accent"
+ style={{
+ width: '100%'
+ }}
+ />
- <Seperator />
- <ScrollView
- nestedScrollEnabled={true}
- onMomentumScrollEnd={() => {
- fwdRef?.current?.handleChildScrollEnd();
- }}
- style={{
- width: '100%'
- }}
- >
- <Heading size={SIZE.md}>Release notes:</Heading>
- {notes.map(item => (
<Paragraph
- key={item}
+ size={12}
color={colors.icon}
style={{
- marginBottom: 5
+ textDecorationLine: 'underline',
+ marginTop: 10
+ }}
+ onPress={() => {
+ Linking.openURL(GITHUB_PAGE_URL).catch(console.log);
}}
>
- • {item}
+ Read full release notes on Github
</Paragraph>
- ))}
- </ScrollView>
- <Seperator />
- <Button
- title={isGithubRelease ? `Download update` : `Update now`}
- onPress={() => {
- Linking.openURL(isGithubRelease ? GITHUB_URL : STORE_LINK).catch(console.log);
- }}
- type="accent"
- style={{
- width: '100%'
- }}
- />
-
- <Paragraph
- size={12}
- color={colors.icon}
- style={{
- textDecorationLine: 'underline',
- marginTop: 10
- }}
- onPress={() => {
- Linking.openURL(GITHUB_PAGE_URL).catch(console.log);
- }}
- >
- Read full release notes on Github
- </Paragraph>
+ </>
+ )}
</View>
);
};
diff --git a/apps/mobile/src/components/sidemenu/index.js b/apps/mobile/src/components/sidemenu/index.js
index acb662b13..520cbbd38 100644
--- a/apps/mobile/src/components/sidemenu/index.js
+++ b/apps/mobile/src/components/sidemenu/index.js
@@ -26,6 +26,7 @@ export const SideMenu = React.memo(
const insets = useSafeAreaInsets();
const subscriptionType = useUserStore(state => state.user?.subscription?.type);
const loading = useNoteStore(state => state.loading);
+ const introCompleted = useSettingStore(state => state.settings.introCompleted);
const noTextMode = false;
const BottomItemsList = [
@@ -72,7 +73,7 @@ export const SideMenu = React.memo(
[]
);
- return !loading ? (
+ return !loading && introCompleted ? (
<View
style={{
height: '100%',
diff --git a/apps/mobile/src/components/sidemenu/userstatus.js b/apps/mobile/src/components/sidemenu/userstatus.js
index df879700f..846e33a6b 100644
--- a/apps/mobile/src/components/sidemenu/userstatus.js
+++ b/apps/mobile/src/components/sidemenu/userstatus.js
@@ -14,6 +14,8 @@ import Paragraph from '../ui/typography/paragraph';
import { TimeSince } from '../ui/time-since';
import useSyncProgress from '../../utils/hooks/use-sync-progress';
import * as Progress from 'react-native-progress';
+import Navigation from '../../services/navigation';
+import { tabBarRef } from '../../utils/global-refs';
export const UserStatus = () => {
const colors = useThemeStore(state => state.colors);
@@ -45,7 +47,16 @@ export const UserStatus = () => {
if (user) {
await Sync.run();
} else {
- eSendEvent(eOpenLoginDialog);
+ tabBarRef.current?.closeDrawer();
+ Navigation.navigate(
+ {
+ name: 'Login'
+ },
+ {
+ mode: 0,
+ canGoBack: true
+ }
+ );
}
}}
type="gray"
diff --git a/apps/mobile/src/navigation/index.js b/apps/mobile/src/navigation/index.js
index 9c3975ad9..3ed07be37 100644
--- a/apps/mobile/src/navigation/index.js
+++ b/apps/mobile/src/navigation/index.js
@@ -1,11 +1,23 @@
import React from 'react';
+import DelayLayout from '../components/delay-layout';
import DialogProvider from '../components/dialog-provider';
+import { Header } from '../components/header';
+import Intro from '../components/intro';
import { Toast } from '../components/toast';
+import SettingsService from '../services/settings';
+import { useNoteStore } from '../stores/use-notes-store';
import { TabsHolder } from './tabs-holder';
export const ApplicationHolder = React.memo(
() => {
- return (
+ const loading = useNoteStore(state => state.loading);
+ const introCompleted = SettingsService.get().introCompleted;
+ return loading && introCompleted ? (
+ <>
+ <Header />
+ <DelayLayout wait={loading} />
+ </>
+ ) : (
<>
<TabsHolder />
<Toast />
diff --git a/apps/mobile/src/navigation/navigationstack.js b/apps/mobile/src/navigation/navigationstack.js
index b4e8155f7..70a3a717d 100644
--- a/apps/mobile/src/navigation/navigationstack.js
+++ b/apps/mobile/src/navigation/navigationstack.js
@@ -1,8 +1,11 @@
-import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import * as React from 'react';
+import Auth from '../components/auth';
+import { Login } from '../components/auth/login';
+import { Signup } from '../components/auth/signup';
import Container from '../components/container';
+import Intro from '../components/intro';
import Favorites from '../screens/favorites';
import Home from '../screens/home';
import Notebook from '../screens/notebook';
@@ -13,6 +16,7 @@ import { TaggedNotes } from '../screens/notes/tagged';
import { TopicNotes } from '../screens/notes/topic-notes';
import { Search } from '../screens/search';
import Settings from '../screens/settings';
+import AppLock from '../screens/settings/app-lock';
import Tags from '../screens/tags';
import Trash from '../screens/trash';
import { eSendEvent } from '../services/event-manager';
@@ -24,10 +28,50 @@ import { history } from '../utils';
import { rootNavigatorRef } from '../utils/global-refs';
import { hideAllTooltips } from '../utils/hooks/use-tooltip';
const NativeStack = createNativeStackNavigator();
+const IntroStack = createNativeStackNavigator();
+
+/**
+ * Intro Stack:
+ *
+ * Welcome Page
+ * Select Privacy Mode Page
+ * Login/Signup Page
+ *
+ */
+
+const IntroStackNavigator = () => {
+ const colors = useThemeStore(state => state.colors);
+ const introCompleted = SettingsService.get().introCompleted;
+ return (
+ <IntroStack.Navigator
+ screenOptions={{
+ headerShown: false,
+ lazy: false,
+ animation: 'none',
+ contentStyle: {
+ backgroundColor: colors.bg
+ }
+ }}
+ initialRouteName={'Intro'}
+ >
+ <NativeStack.Screen name="Intro" component={Intro} />
+ <NativeStack.Screen name="AppLock" component={AppLock} />
+ <NativeStack.Screen
+ name="Auth"
+ initialParams={{
+ mode: 0
+ }}
+ component={Auth}
+ />
+ </IntroStack.Navigator>
+ );
+};
+
const Tabs = React.memo(
() => {
const colors = useThemeStore(state => state.colors);
const homepage = SettingsService.get().homepage;
+ const showWelcome = !SettingsService.get().introCompleted;
React.useEffect(() => {
setTimeout(() => {
useNavigationStore.getState().update({ name: homepage });
@@ -37,7 +81,7 @@ const Tabs = React.memo(
return (
<NativeStack.Navigator
tabBar={() => null}
- initialRouteName={homepage}
+ initialRouteName={showWelcome ? 'Welcome' : homepage}
backBehavior="history"
screenOptions={{
headerShown: false,
@@ -48,6 +92,21 @@ const Tabs = React.memo(
}
}}
>
+ <NativeStack.Screen
+ name="Signup"
+ initialParams={{
+ mode: 1
+ }}
+ component={Auth}
+ />
+ <NativeStack.Screen
+ name="Login"
+ initialParams={{
+ mode: 0
+ }}
+ component={Auth}
+ />
+ <NativeStack.Screen name="Welcome" component={IntroStackNavigator} />
<NativeStack.Screen name="Notes" component={Home} />
<NativeStack.Screen name="Notebooks" component={Notebooks} />
<NativeStack.Screen options={{ lazy: true }} name="Favorites" component={Favorites} />
diff --git a/apps/mobile/src/screens/editor/tiptap/picker.js b/apps/mobile/src/screens/editor/tiptap/picker.js
index dbd0377b1..92f44eb06 100644
--- a/apps/mobile/src/screens/editor/tiptap/picker.js
+++ b/apps/mobile/src/screens/editor/tiptap/picker.js
@@ -188,7 +188,6 @@ const pick = async options => {
}
return;
}
-
if (options?.type.startsWith('image') || options?.type === 'camera') {
if (options.type === 'image') {
gallery(options);
diff --git a/apps/mobile/src/screens/editor/tiptap/useEditorEvents.ts b/apps/mobile/src/screens/editor/tiptap/useEditorEvents.ts
index 72cddcebe..e245a2af2 100644
--- a/apps/mobile/src/screens/editor/tiptap/useEditorEvents.ts
+++ b/apps/mobile/src/screens/editor/tiptap/useEditorEvents.ts
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useRef } from 'react';
import { BackHandler, InteractionManager, NativeEventSubscription } from 'react-native';
import { WebViewMessageEvent } from 'react-native-webview';
+import { AuthMode } from '../../../components/auth';
import { Properties } from '../../../components/properties';
import { DDS } from '../../../services/device-detection';
import {
@@ -95,21 +96,18 @@ const showActionsheet = async (editor: useEditorType) => {
const currentNote = editor?.note?.current;
if (currentNote?.id) {
let note = db.notes?.note(currentNote.id)?.data as NoteType;
- if (!note) {
- ToastEvent.show({
- heading: 'Start writing to create a new note',
- type: 'success',
- context: 'global'
- });
-
- return;
- }
if (editorState().isFocused || editorState().isFocused) {
editorState().isFocused = true;
}
Properties.present(note, ['Dark Mode']);
+ } else {
+ ToastEvent.show({
+ heading: 'Start writing to create a new note',
+ type: 'success',
+ context: 'global'
+ });
}
};
@@ -222,103 +220,100 @@ export const useEditorEvents = (
};
}, []);
- const onMessage = useCallback(
- (event: WebViewMessageEvent) => {
- const data = event.nativeEvent.data;
- let editorMessage = JSON.parse(data) as EditorMessage;
+ const onMessage = (event: WebViewMessageEvent) => {
+ const data = event.nativeEvent.data;
+ let editorMessage = JSON.parse(data) as EditorMessage;
- logger.info('editor', editorMessage.type);
- if (
- editorMessage.sessionId !== editor.sessionId &&
- editorMessage.type !== EditorEvents.status
- ) {
- logger.error(
- 'editor',
- 'invalid session',
- editorMessage.type,
- editor.sessionId,
- editorMessage.sessionId
- );
+ logger.info('editor', editorMessage.type);
+ if (
+ editorMessage.sessionId !== editor.sessionId &&
+ editorMessage.type !== EditorEvents.status
+ ) {
+ logger.error(
+ 'editor',
+ 'invalid session',
+ editorMessage.type,
+ editor.sessionId,
+ editorMessage.sessionId
+ );
- return;
- }
- switch (editorMessage.type) {
- case EventTypes.logger:
- logger.info('[WEBVIEW LOG]', editorMessage.value);
- break;
- case EventTypes.content:
- editor.saveContent({
- type: editorMessage.type,
- content: editorMessage.value
- });
- break;
- case EventTypes.selection:
- break;
- case EventTypes.title:
- editor.saveContent({
- type: editorMessage.type,
- title: editorMessage.value
- });
- break;
- case EventTypes.newtag:
+ return;
+ }
+ switch (editorMessage.type) {
+ case EventTypes.logger:
+ logger.info('[WEBVIEW LOG]', editorMessage.value);
+ break;
+ case EventTypes.content:
+ editor.saveContent({
+ type: editorMessage.type,
+ content: editorMessage.value
+ });
+ break;
+ case EventTypes.selection:
+ break;
+ case EventTypes.title:
+ editor.saveContent({
+ type: editorMessage.type,
+ title: editorMessage.value
+ });
+ break;
+ case EventTypes.newtag:
+ if (!editor.note.current) return;
+ eSendEvent(eOpenTagsDialog, editor.note.current);
+ break;
+ case EventTypes.tag:
+ if (editorMessage.value) {
if (!editor.note.current) return;
- eSendEvent(eOpenTagsDialog, editor.note.current);
- break;
- case EventTypes.tag:
- if (editorMessage.value) {
- if (!editor.note.current) return;
- db.notes
- //@ts-ignore
- ?.note(editor.note.current?.id)
- .untag(editorMessage.value)
- .then(async () => {
- useTagStore.getState().setTags();
- await editor.commands.setTags(editor.note.current);
- Navigation.queueRoutesForUpdate(
- 'ColoredNotes',
- 'Notes',
- 'TaggedNotes',
- 'TopicNotes',
- 'Tags'
- );
- });
- }
- break;
- case EventTypes.filepicker:
- picker.pick({ type: editorMessage.value });
- break;
- case EventTypes.download:
- console.log('download attachment request', editorMessage.value);
- filesystem.downloadAttachment(editorMessage.value?.hash, true);
- break;
- case EventTypes.pro:
- if (editor.state.current?.isFocused) {
- editor.state.current.isFocused = true;
- }
- umami.pageView('/pro-screen', '/editor');
- eSendEvent(eOpenPremiumDialog);
- break;
- case EventTypes.monograph:
- publishNote(editor);
- break;
- case EventTypes.properties:
- showActionsheet(editor);
- break;
- case EventTypes.back:
- onBackPress();
- break;
- default:
- console.log(
- 'unhandled event recieved from editor: ',
- editorMessage.type,
- editorMessage.value
- );
- break;
- }
- eSendEvent(editorMessage.type, editorMessage);
- },
- [editor.sessionId, editor.saveContent]
- );
+ db.notes
+ //@ts-ignore
+ ?.note(editor.note.current?.id)
+ .untag(editorMessage.value)
+ .then(async () => {
+ useTagStore.getState().setTags();
+ await editor.commands.setTags(editor.note.current);
+ Navigation.queueRoutesForUpdate(
+ 'ColoredNotes',
+ 'Notes',
+ 'TaggedNotes',
+ 'TopicNotes',
+ 'Tags'
+ );
+ });
+ }
+ break;
+ case EventTypes.filepicker:
+ picker.pick({ type: editorMessage.value });
+ break;
+ case EventTypes.download:
+ console.log('download attachment request', editorMessage.value);
+ filesystem.downloadAttachment(editorMessage.value?.hash, true);
+ break;
+ case EventTypes.pro:
+ if (editor.state.current?.isFocused) {
+ editor.state.current.isFocused = true;
+ }
+ umami.pageView('/pro-screen', '/editor');
+ eSendEvent(eOpenPremiumDialog);
+ break;
+ case EventTypes.monograph:
+ publishNote(editor);
+ break;
+ case EventTypes.properties:
+ showActionsheet(editor);
+ break;
+ case EventTypes.back:
+ onBackPress();
+ break;
+ default:
+ console.log(
+ 'unhandled event recieved from editor: ',
+ editorMessage.type,
+ editorMessage.value
+ );
+ break;
+ }
+ eSendEvent(editorMessage.type, editorMessage);
+ };
return onMessage;
};
diff --git a/apps/mobile/src/screens/editor/wrapper.js b/apps/mobile/src/screens/editor/wrapper.js
index 49cb26d86..0fc69fbff 100644
--- a/apps/mobile/src/screens/editor/wrapper.js
+++ b/apps/mobile/src/screens/editor/wrapper.js
@@ -26,6 +26,7 @@ export const EditorWrapper = ({ width }) => {
const loading = useNoteStore(state => state.loading);
const insets = useSafeAreaInsets();
const floating = useIsFloatingKeyboard();
+ const introCompleted = useSettingStore(state => state.settings.introCompleted);
const onAppStateChanged = async state => {
if (editorState().movedAway) return;
@@ -54,7 +55,7 @@ export const EditorWrapper = ({ width }) => {
borderLeftColor: DDS.isTab ? colors.nav : 'transparent'
}}
>
- {loading ? null : (
+ {loading || !introCompleted ? null : (
<SafeAreaView
style={{
flex: 1
diff --git a/apps/mobile/src/screens/settings/appearance.js b/apps/mobile/src/screens/settings/appearance.js
index b6fe736e7..de6184727 100644
--- a/apps/mobile/src/screens/settings/appearance.js
+++ b/apps/mobile/src/screens/settings/appearance.js
@@ -103,8 +103,7 @@ export const AccentColorPicker = ({ settings = true, wrap = true }) => {
flexDirection: 'row',
flexWrap: 'wrap',
alignItems: 'center',
- justifyContent: 'center',
- alignContent: 'flex-start'
+ width: '100%'
}}
>
{[
diff --git a/apps/mobile/src/screens/settings/applock.js b/apps/mobile/src/screens/settings/applock.js
index 52be2ff27..bced1ae50 100644
--- a/apps/mobile/src/screens/settings/applock.js
+++ b/apps/mobile/src/screens/settings/applock.js
@@ -1,27 +1,29 @@
import React, { useState } from 'react';
-import { LayoutAnimation, Platform, View } from 'react-native';
+import { Dimensions, LayoutAnimation, Platform, View } from 'react-native';
+import Animated, { FadeInDown, FadeOutUp } from 'react-native-reanimated';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
-import BiometricService from '../../services/biometrics';
+import { SVG_Z } from '../../components/intro';
+import { WelcomeNotice } from '../../components/intro/welcome';
+import { Button } from '../../components/ui/button';
import { PressableButton } from '../../components/ui/pressable';
import Seperator from '../../components/ui/seperator';
+import { SvgView } from '../../components/ui/svg';
+import { BouncingView } from '../../components/ui/transitions/bouncing-view';
import Heading from '../../components/ui/typography/heading';
import Paragraph from '../../components/ui/typography/paragraph';
-import { useThemeStore } from '../../stores/use-theme-store';
-import { useSettingStore } from '../../stores/use-setting-store';
import { presentSheet } from '../../services/event-manager';
import SettingsService from '../../services/settings';
-import { SIZE } from '../../utils/size';
-import { db } from '../../utils/database';
-import { WelcomeNotice } from '../../components/intro/welcome';
-import { Button } from '../../components/ui/button';
+import { useSettingStore } from '../../stores/use-setting-store';
+import { useThemeStore } from '../../stores/use-theme-store';
import { getElevation } from '../../utils';
import umami from '../../utils/analytics';
+import { SIZE } from '../../utils/size';
-const AppLock = ({ welcome, s = 0 }) => {
+const AppLock = ({ navigation, route }) => {
const colors = useThemeStore(state => state.colors);
const appLockMode = useSettingStore(state => state.settings.appLockMode);
-
- const [step, setStep] = useState(s);
+ const [step, setStep] = useState(0);
+ const welcome = route?.params?.welcome;
const modes = [
{
@@ -50,117 +52,155 @@ const AppLock = ({ welcome, s = 0 }) => {
return (
<>
- {step === 0 ? (
- <>
- <View
- style={{
- flexDirection: 'row',
- alignItems: 'flex-end',
- justifyContent: 'space-between',
- width: '95%',
- paddingVertical: 12,
- paddingHorizontal: 0,
- alignSelf: 'center',
- minHeight: 125,
- borderBottomWidth: 1,
- borderBottomColor: colors.nav
- }}
- >
- <Icon
- name="shield-lock"
- color={colors.border}
- size={100}
+ <Animated.View
+ exiting={!welcome ? undefined : FadeOutUp}
+ entering={!welcome ? undefined : FadeInDown}
+ style={{
+ justifyContent: !welcome ? undefined : 'center',
+ height: !welcome ? undefined : '100%',
+ width: !welcome ? undefined : '100%'
+ }}
+ >
+ {step === 0 ? (
+ <>
+ <View
style={{
- position: 'absolute',
- right: 0,
- top: 6
+ flexDirection: 'row',
+ alignItems: 'flex-end',
+ justifyContent: 'space-between',
+ width: '95%',
+ paddingVertical: 12,
+ paddingHorizontal: 0,
+ alignSelf: 'center',
+ minHeight: 125,
+ borderBottomWidth: 1,
+ borderBottomColor: welcome ? 'transparent' : colors.nav
}}
- />
-
- <View>
- <Heading>Protect your notes</Heading>
- <Paragraph size={SIZE.md}>
- Choose how you want to secure your notes locally.
- </Paragraph>
- </View>
- </View>
- <Seperator />
- <View
- style={{
- paddingHorizontal: 12
- }}
- >
- {modes.map(item => (
- <PressableButton
- key={item.title}
- type={appLockMode === item.value ? 'grayBg' : 'transparent'}
- onPress={() => {
- SettingsService.set({ appLockMode: item.value });
- }}
- customStyle={{
- justifyContent: 'flex-start',
- alignItems: 'flex-start',
- paddingHorizontal: 12,
- paddingVertical: 12,
- marginTop: 0,
- marginBottom: 12,
- borderWidth: 1,
- borderColor: appLockMode === item.value ? item.activeColor : colors.nav
+ >
+ <Icon
+ name="shield-lock"
+ color={colors.border}
+ size={100}
+ style={{
+ position: 'absolute',
+ right: 0,
+ top: 6
}}
+ />
+
+ <View
style={{
- marginBottom: 10
+ alignItems: !welcome ? undefined : 'center',
+ width: '100%'
}}
>
- <Heading
- color={appLockMode === item.value ? item.activeColor : colors.pri}
- style={{ maxWidth: '95%' }}
- size={SIZE.md}
- >
- {item.title}
- </Heading>
+ <Heading>Protect your notes</Heading>
<Paragraph
- color={appLockMode === item.value ? item.activeColor : colors.icon}
- style={{ maxWidth: '95%' }}
- size={SIZE.sm}
+ style={{
+ textAlign: !welcome ? undefined : 'center'
+ }}
+ size={SIZE.md}
>
- {item.desc}
+ Choose how you want to secure your notes locally.
</Paragraph>
- </PressableButton>
- ))}
+ </View>
+ </View>
+ <Seperator />
+ <View
+ style={{
+ paddingHorizontal: 12
+ }}
+ >
+ {modes.map(item => (
+ <PressableButton
+ key={item.title}
+ type={appLockMode === item.value ? 'grayBg' : 'transparent'}
+ onPress={() => {
+ SettingsService.set({ appLockMode: item.value });
+ }}
+ customStyle={{
+ justifyContent: 'flex-start',
+ alignItems: 'flex-start',
+ paddingHorizontal: 12,
+ paddingVertical: 12,
+ marginTop: 0,
+ marginBottom: 12,
+ borderWidth: 1,
+ borderColor: appLockMode === item.value ? item.activeColor : colors.nav
+ }}
+ style={{
+ marginBottom: 10
+ }}
+ >
+ <Heading
+ color={appLockMode === item.value ? item.activeColor : colors.pri}
+ style={{ maxWidth: '95%' }}
+ size={SIZE.md}
+ >
+ {item.title}
+ </Heading>
+ <Paragraph
+ color={appLockMode === item.value ? item.activeColor : colors.icon}
+ style={{ maxWidth: '95%' }}
+ size={SIZE.sm}
+ >
+ {item.desc}
+ </Paragraph>
+ </PressableButton>
+ ))}
- {welcome && (
- <Button
- fontSize={SIZE.md}
- height={45}
- width={250}
- onPress={async () => {
- LayoutAnimation.configureNext({
- ...LayoutAnimation.Presets.linear,
- delete: {
- duration: 50,
- property: 'opacity',
- type: 'linear'
- }
- });
- umami.pageView('/privacymode', '/welcome');
- setStep(1);
- }}
- style={{
- paddingHorizontal: 24,
- alignSelf: 'center',
- borderRadius: 100,
- ...getElevation(5),
- marginTop: 30
- }}
- type="accent"
- title="Next"
- />
- )}
- </View>
- </>
- ) : (
- <WelcomeNotice />
- )}
+ {welcome && (
+ <Button
+ fontSize={SIZE.md}
+ height={45}
+ width={250}
+ onPress={async () => {
+ LayoutAnimation.configureNext({
+ ...LayoutAnimation.Presets.linear,
+ delete: {
+ duration: 50,
+ property: 'opacity',
+ type: 'linear'
+ }
+ });
+ umami.pageView('/privacymode', '/welcome');
+ setStep(1);
+ }}
+ style={{
+ paddingHorizontal: 24,
+ alignSelf: 'center',
+ borderRadius: 100,
+ ...getElevation(5),
+ marginTop: 30
+ }}
+ type="accent"
+ title="Next"
+ />
+ )}
+ </View>
+ </>
+ ) : (
+ <WelcomeNotice />
+ )}
+
+ {welcome ? (
+ <BouncingView
+ style={{
+ position: 'absolute',
+ bottom: -130,
+ zIndex: -1
+ }}
+ animated={false}
+ duration={3000}
+ >
+ <SvgView
+ width={Dimensions.get('window').width}
+ height={Dimensions.get('window').width}
+ src={SVG_Z}
+ />
+ </BouncingView>
+ ) : null}
+ </Animated.View>
</>
);
};
diff --git a/apps/mobile/src/screens/settings/sectionitem.tsx b/apps/mobile/src/screens/settings/sectionitem.tsx
index 80e2f597f..dd059fdcc 100644
--- a/apps/mobile/src/screens/settings/sectionitem.tsx
+++ b/apps/mobile/src/screens/settings/sectionitem.tsx
@@ -133,6 +133,7 @@ export const SectionItem = React.memo(
{item.type === 'switch' && item.property && (
<ToggleSwitch
+ //@ts-ignore
isOn={item.getter ? item.getter(item.property || current) : settings[item.property]}
onColor={colors.accent}
offColor={colors.icon}
diff --git a/apps/mobile/src/screens/settings/settingsdata.tsx b/apps/mobile/src/screens/settings/settingsdata.tsx
index 0fad16b1c..0d9ca8988 100644
--- a/apps/mobile/src/screens/settings/settingsdata.tsx
+++ b/apps/mobile/src/screens/settings/settingsdata.tsx
@@ -43,6 +43,7 @@ import { verifyUser } from './functions';
import { SettingSection } from './types';
import { getTimeLeft } from './user-section';
import { ConfigureToolbar } from './editor/configure-toolbar';
+import { AuthMode } from '../../components/auth';
const format = (ver: number) => {
let parts = ver.toString().split('');
return `v${parts[0]}.${parts[1]}.${parts[2]?.startsWith('0') ? '' : parts[2]}${
diff --git a/apps/mobile/src/services/navigation.ts b/apps/mobile/src/services/navigation.ts
index bc5ffed4a..7b108da77 100755
--- a/apps/mobile/src/services/navigation.ts
+++ b/apps/mobile/src/services/navigation.ts
@@ -1,4 +1,3 @@
-import { BottomTabScreenProps } from '@react-navigation/bottom-tabs';
import { StackActions } from '@react-navigation/native';
import { NativeStackScreenProps } from '@react-navigation/native-stack';
import { useFavoriteStore } from '../stores/use-favorite-store';
@@ -7,7 +6,7 @@ import { useNotebookStore } from '../stores/use-notebook-store';
import { useNoteStore } from '../stores/use-notes-store';
import { useTagStore } from '../stores/use-tag-store';
import { useTrashStore } from '../stores/use-trash-store';
-import { eOnNewTopicAdded, refreshNotesPage } from '../utils/events';
+import { eOnNewTopicAdded } from '../utils/events';
import { rootNavigatorRef, tabBarRef } from '../utils/global-refs';
import { ColorType, NotebookType, TagType, TopicType } from '../utils/types';
import { eSendEvent } from './event-manager';
@@ -31,7 +30,13 @@ const routeNames = {
TaggedNotes: 'TaggedNotes',
ColoredNotes: 'ColoredNotes',
TopicNotes: 'TopicNotes',
- Monographs: 'Monographs'
+ Monographs: 'Monographs',
+ Auth: 'Auth',
+ Intro: 'Intro',
+ Welcome: 'Welcome',
+ AppLock: 'AppLock',
+ Login: 'Login',
+ Signup: 'Signup'
};
type GenericRouteParam = { [name: string]: never };
@@ -48,6 +53,14 @@ export type NotesScreenParams = {
canGoBack: boolean;
};
+export type AppLockRouteParams = {
+ welcome: boolean;
+};
+
+export type AuthParams = {
+ mode: number;
+};
+
export type RouteParams = {
Notes: GenericRouteParam;
Notebooks: GenericRouteParam;
@@ -62,6 +75,8 @@ export type RouteParams = {
ColoredNotes: NotesScreenParams;
TopicNotes: NotesScreenParams;
Monographs: NotesScreenParams;
+ AppLock: AppLockRouteParams;
+ Auth: AuthParams;
};
export type NavigationProps<T extends RouteName> = NativeStackScreenProps<RouteParams, T>;
@@ -144,10 +159,10 @@ function push(screen: CurrentScreen, params: { [name: string]: any }) {
rootNavigatorRef.current?.dispatch(StackActions.push(name, params));
}
-function replace(screen: CurrentScreen, params: { [name: string]: any }) {
- useNavigationStore.getState().update(screen, !params.menu);
+function replace<T extends RouteName>(screen: CurrentScreen, params: RouteParams[T]) {
+ useNavigationStore.getState().update(screen, params?.canGoBack);
//@ts-ignore
- rootNavigatorRef.current?.dispatch(StackActions.replace(name, params));
+ rootNavigatorRef.current?.dispatch(StackActions.replace(screen.name, params));
}
function popToTop() {
diff --git a/apps/mobile/src/utils/hooks/useActions.js b/apps/mobile/src/utils/hooks/useActions.js
index cc948c2dd..f5d813095 100644
--- a/apps/mobile/src/utils/hooks/useActions.js
+++ b/apps/mobile/src/utils/hooks/useActions.js
@@ -4,6 +4,7 @@ import { Platform } from 'react-native';
import Share from 'react-native-share';
import { editing, toTXT } from '..';
import { notesnook } from '../../../e2e/test.ids';
+import { AuthMode } from '../../components/auth';
import { presentDialog } from '../../components/dialog/functions';
import NoteHistory from '../../components/note-history';
import { MoveNotes } from '../../components/sheets/move-notes/movenote';
@@ -232,7 +233,15 @@ export const useActions = ({ close = () => {}, item }) => {
message: 'Login to publish note',
context: 'local',
func: () => {
- eSendEvent(eOpenLoginDialog);
+ Navigation.navigate(
+ {
+ name: 'Login'
+ },
+ {
+ mode: AuthMode.login,
+ canGoBack: true
+ }
+ );
},
actionText: 'Login'
});