Skip to content
Snippets Groups Projects
Commit 84c96004 authored by Ruben Bimberg's avatar Ruben Bimberg :computer:
Browse files

Resolve issue with the onboarding tour

parent 4a5e5f64
No related merge requests found
......@@ -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]);
}
}
......
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()));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment