This commit is contained in:
Mo
2022-11-13 09:28:16 -06:00
committed by GitHub
parent e56a960bbf
commit d519aca685
49 changed files with 512 additions and 151 deletions

View File

@@ -287,6 +287,10 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
return this.listedService
}
public get alerts(): ExternalServices.AlertService {
return this.alertService
}
public computePrivateUsername(username: string): Promise<string | undefined> {
return ComputePrivateUsername(this.options.crypto, username)
}
@@ -367,8 +371,12 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
await this.handleStage(ExternalServices.ApplicationStage.StorageDecrypted_09)
this.apiService.loadHost()
const host = this.apiService.loadHost()
this.httpService.setHost(host)
this.webSocketsService.loadWebSocketUrl()
await this.sessionManager.initializeFromDisk()
this.settingsService.initializeFromDisk()
@@ -594,6 +602,7 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
public async setCustomHost(host: string): Promise<void> {
await this.setHost(host)
this.webSocketsService.setWebSocketUrl(undefined)
}
@@ -1072,7 +1081,7 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
this.createProtocolService()
this.diskStorageService.provideEncryptionProvider(this.protocolService)
this.createChallengeService()
this.createHttpManager()
this.createLegacyHttpManager()
this.createApiService()
this.createHttpService()
this.createUserServer()
@@ -1238,6 +1247,10 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
void this.notifyEvent(ApplicationEvent.FeaturesUpdated)
break
}
case ExternalServices.FeaturesEvent.DidPurchaseSubscription: {
void this.notifyEvent(ApplicationEvent.DidPurchaseSubscription)
break
}
default: {
Utils.assertUnreachable(event)
}
@@ -1385,7 +1398,7 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
this.services.push(this.componentManagerService)
}
private createHttpManager() {
private createLegacyHttpManager() {
this.deprecatedHttpService = new InternalServices.SNHttpService(
this.environment,
this.options.appVersion,
@@ -1399,7 +1412,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
this.environment,
this.options.appVersion,
SnjsVersion,
this.options.defaultHost,
this.apiService.processMetaObject.bind(this.apiService),
)
}