From 83e9c6d5776c434e6126f1d25038f8702f70b064 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Fri, 5 Jun 2026 14:40:17 -0300 Subject: [PATCH] chore: temporarily disallow android purchases --- .../src/UseCase/IsNativeAndroid.ts | 13 +++++++++++ .../WebApplication/WebApplicationInterface.ts | 1 + packages/ui-services/src/index.ts | 1 + .../Application/Dependencies/Types.ts | 1 + .../Dependencies/WebDependencies.ts | 6 +++++ .../javascripts/Application/WebApplication.ts | 11 +++++++++- .../Components/Footer/UpgradeNow.tsx | 6 +++++ .../NoSubscriptionBanner.tsx | 8 ++++--- .../Panes/Account/NoProSubscription.tsx | 2 +- .../Account/Subscription/NoSubscription.tsx | 2 +- .../Subviews/UpgradePrompt.tsx | 22 ++++++++++--------- .../RevisionContentLocked.tsx | 20 +++++++++-------- .../PurchaseFlow/PurchaseFlowController.ts | 11 +++++++++- .../Event/ApplicationEventObserver.spec.ts | 12 ++++++++++ .../Event/ApplicationEventObserver.ts | 4 +++- 15 files changed, 93 insertions(+), 27 deletions(-) create mode 100644 packages/ui-services/src/UseCase/IsNativeAndroid.ts diff --git a/packages/ui-services/src/UseCase/IsNativeAndroid.ts b/packages/ui-services/src/UseCase/IsNativeAndroid.ts new file mode 100644 index 00000000000..4df08071349 --- /dev/null +++ b/packages/ui-services/src/UseCase/IsNativeAndroid.ts @@ -0,0 +1,13 @@ +import { Result, SyncUseCaseInterface } from '@standardnotes/domain-core' +import { Environment, Platform } from '@standardnotes/models' + +export class IsNativeAndroid implements SyncUseCaseInterface { + constructor( + private environment: Environment, + private platform: Platform, + ) {} + + execute(): Result { + return Result.ok(this.environment === Environment.Mobile && this.platform === Platform.Android) + } +} diff --git a/packages/ui-services/src/WebApplication/WebApplicationInterface.ts b/packages/ui-services/src/WebApplication/WebApplicationInterface.ts index f2d2bac3da3..7cfad3e7b5e 100644 --- a/packages/ui-services/src/WebApplication/WebApplicationInterface.ts +++ b/packages/ui-services/src/WebApplication/WebApplicationInterface.ts @@ -26,6 +26,7 @@ export interface WebApplicationInterface extends ApplicationInterface { handleReceivedLinkEvent(item: { link: string; title: string }): Promise handleOpenFilePreviewEvent(item: { id: string }): void isNativeMobileWeb(): boolean + canShowPurchaseFlow(): boolean handleAndroidBackButtonPressed(): void addAndroidBackHandlerEventListener(listener: () => boolean): (() => void) | undefined setAndroidBackHandlerFallbackListener(listener: () => boolean): void diff --git a/packages/ui-services/src/index.ts b/packages/ui-services/src/index.ts index ed05b5614cf..d033f6920a0 100644 --- a/packages/ui-services/src/index.ts +++ b/packages/ui-services/src/index.ts @@ -37,6 +37,7 @@ export * from './UseCase/IsGlobalSpellcheckEnabled' export * from './UseCase/IsNativeMobileWeb' export * from './UseCase/IsMobileDevice' export * from './UseCase/IsNativeIOS' +export * from './UseCase/IsNativeAndroid' export * from './UseCase/GetItemTags' export * from './Theme/ThemeManager' diff --git a/packages/web/src/javascripts/Application/Dependencies/Types.ts b/packages/web/src/javascripts/Application/Dependencies/Types.ts index b2ad123521f..594dba04ec4 100644 --- a/packages/web/src/javascripts/Application/Dependencies/Types.ts +++ b/packages/web/src/javascripts/Application/Dependencies/Types.ts @@ -48,6 +48,7 @@ export const Web_TYPES = { IsGlobalSpellcheckEnabled: Symbol.for('IsGlobalSpellcheckEnabled'), IsMobileDevice: Symbol.for('IsMobileDevice'), IsNativeIOS: Symbol.for('IsNativeIOS'), + IsNativeAndroid: Symbol.for('IsNativeAndroid'), IsNativeMobileWeb: Symbol.for('IsNativeMobileWeb'), IsTabletOrMobileScreen: Symbol.for('IsTabletOrMobileScreen'), LoadPurchaseFlowUrl: Symbol.for('LoadPurchaseFlowUrl'), diff --git a/packages/web/src/javascripts/Application/Dependencies/WebDependencies.ts b/packages/web/src/javascripts/Application/Dependencies/WebDependencies.ts index eea0204b48f..edf446b8c7b 100644 --- a/packages/web/src/javascripts/Application/Dependencies/WebDependencies.ts +++ b/packages/web/src/javascripts/Application/Dependencies/WebDependencies.ts @@ -7,6 +7,7 @@ import { IsGlobalSpellcheckEnabled, IsMobileDevice, IsNativeIOS, + IsNativeAndroid, IsNativeMobileWeb, KeyboardService, PluginsService, @@ -77,6 +78,10 @@ export class WebDependencies extends DependencyContainer { return new IsNativeIOS(application.environment, application.platform) }) + this.bind(Web_TYPES.IsNativeAndroid, () => { + return new IsNativeAndroid(application.environment, application.platform) + }) + this.bind(Web_TYPES.OpenSubscriptionDashboard, () => { return new OpenSubscriptionDashboard(application, application.legacyApi) }) @@ -331,6 +336,7 @@ export class WebDependencies extends DependencyContainer { application.mobileDevice, this.get(Web_TYPES.LoadPurchaseFlowUrl), this.get(Web_TYPES.IsNativeIOS), + this.get(Web_TYPES.IsNativeAndroid), application.events, ) }) diff --git a/packages/web/src/javascripts/Application/WebApplication.ts b/packages/web/src/javascripts/Application/WebApplication.ts index aa27bd5b87e..317240738c1 100644 --- a/packages/web/src/javascripts/Application/WebApplication.ts +++ b/packages/web/src/javascripts/Application/WebApplication.ts @@ -37,6 +37,7 @@ import { IsGlobalSpellcheckEnabled, IsMobileDevice, IsNativeIOS, + IsNativeAndroid, IsNativeMobileWeb, KeyboardService, PluginsServiceInterface, @@ -257,12 +258,20 @@ export class WebApplication extends SNApplication implements WebApplicationInter return this.deps.get(Web_TYPES.IsNativeIOS).execute().getValue() } + isNativeAndroid(): boolean { + return this.deps.get(Web_TYPES.IsNativeAndroid).execute().getValue() + } + + canShowPurchaseFlow(): boolean { + return !this.isNativeAndroid() + } + get isMobileDevice(): boolean { return this.deps.get(Web_TYPES.IsMobileDevice).execute().getValue() } get hideOutboundSubscriptionLinks() { - return this.isNativeIOS() + return this.isNativeIOS() || this.isNativeAndroid() } get mobileDevice(): MobileDeviceInterface { diff --git a/packages/web/src/javascripts/Components/Footer/UpgradeNow.tsx b/packages/web/src/javascripts/Components/Footer/UpgradeNow.tsx index 126a5ba5fdc..39504f16382 100644 --- a/packages/web/src/javascripts/Components/Footer/UpgradeNow.tsx +++ b/packages/web/src/javascripts/Components/Footer/UpgradeNow.tsx @@ -18,6 +18,8 @@ const UpgradeNow = ({ application, featuresController, subscriptionContoller }: const onClick = useCallback(() => { if (hasAccount && application.isNativeIOS()) { application.showPremiumModal() + } else if (!application.canShowPurchaseFlow() && !hasAccount) { + application.showAccountMenu() } else { void application.openPurchaseFlow() } @@ -27,6 +29,10 @@ const UpgradeNow = ({ application, featuresController, subscriptionContoller }: return null } + if (!application.canShowPurchaseFlow() && hasAccount) { + return null + } + return (

{message}

- + {application.canShowPurchaseFlow() && ( + + )} ) } diff --git a/packages/web/src/javascripts/Components/Preferences/Panes/Account/NoProSubscription.tsx b/packages/web/src/javascripts/Components/Preferences/Panes/Account/NoProSubscription.tsx index 8b594e1b4b3..394504fec5e 100644 --- a/packages/web/src/javascripts/Components/Preferences/Panes/Account/NoProSubscription.tsx +++ b/packages/web/src/javascripts/Components/Preferences/Panes/Account/NoProSubscription.tsx @@ -40,7 +40,7 @@ const NoProSubscription: FunctionComponent = ({ application, text }) => { {!application.hideOutboundSubscriptionLinks && ( )} - {application.hasAccount() && ( + {application.hasAccount() && application.canShowPurchaseFlow() && ( + {application.canShowPurchaseFlow() && ( + + )} ) } diff --git a/packages/web/src/javascripts/Components/RevisionHistoryModal/RevisionContentLocked.tsx b/packages/web/src/javascripts/Components/RevisionHistoryModal/RevisionContentLocked.tsx index 73866f4c1b6..200ccb4e003 100644 --- a/packages/web/src/javascripts/Components/RevisionHistoryModal/RevisionContentLocked.tsx +++ b/packages/web/src/javascripts/Components/RevisionHistoryModal/RevisionContentLocked.tsx @@ -37,15 +37,17 @@ const RevisionContentLocked: FunctionComponent = () => {
{getPremiumContentCopy(planName)}. Learn more about our other plans to upgrade your history capacity.
-