mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
commit before rebase
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { delay, map, distinctUntilChanged } from 'rxjs/operators';
|
import { delay, map, distinctUntilChanged, filter, take } from 'rxjs/operators';
|
||||||
import {
|
import {
|
||||||
AfterViewInit,
|
AfterViewInit,
|
||||||
ChangeDetectionStrategy,
|
ChangeDetectionStrategy,
|
||||||
@@ -84,7 +84,6 @@ export class AppComponent implements OnInit, AfterViewInit {
|
|||||||
// set the current language code
|
// set the current language code
|
||||||
this.localeService.setCurrentLanguageCode();
|
this.localeService.setCurrentLanguageCode();
|
||||||
|
|
||||||
this.initializeKlaro();
|
|
||||||
|
|
||||||
angulartics2GoogleAnalytics.startTracking();
|
angulartics2GoogleAnalytics.startTracking();
|
||||||
angulartics2DSpace.startTracking();
|
angulartics2DSpace.startTracking();
|
||||||
@@ -103,6 +102,12 @@ export class AppComponent implements OnInit, AfterViewInit {
|
|||||||
map((isBlocking: boolean) => isBlocking === false),
|
map((isBlocking: boolean) => isBlocking === false),
|
||||||
distinctUntilChanged()
|
distinctUntilChanged()
|
||||||
);
|
);
|
||||||
|
this.isNotAuthBlocking$
|
||||||
|
.pipe(
|
||||||
|
filter((notBlocking: boolean) => notBlocking),
|
||||||
|
take(1)
|
||||||
|
).subscribe(() => this.initializeKlaro());
|
||||||
|
|
||||||
const env: string = environment.production ? 'Production' : 'Development';
|
const env: string = environment.production ? 'Production' : 'Development';
|
||||||
const color: string = environment.production ? 'red' : 'green';
|
const color: string = environment.production ? 'red' : 'green';
|
||||||
console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`);
|
console.info(`Environment: %c${env}`, `color: ${color}; font-weight: bold;`);
|
||||||
@@ -150,7 +155,6 @@ export class AppComponent implements OnInit, AfterViewInit {
|
|||||||
this.isLoading$.next(false);
|
this.isLoading$.next(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.translate.get('loading.default').subscribe(t => console.log(t));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('window:resize', ['$event'])
|
@HostListener('window:resize', ['$event'])
|
||||||
|
@@ -176,17 +176,6 @@ export class BrowserKlaroService extends KlaroService {
|
|||||||
// */
|
// */
|
||||||
// 'piwik_ignore',
|
// 'piwik_ignore',
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
|
||||||
You can define an optional callback function that will be called each time the
|
|
||||||
consent state for the given app changes. The consent value will be passed as the
|
|
||||||
first parameter to the function (true=consented). The `app` config will be
|
|
||||||
passed as the second parameter.
|
|
||||||
*/
|
|
||||||
callback: (consent, app) => {
|
|
||||||
console.log(consent, app);
|
|
||||||
this.message$.next('User consent for app ' + app.name + ': consent=' + consent);
|
|
||||||
},
|
|
||||||
/*
|
/*
|
||||||
If 'onlyOnce' is set to 'true', the app will only be executed once regardless
|
If 'onlyOnce' is set to 'true', the app will only be executed once regardless
|
||||||
how often the user toggles it on and off. This is relevant e.g. for tracking
|
how often the user toggles it on and off. This is relevant e.g. for tracking
|
||||||
@@ -217,6 +206,7 @@ export class BrowserKlaroService extends KlaroService {
|
|||||||
.pipe(
|
.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
switchMap((loggedIn: boolean) => {
|
switchMap((loggedIn: boolean) => {
|
||||||
|
console.log('loggedIn', loggedIn);
|
||||||
if (loggedIn) {
|
if (loggedIn) {
|
||||||
return this.authService.getAuthenticatedUserFromStore();
|
return this.authService.getAuthenticatedUserFromStore();
|
||||||
}
|
}
|
||||||
@@ -232,6 +222,13 @@ export class BrowserKlaroService extends KlaroService {
|
|||||||
if (hasValue(user)) {
|
if (hasValue(user)) {
|
||||||
this.klaroConfig.callback = (consent, app) => this.updateSettingsForUsers(user);
|
this.klaroConfig.callback = (consent, app) => this.updateSettingsForUsers(user);
|
||||||
this.klaroConfig.storageName = this.getStorageName(user.uuid);
|
this.klaroConfig.storageName = this.getStorageName(user.uuid);
|
||||||
|
|
||||||
|
const anonCookie = this.cookieService.get(this.getStorageName('anonymous'));
|
||||||
|
if (hasValue(this.getSettingsForUser(user))) {
|
||||||
|
this.restoreSettingsForUsers(user);
|
||||||
|
} else if (hasValue(anonCookie)) {
|
||||||
|
this.cookieService.set(this.getStorageName(user.uuid), anonCookie);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user