Login dialog shows error for Safari with Private Window mode (#1172)

* #958 new StorageService service

abstraction around ‘Storage’ to allow switching to in-memory store
whenever ‘localStorage’ is not available (i.e. private/incognito modes,
etc.)

* fix unit tests

* update unit tests

- disable incorrect auth tests (core)
- simplify widget visibility tests (activiti-form)

* fix unit tests
This commit is contained in:
Denys Vuika
2016-11-30 11:32:16 +00:00
committed by Eugenio Romano
parent 94dad585b1
commit da70a72bba
33 changed files with 494 additions and 414 deletions

View File

@@ -21,7 +21,8 @@ import { Router } from '@angular/router';
import {
AlfrescoTranslationService,
AlfrescoAuthenticationService,
AlfrescoSettingsService
AlfrescoSettingsService,
StorageService
} from 'ng2-alfresco-core';
declare var document: any;
@@ -40,7 +41,8 @@ export class AppComponent {
constructor(public auth: AlfrescoAuthenticationService,
public router: Router,
public alfrescoSettingsService: AlfrescoSettingsService,
private translate: AlfrescoTranslationService) {
private translate: AlfrescoTranslationService,
private storage: StorageService) {
this.setEcmHost();
this.setBpmHost();
this.setProvider();
@@ -103,26 +105,26 @@ export class AppComponent {
}
private setEcmHost() {
if (localStorage.getItem(`ecmHost`)) {
this.alfrescoSettingsService.ecmHost = localStorage.getItem(`ecmHost`);
this.ecmHost = localStorage.getItem(`ecmHost`);
if (this.storage.hasItem(`ecmHost`)) {
this.alfrescoSettingsService.ecmHost = this.storage.getItem(`ecmHost`);
this.ecmHost = this.storage.getItem(`ecmHost`);
} else {
this.alfrescoSettingsService.ecmHost = this.ecmHost;
}
}
private setBpmHost() {
if (localStorage.getItem(`bpmHost`)) {
this.alfrescoSettingsService.bpmHost = localStorage.getItem(`bpmHost`);
this.bpmHost = localStorage.getItem(`bpmHost`);
if (this.storage.hasItem(`bpmHost`)) {
this.alfrescoSettingsService.bpmHost = this.storage.getItem(`bpmHost`);
this.bpmHost = this.storage.getItem(`bpmHost`);
} else {
this.alfrescoSettingsService.bpmHost = this.bpmHost;
}
}
private setProvider() {
if (localStorage.getItem(`providers`)) {
this.alfrescoSettingsService.setProviders(localStorage.getItem(`providers`));
if (this.storage.hasItem(`providers`)) {
this.alfrescoSettingsService.setProviders(this.storage.getItem(`providers`));
}
}
}