diff --git a/packages/ui-services/src/UseCase/IsAndroid.ts b/packages/ui-services/src/UseCase/IsAndroid.ts new file mode 100644 index 00000000000..f961fa52a6d --- /dev/null +++ b/packages/ui-services/src/UseCase/IsAndroid.ts @@ -0,0 +1,10 @@ +import { Result, SyncUseCaseInterface } from '@standardnotes/domain-core' +import { Platform } from '@standardnotes/models' + +export class IsAndroid implements SyncUseCaseInterface { + constructor(private platform: Platform) {} + + execute(): Result { + return Result.ok(this.platform === Platform.Android) + } +} diff --git a/packages/ui-services/src/UseCase/IsNativeAndroid.ts b/packages/ui-services/src/UseCase/IsNativeAndroid.ts deleted file mode 100644 index 4df08071349..00000000000 --- a/packages/ui-services/src/UseCase/IsNativeAndroid.ts +++ /dev/null @@ -1,13 +0,0 @@ -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/index.ts b/packages/ui-services/src/index.ts index d033f6920a0..91d4f55d850 100644 --- a/packages/ui-services/src/index.ts +++ b/packages/ui-services/src/index.ts @@ -37,7 +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/IsAndroid' 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 594dba04ec4..c6089e54d1e 100644 --- a/packages/web/src/javascripts/Application/Dependencies/Types.ts +++ b/packages/web/src/javascripts/Application/Dependencies/Types.ts @@ -48,7 +48,7 @@ export const Web_TYPES = { IsGlobalSpellcheckEnabled: Symbol.for('IsGlobalSpellcheckEnabled'), IsMobileDevice: Symbol.for('IsMobileDevice'), IsNativeIOS: Symbol.for('IsNativeIOS'), - IsNativeAndroid: Symbol.for('IsNativeAndroid'), + IsAndroid: Symbol.for('IsAndroid'), 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 edf446b8c7b..ef871e6d2b1 100644 --- a/packages/web/src/javascripts/Application/Dependencies/WebDependencies.ts +++ b/packages/web/src/javascripts/Application/Dependencies/WebDependencies.ts @@ -7,7 +7,7 @@ import { IsGlobalSpellcheckEnabled, IsMobileDevice, IsNativeIOS, - IsNativeAndroid, + IsAndroid, IsNativeMobileWeb, KeyboardService, PluginsService, @@ -78,8 +78,8 @@ 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.IsAndroid, () => { + return new IsAndroid(application.platform) }) this.bind(Web_TYPES.OpenSubscriptionDashboard, () => { @@ -336,7 +336,7 @@ export class WebDependencies extends DependencyContainer { application.mobileDevice, this.get(Web_TYPES.LoadPurchaseFlowUrl), this.get(Web_TYPES.IsNativeIOS), - this.get(Web_TYPES.IsNativeAndroid), + this.get(Web_TYPES.IsAndroid), application.events, ) }) diff --git a/packages/web/src/javascripts/Application/WebApplication.ts b/packages/web/src/javascripts/Application/WebApplication.ts index 317240738c1..dfafd7586f2 100644 --- a/packages/web/src/javascripts/Application/WebApplication.ts +++ b/packages/web/src/javascripts/Application/WebApplication.ts @@ -37,7 +37,7 @@ import { IsGlobalSpellcheckEnabled, IsMobileDevice, IsNativeIOS, - IsNativeAndroid, + IsAndroid, IsNativeMobileWeb, KeyboardService, PluginsServiceInterface, @@ -258,12 +258,12 @@ 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() + isAndroid(): boolean { + return this.deps.get(Web_TYPES.IsAndroid).execute().getValue() } canShowPurchaseFlow(): boolean { - return !this.isNativeAndroid() + return !this.isAndroid() } get isMobileDevice(): boolean { @@ -271,7 +271,7 @@ export class WebApplication extends SNApplication implements WebApplicationInter } get hideOutboundSubscriptionLinks() { - return this.isNativeIOS() || this.isNativeAndroid() + return this.isNativeIOS() || this.isAndroid() } get mobileDevice(): MobileDeviceInterface { diff --git a/packages/web/src/javascripts/Controllers/PurchaseFlow/PurchaseFlowController.ts b/packages/web/src/javascripts/Controllers/PurchaseFlow/PurchaseFlowController.ts index ebc44ab6e0e..35c76a5c9cf 100644 --- a/packages/web/src/javascripts/Controllers/PurchaseFlow/PurchaseFlowController.ts +++ b/packages/web/src/javascripts/Controllers/PurchaseFlow/PurchaseFlowController.ts @@ -11,7 +11,7 @@ import { action, makeObservable, observable } from 'mobx' import { AbstractViewController } from '../Abstract/AbstractViewController' import { PurchaseFlowPane } from './PurchaseFlowPane' import { LoadPurchaseFlowUrl } from '@/Application/UseCase/LoadPurchaseFlowUrl' -import { IsNativeIOS, IsNativeAndroid } from '@standardnotes/ui-services' +import { IsNativeIOS, IsAndroid } from '@standardnotes/ui-services' export class PurchaseFlowController extends AbstractViewController { isOpen = false @@ -25,7 +25,7 @@ export class PurchaseFlowController extends AbstractViewController { private mobileDevice: MobileDeviceInterface | undefined, private _loadPurchaseFlowUrl: LoadPurchaseFlowUrl, private _isNativeIOS: IsNativeIOS, - private _isNativeAndroid: IsNativeAndroid, + private _isAndroid: IsAndroid, eventBus: InternalEventBusInterface, ) { super(eventBus) @@ -45,7 +45,7 @@ export class PurchaseFlowController extends AbstractViewController { } openPurchaseFlow = async (plan = AppleIAPProductId.ProPlanYearly) => { - if (this._isNativeAndroid.execute().getValue()) { + if (this._isAndroid.execute().getValue()) { return } @@ -63,7 +63,7 @@ export class PurchaseFlowController extends AbstractViewController { } openPurchaseWebpage = async () => { - if (this._isNativeAndroid.execute().getValue()) { + if (this._isAndroid.execute().getValue()) { return }