From 4431b4812385831477012215777fbc6e21b26485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Mon, 11 Apr 2022 15:21:37 +0100 Subject: [PATCH 1/5] changes on android --- android/app/src/main/assets/capacitor.config.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/android/app/src/main/assets/capacitor.config.json b/android/app/src/main/assets/capacitor.config.json index 2399c4927..a8c4fab83 100644 --- a/android/app/src/main/assets/capacitor.config.json +++ b/android/app/src/main/assets/capacitor.config.json @@ -16,5 +16,8 @@ "sound" ] } + }, + "server": { + "url": "http://192.168.0.38:8101" } } From 7cfb96bd72d52751fbcb954ac527731af71b56db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Wed, 13 Apr 2022 21:54:31 +0100 Subject: [PATCH 2/5] Fix bug send msg --- src/app/pages/chat/messages/messages.module.ts | 2 ++ src/app/pages/chat/messages/messages.page.html | 4 ++++ src/app/pages/chat/messages/messages.page.ts | 2 -- src/app/services/chat/message.service.ts | 10 +++++++--- src/environments/environment.ts | 8 ++++---- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/app/pages/chat/messages/messages.module.ts b/src/app/pages/chat/messages/messages.module.ts index ff08a70a5..631a468c8 100644 --- a/src/app/pages/chat/messages/messages.module.ts +++ b/src/app/pages/chat/messages/messages.module.ts @@ -12,6 +12,7 @@ import { BtnModalDismissPage } from 'src/app/shared/btn-modal-dismiss/btn-modal- import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { MatMenuModule } from '@angular/material/menu'; import { LettersAvatarModule } from "ngx-letters-avatar"; +import { PipesModule } from 'src/app/pipes/pipes.module'; @NgModule({ imports: [ @@ -22,6 +23,7 @@ import { LettersAvatarModule } from "ngx-letters-avatar"; MessagesPageRoutingModule, MatMenuModule, LettersAvatarModule, + PipesModule ], declarations: [MessagesPage] }) diff --git a/src/app/pages/chat/messages/messages.page.html b/src/app/pages/chat/messages/messages.page.html index 205a59230..0b47684b6 100644 --- a/src/app/pages/chat/messages/messages.page.html +++ b/src/app/pages/chat/messages/messages.page.html @@ -57,6 +57,10 @@ {{msg.duration}}
+ + {{msg.msg}} + {{msg.msg}} + diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index 2d2dde16f..00902e197 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -929,9 +929,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { downloadFileMsg(msg: MessageService) { - this.downloadLoader = msg.downloadLoader; msg.downloadFileMsg(); - this.downloadLoader = msg.downloadLoader; } b64toBlob(b64Data, contentType) { diff --git a/src/app/services/chat/message.service.ts b/src/app/services/chat/message.service.ts index 5d896da90..74e846ae0 100644 --- a/src/app/services/chat/message.service.ts +++ b/src/app/services/chat/message.service.ts @@ -182,11 +182,15 @@ export class MessageService { } async sendRequest(params) { - - if(params?.attachments[0]?.image_url) { - delete params?.attachments[0]?.image_url +console.log(params) + if(params?.attachments) { + if(params?.attachments[0]?.image_url) { + delete params?.attachments[0]?.image_url + } } + + if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Online) { diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 5f8a0d1c3..6e11abb9d 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -23,10 +23,10 @@ export const environment = { production: false, //apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/', apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/', - apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/', - apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', - //apiChatUrl: 'https://www.tabularium.pt/api/v1/', - //apiWsChatUrl: 'wss://www.tabularium.pt/websocket', + //apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/', + //apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', // QAS + apiChatUrl: 'https://www.tabularium.pt/api/v1/', + apiWsChatUrl: 'wss://www.tabularium.pt/websocket', // Dev /* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */ domain: 'gabinetedigital.local', //gabinetedigital.local defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local From c40724b357e3229708425720a51551de5a436271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Thu, 14 Apr 2022 15:02:37 +0100 Subject: [PATCH 3/5] build made --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3c9b825e8..f058d9db7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3397,18 +3397,18 @@ } }, "@ionic/angular": { - "version": "5.8.4", - "resolved": "https://registry.npmjs.org/@ionic/angular/-/angular-5.8.4.tgz", - "integrity": "sha512-pvy7qOTVih3mqcyIV6C3BK8seeZOEoanRFw+Z5m+soXDcvgrouHBBAKzURu2RUx8uDZqlX38Pkn89ontvqIZUg==", + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/@ionic/angular/-/angular-5.9.3.tgz", + "integrity": "sha512-0j4JZeGHpRvaTH0iyLTiUc4TF01bGVmk0zHZA7qS/OpS/WnGRHYNpVX/F75oODfckNvAa9uacoIMOTu54Cpx3w==", "requires": { - "@ionic/core": "5.8.4", + "@ionic/core": "5.9.3", "tslib": "^1.9.3" }, "dependencies": { "@ionic/core": { - "version": "5.8.4", - "resolved": "https://registry.npmjs.org/@ionic/core/-/core-5.8.4.tgz", - "integrity": "sha512-ioaH7wXAtexcpk23III0KArjSXStkpPrpZ5BCNkyter3EbOmDVd8XIXRcT86zRG68rbGI7Pd9GrugxeaDyMk/g==", + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/@ionic/core/-/core-5.9.3.tgz", + "integrity": "sha512-WM50vVxAAw+MQYqWXKUK4usBgkr7iQ9UWSb6t59mG4ZSy/fPAb7ZIdAjxY0U5i1ykk6A7Ur4B9ZJMpC/a7nnug==", "requires": { "@stencil/core": "^2.4.0", "ionicons": "^5.5.3", diff --git a/package.json b/package.json index 3ea0653a1..563c6bba6 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "@ionic-native/status-bar": "^5.0.0", "@ionic-native/streaming-media": "^5.36.0", "@ionic-native/wheel-selector": "^5.31.1", - "@ionic/angular": "^5.8.4", + "@ionic/angular": "^5.9.3", "@ionic/core": "^5.8.1", "@ionic/pwa-elements": "^3.0.2", "@ionic/storage": "^2.3.1", From 14d521a30c756cdfb1212a301816974121247d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Sat, 16 Apr 2022 19:23:44 +0100 Subject: [PATCH 4/5] Login user parametrization --- src/app/models/user.model.ts | 14 ++++++++++++++ src/app/pages/login/login.page.ts | 13 +++++++------ src/app/services/auth.service.ts | 23 ++++++++++++++++------- src/app/services/chat.service.ts | 5 +++-- src/environments/environment.prod.ts | 9 ++++++--- 5 files changed, 46 insertions(+), 18 deletions(-) diff --git a/src/app/models/user.model.ts b/src/app/models/user.model.ts index 24f420637..a0e0855e8 100644 --- a/src/app/models/user.model.ts +++ b/src/app/models/user.model.ts @@ -10,6 +10,13 @@ export class LoginUserRespose { BasicAuthKey: string; UserId: number; Authorization: string; + ChatData: { + status: string, + data: { + userId: string, + authToken: string + } + } Email: string FullName: string OwnerCalendars: { @@ -38,6 +45,13 @@ export class UserSession { BasicAuthKey: string; UserId: number; Authorization: string; + ChatData: { + status: string, + data: { + userId: string, + authToken: string + } + } Email: string FullName: string ManagerName: string diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 751c3cb26..8cfd9d7d7 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -112,10 +112,10 @@ export class LoginPage implements OnInit { console.log(this.p.userPermission(this.p.permissionList.Chat.access)); - if(this.p.userPermission(this.p.permissionList.Chat.access)){ - await this.authService.loginChat(); + /* if(this.p.userPermission(this.p.permissionList.Chat.access)){*/ + await this.authService.loginChat(attempt.ChatData.data); await this.authService.loginToChatWs(); - } + //} this.getToken(); SessionStore.setInativity(true); @@ -132,10 +132,11 @@ export class LoginPage implements OnInit { this.changeProfileService.run(); - if(this.p.userPermission(this.p.permissionList.Chat.access)){ - await this.authService.loginChat(); + console.log(attempt.ChatData) + /* if(this.p.userPermission(this.p.permissionList.Chat.access)){*/ + await this.authService.loginChat(attempt.ChatData.data); await this.authService.loginToChatWs(); - } + //} this.getToken(); diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 3cebb8fc3..933a94fc1 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -94,6 +94,10 @@ export class AuthService { SetSession(response: LoginUserRespose, user:UserForm) { const session: UserSession = Object.assign(SessionStore.user, response) + console.log('SETSESSION', response, user) + console.log('SETSESSION 2', session) + + if (response) { if( session.RoleID == 100000014) { session.Profile = 'PR' @@ -141,9 +145,13 @@ export class AuthService { //Login to rocketChat server2 //user: UserForm - async loginChat() { + async loginChat(responseChat = this.ValidatedUserChat) { - const expirationMinutes = 30; + this.ValidatedUserChat = responseChat; + localStorage.setItem('userChat', JSON.stringify(responseChat)); + this.storageService.store(AuthConnstants.AUTH, responseChat); + + /* const expirationMinutes = 30; let date = new Date().getTime(); let expirationDate = new Date(new Date().getTime() + expirationMinutes*60*1000); @@ -155,7 +163,7 @@ export class AuthService { let responseChat = await this.httpService.post('login', postData).toPromise(); if(responseChat) { - + console.log() this.ValidatedUserChat = responseChat; localStorage.setItem('userChat', JSON.stringify(responseChat)); this.storageService.store(AuthConnstants.AUTH, responseChat); @@ -165,13 +173,13 @@ export class AuthService { this.presentAlert('Network error'); } - this.autoLoginChat(expirationDate.getTime() - date); + this.autoLoginChat(expirationDate.getTime() - date); */ } async autoLoginChat(expirationDate:number) { - setTimeout(()=>{ - this.loginChat(); - }, expirationDate) + /* setTimeout(()=>{ + this.loginChat(this.ValidatedUserChat); + }, expirationDate) */ } loginToChatWs() { @@ -179,6 +187,7 @@ export class AuthService { this.WsChatService.connect(); this.WsChatService.login().then((message: any) => { + console.log('loginToChatWs',message) SessionStore.user.RochetChatUserId = message.result.id SessionStore.save() diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts index 5be562fd6..ccbabdccf 100644 --- a/src/app/services/chat.service.ts +++ b/src/app/services/chat.service.ts @@ -38,8 +38,9 @@ export class ChatService { if(this.p.userPermission(this.p.permissionList.Chat.access)) { - this.headers = this.headers.set('X-User-Id', this.loggedUserChat['data'].userId); - this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat['data'].authToken); + console.log(this.loggedUserChat) + this.headers = this.headers.set('X-User-Id', this.loggedUserChat.userId); + this.headers = this.headers.set('X-Auth-Token', this.loggedUserChat.authToken); this.options = { headers: this.headers, }; diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 0a5b0df12..4f208f1ed 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,8 +1,11 @@ export const environment = { - apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/', - apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/', - apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', + //apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/', + apiURL: 'https://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/', + //apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/', + //apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', + apiChatUrl: 'https://www.tabularium.pt/api/v1/', + apiWsChatUrl: 'wss://www.tabularium.pt/websocket', //apiChatUrl: 'https://www.tabularium.pt/api/v1/', production: true, From 6aa0f43b650d461c5a3a655330c43df4a7642b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Sat, 16 Apr 2022 19:27:43 +0100 Subject: [PATCH 5/5] -gradel update --- android/.idea/misc.xml | 1 + src/environments/environment.ts | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/android/.idea/misc.xml b/android/.idea/misc.xml index 6b486df50..95e233687 100644 --- a/android/.idea/misc.xml +++ b/android/.idea/misc.xml @@ -10,6 +10,7 @@ + diff --git a/src/environments/environment.ts b/src/environments/environment.ts index e1c6e905b..b59595989 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -23,10 +23,10 @@ export const environment = { production: false, //apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/', apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/', - //apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/', - //apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', - apiChatUrl: 'https://www.tabularium.pt/api/v1/', - apiWsChatUrl: 'wss://www.tabularium.pt/websocket', + apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/', + apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', + /* apiChatUrl: 'https://www.tabularium.pt/api/v1/', + apiWsChatUrl: 'wss://www.tabularium.pt/websocket', */ /* apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/', */ domain: 'gabinetedigital.local', //gabinetedigital.local defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local