Skip to content

Commit

Permalink
Merge pull request #360 from swisstopo/develop
Browse files Browse the repository at this point in the history
Release to INT
  • Loading branch information
vej-ananas authored Nov 28, 2024
2 parents 3247f65 + 14aae86 commit 2e20f5f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import { ENTER } from '@angular/cdk/keycodes';
import { HttpClient } from '@angular/common/http';
import {
ChangeDetectionStrategy,
Component,
ElementRef,
inject,
Input,
OnInit,
Output,
ViewChild,
} from '@angular/core';
import { Component, ElementRef, inject, Input, OnInit, Output, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { appSharedStateActions, AuthService, fromAppShared } from '@asset-sg/client-shared';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
Expand All @@ -24,7 +15,6 @@ import { Version } from './version';
selector: 'asset-sg-app-bar',
templateUrl: './app-bar.component.html',
styleUrls: ['./app-bar.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppBarComponent implements OnInit {
// TODO use new pattern here
Expand Down
18 changes: 10 additions & 8 deletions libs/client-shared/src/lib/features/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export class AuthService {
private readonly _isInitialized$ = new BehaviorSubject(false);

async initialize(oAuthConfig: Record<string, unknown>) {
if (oAuthConfig['anonymous_mode']) {
const isAnonymous = oAuthConfig['anonymous_mode'];
if (isAnonymous) {
this.setState(AuthState.Success);
this.store.dispatch(appSharedStateActions.setAnonymousMode());
} else {
Expand All @@ -50,6 +51,14 @@ export class AuthService {
this.store.dispatch(appSharedStateActions.loadUserProfile());
}
this._isInitialized$.next(true);

const isLoggedIn = isAnonymous || this._state$.value === AuthState.Success;
if (isLoggedIn && !this.configService.getHideDisclaimer()) {
this.dialogService.open(DisclaimerDialogComponent, {
width: '500px',
disableClose: true,
});
}
}

async signIn(): Promise<void> {
Expand All @@ -62,13 +71,6 @@ export class AuthService {
// If something else has interrupted the auth process, then we don't want to signal a success.
if (this._state$.value === AuthState.Ongoing) {
this._state$.next(AuthState.Success);

if (!this.configService.getHideDisclaimer()) {
this.dialogService.open(DisclaimerDialogComponent, {
width: '500px',
disableClose: true,
});
}
}
}
} else {
Expand Down

0 comments on commit 2e20f5f

Please sign in to comment.