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 { LoadFontService } from './core/ui-services/load-font.service';
import { LoginDataService } from './core/ui-services/login-data.service'; import { LoginDataService } from './core/ui-services/login-data.service';
import { OfflineService } from './core/core-services/offline.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 { OperatorService } from './core/core-services/operator.service';
import { OverlayService } from './core/ui-services/overlay.service'; import { OverlayService } from './core/ui-services/overlay.service';
import { RoutingStateService } from './core/ui-services/routing-state.service'; import { RoutingStateService } from './core/ui-services/routing-state.service';
@ -60,16 +61,8 @@ export class AppComponent {
* *
* Handles the altering of Array.toString() * Handles the altering of Array.toString()
* *
* @param translate To set the default language * Most of the injected service are not used - this is ok. It is needed to definitly
* @param operator To call the constructor of the OperatorService * run their constructors at app loading time
* @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
*/ */
public constructor( public constructor(
private matIconRegistry: MatIconRegistry, private matIconRegistry: MatIconRegistry,
@ -77,6 +70,7 @@ export class AppComponent {
translate: TranslateService, translate: TranslateService,
appRef: ApplicationRef, appRef: ApplicationRef,
servertimeService: ServertimeService, servertimeService: ServertimeService,
openslidesService: OpenSlidesService,
router: Router, router: Router,
offlineService: OfflineService, offlineService: OfflineService,
operator: OperatorService, operator: OperatorService,
@ -114,7 +108,10 @@ export class AppComponent {
filter(s => s), filter(s => s),
take(1) take(1)
) )
.subscribe(() => servertimeService.startScheduler()); .subscribe(() => {
openslidesService.setStable();
servertimeService.startScheduler();
});
} }
private overloadArrayFunctions(): void { private overloadArrayFunctions(): void {

View File

@ -5,6 +5,7 @@ import { BehaviorSubject } from 'rxjs';
import { CommunicationManagerService } from './communication-manager.service'; import { CommunicationManagerService } from './communication-manager.service';
import { DataStoreService } from './data-store.service'; import { DataStoreService } from './data-store.service';
import { Deferred } from '../promises/deferred';
import { OfflineBroadcastService, OfflineReason } from './offline-broadcast.service'; import { OfflineBroadcastService, OfflineReason } from './offline-broadcast.service';
import { OperatorService, WhoAmI } from './operator.service'; import { OperatorService, WhoAmI } from './operator.service';
import { StorageService } from './storage.service'; import { StorageService } from './storage.service';
@ -34,6 +35,8 @@ export class OpenSlidesService {
return this.booted.value; return this.booted.value;
} }
private stable = new Deferred();
public constructor( public constructor(
private storageService: StorageService, private storageService: StorageService,
private operator: OperatorService, private operator: OperatorService,
@ -42,15 +45,13 @@ export class OpenSlidesService {
private communicationManager: CommunicationManagerService, private communicationManager: CommunicationManagerService,
private offlineBroadcastService: OfflineBroadcastService 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(); this.bootup();
} }
public setStable(): void {
this.stable.resolve();
}
/** /**
* the bootup-sequence: Do a whoami request and if it was successful, do * the bootup-sequence: Do a whoami request and if it was successful, do
* {@method afterLoginBootup}. If not, redirect the user to the login page. * {@method afterLoginBootup}. If not, redirect the user to the login page.
@ -124,6 +125,7 @@ export class OpenSlidesService {
*/ */
private async setupDataStoreAndStartCommunication(): Promise<void> { private async setupDataStoreAndStartCommunication(): Promise<void> {
await this.DS.initFromStorage(); await this.DS.initFromStorage();
await this.stable;
this.communicationManager.startCommunication(); this.communicationManager.startCommunication();
} }