Skip to content

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

mobile: fix intro flow

Ammar Ahmed4df9c7d9f770
diff --git a/apps/mobile/app/components/auth/common.js b/apps/mobile/app/components/auth/common.js
index 10bdbab1d..113e6daac 100644
--- a/apps/mobile/app/components/auth/common.js
+++ b/apps/mobile/app/components/auth/common.js
@@ -29,9 +29,12 @@ export const AuthMode = {
};
export const initialAuthMode = createRef(0);
-export function hideAuth() {
+export function hideAuth(context) {
eSendEvent(eCloseLoginDialog);
- if (initialAuthMode.current === AuthMode.welcomeSignup) {
+ if (
+ initialAuthMode.current === AuthMode.welcomeSignup ||
+ context === "intro"
+ ) {
Navigation.replace("FluidPanelsView");
setTimeout(() => {
Navigation.resetRootState();
diff --git a/apps/mobile/app/components/auth/header.tsx b/apps/mobile/app/components/auth/header.tsx
index 05187004d..a30f11bce 100644
--- a/apps/mobile/app/components/auth/header.tsx
+++ b/apps/mobile/app/components/auth/header.tsx
@@ -17,16 +17,18 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { useThemeColors } from "@notesnook/theme";
+import { useRoute } from "@react-navigation/native";
import React from "react";
import { Platform, View } from "react-native";
import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
import { Button } from "../ui/button";
import { IconButton } from "../ui/icon-button";
import { hideAuth } from "./common";
-
export const AuthHeader = (props: { welcome?: boolean }) => {
const { colors } = useThemeColors();
const insets = useGlobalSafeAreaInsets();
+ const route = useRoute();
+
return (
<View
style={{
@@ -48,7 +50,7 @@ export const AuthHeader = (props: { welcome?: boolean }) => {
<IconButton
name="arrow-left"
onPress={() => {
- hideAuth();
+ hideAuth((route.params as any)?.context);
}}
color={colors.primary.paragraph}
/>
diff --git a/apps/mobile/app/components/intro/index.tsx b/apps/mobile/app/components/intro/index.tsx
index a2712c78d..213059351 100644
--- a/apps/mobile/app/components/intro/index.tsx
+++ b/apps/mobile/app/components/intro/index.tsx
@@ -20,11 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { strings } from "@notesnook/intl";
import { useThemeColors } from "@notesnook/theme";
import React from "react";
-import { Linking, ScrollView, useWindowDimensions, View } from "react-native";
+import { Linking, useWindowDimensions, View } from "react-native";
import { SwiperFlatList } from "react-native-swiper-flatlist";
import useGlobalSafeAreaInsets from "../../hooks/use-global-safe-area-insets";
import Navigation from "../../services/navigation";
-import SettingsService from "../../services/settings";
import { AppFontSize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles";
import { AuthMode } from "../auth/common";
@@ -34,7 +33,7 @@ import Paragraph from "../ui/typography/paragraph";
const Intro = () => {
const { colors } = useThemeColors();
- const { width, height } = useWindowDimensions();
+ const { width } = useWindowDimensions();
const insets = useGlobalSafeAreaInsets();
const isTablet = width > 600;
@@ -205,7 +204,8 @@ const Intro = () => {
// introCompleted: true
// });
Navigation.push("Auth", {
- mode: AuthMode.login
+ mode: AuthMode.login,
+ context: "intro"
});
}}
/>
diff --git a/apps/mobile/app/stores/use-navigation-store.ts b/apps/mobile/app/stores/use-navigation-store.ts
index 0d18c714e..6e9fd618f 100644
--- a/apps/mobile/app/stores/use-navigation-store.ts
+++ b/apps/mobile/app/stores/use-navigation-store.ts
@@ -54,6 +54,7 @@ export type AppLockRouteParams = {
export type AuthParams = {
mode: number;
+ context?: "intro";
};
export interface RouteParams extends ParamListBase {