fix(mobile): show premium modal on iOS
This commit is contained in:
@@ -356,7 +356,7 @@ export class WebApplication extends SNApplication implements WebApplicationInter
|
|||||||
return this.getViewControllerManager().featuresController.entitledToFiles
|
return this.getViewControllerManager().featuresController.entitledToFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
showPremiumModal(featureName: FeatureName): void {
|
showPremiumModal(featureName?: FeatureName): void {
|
||||||
void this.getViewControllerManager().featuresController.showPremiumAlert(featureName)
|
void this.getViewControllerManager().featuresController.showPremiumAlert(featureName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,19 @@ const UpgradeNow = ({ application, featuresController, subscriptionContoller }:
|
|||||||
const shouldShowCTA = !featuresController.hasFolders
|
const shouldShowCTA = !featuresController.hasFolders
|
||||||
const hasAccount = subscriptionContoller.hasAccount
|
const hasAccount = subscriptionContoller.hasAccount
|
||||||
|
|
||||||
|
const onClick = () => {
|
||||||
|
if (application.isNativeIOS()) {
|
||||||
|
application.showPremiumModal()
|
||||||
|
} else {
|
||||||
|
application.openPurchaseFlow()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return shouldShowCTA ? (
|
return shouldShowCTA ? (
|
||||||
<div className="flex h-full items-center px-2">
|
<div className="flex h-full items-center px-2">
|
||||||
<button
|
<button
|
||||||
className="rounded bg-info py-0.5 px-1.5 text-sm font-bold uppercase text-info-contrast hover:brightness-125 lg:text-xs"
|
className="rounded bg-info py-0.5 px-1.5 text-sm font-bold uppercase text-info-contrast hover:brightness-125 lg:text-xs"
|
||||||
onClick={() => application.openPurchaseFlow()}
|
onClick={onClick}
|
||||||
>
|
>
|
||||||
{hasAccount ? 'Unlock features' : 'Sign up to sync'}
|
{hasAccount ? 'Unlock features' : 'Sign up to sync'}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -14,22 +14,27 @@ const NoSubscriptionBanner = ({
|
|||||||
title: string
|
title: string
|
||||||
message: string
|
message: string
|
||||||
className?: string
|
className?: string
|
||||||
}) => (
|
}) => {
|
||||||
<div className={classNames('grid grid-cols-1 rounded-md border border-border p-4', className)}>
|
const onClick = () => {
|
||||||
<div className="flex items-center">
|
if (application.isNativeIOS()) {
|
||||||
<Icon className={classNames('mr-1 -ml-1 h-5 w-5', PremiumFeatureIconClass)} type={PremiumFeatureIconName} />
|
application.showPremiumModal()
|
||||||
<h1 className="sk-h3 m-0 text-sm font-semibold">{title}</h1>
|
} else {
|
||||||
|
application.openPurchaseFlow()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={classNames('grid grid-cols-1 rounded-md border border-border p-4', className)}>
|
||||||
|
<div className="flex items-center">
|
||||||
|
<Icon className={classNames('mr-1 -ml-1 h-5 w-5', PremiumFeatureIconClass)} type={PremiumFeatureIconName} />
|
||||||
|
<h1 className="sk-h3 m-0 text-sm font-semibold">{title}</h1>
|
||||||
|
</div>
|
||||||
|
<p className="col-start-1 col-end-3 m-0 mt-1 text-sm">{message}</p>
|
||||||
|
<Button primary small className="col-start-1 col-end-3 mt-3 justify-self-start uppercase" onClick={onClick}>
|
||||||
|
Upgrade Features
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<p className="col-start-1 col-end-3 m-0 mt-1 text-sm">{message}</p>
|
)
|
||||||
<Button
|
}
|
||||||
primary
|
|
||||||
small
|
|
||||||
className="col-start-1 col-end-3 mt-3 justify-self-start uppercase"
|
|
||||||
onClick={() => application.openPurchaseFlow()}
|
|
||||||
>
|
|
||||||
Upgrade Features
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
|
|
||||||
export default NoSubscriptionBanner
|
export default NoSubscriptionBanner
|
||||||
|
|||||||
@@ -15,7 +15,11 @@ const NoSubscription: FunctionComponent<Props> = ({ application }) => {
|
|||||||
const errorMessage = 'There was an error when attempting to redirect you to the subscription page.'
|
const errorMessage = 'There was an error when attempting to redirect you to the subscription page.'
|
||||||
setIsLoadingPurchaseFlow(true)
|
setIsLoadingPurchaseFlow(true)
|
||||||
try {
|
try {
|
||||||
application.openPurchaseFlow()
|
if (application.isNativeIOS()) {
|
||||||
|
application.showPremiumModal()
|
||||||
|
} else {
|
||||||
|
application.openPurchaseFlow()
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setPurchaseFlowError(errorMessage)
|
setPurchaseFlowError(errorMessage)
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -15,7 +15,11 @@ const NoProSubscription: FunctionComponent<Props> = ({ application }) => {
|
|||||||
const errorMessage = 'There was an error when attempting to redirect you to the subscription page.'
|
const errorMessage = 'There was an error when attempting to redirect you to the subscription page.'
|
||||||
setIsLoadingPurchaseFlow(true)
|
setIsLoadingPurchaseFlow(true)
|
||||||
try {
|
try {
|
||||||
application.openPurchaseFlow()
|
if (application.isNativeIOS()) {
|
||||||
|
application.showPremiumModal()
|
||||||
|
} else {
|
||||||
|
application.openPurchaseFlow()
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setPurchaseFlowError(errorMessage)
|
setPurchaseFlowError(errorMessage)
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -42,12 +42,20 @@ const HelpAndFeedback = ({ application }: { application: WebApplication }) => {
|
|||||||
</a>
|
</a>
|
||||||
</Text>
|
</Text>
|
||||||
{application.isNativeIOS() && (
|
{application.isNativeIOS() && (
|
||||||
<LinkButton
|
<>
|
||||||
className="mt-3"
|
<LinkButton
|
||||||
label="Privacy Policy"
|
className="mt-3"
|
||||||
link="https://standardnotes.com/privacy"
|
label="Privacy Policy"
|
||||||
onClick={handleClick}
|
link="https://standardnotes.com/privacy"
|
||||||
/>
|
onClick={handleClick}
|
||||||
|
/>
|
||||||
|
<LinkButton
|
||||||
|
className="mt-3"
|
||||||
|
label="Terms of Use"
|
||||||
|
link="https://www.apple.com/legal/internet-services/itunes/dev/stdeula/"
|
||||||
|
onClick={handleClick}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</PreferencesSegment>
|
</PreferencesSegment>
|
||||||
<HorizontalSeparator classes="my-4" />
|
<HorizontalSeparator classes="my-4" />
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { UpgradePrompt } from './Subviews/UpgradePrompt'
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
application: WebApplication
|
application: WebApplication
|
||||||
featureName: FeatureName | string
|
featureName?: FeatureName | string
|
||||||
hasSubscription: boolean
|
hasSubscription: boolean
|
||||||
hasAccount: boolean
|
hasAccount: boolean
|
||||||
onClose: () => void
|
onClose: () => void
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export const UpgradePrompt = ({
|
|||||||
hasAccount,
|
hasAccount,
|
||||||
onClose,
|
onClose,
|
||||||
}: {
|
}: {
|
||||||
featureName: string
|
featureName?: string
|
||||||
ctaRef: React.RefObject<HTMLButtonElement>
|
ctaRef: React.RefObject<HTMLButtonElement>
|
||||||
application: WebApplication
|
application: WebApplication
|
||||||
hasSubscription: boolean
|
hasSubscription: boolean
|
||||||
@@ -52,8 +52,17 @@ export const UpgradePrompt = ({
|
|||||||
<div className="mb-1 text-center text-lg font-bold">Enable Advanced Features</div>
|
<div className="mb-1 text-center text-lg font-bold">Enable Advanced Features</div>
|
||||||
</AlertDialogLabel>
|
</AlertDialogLabel>
|
||||||
<AlertDialogDescription className="mb-2 px-4.5 text-center text-sm text-passive-1">
|
<AlertDialogDescription className="mb-2 px-4.5 text-center text-sm text-passive-1">
|
||||||
To take advantage of <span className="font-semibold">{featureName}</span> and other advanced features, upgrade
|
{featureName && (
|
||||||
your current plan.
|
<span>
|
||||||
|
To take advantage of <span className="font-semibold">{featureName}</span> and other advanced features,
|
||||||
|
upgrade your current plan.
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{!featureName && (
|
||||||
|
<span>
|
||||||
|
To take advantage of all the advanced features Standard Notes has to offer, upgrade your current plan.
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
{application.isNativeIOS() && (
|
{application.isNativeIOS() && (
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
<div className="mb-2 font-bold">The Professional Plan costs $99.99/year and includes benefits like</div>
|
<div className="mb-2 font-bold">The Professional Plan costs $99.99/year and includes benefits like</div>
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ export class FeaturesController extends AbstractViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async showPremiumAlert(featureName: FeatureName | string): Promise<void> {
|
public async showPremiumAlert(featureName?: FeatureName | string): Promise<void> {
|
||||||
this.premiumAlertFeatureName = featureName
|
this.premiumAlertFeatureName = featureName
|
||||||
this.premiumAlertType = PremiumFeatureModalType.UpgradePrompt
|
this.premiumAlertType = PremiumFeatureModalType.UpgradePrompt
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user