A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix trial ending flow
ammarahm-edccf7e23df559
diff --git a/apps/mobile/src/components/Premium/expiring.js b/apps/mobile/src/components/Premium/expiring.jsindex 0ba64db4c..0c03da30b 100644--- a/apps/mobile/src/components/Premium/expiring.js+++ b/apps/mobile/src/components/Premium/expiring.js@@ -32,6 +32,10 @@ export const Expiring = () => {offer: null,extend: true});+ const promo = status.offer ? {+ promoCode:"com.streetwriters.notesnook.sub.yr.15",+ text:"GET 30% OFF on yearly"+}: nulluseEffect(() => {eSubscribeEvent(eOpenTrialEndingDialog, open);@@ -102,7 +106,7 @@ export const Expiring = () => {onPress={async () => {setVisible(false);await sleep(300);- eSendEvent(eOpenPremiumDialog);+ eSendEvent(eOpenPremiumDialog, promo);}}size={SIZE.xs + 2}style={{@@ -130,7 +134,7 @@ export const Expiring = () => {onPress={async () => {setVisible(false);await sleep(300);- PremiumService.sheet(null,status.offer)+ PremiumService.sheet(null,promo)}}fontSize={SIZE.md + 2}style={{diff --git a/apps/mobile/src/components/Premium/offer.js b/apps/mobile/src/components/Premium/offer.jsindex eed64e062..a02bc8ab9 100644--- a/apps/mobile/src/components/Premium/offer.js+++ b/apps/mobile/src/components/Premium/offer.js@@ -1,10 +1,14 @@import React from 'react';-import { Text } from 'react-native';-import { useTracked } from '../../provider';-import { SIZE } from '../../utils/SizeUtils';+import {Text} from 'react-native';+import {useTracked} from '../../provider';+import {SIZE} from '../../utils/SizeUtils';import Paragraph from '../Typography/Paragraph';-export const Offer = ({off = '30', text = 'on both yearly & monthly plans',padding=0}) => {+export const Offer = ({+ off = '30',+ text = 'on yearly plan, offer ends soon',+ padding = 0+}) => {const [state, dispatch] = useTracked();const {colors} = state;@@ -12,7 +16,7 @@ export const Offer = ({off = '30', text = 'on both yearly & monthly plans',paddi<Paragraphstyle={{textAlign: 'center',- paddingVertical:padding+ paddingVertical: padding}}size={SIZE.xxxl}>GET {off}diff --git a/apps/mobile/src/components/Premium/pricingplans.js b/apps/mobile/src/components/Premium/pricingplans.jsindex 2299ac2d5..e6e970474 100644--- a/apps/mobile/src/components/Premium/pricingplans.js+++ b/apps/mobile/src/components/Premium/pricingplans.js@@ -54,7 +54,6 @@ export const PricingPlans = ({const getSkus = async () => {try {let products = PremiumService.getProducts();-if (products.length > 0) {let offers = {monthly: products.find(@@ -75,7 +74,9 @@ export const PricingPlans = ({}};- const getPromo = productId => {+ const getPromo = async productId => {+ await sleep(500);+ let products = PremiumService.getProducts()let product = products.find(p => p.productId === productId);let isMonthly = product.productId.indexOf('.mo') > -1;let cycleText = isMonthlydiff --git a/apps/mobile/src/services/PremiumService.js b/apps/mobile/src/services/PremiumService.jsindex aca2175f7..ede83ba5a 100644--- a/apps/mobile/src/services/PremiumService.js+++ b/apps/mobile/src/services/PremiumService.js@@ -280,12 +280,13 @@ const subscriptions = {async function getRemainingTrialDaysStatus() {let user = await db.user.getUser();if (!user) return;-+ let premium = user.subscription.type !== SUBSCRIPTION_STATUS.BASIC;let total = user.subscription.expiry - user.subscription.start;let current = Date.now() - user.subscription.start;+ current = (current / total) * 100;- current = ((current / total) * 100).toFixed(0);let lastTrialDialogShownAt = await MMKV.getItem('lastTrialDialogShownAt');+if (current > 75 && lastTrialDialogShownAt !== 'ending') {eSendEvent(eOpenTrialEndingDialog, {title: 'Your trial is ending soon',@@ -293,15 +294,16 @@ async function getRemainingTrialDaysStatus() {extend: false});MMKV.setItem('lastTrialDialogShownAt', 'ending');- } else if (!get() && lastTrialDialogShownAt !== 'expired') {+ return;+ }++ if (!premium && lastTrialDialogShownAt !== 'expired') {eSendEvent(eOpenTrialEndingDialog, {title: 'Your trial has expired',offer: 30,- extend: true+ extend: false});MMKV.setItem('lastTrialDialogShownAt', 'expired');- } else {- return;}}@@ -329,7 +331,7 @@ const features_list = [const sheet = (context, promo) => {presentSheet({- context:context,+ context: context,component: ref => (<><DialogHeader