-
+
Início
@@ -44,18 +44,18 @@
-
+
+
-
+
@@ -65,6 +65,5 @@
-
+
-
\ No newline at end of file
diff --git a/src/app/store/despacho-store.service.spec.ts b/src/app/store/despacho-store.service.spec.ts
new file mode 100644
index 000000000..459bfef6f
--- /dev/null
+++ b/src/app/store/despacho-store.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { DespachoStoreService } from './despacho-store.service';
+
+describe('DespachoStoreService', () => {
+ let service: DespachoStoreService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(DespachoStoreService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/store/despacho-store.service.ts b/src/app/store/despacho-store.service.ts
new file mode 100644
index 000000000..582b6ceae
--- /dev/null
+++ b/src/app/store/despacho-store.service.ts
@@ -0,0 +1,58 @@
+import { Injectable } from '@angular/core';
+import { localstoreService } from './localstore.service'
+import { AES, enc, SHA1 } from 'crypto-js'
+
+@Injectable({
+ providedIn: 'root'
+})
+export class DespachoStoreService {
+
+ // main data
+ private _list: Event[]
+ // local storage keyName
+ private keyName: string;
+ private _count = 0
+
+ constructor() {
+
+ this.keyName = (SHA1(this.constructor.name+ 'home/eventSource')).toString()
+
+
+ setTimeout(()=>{
+ let restore = localstoreService.get(this.keyName, {})
+ this._list = restore.eventsList || []
+ this._count = restore.count || 0
+ }, 10)
+
+ }
+
+ get list() {
+ return this._list
+ }
+ get count() {
+ return this._count
+ }
+ set count(value) {
+ this._count = value
+ }
+
+ reset(eventsList: any) {
+ this._list = eventsList
+
+ this.count = this._list.length
+ this.save(this._list)
+ }
+
+ private save(eventsList: any) {
+ setTimeout(()=>{
+ localstoreService.set(this.keyName,{
+ eventsList,
+ count: this._list
+ })
+ }, 10)
+
+ }
+
+}
+
+export const DespachoStore = new DespachoStoreService()
diff --git a/src/app/store/publication-event-folder.service.ts b/src/app/store/publication-event-folder.service.ts
index cabdba605..9c5d229ed 100644
--- a/src/app/store/publication-event-folder.service.ts
+++ b/src/app/store/publication-event-folder.service.ts
@@ -10,13 +10,13 @@ export class PublicationEventFolderService {
// main data
private _list: PublicationFolder[] = []
// local storage keyName
- private keyName: string;
+ private keyName: string;
constructor() {
this.keyName = (SHA1(this.constructor.name+ 'PublicationEventFolder/local')).toString()
- setTimeout(()=>{
+ setTimeout(()=>{
let restore = localstoreService.get(this.keyName, [])
this._list = restore
}, 10)
@@ -34,10 +34,10 @@ export class PublicationEventFolderService {
}
private save(list: PublicationFolder[]) {
- setTimeout(()=> {
+ setTimeout(()=> {
localstoreService.set(this.keyName, list)
}, 10)
}
}
-export const PublicationEventFolderStorage = new PublicationEventFolderService()
\ No newline at end of file
+export const PublicationEventFolderStorage = new PublicationEventFolderService()
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index 2b6b37e91..4f006b22a 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -20,4 +20,4 @@ export const environment = {
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
-// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
+// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
diff --git a/src/polyfills.ts b/src/polyfills.ts
index 9d5173a3a..4f7af3834 100644
--- a/src/polyfills.ts
+++ b/src/polyfills.ts
@@ -62,7 +62,7 @@ import './zone-flags';
* Zone JS is required by default for Angular itself.
*/
-import 'zone.js/dist/zone'; // Included with Angular CLI.
+import 'zone.js'; // Included with Angular CLI.
/***************************************************************************************************
diff --git a/src/test.ts b/src/test.ts
index 16317897b..a6f15af36 100644
--- a/src/test.ts
+++ b/src/test.ts
@@ -1,6 +1,6 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
-import 'zone.js/dist/zone-testing';
+import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,