Gabinete Digital
diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.ts b/src/app/pages/gabinete-digital/gabinete-digital.page.ts
index 33ef353a7..cee2c2fae 100644
--- a/src/app/pages/gabinete-digital/gabinete-digital.page.ts
+++ b/src/app/pages/gabinete-digital/gabinete-digital.page.ts
@@ -41,7 +41,7 @@ import { DataService } from 'src/app/services/data.service';
import { Storage } from '@ionic/storage';
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
import { SessionStore } from 'src/app/store/session.service';
-
+import { NotificationsService } from 'src/app/services/notifications.service'
@Component({
selector: 'app-gabinete-digital',
templateUrl: './gabinete-digital.page.html',
@@ -140,7 +140,8 @@ export class GabineteDigitalPage implements OnInit {
private DeplomasServiceService: DeplomasServiceService,
private AproveEventService: AproveEventService,
private ParecerService: ParecerService,
- private DespachoPRService: DespachoPRService
+ private DespachoPRService: DespachoPRService,
+ public NotificationsService: NotificationsService
) {
@@ -179,13 +180,16 @@ export class GabineteDigitalPage implements OnInit {
const pathname = window.location.pathname
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == pathname) {
-
this.waitForDomService.selector({
selector: 'app-gabinete-digital ion-content .aside-wrapper',
callback: () => {
- this.checkRoutes();
- // console.log('FIRST CALL')
- this.LoadCounts();
+ if(this.NotificationsService.active === false) {
+ this.checkRoutes();
+ this.LoadCounts();
+ } else {
+ this.checkRoutes();
+ this.LoadCounts();
+ }
}
})
}
@@ -204,6 +208,73 @@ export class GabineteDigitalPage implements OnInit {
this.backgroundservice.registerBackService('Online', () => {
this.loadAllProcesses();
});
+
+
+ this.NotificationsService.registerCallback(
+ 'despachos',
+ () => {
+ this.LoadCounts();
+ console.log('refresh with notification')
+ }
+ )
+ this.NotificationsService.registerCallback(
+ 'despachos-pr',
+ () => {
+ this.LoadCounts();
+ console.log('refresh with notification')
+ }
+ )
+ this.NotificationsService.registerCallback(
+ 'expediente',
+ () => {
+ this.LoadCounts();
+ console.log('refresh with notification')
+ }
+ )
+ this.NotificationsService.registerCallback(
+ 'gabinete-digital',
+ () => {
+ this.LoadCounts();
+ console.log('refresh with notification')
+ }
+ )
+ this.NotificationsService.registerCallback(
+ 'parecer',
+ () => {
+ this.LoadCounts();
+ console.log('refresh with notification')
+ }
+ )
+ this.NotificationsService.registerCallback(
+ 'deferimento',
+ () => {
+ this.LoadCounts();
+ console.log('refresh with notification')
+ }
+ )
+ this.NotificationsService.registerCallback(
+ 'diplomas-assinar',
+ () => {
+ this.LoadCounts();
+ console.log('refresh with notification')
+ }
+ )
+ this.NotificationsService.registerCallback(
+ 'diplomas',
+ () => {
+ this.LoadCounts();
+ console.log('refresh with notification')
+ }
+ )
+ this.NotificationsService.registerCallback(
+ 'expedientes-pr',
+ () => {
+ this.LoadCounts();
+ console.log('refresh with notification')
+ }
+ )
+
+
}
async loadAllProcesses() {
@@ -382,7 +453,7 @@ export class GabineteDigitalPage implements OnInit {
else if (activityName == 'Diploma Assinado') {
this.router.navigate(['/home/gabinete-digital/diplomas-assinar', serialNumber, 'gabinete-digital']);
} else {
- alert('bug!')
+ console.log('no route!')
}
}
else if (workflowName == 'Pedido de Parecer' || workflowName == 'Pedido de Deferimento') {
diff --git a/src/app/resolvers/userData.resolver.ts b/src/app/resolvers/userData.resolver.ts
deleted file mode 100644
index b5b5bbc93..000000000
--- a/src/app/resolvers/userData.resolver.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { Injectable } from '@angular/core';
-import { AuthService } from '../services/auth.service';
-
-@Injectable({
- providedIn: 'root'
-})
-export class UserDataResolver{
- constructor(private authService: AuthService){}
-
- resolve(){
- return this.authService.getUserData();
- }
-}
\ No newline at end of file
diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts
index f063abba5..20287d5a9 100644
--- a/src/app/services/auth.service.ts
+++ b/src/app/services/auth.service.ts
@@ -95,14 +95,11 @@ export class AuthService {
} else {
session.Profile = 'Unknown'
}
+
session.Password = user.password
-
session.BasicAuthKey = user.BasicAuthKey
-
SessionStore.reset(session)
- this.storageService.store(AuthConnstants.USER, response);
-
return true;
}
@@ -220,15 +217,6 @@ export class AuthService {
}
- // Get user data from RocketChat | global object
- getUserData() {
- this.storageService.get(AuthConnstants.AUTH).then(res=>{
- this.userData$.next(res);
- }).catch((error) => {
- console.error('storage getuserdata',error)
- });
- }
-
logoutChat() {
}
diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts
index 3baea940c..5860113e0 100644
--- a/src/app/services/chat.service.ts
+++ b/src/app/services/chat.service.ts
@@ -389,18 +389,23 @@ export class ChatService {
} catch (error) {
this.resetTimer();
- await this.refreshtoken();
+ setTimeout(async() =>{
+ await this.refreshtoken();
+ }, 8000)
+
}
+ } else if(!SessionStore.user.ChatData) {
+ // do nothing
} else if (!this.headers) {
this.setheader()
this.refreshtoken()
} else {
setTimeout(async ()=>{
await this.refreshtoken();
- }, 4000)
+ }, 8000)
}
}
diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts
index f929eb788..fc8ec9fbf 100644
--- a/src/app/services/notifications.service.ts
+++ b/src/app/services/notifications.service.ts
@@ -15,6 +15,7 @@ import { v4 as uuidv4 } from 'uuid';
import { EventTrigger } from '../services/eventTrigger.service';
import { SessionStore } from '../store/session.service';
import { ActionPerformed, PushNotificationSchema, PushNotifications, Token, } from '@capacitor/push-notifications';
+import { IdObject } from '../models/notifications';
/* import { Events } from 'ionic-angular' */
@Injectable({
@@ -32,6 +33,8 @@ export class NotificationsService {
id: string
}[] = []
+ active = false
+
constructor(
private http: HttpClient,
private storageService: StorageService,
@@ -48,18 +51,17 @@ export class NotificationsService {
/* private eventTriger: Events, */
/* private fcm: FCM */) {
- this.storageService.get("Notifications").then((value) => {
+ this.storageService.get("Notifications").then((value) => {
- }).catch((error)=>{
- console.error('storage getnotification',error)
+ }).catch((error)=>{
+ console.error('storage getnotification',error)
}).catch(() => {
this.storageService.store("Notifications", [])
})
}
-
- registerCallback(type: string, funx: Function, object: any = {}) {
+ registerCallback(type: IdObject, funx: Function, object: any = {}) {
const id = uuidv4()
this.callbacks.push({ type, funx, id })
@@ -105,7 +107,8 @@ export class NotificationsService {
const geturl = environment.apiURL + 'notifications/token';
PushNotifications.addListener('registration',
(token: Token) => {
-
+
+ this.active = false
this.storageService.store(username, token.value);
this.storageService.get(username).then(value => {
@@ -138,11 +141,11 @@ export class NotificationsService {
}
registrationError() {
- PushNotifications.addListener('registrationError',
- (error: any) => {
-
- }
- );
+ PushNotifications.addListener('registrationError',
+ (error: any) => {
+ this.active = false
+ }
+ );
}
onReciveForeground() {
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index 56998ebab..28c7bf4e1 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -1,15 +1,15 @@
import { versionData } from '../../version/git-version'
export const environment = {
- // apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
+ apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
//apiURL: 'https://gd-api.oapr.gov.ao/api/',
- apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',
+ //apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',
// apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
// apiChatUrl: 'http://192.168.0.29:3000/api/v1/',
// apiWsChatUrl: 'wss://192.168.0.29:3000/websocket',
//apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/',
- //apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket',
+ apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket',
apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
- apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',
+ //apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',
production: true,
domain: 'paulo.pinto@gabinetedigital.local',
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto@gabinetedigital.local
diff --git a/version/git-version.ts b/version/git-version.ts
index 9c83cd872..34e3c5a13 100644
--- a/version/git-version.ts
+++ b/version/git-version.ts
@@ -1,12 +1,12 @@
export let versionData = {
- "shortSHA": "3e110c9e9",
- "SHA": "3e110c9e93c95abc7bf1fd73a6ca264587505821",
+ "shortSHA": "f7aae9aa0",
+ "SHA": "f7aae9aa00ab6135903a56b1ecbfcfeab8d4a9e9",
"branch": "develop_bitOut-fix",
"lastCommitAuthor": "'Peter Maquiran'",
- "lastCommitTime": "'Mon Jan 2 14:36:57 2023 +0100'",
- "lastCommitMessage": "remote inactivity",
- "lastCommitNumber": "4605",
- "change": "diff --git a/src/app/app.component.ts b/src/app/app.component.ts\nindex 127ce8ee6..ce0ad7dbd 100644\n--- a/src/app/app.component.ts\n+++ b/src/app/app.component.ts\n@@ -1,17 +1,10 @@\n-import { Component, Inject } from '@angular/core';\n+import { Component } from '@angular/core';\n \n import { Platform } from '@ionic/angular';\n import { StatusBar } from '@ionic-native/status-bar/ngx';\n-import * as _moment from 'moment';\n-import * as _rollupMoment from 'moment';\n import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';\n-const moment = _rollupMoment || _moment;\n import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';\n import { SqliteService } from 'src/app/services/sqlite.service';\n-import { BackgroundService } from 'src/app/services/background.service';\n-import { ScreenOrientation } from '@ionic-native/screen-orientation/ngx';\n-import { StorageService } from 'src/app/services/storage.service';\n-import { MessageModel } from './models/beast-orm';\n import { InativityService } from \"src/app/services/inativity.service\";\n import { ThemeService } from 'src/app/services/theme.service';\n import { environment } from 'src/environments/environment';\n@@ -41,30 +34,16 @@ const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {\n export class AppComponent {\n constructor(\n private platform: Platform,\n- /* private splashScreen: SplashScreen, */\n private statusBar: StatusBar,\n- private screenOrientation: ScreenOrientation,\n private sqliteservice: SqliteService,\n- private backgroundservice: BackgroundService,\n- private storageservice: StorageService,\n private InativityService: InativityService,\n public ThemeService: ThemeService,\n private storage: Storage,\n ) {\n- // this.createCacheFolder()\n this.initializeApp();\n- console.log('version: '+ environment.version)\n-\n this.storage.set('version', environment.version).then(() => {})\n }\n \n- // async createCacheFolder(){\n- // await Filesystem.mkdir({\n- // directory: Directory.Cache,\n- // path: `CACHED-IMG`\n- // })\n- // }\n-\n initializeApp() {\n this.platform.ready().then(() => {\n this.statusBar.styleDefault();\n@@ -87,18 +66,6 @@ export class AppComponent {\n }\n }\n \n- /* this.storageservice.get('networkCheckStore').then((network) => {\n- if(network === 'online') {\n- console.log('Network app componente check', network)\n- this.backgroundservice.online()\n- } else {\n- console.log('Network app componente check', network)\n- this.backgroundservice.offline();\n- }\n- }).catch((error) => {\n- console.error('storage initialize: ',error)\n- }) */\n-\n });\n }\n }\ndiff --git a/src/app/home/home.page.html b/src/app/home/home.page.html\nindex 0caf5aeba..508ad8347 100644\n--- a/src/app/home/home.page.html\n+++ b/src/app/home/home.page.html\n@@ -7,7 +7,6 @@\n \n \n \n- \n Início\n \n \n@@ -22,8 +21,6 @@\n \n \n \n- \n Gabinete\n \n \ndiff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts\nindex ec7211e0b..f6dbe7daf 100644\n--- a/src/app/home/home.page.ts\n+++ b/src/app/home/home.page.ts\n@@ -163,7 +163,7 @@ export class HomePage implements OnInit {\n \n }\n \n- clearTabButtonSelection(){\n+ clearTabButtonSelection() {\n this.tabButton.home = false;\n this.tabButton.agenda = false;\n this.tabButton.gabinete = false;\n@@ -179,13 +179,13 @@ export class HomePage implements OnInit {\n else if(url == '/home/agenda'){\n this.tabButton.agenda = true;\n }\n- else if(url =='/home/gabinete-digital'){\n+ else if(url =='/home/gabinete-digital') {\n this.tabButton.gabinete = true;\n }\n- else if(url =='/home/publications'){\n+ else if(url =='/home/publications') {\n this.tabButton.actions = true;\n }\n- else if(url == '/home/chat'){\n+ else if(url == '/home/chat') {\n this.tabButton.chat = true;\n }\n else{\n@@ -193,17 +193,12 @@ export class HomePage implements OnInit {\n }\n }\n \n- logDeviceInfo = async () => {\n+ logDeviceInfo = async () => {\n const info = await Device.getInfo();\n-\n- };\n-\n- get pathname(){\n- return window.location.pathname\n }\n \n- get color() {\n- return '#797979'\n+ get pathname() {\n+ return window.location.pathname\n }\n \n updateList() {\n@@ -266,5 +261,4 @@ export class HomePage implements OnInit {\n this.sqliteservice.deleteAllTables();\n }\n \n-}\n-\n+}\n\\ No newline at end of file\ndiff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts\nindex e3161d1fe..4d6b1b510 100644\n--- a/src/environments/environment.prod.ts\n+++ b/src/environments/environment.prod.ts\n@@ -1,17 +1,17 @@\n import { versionData } from '../../version/git-version'\n export const environment = {\n // apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',\n- apiURL: 'https://gd-api.oapr.gov.ao/api/',\n- //apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',\n+ //apiURL: 'https://gd-api.oapr.gov.ao/api/',\n+ apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',\n // apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',\n // apiChatUrl: 'http://192.168.0.29:3000/api/v1/',\n // apiWsChatUrl: 'wss://192.168.0.29:3000/websocket',\n //apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',\n //apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',\n- apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/',\n- apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket',\n- // apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',\n- // apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',\n+ //apiChatUrl: 'https://gd-chat.oapr.gov.ao/api/v1/',\n+ //apiWsChatUrl: 'wss://gd-chat.oapr.gov.ao/websocket',\n+ apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',\n+ apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',\n production: true,\n domain: 'gabinetedigital.local',\n defaultuser: 'eqformacao@oapr.gov.ao',//paulo.pinto@gabinetedigital.local",
- "changeStatus": "On branch develop_bitOut-fix\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/pages/publications/publications.page.ts\n\nChanges not staged for commit:\n (use \"git add ...\" to update what will be committed)\n (use \"git restore ...\" to discard changes in working directory)\n\tmodified: src/app/app.component.ts\n\tmodified: src/app/home/home.page.html\n\tmodified: src/app/home/home.page.ts\n\tmodified: src/environments/environment.prod.ts\n\nUntracked files:\n (use \"git add ...\" to include in what will be committed)\n\tsrc/app/home/sharedWorker.js",
+ "lastCommitTime": "'Mon Jan 2 15:42:15 2023 +0100'",
+ "lastCommitMessage": "improve publicações",
+ "lastCommitNumber": "4606",
+ "change": "",
+ "changeStatus": "On branch develop_bitOut-fix\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/app-routing.module.ts\n\tmodified: src/app/guards/auth.guard.ts\n\tmodified: src/app/home/home-routing.module.ts\n\tnew file: src/app/modals/information/information-routing.module.ts\n\tnew file: src/app/modals/information/information.module.ts\n\tnew file: src/app/modals/information/information.page.html\n\tnew file: src/app/modals/information/information.page.scss\n\tnew file: src/app/modals/information/information.page.spec.ts\n\tnew file: src/app/modals/information/information.page.ts\n\tnew file: src/app/models/notifications.ts\n\tmodified: src/app/pages/chat/chat.page.ts\n\tmodified: src/app/pages/events/events.page.ts\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.html\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.ts\n\tdeleted: src/app/resolvers/userData.resolver.ts\n\tmodified: src/app/services/auth.service.ts\n\tmodified: src/app/services/chat.service.ts\n\tmodified: src/app/services/notifications.service.ts\n\tmodified: src/environments/environment.ts",
"changeAuthor": "peter.maquiran"
}
\ No newline at end of file