Skip to content

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

mobile: minor refactor

Ammar Ahmedf1a0c1b447c4
diff --git a/apps/mobile/app/components/paywall/index.tsx b/apps/mobile/app/components/paywall/index.tsx
index 83617eb28..28be8e6b6 100644
--- a/apps/mobile/app/components/paywall/index.tsx
+++ b/apps/mobile/app/components/paywall/index.tsx
@@ -56,7 +56,10 @@ import {
XDA_SVG
} from "../../assets/images/assets";
import { useNavigationFocus } from "../../hooks/use-navigation-focus";
-import usePricingPlans, { PricingPlan } from "../../hooks/use-pricing-plans";
+import usePricingPlans, {
+ PlanOverView,
+ PricingPlan
+} from "../../hooks/use-pricing-plans";
import Navigation, { NavigationProps } from "../../services/navigation";
import { getElevationStyle } from "../../utils/elevation";
import { openLinkInBrowser } from "../../utils/functions";
@@ -80,29 +83,6 @@ const Steps = {
buyWeb: 4
};
-const PlanOverView = {
- free: {
- storage: `50 MB/mo`,
- fileSize: `1 MB`,
- hdImages: false
- },
- essential: {
- storage: `1 GB`,
- fileSize: `100 MB/mo`,
- hdImages: false
- },
- pro: {
- storage: `10 GB/mo`,
- fileSize: `1 GB`,
- hdImages: true
- },
- believer: {
- storage: `25 GB/mo`,
- fileSize: `5 GB`,
- hdImages: true
- }
-};
-
const PayWall = (props: NavigationProps<"PayWall">) => {
const isGithubRelease = Config.GITHUB_RELEASE === "true";
const routeParams = props.route.params;
diff --git a/apps/mobile/app/components/sheets/paywall/index.tsx b/apps/mobile/app/components/sheets/paywall/index.tsx
index ac001dedc..f6fc00ae9 100644
--- a/apps/mobile/app/components/sheets/paywall/index.tsx
+++ b/apps/mobile/app/components/sheets/paywall/index.tsx
@@ -4,7 +4,9 @@ import { useThemeColors } from "@notesnook/theme";
import { useEffect } from "react";
import { View } from "react-native";
import Config from "react-native-config";
-import usePricingPlans from "../../../hooks/use-pricing-plans";
+import usePricingPlans, {
+ PlanOverView
+} from "../../../hooks/use-pricing-plans";
import {
eSendEvent,
presentSheet,
@@ -56,8 +58,7 @@ export default function PaywallSheet<Tid extends FeatureId>(props: {
width: "100%",
justifyContent: "center",
alignItems: "center",
- gap: DefaultAppStyles.GAP_VERTICAL,
- paddingBottom: DefaultAppStyles.GAP
+ gap: DefaultAppStyles.GAP_VERTICAL
}}
>
<>
@@ -101,27 +102,35 @@ export default function PaywallSheet<Tid extends FeatureId>(props: {
flexShrink: 1
}}
>
- <Heading size={AppFontSize.sm}>25 GB</Heading>{" "}
+ <Heading size={AppFontSize.sm}>
+ {
+ PlanOverView[
+ pricingPlans.currentPlan.id as keyof typeof PlanOverView
+ ].storage
+ }
+ </Heading>{" "}
{strings.cloudSpace()}
</Paragraph>
</View>
- <View
- style={{
- gap: DefaultAppStyles.GAP_SMALL,
- flexDirection: "row"
- }}
- >
- <AppIcon name="lock" size={AppFontSize.xxl} />
- <Paragraph
+ {pricingPlans.currentPlan.id !== "essential" ? (
+ <View
style={{
- flexShrink: 1
+ gap: DefaultAppStyles.GAP_SMALL,
+ flexDirection: "row"
}}
>
- <Heading size={AppFontSize.sm}>{strings.appLock()}</Heading>{" "}
- {strings.appLockFeatureBenefit()}
- </Paragraph>
- </View>
+ <AppIcon name="lock" size={AppFontSize.xxl} />
+ <Paragraph
+ style={{
+ flexShrink: 1
+ }}
+ >
+ <Heading size={AppFontSize.sm}>{strings.appLock()}</Heading>{" "}
+ {strings.appLockFeatureBenefit()}
+ </Paragraph>
+ </View>
+ ) : null}
<View
style={{
diff --git a/apps/mobile/app/hooks/use-pricing-plans.ts b/apps/mobile/app/hooks/use-pricing-plans.ts
index 9d1ee82cf..6b169932a 100644
--- a/apps/mobile/app/hooks/use-pricing-plans.ts
+++ b/apps/mobile/app/hooks/use-pricing-plans.ts
@@ -31,6 +31,29 @@ function numberWithCommas(x: string) {
return parts.join(".");
}
+export const PlanOverView = {
+ free: {
+ storage: `50 MB/mo`,
+ fileSize: `1 MB`,
+ hdImages: false
+ },
+ essential: {
+ storage: `1 GB`,
+ fileSize: `100 MB/mo`,
+ hdImages: false
+ },
+ pro: {
+ storage: `10 GB/mo`,
+ fileSize: `1 GB`,
+ hdImages: true
+ },
+ believer: {
+ storage: `25 GB/mo`,
+ fileSize: `5 GB`,
+ hdImages: true
+ }
+};
+
export type PricingPlan = {
id: string;
name: string;