Skip to content

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

mobile: pricing changes

Ammar Ahmed06710ff41602
diff --git a/apps/mobile/app/components/premium/paywall.tsx b/apps/mobile/app/components/premium/paywall.tsx
index 47b9d9c76..42432e667 100644
--- a/apps/mobile/app/components/premium/paywall.tsx
+++ b/apps/mobile/app/components/premium/paywall.tsx
@@ -29,11 +29,11 @@ import {
TouchableOpacity,
View
} from "react-native";
-import { WebView } from "react-native-webview";
import Config from "react-native-config";
import * as RNIap from "react-native-iap";
import { SafeAreaView } from "react-native-safe-area-context";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
+import { WebView } from "react-native-webview";
import ToggleSwitch from "toggle-switch-react-native";
import { useNavigationFocus } from "../../hooks/use-navigation-focus";
import usePricingPlans, { PricingPlan } from "../../hooks/use-pricing-plans";
@@ -50,7 +50,6 @@ import { Button } from "../ui/button";
import Heading from "../ui/typography/heading";
import Paragraph from "../ui/typography/paragraph";
import { FeaturesList } from "./features-list";
-import { db } from "../../common/database";
const Steps = {
select: 1,
@@ -59,6 +58,29 @@ const Steps = {
buyWeb: 4
};
+const PlanOverView = {
+ free: {
+ storage: `100 MB`,
+ fileSize: `1 MB`,
+ hdImages: false
+ },
+ essential: {
+ storage: `1 GB`,
+ fileSize: `25 MB`,
+ hdImages: false
+ },
+ pro: {
+ storage: `10 GB`,
+ fileSize: `25 MB`,
+ hdImages: true
+ },
+ believer: {
+ storage: `50 GB`,
+ fileSize: `25 MB`,
+ hdImages: true
+ }
+};
+
const PayWall = (props: NavigationProps<"PayWall">) => {
const isGithubRelease = Config.GITHUB_RELEASE === "true";
const routeParams = props.route.params;
@@ -71,6 +93,7 @@ const PayWall = (props: NavigationProps<"PayWall">) => {
const [annualBilling, setAnnualBilling] = useState(
routeParams.state ? routeParams.state.billingType === "annual" : true
);
+ const [ctaButtonVisible, setCtaButtonVisible] = useState(false);
const [step, setStep] = useState(
routeParams.state
? isGithubRelease
@@ -139,6 +162,13 @@ const PayWall = (props: NavigationProps<"PayWall">) => {
}}
keyboardDismissMode="none"
keyboardShouldPersistTaps="always"
+ onScroll={(event) => {
+ if (event.nativeEvent.contentOffset.y > 1000) {
+ setCtaButtonVisible(true);
+ } else {
+ setCtaButtonVisible(false);
+ }
+ }}
>
<View
style={{
@@ -208,7 +238,10 @@ const PayWall = (props: NavigationProps<"PayWall">) => {
setAnnualBilling((state) => !state);
}}
/>
- <Paragraph>Yearly </Paragraph>
+ <Paragraph>
+ Yearly{" "}
+ <Paragraph color={colors.primary.accent}>(15% off)</Paragraph>
+ </Paragraph>
</TouchableOpacity>
{pricingPlans.pricingPlans.map((plan) => (
@@ -795,7 +828,7 @@ const PricingPlanCard = ({
gap: 6
}}
>
- {discountPercentage ? (
+ {/* {discountPercentage ? (
<View
style={{
backgroundColor: colors.static.red,
@@ -811,7 +844,7 @@ const PricingPlanCard = ({
{discountPercentage}% Off
</Heading>
</View>
- ) : null}
+ ) : null} */}
<View>
<Heading size={AppFontSize.md}>
@@ -828,6 +861,57 @@ const PricingPlanCard = ({
) : null}
</Heading>
<Paragraph>{plan.description}</Paragraph>
+
+ <View
+ style={{
+ gap: 5,
+ marginVertical: DefaultAppStyles.GAP_VERTICAL
+ }}
+ >
+ <View
+ style={{
+ flexDirection: "row",
+ width: "100%",
+ justifyContent: "space-between"
+ }}
+ >
+ <Paragraph size={AppFontSize.xs}>Storage</Paragraph>
+
+ <Paragraph size={AppFontSize.xs}>
+ {PlanOverView[plan.id as keyof typeof PlanOverView].storage}
+ </Paragraph>
+ </View>
+
+ <View
+ style={{
+ flexDirection: "row",
+ width: "100%",
+ justifyContent: "space-between"
+ }}
+ >
+ <Paragraph size={AppFontSize.xs}>File size</Paragraph>
+
+ <Paragraph size={AppFontSize.xs}>
+ {PlanOverView[plan.id as keyof typeof PlanOverView].fileSize}
+ </Paragraph>
+ </View>
+
+ <View
+ style={{
+ flexDirection: "row",
+ width: "100%",
+ justifyContent: "space-between"
+ }}
+ >
+ <Paragraph size={AppFontSize.xs}>HD images</Paragraph>
+
+ <Paragraph size={AppFontSize.xs}>
+ {PlanOverView[plan.id as keyof typeof PlanOverView].hdImages
+ ? "Yes"
+ : "No"}
+ </Paragraph>
+ </View>
+ </View>
</View>
{pricingPlans?.loading ? (
diff --git a/apps/mobile/app/components/properties/color-tags.tsx b/apps/mobile/app/components/properties/color-tags.tsx
index fe5e8bef6..c570c97d4 100644
--- a/apps/mobile/app/components/properties/color-tags.tsx
+++ b/apps/mobile/app/components/properties/color-tags.tsx
@@ -187,8 +187,7 @@ export const ColorTags = ({ item }: { item: Note }) => {
borderRadius: 100,
justifyContent: "center",
alignItems: "center",
- marginRight: 5,
- opacity: !colorFeature?.isAllowed ? 0.5 : 1
+ marginRight: 5
}}
type="secondary"
onPress={onPress}
diff --git a/apps/mobile/app/components/properties/items.tsx b/apps/mobile/app/components/properties/items.tsx
index b28871d59..dc5b7b4fe 100644
--- a/apps/mobile/app/components/properties/items.tsx
+++ b/apps/mobile/app/components/properties/items.tsx
@@ -27,11 +27,12 @@ import { Action, ActionId, useActions } from "../../hooks/use-actions";
import { useStoredRef } from "../../hooks/use-stored-ref";
import { DDS } from "../../services/device-detection";
import { useSettingStore } from "../../stores/use-setting-store";
-import { AppFontSize } from "../../utils/size";
+import { AppFontSize, defaultBorderRadius } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles";
import { Button } from "../ui/button";
import { Pressable } from "../ui/pressable";
import Paragraph from "../ui/typography/paragraph";
+import AppIcon from "../ui/AppIcon";
const TOP_BAR_ITEMS: ActionId[] = [
"pin",
@@ -247,7 +248,7 @@ export const Items = ({
testID={"icon-" + item.id}
style={{
width: columnItemWidth - 8,
- opacity: item.locked ? 0.5 : 1
+ alignSelf: "flex-start"
}}
>
<View
@@ -255,7 +256,11 @@ export const Items = ({
height: columnItemWidth / 2,
width: columnItemWidth - DefaultAppStyles.GAP_SMALL,
justifyContent: "center",
- alignItems: "center"
+ alignItems: "center",
+ borderWidth: 1,
+ borderRadius: defaultBorderRadius,
+ borderColor: colors.primary.border,
+ overflow: "hidden"
}}
>
<Icon
@@ -270,6 +275,28 @@ export const Items = ({
: colors.secondary.icon
}
/>
+
+ {item.locked ? (
+ <View
+ style={{
+ width: 20,
+ height: 20,
+ borderRadius: 100,
+ backgroundColor: colors.primary.accent,
+ justifyContent: "center",
+ alignItems: "center",
+ position: "absolute",
+ bottom: -3,
+ right: -3
+ }}
+ >
+ <AppIcon
+ color={colors.static.orange}
+ size={AppFontSize.xxxs}
+ name="crown"
+ />
+ </View>
+ ) : null}
</View>
<Paragraph
@@ -327,9 +354,14 @@ export const Items = ({
paginationStyle={{
position: "relative",
marginHorizontal: 2,
- marginBottom: 0,
- marginTop: DefaultAppStyles.GAP
+ marginBottom: 0
+ }}
+ contentContainerStyle={{
+ justifyContent: "flex-start",
+ alignItems: "flex-start",
+ alignSelf: "flex-start"
}}
+ centerContent={false}
renderItem={({ item, index }) => (
<View
style={{
diff --git a/apps/mobile/app/components/sheets/buy-plan/index.tsx b/apps/mobile/app/components/sheets/buy-plan/index.tsx
index cb5543801..e3f9ac21a 100644
--- a/apps/mobile/app/components/sheets/buy-plan/index.tsx
+++ b/apps/mobile/app/components/sheets/buy-plan/index.tsx
@@ -25,11 +25,11 @@ import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import useGlobalSafeAreaInsets from "../../../hooks/use-global-safe-area-insets";
import usePricingPlans from "../../../hooks/use-pricing-plans";
import { openLinkInBrowser } from "../../../utils/functions";
-import { AppFontSize } from "../../../utils/size";
+import { AppFontSize, defaultBorderRadius } from "../../../utils/size";
+import { DefaultAppStyles } from "../../../utils/styles";
import { Button } from "../../ui/button";
import Heading from "../../ui/typography/heading";
import Paragraph from "../../ui/typography/paragraph";
-import { DefaultAppStyles } from "../../../utils/styles";
export const BuyPlan = (props: {
planId: string;
@@ -64,49 +64,13 @@ export const BuyPlan = (props: {
}}
keyboardDismissMode="none"
keyboardShouldPersistTaps="always"
- stickyHeaderIndices={[0]}
>
<View
style={{
- paddingHorizontal: DefaultAppStyles.GAP
+ paddingHorizontal: DefaultAppStyles.GAP,
+ gap: DefaultAppStyles.GAP_VERTICAL
}}
>
- {props.canActivateTrial ? (
- <View
- style={{
- gap: 10,
- marginBottom: 10
- }}
- >
- {(is5YearPlanSelected
- ? [
- "One time purchase, no auto-renewal",
- "Pay once and use for 5 years"
- ]
- : [
- `Free ${billingDuration.duration} day trial, cancel any time`,
- "Google will remind you before your trial ends"
- ]
- ).map((item) => (
- <View
- style={{
- flexDirection: "row",
- alignItems: "center",
- gap: 10
- }}
- key={item}
- >
- <Icon
- color={colors.primary.accent}
- size={AppFontSize.lg}
- name="check"
- />
- <Paragraph>{item}</Paragraph>
- </View>
- ))}
- </View>
- ) : null}
-
{[
`notesnook.${props.planId}.yearly`,
`notesnook.${props.planId}.monthly`,
@@ -125,8 +89,10 @@ export const BuyPlan = (props: {
style={{
flexDirection: "row",
justifyContent: "space-between",
-
- marginTop: DefaultAppStyles.GAP_VERTICAL
+ borderWidth: 1,
+ borderColor: colors.primary.border,
+ padding: DefaultAppStyles.GAP,
+ borderRadius: defaultBorderRadius
}}
>
<Heading color={colors.primary.paragraph} size={AppFontSize.sm}>
@@ -144,7 +110,7 @@ export const BuyPlan = (props: {
<Paragraph color={colors.primary.paragraph}>
{pricingPlans.userCanRequestTrial
- ? "0.00"
+ ? "FREE"
: pricingPlans.getStandardPrice(
pricingPlans.selectedProduct as RNIap.Subscription
)}
@@ -155,7 +121,11 @@ export const BuyPlan = (props: {
<View
style={{
flexDirection: "row",
- justifyContent: "space-between"
+ justifyContent: "space-between",
+ borderWidth: 1,
+ borderColor: colors.primary.border,
+ padding: DefaultAppStyles.GAP,
+ borderRadius: defaultBorderRadius
}}
>
<Paragraph color={colors.secondary.paragraph}>
@@ -170,6 +140,45 @@ export const BuyPlan = (props: {
</View>
) : null}
+ {props.canActivateTrial ? (
+ <View
+ style={{
+ gap: DefaultAppStyles.GAP_VERTICAL,
+ borderWidth: 1,
+ borderColor: colors.primary.border,
+ padding: DefaultAppStyles.GAP,
+ borderRadius: defaultBorderRadius
+ }}
+ >
+ {(is5YearPlanSelected
+ ? [
+ "One time purchase, no auto-renewal",
+ "Pay once and use for 5 years"
+ ]
+ : [
+ `Free ${billingDuration.duration} day trial, cancel any time`,
+ "Google will remind you before your trial ends"
+ ]
+ ).map((item) => (
+ <View
+ style={{
+ flexDirection: "row",
+ alignItems: "center",
+ gap: 10
+ }}
+ key={item}
+ >
+ <Icon
+ color={colors.primary.accent}
+ size={AppFontSize.lg}
+ name="check"
+ />
+ <Paragraph>{item}</Paragraph>
+ </View>
+ ))}
+ </View>
+ ) : null}
+
<Button
width="100%"
type="accent"
@@ -181,10 +190,6 @@ export const BuyPlan = (props: {
? "Subscribe and start free trial"
: "Subscribe"
}
- style={{
- marginTop: DefaultAppStyles.GAP_VERTICAL,
- marginBottom: DefaultAppStyles.GAP_VERTICAL
- }}
onPress={() => {
const offerToken = pricingPlans.getOfferTokenAndroid(
pricingPlans.selectedProduct as RNIap.SubscriptionAndroid,
@@ -264,6 +269,7 @@ const ProductItem = (props: {
}}
activeOpacity={0.9}
onPress={() => {
+ if (!product) return;
props.pricingPlans.selectProduct(product?.productId);
}}
>
@@ -310,18 +316,21 @@ const ProductItem = (props: {
) : null}
</View>
- <Paragraph>
- {product?.productId.includes("5year")
- ? (product as RNIap.Product).localizedPrice
- : props.pricingPlans.getStandardPrice(
- product as RNIap.Subscription
- )}{" "}
+ <Paragraph size={AppFontSize.md}>
{isAnnual || product?.productId.includes("5year")
- ? `(${props.pricingPlans.getPrice(
+ ? `${props.pricingPlans.getPrice(
product as RNIap.Subscription,
- props.pricingPlans.hasTrialOffer() ? 1 : 0,
+ props.pricingPlans.hasTrialOffer(undefined, product?.productId)
+ ? 1
+ : 0,
isAnnual
- )}/month)`
+ )}/month`
+ : null}
+
+ {!isAnnual && !product?.productId.includes("5year")
+ ? `${props.pricingPlans.getStandardPrice(
+ product as RNIap.Subscription
+ )}/month`
: null}
</Paragraph>
</View>
diff --git a/apps/mobile/app/hooks/use-pricing-plans.ts b/apps/mobile/app/hooks/use-pricing-plans.ts
index f03f1c98c..80d240930 100644
--- a/apps/mobile/app/hooks/use-pricing-plans.ts
+++ b/apps/mobile/app/hooks/use-pricing-plans.ts
@@ -20,12 +20,9 @@ import { useEffect, useState } from "react";
import { Platform } from "react-native";
import * as RNIap from "react-native-iap";
import { DatabaseLogger, db } from "../common/database";
-import { eSendEvent } from "../services/event-manager";
import PremiumService from "../services/premium";
import { useSettingStore } from "../stores/use-setting-store";
import { useUserStore } from "../stores/use-user-store";
-import { eClosePremiumDialog, eCloseSheet } from "../utils/events";
-import { sleep } from "../utils/time";
function numberWithCommas(x: string) {
const parts = x.toString().split(".");
@@ -147,16 +144,17 @@ type PricingPlansOptions = {
const usePricingPlans = (options?: PricingPlansOptions) => {
const user = useUserStore((state) => state.user);
const [currentPlan, setCurrentPlan] = useState<string>(
- options?.planId || pricingPlans[0].id
+ options?.planId || pricingPlans[2].id
);
const [plans, setPlans] = useState<PricingPlan[]>(pricingPlans);
const [loading, setLoading] = useState(false);
const [loadingPlans, setLoadingPlans] = useState(true);
- const [selectedProductSku, setSelectedProductSku] = useState<
- string | undefined
- >(options?.productId || undefined);
+ const [selectedProductSku, setSelectedProductSku] = useState<string>(
+ options?.productId || "notesnook.pro.yearly"
+ );
const [isPromoOffer, setIsPromoOffer] = useState(false);
const [cancelPromo, setCancelPromo] = useState(false);
+ const [userCanRequestTrial, setUserCanRequestTrial] = useState(false);
const getProduct = (planId: string, skuId: string) => {
return (
@@ -173,22 +171,25 @@ const usePricingPlans = (options?: PricingPlansOptions) => {
return getProduct(planId, skuId) as RNIap.SubscriptionIOS;
};
- const hasTrialOffer = () => {
- if (!selectedProductSku) return false;
+ const hasTrialOffer = (planId?: string, productId?: string) => {
+ if (!selectedProductSku && !productId) return false;
return Platform.OS === "ios"
- ? !!(getProduct(currentPlan, selectedProductSku) as RNIap.SubscriptionIOS)
- ?.introductoryPrice
+ ? !!(
+ getProduct(
+ planId || currentPlan,
+ productId || selectedProductSku
+ ) as RNIap.SubscriptionIOS
+ )?.introductoryPrice
: (
getProduct(
- currentPlan,
- selectedProductSku
+ planId || currentPlan,
+ productId || selectedProductSku
) as RNIap.SubscriptionAndroid
)?.subscriptionOfferDetails?.[0]?.pricingPhases?.pricingPhaseList
?.length > 1;
};
- const userCanRequestTrial = hasTrialOffer();
// user && (!user.subscription || !user.subscription.expiry) ? true : false;
useEffect(() => {
@@ -207,6 +208,7 @@ const usePricingPlans = (options?: PricingPlansOptions) => {
});
});
setPlans([...pricingPlans]);
+ setUserCanRequestTrial(hasTrialOffer());
setLoadingPlans(false);
};
@@ -586,9 +588,12 @@ const usePricingPlans = (options?: PricingPlansOptions) => {
loading,
selectPlan: (planId: string) => {
setCurrentPlan(planId);
- setSelectedProductSku(
- plans.find((p) => p.id === planId)?.subscriptionSkuList?.[0]
- );
+ const product = plans.find((p) => p.id === planId)
+ ?.subscriptionSkuList?.[0];
+ if (product) {
+ setSelectedProductSku(product);
+ }
+
setIsPromoOffer(false);
},
convertYearlyPriceToMonthly: convertPrice,
diff --git a/apps/mobile/app/screens/settings/section-item.tsx b/apps/mobile/app/screens/settings/section-item.tsx
index ca51a7f49..05e92d739 100644
--- a/apps/mobile/app/screens/settings/section-item.tsx
+++ b/apps/mobile/app/screens/settings/section-item.tsx
@@ -45,6 +45,7 @@ import { AppFontSize } from "../../utils/size";
import { DefaultAppStyles } from "../../utils/styles";
import { components } from "./components";
import { RouteParams, SettingSection } from "./types";
+import AppIcon from "../../components/ui/AppIcon";
const _SectionItem = ({ item }: { item: SettingSection }) => {
const { colors } = useThemeColors();
@@ -131,15 +132,7 @@ const _SectionItem = ({ item }: { item: SettingSection }) => {
const checkIsFeatureAvailable = React.useCallback(() => {
if (!isFeatureAvailable) return false;
if (isFeatureAvailable && !isFeatureAvailable?.isAllowed) {
- ToastManager.show({
- message: isFeatureAvailable?.error,
- type: "info",
- context: "global",
- actionText: strings.upgrade(),
- func: () => {
- PaywallSheet.present(isFeatureAvailable);
- }
- });
+ PaywallSheet.present(isFeatureAvailable);
return false;
}
@@ -156,8 +149,8 @@ const _SectionItem = ({ item }: { item: SettingSection }) => {
flexDirection: "row",
justifyContent: "space-between",
paddingVertical: DefaultAppStyles.GAP,
- opacity: isDisabled ? 0.5 : 1,
borderRadius: 0,
+ overflow: "hidden",
...styles
}}
onPress={async () => {
@@ -185,6 +178,27 @@ const _SectionItem = ({ item }: { item: SettingSection }) => {
}
}}
>
+ {!isFeatureAvailable?.isAllowed ? (
+ <View
+ style={{
+ width: 35,
+ height: 35,
+ borderRadius: 100,
+ backgroundColor: colors.primary.accent,
+ justifyContent: "center",
+ alignItems: "center",
+ position: "absolute",
+ bottom: -8,
+ right: -8
+ }}
+ >
+ <AppIcon
+ color={colors.static.orange}
+ size={AppFontSize.md}
+ name="crown"
+ />
+ </View>
+ ) : null}
<View
style={{
flexDirection: "row",
diff --git a/apps/mobile/app/screens/settings/settings-data.tsx b/apps/mobile/app/screens/settings/settings-data.tsx
index b8f779683..159a84ca5 100644
--- a/apps/mobile/app/screens/settings/settings-data.tsx
+++ b/apps/mobile/app/screens/settings/settings-data.tsx
@@ -1258,7 +1258,8 @@ export const settingsGroups: SettingSection[] = [
notifNotes: !settings.notifNotes
});
},
- hidden: () => Platform.OS !== "android"
+ hidden: () => Platform.OS !== "android",
+ featureId: "createNoteFromNotificationDrawer"
},
{
id: "reminders",