chore: remove calling payments server for subscriptions if using third party api hosts (#2398)

This commit is contained in:
Karol Sójko
2023-08-09 13:16:19 +02:00
committed by GitHub
parent e05d8c9e76
commit 90dcb33a44
24 changed files with 233 additions and 89 deletions

View File

@@ -962,10 +962,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
}
}
public isThirdPartyHostUsed(): boolean {
return this.legacyApi.isThirdPartyHostUsed()
}
async isUsingHomeServer(): Promise<boolean> {
const homeServerService = this.dependencies.get<HomeServerServiceInterface>(TYPES.HomeServerService)

View File

@@ -133,6 +133,7 @@ import {
GenerateUuid,
GetVaultItems,
ValidateVaultPassword,
IsApplicationUsingThirdPartyHost,
} from '@standardnotes/services'
import { ItemManager } from '../../Services/Items/ItemManager'
import { PayloadManager } from '../../Services/Payloads/PayloadManager'
@@ -243,6 +244,10 @@ export class Dependencies {
return new GetHost(this.get<LegacyApiService>(TYPES.LegacyApiService))
})
this.factory.set(TYPES.IsApplicationUsingThirdPartyHost, () => {
return new IsApplicationUsingThirdPartyHost(this.get<GetHost>(TYPES.GetHost))
})
this.factory.set(TYPES.SetHost, () => {
return new SetHost(this.get<HttpService>(TYPES.HttpService), this.get<LegacyApiService>(TYPES.LegacyApiService))
})
@@ -1159,6 +1164,7 @@ export class Dependencies {
this.get<SessionManager>(TYPES.SessionManager),
this.get<PureCryptoInterface>(TYPES.Crypto),
this.get<Logger>(TYPES.Logger),
this.get<IsApplicationUsingThirdPartyHost>(TYPES.IsApplicationUsingThirdPartyHost),
this.get<InternalEventBus>(TYPES.InternalEventBus),
)
})
@@ -1267,6 +1273,7 @@ export class Dependencies {
this.get<SubscriptionApiService>(TYPES.SubscriptionApiService),
this.get<SessionManager>(TYPES.SessionManager),
this.get<DiskStorageService>(TYPES.DiskStorageService),
this.get<IsApplicationUsingThirdPartyHost>(TYPES.IsApplicationUsingThirdPartyHost),
this.get<InternalEventBus>(TYPES.InternalEventBus),
)
})
@@ -1286,6 +1293,7 @@ export class Dependencies {
this.get<LegacySessionStorageMapper>(TYPES.LegacySessionStorageMapper),
this.options.identifier,
this.get<GetKeyPairs>(TYPES.GetKeyPairs),
this.get<IsApplicationUsingThirdPartyHost>(TYPES.IsApplicationUsingThirdPartyHost),
this.get<InternalEventBus>(TYPES.InternalEventBus),
)
})

View File

@@ -158,6 +158,7 @@ export const TYPES = {
ChangeVaultStorageMode: Symbol.for('ChangeVaultStorageMode'),
ChangeAndSaveItem: Symbol.for('ChangeAndSaveItem'),
GetHost: Symbol.for('GetHost'),
IsApplicationUsingThirdPartyHost: Symbol.for('IsApplicationUsingThirdPartyHost'),
SetHost: Symbol.for('SetHost'),
GenerateUuid: Symbol.for('GenerateUuid'),
GetVaultItems: Symbol.for('GetVaultItems'),