Merge pull request #5847 from FinnStutzenstein/loadingIndicator

Wait for a stable app (closes #5813)
This commit is contained in:
Finn Stutzenstein 2021-02-04 13:08:05 +01:00 committed by GitHub
commit 5b2f8409e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 17 deletions

View File

@ -13,6 +13,7 @@ import { DataStoreUpgradeService } from './core/core-services/data-store-upgrade
import { LoadFontService } from './core/ui-services/load-font.service';
import { LoginDataService } from './core/ui-services/login-data.service';
import { OfflineService } from './core/core-services/offline.service';
import { OpenSlidesService } from './core/core-services/openslides.service';
import { OperatorService } from './core/core-services/operator.service';
import { OverlayService } from './core/ui-services/overlay.service';
import { RoutingStateService } from './core/ui-services/routing-state.service';
@ -60,16 +61,8 @@ export class AppComponent {
*
* Handles the altering of Array.toString()
*
* @param translate To set the default language
* @param operator To call the constructor of the OperatorService
* @param loginDataService to call the constructor of the LoginDataService
* @param constantService to call the constructor of the ConstantService
* @param servertimeService executes the scheduler early on
* @param themeService used to listen to theme-changes
* @param countUsersService to call the constructor of the CountUserService
* @param configService to call the constructor of the ConfigService
* @param loadFontService to call the constructor of the LoadFontService
* @param dataStoreUpgradeService
* Most of the injected service are not used - this is ok. It is needed to definitly
* run their constructors at app loading time
*/
public constructor(
private matIconRegistry: MatIconRegistry,
@ -77,6 +70,7 @@ export class AppComponent {
translate: TranslateService,
appRef: ApplicationRef,
servertimeService: ServertimeService,
openslidesService: OpenSlidesService,
router: Router,
offlineService: OfflineService,
operator: OperatorService,
@ -114,7 +108,10 @@ export class AppComponent {
filter(s => s),
take(1)
)
.subscribe(() => servertimeService.startScheduler());
.subscribe(() => {
openslidesService.setStable();
servertimeService.startScheduler();
});
}
private overloadArrayFunctions(): void {

View File

@ -5,6 +5,7 @@ import { BehaviorSubject } from 'rxjs';
import { CommunicationManagerService } from './communication-manager.service';
import { DataStoreService } from './data-store.service';
import { Deferred } from '../promises/deferred';
import { OfflineBroadcastService, OfflineReason } from './offline-broadcast.service';
import { OperatorService, WhoAmI } from './operator.service';
import { StorageService } from './storage.service';
@ -34,6 +35,8 @@ export class OpenSlidesService {
return this.booted.value;
}
private stable = new Deferred();
public constructor(
private storageService: StorageService,
private operator: OperatorService,
@ -42,15 +45,13 @@ export class OpenSlidesService {
private communicationManager: CommunicationManagerService,
private offlineBroadcastService: OfflineBroadcastService
) {
// Handler that gets called, if the websocket connection reconnects after a disconnection.
// There might have changed something on the server, so we check the operator, if he changed.
/*websocketService.retryReconnectEvent.subscribe(() => {
this.checkOperator();
});*/
this.bootup();
}
public setStable(): void {
this.stable.resolve();
}
/**
* the bootup-sequence: Do a whoami request and if it was successful, do
* {@method afterLoginBootup}. If not, redirect the user to the login page.
@ -124,6 +125,7 @@ export class OpenSlidesService {
*/
private async setupDataStoreAndStartCommunication(): Promise<void> {
await this.DS.initFromStorage();
await this.stable;
this.communicationManager.startCommunication();
}