Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/ui-services/src/UseCase/IsAndroid.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Result, SyncUseCaseInterface } from '@standardnotes/domain-core'
import { Platform } from '@standardnotes/models'

export class IsAndroid implements SyncUseCaseInterface<boolean> {
constructor(private platform: Platform) {}

execute(): Result<boolean> {
return Result.ok(this.platform === Platform.Android)
}
}
13 changes: 0 additions & 13 deletions packages/ui-services/src/UseCase/IsNativeAndroid.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/ui-services/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
IsGlobalSpellcheckEnabled,
IsMobileDevice,
IsNativeIOS,
IsNativeAndroid,
IsAndroid,
IsNativeMobileWeb,
KeyboardService,
PluginsService,
Expand Down Expand Up @@ -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, () => {
Expand Down Expand Up @@ -336,7 +336,7 @@ export class WebDependencies extends DependencyContainer {
application.mobileDevice,
this.get<LoadPurchaseFlowUrl>(Web_TYPES.LoadPurchaseFlowUrl),
this.get<IsNativeIOS>(Web_TYPES.IsNativeIOS),
this.get<IsNativeAndroid>(Web_TYPES.IsNativeAndroid),
this.get<IsAndroid>(Web_TYPES.IsAndroid),
application.events,
)
})
Expand Down
10 changes: 5 additions & 5 deletions packages/web/src/javascripts/Application/WebApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
IsGlobalSpellcheckEnabled,
IsMobileDevice,
IsNativeIOS,
IsNativeAndroid,
IsAndroid,
IsNativeMobileWeb,
KeyboardService,
PluginsServiceInterface,
Expand Down Expand Up @@ -258,20 +258,20 @@ export class WebApplication extends SNApplication implements WebApplicationInter
return this.deps.get<IsNativeIOS>(Web_TYPES.IsNativeIOS).execute().getValue()
}

isNativeAndroid(): boolean {
return this.deps.get<IsNativeAndroid>(Web_TYPES.IsNativeAndroid).execute().getValue()
isAndroid(): boolean {
return this.deps.get<IsAndroid>(Web_TYPES.IsAndroid).execute().getValue()
}

canShowPurchaseFlow(): boolean {
return !this.isNativeAndroid()
return !this.isAndroid()
}

get isMobileDevice(): boolean {
return this.deps.get<IsMobileDevice>(Web_TYPES.IsMobileDevice).execute().getValue()
}

get hideOutboundSubscriptionLinks() {
return this.isNativeIOS() || this.isNativeAndroid()
return this.isNativeIOS() || this.isAndroid()
}

get mobileDevice(): MobileDeviceInterface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
}

Expand All @@ -63,7 +63,7 @@ export class PurchaseFlowController extends AbstractViewController {
}

openPurchaseWebpage = async () => {
if (this._isNativeAndroid.execute().getValue()) {
if (this._isAndroid.execute().getValue()) {
return
}

Expand Down
Loading