diff --git a/package.json b/package.json index ac8a960e5..7ed2ff043 100644 --- a/package.json +++ b/package.json @@ -177,4 +177,4 @@ "url": "git+https://Kayaya@bitbucket.org/equilibriumito/gabinete-digital.git" }, "license": "ISC" -} \ No newline at end of file +} diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index d60cc0446..e6a996b82 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -79,10 +79,12 @@ export class HomePage implements OnInit { } mobilefirstConnect() { - window['WLAuthorizationManager'].obtainAccessToken("").then( - (token) => { + + try { + window['WLAuthorizationManager'].obtainAccessToken("").then( (token) => { + console.log('MobileFirst Server connect: Success ' + token); - + var resourceRequest = new WLResourceRequest("/adapters/javaAdapter/resource/greet/", WLResourceRequest.GET ); @@ -105,8 +107,9 @@ export class HomePage implements OnInit { alert("Bummer..."); alert("Failed to connect to MobileFirst Server"); }); */ - } - ); + }); + } catch {} + } } diff --git a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts index df03737b8..38b168434 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts +++ b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts @@ -137,12 +137,17 @@ export class DespachoPrPage implements OnInit { }); this.getDocumentDetails(this.task.FolderId, '361'); - }, ()=>{ + }, (error)=>{ try { - this.toastService.badRequest('Processo não encontrado') this.goBack() } catch (e) { window.history.back(); + } finally { + if(error.status == 0) { + this.toastService.badRequest('Não é possível vizualizar este processo no modo offline') + } else { + this.toastService.badRequest('Processo não encontrado') + } } }); } diff --git a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts index c2be7694c..31c55ea0c 100644 --- a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts +++ b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.ts @@ -139,12 +139,17 @@ export class DespachoPage implements OnInit { }); }); this.getDocumentDetails(this.task.FolderId, '361'); - }, ()=>{ + }, (error)=>{ try { - this.toastService.badRequest('Processo não encontrado') this.goBack() } catch (e) { window.history.back(); + } finally { + if(error.status == 0) { + this.toastService.badRequest('Não é possível vizualizar este processo no modo offline') + } else { + this.toastService.badRequest('Processo não encontrado') + } } }); } diff --git a/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts b/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts index 1497499a5..9d75153fe 100644 --- a/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts +++ b/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts @@ -123,12 +123,18 @@ export class DiplomaAssinarPage implements OnInit { }); this.getDocumentDetails(this.task.FolderId, '361'); - }, ()=>{ + }, (error)=>{ try { this.toastService.badRequest('Processo não encontrado') this.goBack() } catch (e) { window.history.back(); + } finally { + if(error.status == 0) { + this.toastService.badRequest('Não é possível vizualizar este processo no modo offline') + } else { + this.toastService.badRequest('Processo não encontrado') + } } }); diff --git a/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts b/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts index fb1bb59f5..b98ba048b 100644 --- a/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts +++ b/src/app/pages/gabinete-digital/diplomas/diploma/diploma.page.ts @@ -138,12 +138,17 @@ export class DiplomaPage implements OnInit { }); this.getDocumentDetails(this.task.FolderId, '361'); - }, ()=>{ + }, (error)=>{ try { - this.toastService.badRequest('Processo não encontrado') this.goBack() } catch (e) { window.history.back(); + } finally { + if(error.status == 0) { + this.toastService.badRequest('Não é possível vizualizar este processo no modo offline') + } else { + this.toastService.badRequest('Processo não encontrado') + } } }); diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts index bab6d723e..59edb0cb5 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts @@ -49,14 +49,14 @@ export class ExpedienteDetailPage implements OnInit { private activatedRoute: ActivatedRoute, private toastService: ToastService, ) { - this.activatedRoute.paramMap.subscribe(params => { - if(params["params"].SerialNumber) { - this.serialnumber = params["params"].SerialNumber; - } - if(params["params"].caller) { - this.caller = params["params"].caller; - } - }); + this.activatedRoute.paramMap.subscribe(params => { + if(params["params"].SerialNumber) { + this.serialnumber = params["params"].SerialNumber; + } + if(params["params"].caller) { + this.caller = params["params"].caller; + } + }); } ngOnInit() { @@ -160,12 +160,18 @@ export class ExpedienteDetailPage implements OnInit { console.log('this.task', this.task) console.log('this.task.DocumentURL', this.task.DocumentURL) - }, ()=>{ + }, (error)=>{ try { this.toastService.badRequest('Processo não encontrado') this.goBack() } catch (e) { window.history.back(); + } finally { + if(error.status == 0) { + this.toastService.badRequest('Não é possível vizualizar este processo no modo offline') + } else { + this.toastService.badRequest('Processo não encontrado') + } } }); diff --git a/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.ts b/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.ts index 584fd0671..a090b7b78 100644 --- a/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.ts +++ b/src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.ts @@ -187,12 +187,18 @@ export class ExpedientePrPage implements OnInit { }) - }, ()=>{ + }, (error)=>{ try { this.toastService.badRequest('Processo não encontrado') this.goBack() } catch (e) { window.history.back(); + } finally { + if(error.status == 0) { + this.toastService.badRequest('Não é possível vizualizar este processo no modo offline') + } else { + this.toastService.badRequest('Processo não encontrado') + } } }); } diff --git a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts index 3a21c4d02..e23e48956 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts +++ b/src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.ts @@ -156,13 +156,18 @@ export class PedidoPage implements OnInit { }); }); this.getDocumentDetails(res.workflowInstanceDataFields.FolderID, '361'); - }, ()=>{ + }, (error)=>{ try { - this.toastService.badRequest('Processo não encontrado') this.goBack() this.close() } catch (e) { window.history.back(); + } finally { + if(error.status == 0) { + this.toastService.badRequest('Não é possível vizualizar este processo no modo offline') + } else { + this.toastService.badRequest('Processo não encontrado') + } } }); diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 0cfbd7b86..3598ff96a 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -124,7 +124,7 @@ export class LoginPage implements OnInit { domainName: environment.domain, BasicAuthKey: "" } - let attempt = await this.authService.login(this.userattempt); + let attempt = await this.authService.login(this.userattempt) if (attempt) { this.authService.loginChat(this.userattempt); @@ -138,9 +138,6 @@ export class LoginPage implements OnInit { this.router.navigate(['/home/events']); } } - else { - this.toastService.badRequest('O email e/ou palavra-passe estão incorretas ou verifique a sua conexão com a internet e volte a tentar'); - } } else { this.toastService.badRequest('Por favor, insira a sua palavra-passe'); diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts index f3c6666f4..20e13fc9c 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -88,10 +88,12 @@ export class ViewPublicationsPage implements OnInit { } getPublicationDetail() { + setTimeout(() => { - let allActions = this.publicationEventFolderStorage.list.concat(this.publicationTravelFolderService.list) - this.item = allActions.find((e)=> e.ProcessId == this.folderId); - }, 100); + let allActions = this.publicationEventFolderStorage.list.concat(this.publicationTravelFolderService.list) + this.item = allActions.find((e)=> e.ProcessId == this.folderId); + }, 100); + } getPublications() { diff --git a/src/app/pages/search/search.page.ts b/src/app/pages/search/search.page.ts index 3977a4821..15c6a5231 100644 --- a/src/app/pages/search/search.page.ts +++ b/src/app/pages/search/search.page.ts @@ -428,7 +428,7 @@ export class SearchPage implements OnInit { /** * @description set empty value to searchSubject */ - clearSearchInput(){ + clearSearchInput() { this.searchSubject = "" this.searchCategories = []; @@ -436,8 +436,7 @@ export class SearchPage implements OnInit { this.showDocuments = false; this.wordCloud(); - - } + } /** * @param isoDate String Iso date diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 957ed48a2..2a69c3907 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -9,6 +9,7 @@ import { BehaviorSubject, Observable } from 'rxjs'; import { AuthConnstants } from '../config/auth-constants'; import { AlertController } from '@ionic/angular'; import { LocalstoreService } from '../store/localstore.service'; +import { ToastService } from './toast.service'; @Injectable({ providedIn: 'root' @@ -27,7 +28,8 @@ export class AuthService { private storageService:StorageService, private router:Router, public alertController: AlertController, - private localstoreService: LocalstoreService + private localstoreService: LocalstoreService, + private toastService: ToastService, ) { this.headers = new HttpHeaders(); @@ -80,6 +82,11 @@ export class AuthService { } } catch (error) { + if(error.status == 0) { + this.toastService.badRequest('Verifique a sua conexão com a internet e volte a tentar') + } else { + this.toastService.badRequest('O email e/ou palavra-passe estão incorretas ou verifique a sua conexão com a internet e volte a tentar'); + } return false; } diff --git a/src/app/shared/agenda/view-event/view-event.page.ts b/src/app/shared/agenda/view-event/view-event.page.ts index d6468e6a8..28303ccaa 100644 --- a/src/app/shared/agenda/view-event/view-event.page.ts +++ b/src/app/shared/agenda/view-event/view-event.page.ts @@ -100,12 +100,20 @@ export class ViewEventPage implements OnInit { this.today = new Date(res.StartDate); this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); this.getAttachments(this.loadedEvent.EventId); - }, (errer)=> { + }, (error)=> { + + console.log('errer', ) + this.viewEventDetailDismiss.emit({ type: 'close' }) - this.toastService.badRequest('Este evento já não existe na sua agenda') + if(error.status == 0) { + this.toastService.badRequest('não é possível vizualizar este event no modo offline') + } else { + this.toastService.badRequest('Este evento já não existe na sua agenda') + } + }) ; } diff --git a/src/app/store/despacho-store.service.ts b/src/app/store/despacho-store.service.ts index 582b6ceae..0143219cf 100644 --- a/src/app/store/despacho-store.service.ts +++ b/src/app/store/despacho-store.service.ts @@ -8,7 +8,7 @@ import { AES, enc, SHA1 } from 'crypto-js' export class DespachoStoreService { // main data - private _list: Event[] + private _list: [] = [] // local storage keyName private keyName: string; private _count = 0 @@ -27,8 +27,9 @@ export class DespachoStoreService { } get list() { - return this._list + return this._list || [] } + get count() { return this._count } diff --git a/src/app/store/expediente-storage-service.service.ts b/src/app/store/expediente-storage-service.service.ts index 759256a8e..236670ebb 100644 --- a/src/app/store/expediente-storage-service.service.ts +++ b/src/app/store/expediente-storage-service.service.ts @@ -11,7 +11,7 @@ import { AES, enc, SHA1 } from 'crypto-js' class ExpedienteStorageServiceService { // main data - private _list: Event[] + private _list: Event[] = [] private _count = 0 // local storage keyName private keyName: string; diff --git a/src/app/store/localstore.service.ts b/src/app/store/localstore.service.ts index c70ca0608..09312420e 100644 --- a/src/app/store/localstore.service.ts +++ b/src/app/store/localstore.service.ts @@ -6,7 +6,7 @@ import { AES, enc, SHA1 } from 'crypto-js' }) export class LocalstoreService { - private prefix = 'v9-' + private prefix = 'v10-' constructor() { diff --git a/src/app/store/to-day-event-storage.service.ts b/src/app/store/to-day-event-storage.service.ts index ece42fc97..ec28debad 100644 --- a/src/app/store/to-day-event-storage.service.ts +++ b/src/app/store/to-day-event-storage.service.ts @@ -10,7 +10,7 @@ import { AES, enc, SHA1 } from 'crypto-js' export class ToDayEventStorageService { // main data - private _eventsList: Event[] + private _eventsList: Event[] = [] // local storage keyName private keyName: string; private _count = 0