Skip to content

Commit fe4d0aa

Browse files
authored
chore: temporarily disallow android purchases (#3019)
1 parent ed1cd0c commit fe4d0aa

7 files changed

Lines changed: 25 additions & 28 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Result, SyncUseCaseInterface } from '@standardnotes/domain-core'
2+
import { Platform } from '@standardnotes/models'
3+
4+
export class IsAndroid implements SyncUseCaseInterface<boolean> {
5+
constructor(private platform: Platform) {}
6+
7+
execute(): Result<boolean> {
8+
return Result.ok(this.platform === Platform.Android)
9+
}
10+
}

packages/ui-services/src/UseCase/IsNativeAndroid.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/ui-services/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export * from './UseCase/IsGlobalSpellcheckEnabled'
3737
export * from './UseCase/IsNativeMobileWeb'
3838
export * from './UseCase/IsMobileDevice'
3939
export * from './UseCase/IsNativeIOS'
40-
export * from './UseCase/IsNativeAndroid'
40+
export * from './UseCase/IsAndroid'
4141
export * from './UseCase/GetItemTags'
4242

4343
export * from './Theme/ThemeManager'

packages/web/src/javascripts/Application/Dependencies/Types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const Web_TYPES = {
4848
IsGlobalSpellcheckEnabled: Symbol.for('IsGlobalSpellcheckEnabled'),
4949
IsMobileDevice: Symbol.for('IsMobileDevice'),
5050
IsNativeIOS: Symbol.for('IsNativeIOS'),
51-
IsNativeAndroid: Symbol.for('IsNativeAndroid'),
51+
IsAndroid: Symbol.for('IsAndroid'),
5252
IsNativeMobileWeb: Symbol.for('IsNativeMobileWeb'),
5353
IsTabletOrMobileScreen: Symbol.for('IsTabletOrMobileScreen'),
5454
LoadPurchaseFlowUrl: Symbol.for('LoadPurchaseFlowUrl'),

packages/web/src/javascripts/Application/Dependencies/WebDependencies.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
IsGlobalSpellcheckEnabled,
88
IsMobileDevice,
99
IsNativeIOS,
10-
IsNativeAndroid,
10+
IsAndroid,
1111
IsNativeMobileWeb,
1212
KeyboardService,
1313
PluginsService,
@@ -78,8 +78,8 @@ export class WebDependencies extends DependencyContainer {
7878
return new IsNativeIOS(application.environment, application.platform)
7979
})
8080

81-
this.bind(Web_TYPES.IsNativeAndroid, () => {
82-
return new IsNativeAndroid(application.environment, application.platform)
81+
this.bind(Web_TYPES.IsAndroid, () => {
82+
return new IsAndroid(application.platform)
8383
})
8484

8585
this.bind(Web_TYPES.OpenSubscriptionDashboard, () => {
@@ -336,7 +336,7 @@ export class WebDependencies extends DependencyContainer {
336336
application.mobileDevice,
337337
this.get<LoadPurchaseFlowUrl>(Web_TYPES.LoadPurchaseFlowUrl),
338338
this.get<IsNativeIOS>(Web_TYPES.IsNativeIOS),
339-
this.get<IsNativeAndroid>(Web_TYPES.IsNativeAndroid),
339+
this.get<IsAndroid>(Web_TYPES.IsAndroid),
340340
application.events,
341341
)
342342
})

packages/web/src/javascripts/Application/WebApplication.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import {
3737
IsGlobalSpellcheckEnabled,
3838
IsMobileDevice,
3939
IsNativeIOS,
40-
IsNativeAndroid,
40+
IsAndroid,
4141
IsNativeMobileWeb,
4242
KeyboardService,
4343
PluginsServiceInterface,
@@ -258,20 +258,20 @@ export class WebApplication extends SNApplication implements WebApplicationInter
258258
return this.deps.get<IsNativeIOS>(Web_TYPES.IsNativeIOS).execute().getValue()
259259
}
260260

261-
isNativeAndroid(): boolean {
262-
return this.deps.get<IsNativeAndroid>(Web_TYPES.IsNativeAndroid).execute().getValue()
261+
isAndroid(): boolean {
262+
return this.deps.get<IsAndroid>(Web_TYPES.IsAndroid).execute().getValue()
263263
}
264264

265265
canShowPurchaseFlow(): boolean {
266-
return !this.isNativeAndroid()
266+
return !this.isAndroid()
267267
}
268268

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

273273
get hideOutboundSubscriptionLinks() {
274-
return this.isNativeIOS() || this.isNativeAndroid()
274+
return this.isNativeIOS() || this.isAndroid()
275275
}
276276

277277
get mobileDevice(): MobileDeviceInterface {

packages/web/src/javascripts/Controllers/PurchaseFlow/PurchaseFlowController.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { action, makeObservable, observable } from 'mobx'
1111
import { AbstractViewController } from '../Abstract/AbstractViewController'
1212
import { PurchaseFlowPane } from './PurchaseFlowPane'
1313
import { LoadPurchaseFlowUrl } from '@/Application/UseCase/LoadPurchaseFlowUrl'
14-
import { IsNativeIOS, IsNativeAndroid } from '@standardnotes/ui-services'
14+
import { IsNativeIOS, IsAndroid } from '@standardnotes/ui-services'
1515

1616
export class PurchaseFlowController extends AbstractViewController {
1717
isOpen = false
@@ -25,7 +25,7 @@ export class PurchaseFlowController extends AbstractViewController {
2525
private mobileDevice: MobileDeviceInterface | undefined,
2626
private _loadPurchaseFlowUrl: LoadPurchaseFlowUrl,
2727
private _isNativeIOS: IsNativeIOS,
28-
private _isNativeAndroid: IsNativeAndroid,
28+
private _isAndroid: IsAndroid,
2929
eventBus: InternalEventBusInterface,
3030
) {
3131
super(eventBus)
@@ -45,7 +45,7 @@ export class PurchaseFlowController extends AbstractViewController {
4545
}
4646

4747
openPurchaseFlow = async (plan = AppleIAPProductId.ProPlanYearly) => {
48-
if (this._isNativeAndroid.execute().getValue()) {
48+
if (this._isAndroid.execute().getValue()) {
4949
return
5050
}
5151

@@ -63,7 +63,7 @@ export class PurchaseFlowController extends AbstractViewController {
6363
}
6464

6565
openPurchaseWebpage = async () => {
66-
if (this._isNativeAndroid.execute().getValue()) {
66+
if (this._isAndroid.execute().getValue()) {
6767
return
6868
}
6969

0 commit comments

Comments
 (0)