diff --git a/src/app/services/util/onboarding.service.ts b/src/app/services/util/onboarding.service.ts index 924a7c7466e3e7ef3e9fe85af089f591a971e106..07a434ba8e976d2f2669e3f237286bd74b0010d9 100644 --- a/src/app/services/util/onboarding.service.ts +++ b/src/app/services/util/onboarding.service.ts @@ -60,7 +60,7 @@ export class OnboardingService { startDefaultTour(ignoreDone = false): boolean { return this.startOnboardingTour( - initDefaultTour(this.authenticationService, this.dataStoreService, this.router, this.roomService), ignoreDone); + initDefaultTour(this.authenticationService, this.dataStoreService, this.roomService), ignoreDone); } doStep(stepDirection: number): boolean { @@ -109,6 +109,9 @@ export class OnboardingService { if (tourInfo && tourInfo.state !== 'running') { return false; } + if (!this.dataStoreService.has('onboarding_' + tour.name + '_redirect')) { + this.dataStoreService.set('onboarding_' + tour.name + '_redirect', this.router.url); + } AppComponent.rescale.setDefaultScale(1); this._currentStep = tourInfo && tourInfo.step ? tourInfo.step : 1; const firstStepRoute = tour.tour[this._currentStep - 1].split('@'); @@ -212,11 +215,15 @@ export class OnboardingService { } private cleanup(finished = false) { + const redirectKey = 'onboarding_' + this._activeTour.name + '_redirect'; + const redirect = this.dataStoreService.get(redirectKey); this._eventServiceSubscription.unsubscribe(); this._activeTour = null; if (finished) { this._tourSubscription.unsubscribe(); window.removeEventListener('keyup', this._keyUpWrapper); + this.dataStoreService.remove(redirectKey); + this.router.navigate([redirect]); } } diff --git a/src/app/services/util/onboarding.tours.ts b/src/app/services/util/onboarding.tours.ts index a7eb6c49ba2569bee810b2c9994250605d98c23e..e129d1724efb23499b4fb270a56d918f1a286e9d 100644 --- a/src/app/services/util/onboarding.tours.ts +++ b/src/app/services/util/onboarding.tours.ts @@ -1,7 +1,6 @@ import { AuthenticationService } from '../http/authentication.service'; import { UserRole } from '../../models/user-roles.enum'; import { DataStoreService } from './data-store.service'; -import { Router } from '@angular/router'; import { RoomService } from '../http/room.service'; import { Observable, of, Subject } from 'rxjs'; @@ -36,7 +35,6 @@ const roomChecker = (roomService: RoomService, roomUrl: string): Observable<bool export const initDefaultTour = (authenticationService: AuthenticationService, dataStoreService: DataStoreService, - router: Router, roomService: RoomService): OnboardingTour => ({ name: 'default', tour: [ @@ -76,7 +74,6 @@ export const initDefaultTour = (authenticationService: AuthenticationService, authenticationService.logout(); } dataStoreService.remove('onboarding-default-meta'); - router.navigate(['/home']); }, startupAction: () => { dataStoreService.set('onboarding-default-meta', String(authenticationService.isLoggedIn()));