Skip to content

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

mobile: fix login flow

Ammar Ahmed699080048de3
diff --git a/apps/mobile/app/components/auth/common.js b/apps/mobile/app/components/auth/common.js
index 113e6daac..88e62ff3d 100644
--- a/apps/mobile/app/components/auth/common.js
+++ b/apps/mobile/app/components/auth/common.js
@@ -25,7 +25,8 @@ export const AuthMode = {
login: 0,
signup: 1,
welcomeSignup: 2,
- trialSignup: 3
+ welcomeLogin: 3,
+ trialSignup: 4
};
export const initialAuthMode = createRef(0);
@@ -33,6 +34,7 @@ export function hideAuth(context) {
eSendEvent(eCloseLoginDialog);
if (
initialAuthMode.current === AuthMode.welcomeSignup ||
+ initialAuthMode.current === AuthMode.welcomeLogin ||
context === "intro"
) {
Navigation.replace("FluidPanelsView");
diff --git a/apps/mobile/app/components/auth/index.js b/apps/mobile/app/components/auth/index.js
index 1996212f7..f8715a814 100644
--- a/apps/mobile/app/components/auth/index.js
+++ b/apps/mobile/app/components/auth/index.js
@@ -38,7 +38,8 @@ const Auth = ({ navigation, route }) => {
<SafeAreaView
style={{ flex: 1, backgroundColor: colors.primary.background }}
>
- {currentAuthMode !== AuthMode.login ? (
+ {currentAuthMode !== AuthMode.login &&
+ currentAuthMode !== AuthMode.welcomeLogin ? (
<Signup
changeMode={(mode) => setCurrentAuthMode(mode)}
trial={AuthMode.trialSignup === currentAuthMode}
diff --git a/apps/mobile/app/components/auth/login.js b/apps/mobile/app/components/auth/login.js
index 47f88086f..1f7f8c775 100644
--- a/apps/mobile/app/components/auth/login.js
+++ b/apps/mobile/app/components/auth/login.js
@@ -74,6 +74,7 @@ export const Login = ({ changeMode }) => {
Sync.run("global", false, "full");
}
}, 5000);
+
if (!PremiumService.get()) {
Navigation.navigate("PayWall", {
context: "logged-in",
@@ -275,7 +276,7 @@ export const Login = ({ changeMode }) => {
setStep(LoginSteps.emailAuth);
setLoading(false);
}}
- fontSize={AppFontSize.xs}
+ fontSize={AppFontSize.md}
type="secondaryAccented"
/>
)}
diff --git a/apps/mobile/app/components/intro/index.tsx b/apps/mobile/app/components/intro/index.tsx
index ef23baf5d..c13715202 100644
--- a/apps/mobile/app/components/intro/index.tsx
+++ b/apps/mobile/app/components/intro/index.tsx
@@ -205,7 +205,7 @@ const Intro = () => {
introCompleted: true
});
Navigation.push("Auth", {
- mode: AuthMode.login,
+ mode: AuthMode.welcomeLogin,
context: "intro"
});
}}
diff --git a/apps/mobile/app/services/premium.js b/apps/mobile/app/services/premium.js
index 3b1d81a27..b4a568bd6 100644
--- a/apps/mobile/app/services/premium.js
+++ b/apps/mobile/app/services/premium.js
@@ -17,7 +17,7 @@ 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 { CHECK_IDS } from "@notesnook/core";
+import { CHECK_IDS, SubscriptionPlan } from "@notesnook/core";
import { Platform } from "react-native";
import Config from "react-native-config";
import * as RNIap from "react-native-iap";
@@ -119,9 +119,12 @@ async function loadProductsAndSubs() {
}
function get() {
- if (__DEV__ || Config.isTesting === "true") return true;
+ // if (__DEV__ || Config.isTesting === "true") return true;
- return SUBSCRIPTION_STATUS.BASIC !== premiumStatus;
+ return (
+ useUserStore.getState().user?.subscription?.plan !== undefined &&
+ useUserStore.getState().user?.subscription?.plan !== SubscriptionPlan.FREE
+ );
}
async function verify(callback, error) {