From 35b21b21ce2438540d799b5a2f04fe5616bf2c3e Mon Sep 17 00:00:00 2001 From: Mo Date: Wed, 2 Nov 2022 12:07:26 -0500 Subject: [PATCH] fix: hide subscription marketing on iOS (#1929) --- .../javascripts/Application/Application.ts | 8 ++++++++ .../ContentListView/ContentListView.tsx | 7 ++++--- .../Header/DisplayOptionsMenu.tsx | 19 ++++++++++-------- .../Components/Footer/UpgradeNow.tsx | 4 ++++ .../Components/NotesOptions/NotesOptions.tsx | 4 +++- .../Account/Subscription/NoSubscription.tsx | 14 +++++++------ .../SubscriptionSharing/NoProSubscription.tsx | 15 ++++++++------ .../PremiumFeaturesModal.tsx | 20 ++++++++++--------- .../QuickSettingsMenu/FocusModeSwitch.tsx | 7 ++++++- .../PanelSettingsSection.tsx | 2 +- .../QuickSettingsMenu/QuickSettingsMenu.tsx | 13 ++++++++++-- .../QuickSettingsMenu/ThemesMenuButton.tsx | 9 ++++++--- .../ItemList/ItemListController.ts | 20 +++++++++++++++++-- 13 files changed, 100 insertions(+), 42 deletions(-) diff --git a/packages/web/src/javascripts/Application/Application.ts b/packages/web/src/javascripts/Application/Application.ts index cf202ad79..6a9e35264 100644 --- a/packages/web/src/javascripts/Application/Application.ts +++ b/packages/web/src/javascripts/Application/Application.ts @@ -203,6 +203,14 @@ export class WebApplication extends SNApplication implements WebApplicationInter return undefined } + isNativeIOS() { + return this.isNativeMobileWeb() && this.platform === Platform.Ios + } + + get hideSubscriptionMarketing() { + return this.isNativeIOS() + } + mobileDevice(): MobileDeviceInterface { if (!this.isNativeMobileWeb()) { throw Error('Attempting to access device as mobile device on non mobile platform') diff --git a/packages/web/src/javascripts/Components/ContentListView/ContentListView.tsx b/packages/web/src/javascripts/Components/ContentListView/ContentListView.tsx index a1822d609..999cd1a00 100644 --- a/packages/web/src/javascripts/Components/ContentListView/ContentListView.tsx +++ b/packages/web/src/javascripts/Components/ContentListView/ContentListView.tsx @@ -110,6 +110,7 @@ const ContentListView: FunctionComponent = ({ renderedItems, items, searchBarElement, + isCurrentNoteTemplate, } = itemListController const { selectedUuids, selectNextItem, selectPreviousItem } = selectionController @@ -245,13 +246,13 @@ const ContentListView: FunctionComponent = ({ ) useEffect(() => { - const hasEditorPane = selectedUuids.size > 0 + const hasEditorPane = selectedUuids.size > 0 || renderedItems.length === 0 || isCurrentNoteTemplate if (!hasEditorPane) { itemsViewPanelRef.current?.style.removeProperty('width') } - }, [selectedUuids, itemsViewPanelRef]) + }, [selectedUuids, itemsViewPanelRef, isCurrentNoteTemplate, renderedItems]) - const hasEditorPane = selectedUuids.size > 0 || renderedItems.length === 0 + const hasEditorPane = selectedUuids.size > 0 || renderedItems.length === 0 || isCurrentNoteTemplate return (
= ({ {!DailyEntryModeEnabled && 'Create powerful workflows and organizational layouts with per-tag display preferences.'}

- + + {!application.hideSubscriptionMarketing && ( + + )}
) diff --git a/packages/web/src/javascripts/Components/Footer/UpgradeNow.tsx b/packages/web/src/javascripts/Components/Footer/UpgradeNow.tsx index 055479489..5c036adff 100644 --- a/packages/web/src/javascripts/Components/Footer/UpgradeNow.tsx +++ b/packages/web/src/javascripts/Components/Footer/UpgradeNow.tsx @@ -12,6 +12,10 @@ const UpgradeNow = ({ application, featuresController }: Props) => { const shouldShowCTA = !featuresController.hasFolders const hasAccount = application.hasAccount() + if (hasAccount && application.hideSubscriptionMarketing) { + return null + } + return shouldShowCTA ? (
diff --git a/packages/web/src/javascripts/Components/Preferences/Panes/Account/Subscription/NoSubscription.tsx b/packages/web/src/javascripts/Components/Preferences/Panes/Account/Subscription/NoSubscription.tsx index e91a34d79..d38b7bc45 100644 --- a/packages/web/src/javascripts/Components/Preferences/Panes/Account/Subscription/NoSubscription.tsx +++ b/packages/web/src/javascripts/Components/Preferences/Panes/Account/Subscription/NoSubscription.tsx @@ -31,12 +31,14 @@ const NoSubscription: FunctionComponent = ({ application }) => { You don't have a Standard Notes subscription yet. {isLoadingPurchaseFlow && Redirecting you to the subscription page...} {purchaseFlowError && {purchaseFlowError}} -
- - {application.hasAccount() && ( -
+ {!application.hideSubscriptionMarketing && ( +
+ + {application.hasAccount() && ( +
+ )} ) } diff --git a/packages/web/src/javascripts/Components/Preferences/Panes/Account/SubscriptionSharing/NoProSubscription.tsx b/packages/web/src/javascripts/Components/Preferences/Panes/Account/SubscriptionSharing/NoProSubscription.tsx index 008427ad7..51f15820e 100644 --- a/packages/web/src/javascripts/Components/Preferences/Panes/Account/SubscriptionSharing/NoProSubscription.tsx +++ b/packages/web/src/javascripts/Components/Preferences/Panes/Account/SubscriptionSharing/NoProSubscription.tsx @@ -34,12 +34,15 @@ const NoProSubscription: FunctionComponent = ({ application }) => { {isLoadingPurchaseFlow && Redirecting you to the subscription page...} {purchaseFlowError && {purchaseFlowError}} -
- - {application.hasAccount() && ( -
+ + {!application.hideSubscriptionMarketing && ( +
+ + {application.hasAccount() && ( +
+ )} ) } diff --git a/packages/web/src/javascripts/Components/PremiumFeaturesModal/PremiumFeaturesModal.tsx b/packages/web/src/javascripts/Components/PremiumFeaturesModal/PremiumFeaturesModal.tsx index 5afb56f18..719f24135 100644 --- a/packages/web/src/javascripts/Components/PremiumFeaturesModal/PremiumFeaturesModal.tsx +++ b/packages/web/src/javascripts/Components/PremiumFeaturesModal/PremiumFeaturesModal.tsx @@ -61,15 +61,17 @@ const PremiumFeaturesModal: FunctionComponent = ({ To take advantage of {featureName} and other advanced features, upgrade your current plan. -
- -
+ {!application.hideSubscriptionMarketing && ( +
+ +
+ )}
diff --git a/packages/web/src/javascripts/Components/QuickSettingsMenu/FocusModeSwitch.tsx b/packages/web/src/javascripts/Components/QuickSettingsMenu/FocusModeSwitch.tsx index 154de6eaf..04c4b7786 100644 --- a/packages/web/src/javascripts/Components/QuickSettingsMenu/FocusModeSwitch.tsx +++ b/packages/web/src/javascripts/Components/QuickSettingsMenu/FocusModeSwitch.tsx @@ -2,6 +2,7 @@ import { WebApplication } from '@/Application/Application' import { FunctionComponent, MouseEventHandler, useCallback } from 'react' import Switch from '@/Components/Switch/Switch' import { isMobileScreen } from '@/Utils' +import { classNames } from '@/Utils/ConcatenateClassNames' type Props = { application: WebApplication @@ -29,7 +30,11 @@ const FocusModeSwitch: FunctionComponent = ({ application, onToggle, onCl return (