From af5d428134c6f91f23d5598fa11885b40af9d8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Wed, 6 Mar 2024 15:20:35 +0100 Subject: [PATCH 1/7] chat interceptor added --- src/app/app.module.ts | 5 +- src/app/interceptors/chatToken.interceptor.ts | 266 ++++++++++-------- src/app/interceptors/token.interceptors.ts | 8 +- src/app/services/chat.service.ts | 55 ---- 4 files changed, 152 insertions(+), 182 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index e9d6f4b08..9b80a69cc 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -87,7 +87,7 @@ import { LoggingInterceptorService } from './services/logging-interceptor.servic import { PopupQuestionPipe } from './modals/popup-question.pipe'; import '@teamhive/capacitor-video-recorder'; import { tokenInterceptor } from './interceptors/token.interceptors'; -import { ChatTokenInterceptor } from './interceptors/chatToken.interceptor'; +import { chatTokenInterceptor } from './interceptors/chatToken.interceptor'; import { InputFilterDirective } from './services/directives/input-filter.directive'; import { VisibilityDirective } from './services/directives/visibility.directive'; @@ -217,8 +217,9 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */ DocumentViewer, FFMpeg, { provide: HTTP_INTERCEPTORS, useClass: LoggingInterceptorService, multi: true }, + chatTokenInterceptor, tokenInterceptor, - /* ChatTokenInterceptor */ + ], bootstrap: [AppComponent], diff --git a/src/app/interceptors/chatToken.interceptor.ts b/src/app/interceptors/chatToken.interceptor.ts index c1929a01e..974b7d783 100644 --- a/src/app/interceptors/chatToken.interceptor.ts +++ b/src/app/interceptors/chatToken.interceptor.ts @@ -1,12 +1,12 @@ import { Injectable } from '@angular/core'; import { - HttpInterceptor, - HttpRequest, - HttpHandler, - HttpEvent, - HttpErrorResponse, - HTTP_INTERCEPTORS, - HttpHeaders, + HttpInterceptor, + HttpRequest, + HttpHandler, + HttpEvent, + HttpErrorResponse, + HTTP_INTERCEPTORS, + HttpHeaders, } from '@angular/common/http'; import { Observable, throwError, BehaviorSubject } from 'rxjs'; import { catchError, switchMap, filter, take } from 'rxjs/operators'; @@ -15,138 +15,158 @@ import { Router } from '@angular/router'; import { SessionStore } from '../store/session.service'; import { environment } from "src/environments/environment"; import { PermissionService } from '../services/permission.service'; -import { NetworkServiceService , ConnectionStatus} from 'src/app/services/network-service.service'; +import { NetworkServiceService, ConnectionStatus } from 'src/app/services/network-service.service'; import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'; - + @Injectable() export class ChatTokenInterceptor implements HttpInterceptor { - private isRefreshing = false; - headers: HttpHeaders; - options: any; - private refreshTokenSubject: BehaviorSubject = new BehaviorSubject( - null - ); - - private excludedDomain = 'https://gdchat-dev.dyndns.info';// Add other domains as needed - - constructor(private http: HttpClient, private router: Router,private p: PermissionService,private NetworkServiceService: NetworkServiceService, - private RochetChatConnectorService: RochetChatConnectorService) {} - - intercept( - request: HttpRequest, - next: HttpHandler - ): Observable> { - if (this.shouldExcludeDomain(request)) { - return next.handle(request); - } - - return next.handle(request).pipe( - catchError((error) => { - if (error instanceof HttpErrorResponse && error.status === 401) { - return this.handle401Error(request, next); - } else { - return throwError(error); - } - }) + private isRefreshing = false; + headers: HttpHeaders; + options: any; + private refreshChatTokenSubject: BehaviorSubject = new BehaviorSubject( + null ); - } - - private shouldExcludeDomain(request: HttpRequest): boolean { - const url = request.url.toLowerCase(); - return !url.includes(this.excludedDomain.toLowerCase()); - } - - private handle401Error( - request: HttpRequest, - next: HttpHandler - ): Observable> { - if (!this.isRefreshing) { - this.isRefreshing = true; - this.refreshTokenSubject.next(null); - - return this.refreshToken().pipe( - switchMap((token: any) => { - this.isRefreshing = false; - let data = { - status: token['status'], - data: { - userId: token['data'].userId, - authToken: token['data'].authToken - } + private excludedDomains = ['Login',environment.apiURL];// Add other domains as needed + + constructor(private http: HttpClient, private router: Router, private p: PermissionService, private NetworkServiceService: NetworkServiceService, + private RochetChatConnectorService: RochetChatConnectorService) { } + + intercept( + request: HttpRequest, + next: HttpHandler + ): Observable> { + if (this.shouldExcludeDomain(request)) { + return next.handle(request); + } + + if (SessionStore.user.Authorization) { + request = this.addToken(request, SessionStore.user.Authorization); } - SessionStore.user.ChatData = data - SessionStore.save() - this.setheader() - - - this.refreshTokenSubject.next(token.Authorization); - return next.handle(this.addToken(request, token.Authorization)); - }) - ); - } else { - return this.refreshTokenSubject.pipe( - filter((token) => token != null), - take(1), - switchMap((jwt) => { - return next.handle(this.addToken(request, jwt)); - }) - ); + return next.handle(request).pipe( + catchError((error) => { + if (error instanceof HttpErrorResponse && error.status === 401) { + return this.handle401Error(request, next); + } else { + return throwError(error); + } + }) + ); } - } - - private addToken(request: HttpRequest, token: string) { - return request.clone({ - /* setHeaders: { - Authorization: `Bearer ${token}`, - }, */ - }); - } - - private refreshToken(): Observable { - return this.http - .get(environment.apiURL + 'UserAuthentication/RegenereChatToken', { - /* refreshToken: SessionStore.user.RefreshToken, */ - }) - .pipe( - catchError((error) => { - // Handle token refresh failure - console.log('ChatToken refresh failed:', error); - return throwError(error); - }) - ); - } - + + private shouldExcludeDomain(request: HttpRequest): boolean { + const url = request.url.toLowerCase(); + return this.excludedDomains.some((domain) => url.includes(domain.toLowerCase())); + } + + private handle401Error( + request: HttpRequest, + next: HttpHandler + ): Observable> { + if (!this.isRefreshing) { + this.isRefreshing = true; + this.refreshChatTokenSubject.next(null); + + return this.refreshToken().pipe( + switchMap((token: any) => { + this.isRefreshing = false; + + let data = { + status: token['status'], + data: { + userId: token['data'].userId, + authToken: token['data'].authToken + } + } + SessionStore.user.ChatData = data + SessionStore.save() + /* this.setheader() */ - setheader() { - try { - if (this.p.userPermission(this.p.permissionList.Chat.access) && SessionStore.user.ChatData) { - this.headers = new HttpHeaders();; + this.refreshChatTokenSubject.next(token.Authorization); + return next.handle(this.addToken(request, token.Authorization)); + }) + ); + } else { + return this.refreshChatTokenSubject.pipe( + filter((token) => token != null), + take(1), + switchMap((jwt) => { + return next.handle(this.addToken(request, jwt)); + }) + ); + } + } - if (this.p.userPermission(this.p.permissionList.Chat.access)) { - // - this.headers = this.headers.set('X-User-Id', SessionStore.user.ChatData.data.userId); - this.headers = this.headers.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken); - this.options = { - headers: this.headers, - }; + private addToken(request: HttpRequest, token: string) { + let headers = new HttpHeaders(); + + + console.log('X-User-Id', SessionStore.user.ChatData.data.userId) + console.log('X-Auth-Token', SessionStore.user.ChatData.data.authToken) + headers = headers.set('X-User-Id', SessionStore.user.ChatData.data.userId); + headers = headers.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken); + + return request.clone({ + setHeaders: { + Authorization: `Bearer ${token}`, + ...headers.keys().reduce((acc, key) => ({ ...acc, [key]: headers.get(key) }), {}), + }, + }); + } + + /* private addToken(request: HttpRequest, token: string) { + return request.clone({ + setHeaders: { + Authorization: `Bearer ${token}`, + }, + }); + } */ + + private refreshToken(): Observable { + return this.http + .get(environment.apiURL + 'UserAuthentication/RegenereChatToken', { + /* refreshToken: SessionStore.user.RefreshToken, */ + }) + .pipe( + catchError((error) => { + // Handle token refresh failure + console.log('ChatToken refresh failed:', error); + return throwError(error); + }) + ); + } + + + + setheader() { + try { + + if (this.p.userPermission(this.p.permissionList.Chat.access) && SessionStore.user.ChatData) { + this.headers = new HttpHeaders();; + + if (this.p.userPermission(this.p.permissionList.Chat.access)) { + // + this.headers = this.headers.set('X-User-Id', SessionStore.user.ChatData.data.userId); + this.headers = this.headers.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken); + this.options = { + headers: this.headers, + }; + + } + } + } catch (error) { } - } - } catch (error) { - } - } } - - - -export const tokenInterceptor = { + + + +export const chatTokenInterceptor = { provide: HTTP_INTERCEPTORS, useClass: ChatTokenInterceptor, multi: true - }; - \ No newline at end of file +}; diff --git a/src/app/interceptors/token.interceptors.ts b/src/app/interceptors/token.interceptors.ts index 13e4ebe71..b0916499f 100644 --- a/src/app/interceptors/token.interceptors.ts +++ b/src/app/interceptors/token.interceptors.ts @@ -119,9 +119,13 @@ export class TokenInterceptor implements HttpInterceptor { if (environment.production) { window.location.pathname = '/auth' } else { - /* const pathBeforeGoOut = window.location.pathname */ + const pathBeforeGoOut = window.location.pathname + console.log('Before auth',window.location.pathname) this.router.navigateByUrl('/auth', { replaceUrl: true }).then(() =>{ - this.httpErrorHandle.httpsSucessMessagge('sessonExpired') + if(pathBeforeGoOut != "/auth") { + this.httpErrorHandle.httpsSucessMessagge('sessonExpired') + } + }) } return of(false); diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts index 792716595..5d8072ddb 100644 --- a/src/app/services/chat.service.ts +++ b/src/app/services/chat.service.ts @@ -392,61 +392,6 @@ export class ChatService { async refreshtoken() { - if(this.headers && SessionStore.user.ChatData) { - this.headers = this.headers.set('Authorization', 'Bearer ' + SessionStore.user.Authorization); - let options = { - headers: this.headers - }; - - try { - let res = await this.http.get(environment.apiURL + 'UserAuthentication/RegenereChatToken', options).toPromise(); - - let data = { - status: res['status'], - data: { - userId: res['data'].userId, - authToken: res['data'].authToken - } - } - SessionStore.user.ChatData = data - SessionStore.save() - this.setheader() - this.timerEventTriggerDateLastUpdate = new Date(); - } catch (error) { - - if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Offline) { - this.RochetChatConnectorService.registerCallback({ - requestId: 'refreshtoken', - type: 'reConnect', - funx: async () => { - - this.resetTimer(); - await this.refreshtoken(); - - return true - } - }) - } else { - - if(SessionStore.user.Authorization != '') { - setTimeout(async () => { - this.resetTimer(); - await this.refreshtoken(); - }, 60000) - } - - - } - - } - - } else if(!SessionStore.user.ChatData) { - // do nothing - } else if (!this.headers) { - this.setheader() - this.refreshtoken() - } - } From a3e83d8298bb4db22600948289578028ee1031a9 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Wed, 6 Mar 2024 15:25:06 +0100 Subject: [PATCH 2/7] fix change timeline, publication wont load list --- src/app/pages/agenda/agenda.page.html | 9 ++-- src/app/pages/login/login.page.ts | 2 - .../view-publications.page.ts | 11 ++++- src/app/services/active-tab.service.ts | 9 ++++ src/app/services/agenda/list-box.service.ts | 13 ++---- src/app/services/auth.service.ts | 12 ++++- .../services/socket-connection-mcr.service.ts | 44 +++++++++---------- .../group-messages/group-messages.page.ts | 39 ---------------- src/environments/environment.prod.ts | 2 +- 9 files changed, 62 insertions(+), 79 deletions(-) diff --git a/src/app/pages/agenda/agenda.page.html b/src/app/pages/agenda/agenda.page.html index aa03c4cd4..5561a3c30 100644 --- a/src/app/pages/agenda/agenda.page.html +++ b/src/app/pages/agenda/agenda.page.html @@ -242,7 +242,6 @@ >
-
InĂ­cio
Fim
@@ -254,8 +253,12 @@
-
Todo
-
o dia
+
Todo
+
o dia
+ +
{{event.event.StartDate | date: 'HH:mm'}}
+
{{event.event.EndDate | date: 'HH:mm'}}
+
diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 471a0e1a6..0be3a9409 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -146,7 +146,6 @@ export class LoginPage implements OnInit { await this.authService.loginToChatWs(); this.ChatService.setheader() - this.ChatSystemService.loadChat(); } @@ -181,7 +180,6 @@ export class LoginPage implements OnInit { if (attempt.ChatData) { await this.authService.loginToChatWs(); this.ChatService.setheader(); - this.ChatSystemService.loadChat(); } this.storageService.remove("Notifications") this.getToken(); 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 1848c564a..306b947b2 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -20,6 +20,7 @@ import { PublicationVideoManagerService } from "src/app/services/publication/pub import { StopvideoService } from "src/app/services/stopvideo.service" import { Result } from 'neverthrow'; import { App } from '@capacitor/app'; +import { ActiveTabService } from 'src/app/services/active-tab.service'; @Component({ selector: 'app-view-publications', templateUrl: './view-publications.page.html', @@ -69,7 +70,8 @@ export class ViewPublicationsPage implements OnInit { public checkFileType: checkFileTypeService, private publicationVideoManagerService: PublicationVideoManagerService, public stopvideoService: StopvideoService, - private platform: Platform,) { + private platform: Platform, + public activeTabService: ActiveTabService) { /* this.publicationVideoManagerService.setContainer(this.VideoManager.nativeElement) */ @@ -118,6 +120,13 @@ export class ViewPublicationsPage implements OnInit { }) // console.log(this.publicationFolderService.publicationList[this.folderId]) + + setTimeout(()=> { + + this.doRefresh({}) + + }, 1500) + } diff --git a/src/app/services/active-tab.service.ts b/src/app/services/active-tab.service.ts index 3fe770e8f..ec712de96 100644 --- a/src/app/services/active-tab.service.ts +++ b/src/app/services/active-tab.service.ts @@ -16,6 +16,8 @@ export class ActiveTabService { gabineteDetails: false } + updatePublications = () => {} + constructor( private router: Router, public HeaderSettingsService: HeaderSettingsService) { @@ -47,6 +49,13 @@ export class ActiveTabService { } else if (pathName.startsWith('/home/publications')) { this.pages.publication = true + if(pathName.includes("/publications/")) { + if(this.updatePublications) { + this.updatePublications() + } + + } + } else if (pathName.startsWith('/home/chat')) { this.pages.chat = true } diff --git a/src/app/services/agenda/list-box.service.ts b/src/app/services/agenda/list-box.service.ts index 47151f290..192498ec2 100644 --- a/src/app/services/agenda/list-box.service.ts +++ b/src/app/services/agenda/list-box.service.ts @@ -67,8 +67,6 @@ export class ListBoxService { // object[momentG(new Date(e.start), 'MMMM yyyy')].push(e) // } - // console.log({object}) - // const daysStringNum = Object.keys(object).reverse() // const daysObject = {} @@ -77,13 +75,8 @@ export class ListBoxService { // daysObject[day] = object[day] // } - // console.log({daysObject}) - - return this.display(newStracture, selectedDate).year - // console.log({daysObject}) - // const daysStringNum = Object.keys(daysObject) // for(const day of daysStringNum) { @@ -105,6 +98,8 @@ export class ListBoxService { } display(list: CustomCalendarEvent[], selectedDate) { + + let days = {}; const year: Year[] = [] @@ -171,14 +166,14 @@ export class ListBoxService { // last push const EndEvent = this.transForm(cloneEvent, {startMany: false, endMany: true, middle: false}) if(this.CanPush(cloneEvent, selectedDate) && cloneEvent.start.getTime() >= cloneSelectedDate.getTime()) { - days[otherDays].push(EndEvent) ; this.push(cloneEvent, year) + days[otherDays].push(EndEvent) ; this.push(EndEvent, year) } } else { const EndEvent = this.transForm(cloneEvent, {startMany: false,endMany: true, middle: true}) if(this.CanPush(cloneEvent, selectedDate) && cloneEvent.start.getTime() >= cloneSelectedDate.getTime()) { - days[otherDays].push(EndEvent) ; this.push(cloneEvent, year) + days[otherDays].push(EndEvent) ; this.push(EndEvent, year) } } diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index d46be8058..7e382a2f6 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -190,6 +190,7 @@ export class AuthService { SessionStore.user.RochetChatUserId = message.result.id SessionStore.save() + this.ChatSystemService.loadChat() this.RochetChatConnectorService.setStatus('online') window['RochetChatConnectorService'] = this.RochetChatConnectorService setTimeout(() => { @@ -199,7 +200,14 @@ export class AuthService { }).catch((error) => { - // console.error(SessionStore.user.ChatData, 'web socket login',error) + console.error(SessionStore.user.ChatData, 'web socket login', error) + + if(window.location.pathname.includes('/home/')) { + setTimeout(() => { + this.loginToChatWs(); + }, 4000) + } + }) } @@ -333,7 +341,7 @@ export class AuthService { } refreshToken() { - + return this.http .put(environment.apiURL + "UserAuthentication/RefreshToken", { refreshToken: SessionStore.user.RefreshToken, diff --git a/src/app/services/socket-connection-mcr.service.ts b/src/app/services/socket-connection-mcr.service.ts index 0490b2406..3340a6872 100644 --- a/src/app/services/socket-connection-mcr.service.ts +++ b/src/app/services/socket-connection-mcr.service.ts @@ -390,32 +390,32 @@ export class ObjectMergeNotification{ watchCount = 0 constructor() { - this.socket.onDisconnectCallback(()=> { - console.log("run watch") - this.runWatch = true - this.watch() - }) + // this.socket.onDisconnectCallback(()=> { + // console.log("run watch") + // this.runWatch = true + // this.watch() + // }) - this.socket.onConnectCallback(()=> { + // this.socket.onConnectCallback(()=> { - console.log("open trigger") - this.runWatch = false - }) + // console.log("open trigger") + // this.runWatch = false + // }) - this.socket.subscribe((data: socketResponse) => { - if(data.IsCompleted == true) { - console.log("==================!!!====================") - try { - this.callbacks[data.Guid](data) - delete this.callbacks[data.Guid] - } catch (error) {} - } else { - console.log("else", data) - } - }) + // this.socket.subscribe((data: socketResponse) => { + // if(data.IsCompleted == true) { + // console.log("==================!!!====================") + // try { + // this.callbacks[data.Guid](data) + // delete this.callbacks[data.Guid] + // } catch (error) {} + // } else { + // console.log("else", data) + // } + // }) - this.socket.connect(); - this.watch() + // this.socket.connect(); + // this.watch() } connect() { diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index b90b88db4..002fca5f2 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -46,7 +46,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe documents: SearchList[] = []; room: any = new Array(); - roomName: any; members: any; capturedImage: any; @@ -58,8 +57,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe currentPosition: any; startPosition: number; scrollToBottomBtn = false; - roomCountDownDate: string; - roomCountDownTime: string; isAdmin = false; @Input() roomId: string; @@ -112,8 +109,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe this.ChatSystemService.getUser() this.loggedUserChat = SessionStore.user.ChatData['data']; this.isGroupCreated = true; - this.roomCountDownDate = ""; - this.roomCountDownTime = ""; } ngOnChanges(changes: SimpleChanges): void { @@ -151,10 +146,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe return this.timeService.showDateDuration(start); } - countDownDate() { - return this.timeService.countDownDateTimer(this.roomCountDownDate, this.roomId); - } - setStatus(status: string) { let body = { message: '', @@ -377,28 +368,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({}); } - let room = await this.chatService.getRoomInfo(this.roomId).toPromise(); - this.room = room['room']; - if (this.room.name) { - try { - this.roomName = this.room.name.split('-').join(' '); - } catch (error) { - this.roomName = this.room.name; - } - - } - - - if(SessionStore.user.ChatData.data.userId == this.room.u._id){ - this.isAdmin = true - } else { - this.isAdmin = false - } - - if (this.room.customFields.countDownDate) { - this.roomCountDownDate = this.room.customFields.countDownDate; - } - this.getGroupContacts(this.room); } @@ -536,14 +505,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe } else { - if(res?.data?.name) { - try { - this.roomName = res.data.name.split('-').join(' '); - } catch (error) { - this.roomName = res.data.name - - } - } }; diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 1b55290ea..2536052bb 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -4,4 +4,4 @@ import { environment as doneITProd } from './suport/doneIt' import { DevDev } from './suport/dev' -export const environment: Environment = oaprProd; +export const environment: Environment = DevDev; From a614036b66572a0c05346447f8ee2c7d01eab081 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Wed, 6 Mar 2024 16:56:48 +0100 Subject: [PATCH 3/7] agenda timeline fix --- src/app/pages/agenda/agenda.page.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/pages/agenda/agenda.page.html b/src/app/pages/agenda/agenda.page.html index 5561a3c30..5e11c7fc5 100644 --- a/src/app/pages/agenda/agenda.page.html +++ b/src/app/pages/agenda/agenda.page.html @@ -253,9 +253,14 @@
+
Todo
o dia
+ +
Todo
+
o dia
+
{{event.event.StartDate | date: 'HH:mm'}}
{{event.event.EndDate | date: 'HH:mm'}}
From 3282d417569920c64f39c2b36869adf7af5ee2ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Thu, 7 Mar 2024 12:01:16 +0100 Subject: [PATCH 4/7] changed instanceNAme for woeckflowDisplayName on gabinete --- src/app/pages/gabinete-digital/despachos/despachos.page.html | 2 +- .../diplomas-assinar/diplomas-assinar.page.html | 2 +- .../gabinete-digital/diplomas-gerar/diplomas-gerar.page.html | 4 ++-- src/app/pages/gabinete-digital/diplomas/diplomas.page.html | 4 ++-- .../pages/gabinete-digital/expediente/expediente.page.html | 2 +- src/app/pages/gabinete-digital/gabinete-digital.page.html | 4 ++-- src/app/pages/gabinete-digital/pedidos/pedidos.page.html | 4 ++-- .../gabinete-digital/all-processes/all-processes.page.html | 2 +- .../gabinete-digital/diplomas-gerar/diplomas-gerar.page.html | 2 +- src/app/shared/gabinete-digital/diplomas/diplomas.page.html | 2 +- .../generic/task-details/task-details.page.html | 2 +- .../gabinete-digital/generic/task-list/task-list.page.html | 2 +- src/app/shared/gabinete-digital/pedidos/pedidos.page.html | 4 ++-- 13 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/app/pages/gabinete-digital/despachos/despachos.page.html b/src/app/pages/gabinete-digital/despachos/despachos.page.html index 3efac5be7..3905b5788 100644 --- a/src/app/pages/gabinete-digital/despachos/despachos.page.html +++ b/src/app/pages/gabinete-digital/despachos/despachos.page.html @@ -95,7 +95,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} diff --git a/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.html b/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.html index 599547d08..20fccfc7a 100644 --- a/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.html +++ b/src/app/pages/gabinete-digital/diplomas-assinar/diplomas-assinar.page.html @@ -99,7 +99,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} diff --git a/src/app/pages/gabinete-digital/diplomas-gerar/diplomas-gerar.page.html b/src/app/pages/gabinete-digital/diplomas-gerar/diplomas-gerar.page.html index fd37bd992..5abddef6e 100644 --- a/src/app/pages/gabinete-digital/diplomas-gerar/diplomas-gerar.page.html +++ b/src/app/pages/gabinete-digital/diplomas-gerar/diplomas-gerar.page.html @@ -87,7 +87,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} @@ -165,7 +165,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} diff --git a/src/app/pages/gabinete-digital/diplomas/diplomas.page.html b/src/app/pages/gabinete-digital/diplomas/diplomas.page.html index bb9b1beb9..23734c01e 100644 --- a/src/app/pages/gabinete-digital/diplomas/diplomas.page.html +++ b/src/app/pages/gabinete-digital/diplomas/diplomas.page.html @@ -55,7 +55,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} @@ -125,7 +125,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} diff --git a/src/app/pages/gabinete-digital/expediente/expediente.page.html b/src/app/pages/gabinete-digital/expediente/expediente.page.html index 5637f8be3..2689461dc 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente.page.html +++ b/src/app/pages/gabinete-digital/expediente/expediente.page.html @@ -102,7 +102,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} diff --git a/src/app/pages/gabinete-digital/gabinete-digital.page.html b/src/app/pages/gabinete-digital/gabinete-digital.page.html index 9c0d83882..cb8b6e45c 100644 --- a/src/app/pages/gabinete-digital/gabinete-digital.page.html +++ b/src/app/pages/gabinete-digital/gabinete-digital.page.html @@ -209,7 +209,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' @@ -647,7 +647,7 @@ TaskService.pedidosstore.listParecerCount.length}} correspondĂȘncia nova

- Pedidos de Parecer solicitados por mim
+ Parecer solicitados por mim
{{ TaskService.pedidosstore.listParecerCount.length}} correspondĂȘncias novas {{ diff --git a/src/app/pages/gabinete-digital/pedidos/pedidos.page.html b/src/app/pages/gabinete-digital/pedidos/pedidos.page.html index 9a7d4288b..90a7e586d 100644 --- a/src/app/pages/gabinete-digital/pedidos/pedidos.page.html +++ b/src/app/pages/gabinete-digital/pedidos/pedidos.page.html @@ -121,7 +121,7 @@

- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} @@ -160,7 +160,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} diff --git a/src/app/shared/gabinete-digital/all-processes/all-processes.page.html b/src/app/shared/gabinete-digital/all-processes/all-processes.page.html index c3e89c5a3..d539fc571 100644 --- a/src/app/shared/gabinete-digital/all-processes/all-processes.page.html +++ b/src/app/shared/gabinete-digital/all-processes/all-processes.page.html @@ -165,7 +165,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} diff --git a/src/app/shared/gabinete-digital/diplomas-gerar/diplomas-gerar.page.html b/src/app/shared/gabinete-digital/diplomas-gerar/diplomas-gerar.page.html index 97888f2ad..27463642c 100644 --- a/src/app/shared/gabinete-digital/diplomas-gerar/diplomas-gerar.page.html +++ b/src/app/shared/gabinete-digital/diplomas-gerar/diplomas-gerar.page.html @@ -91,7 +91,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} diff --git a/src/app/shared/gabinete-digital/diplomas/diplomas.page.html b/src/app/shared/gabinete-digital/diplomas/diplomas.page.html index 5af7322d7..65b3b4e67 100644 --- a/src/app/shared/gabinete-digital/diplomas/diplomas.page.html +++ b/src/app/shared/gabinete-digital/diplomas/diplomas.page.html @@ -128,7 +128,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} diff --git a/src/app/shared/gabinete-digital/generic/task-details/task-details.page.html b/src/app/shared/gabinete-digital/generic/task-details/task-details.page.html index f729bd008..2c2a8e879 100644 --- a/src/app/shared/gabinete-digital/generic/task-details/task-details.page.html +++ b/src/app/shared/gabinete-digital/generic/task-details/task-details.page.html @@ -40,7 +40,7 @@
-

{{ task.activityInstanceName }}

+

{{ task.WorkflowName }}

diff --git a/src/app/shared/gabinete-digital/generic/task-list/task-list.page.html b/src/app/shared/gabinete-digital/generic/task-list/task-list.page.html index fe37e9924..323f7b434 100644 --- a/src/app/shared/gabinete-digital/generic/task-list/task-list.page.html +++ b/src/app/shared/gabinete-digital/generic/task-list/task-list.page.html @@ -29,7 +29,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} diff --git a/src/app/shared/gabinete-digital/pedidos/pedidos.page.html b/src/app/shared/gabinete-digital/pedidos/pedidos.page.html index 779ab3065..49000d6ce 100644 --- a/src/app/shared/gabinete-digital/pedidos/pedidos.page.html +++ b/src/app/shared/gabinete-digital/pedidos/pedidos.page.html @@ -136,7 +136,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} @@ -175,7 +175,7 @@
- {{task.activityInstanceName}} + {{task.WorkflowName}}
{{ task.taskStartDate || task.TaskStartDate | date: 'dd-MM-yyyy HH:mm' }} From 84efe58c0ab49f19761d285749df3c115bd7eb85 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 7 Mar 2024 12:02:59 +0100 Subject: [PATCH 5/7] update chat, make it render --- src/app/pages/chat/chat.page.ts | 13 ++++ .../group-messages/group-messages.page.html | 6 +- .../group-messages/group-messages.page.ts | 15 +++- src/app/pages/chat/messages/messages.page.ts | 13 +++- src/app/services/chat/chat-system.service.ts | 11 ++- src/app/services/chat/room.service.ts | 10 ++- src/app/services/notifications.service.ts | 21 +++++- .../group-messages/group-messages.page.ts | 15 +++- src/app/shared/chat/messages/messages.page.ts | 15 +++- src/app/store/notification-holder.service.ts | 68 +++++++++++++++++++ 10 files changed, 169 insertions(+), 18 deletions(-) diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index 4fe27b30a..e0e210b80 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -32,6 +32,8 @@ import { EventTrigger } from 'src/app/services/eventTrigger.service'; import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'; import { RouteService } from 'src/app/services/route.service'; import { Plugins } from '@capacitor/core'; +import { ChangeDetectorRef } from '@angular/core'; + const { App } = Plugins; @@ -128,6 +130,7 @@ export class ChatPage implements OnInit { private RochetChatConnectorService: RochetChatConnectorService, private zone: NgZone, public RouteService: RouteService, + private ChangeDetectorRef: ChangeDetectorRef ) { this.headers = new HttpHeaders();; @@ -175,8 +178,18 @@ export class ChatPage implements OnInit { } }); + this.ChatSystemService.setMainChangeDetector(()=> { + this.changeDetector() + }) + } + changeDetector = () => { + console.log('run detection') + this.ChangeDetectorRef.detectChanges() + } + + ngOnDestroy() { // this.setStatus('offline'); this.routerSubscription?.unsubscribe(); diff --git a/src/app/pages/chat/group-messages/group-messages.page.html b/src/app/pages/chat/group-messages/group-messages.page.html index 86a3a4b28..295800e6f 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.html +++ b/src/app/pages/chat/group-messages/group-messages.page.html @@ -1,6 +1,6 @@ -
+
@@ -45,7 +45,7 @@ - +
@@ -277,7 +277,7 @@ - +
{ + this.changeDetector() + }) } catch (error) { setTimeout(() => { this.open() @@ -151,6 +156,12 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { } } + + changeDetector = () => { + console.log('run detection page') + this.ChangeDetectorRef.detectChanges() + } + ngOnInit() { this.loggedUser = this.loggedUserChat; diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index b28b048a0..fb613e750 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -35,6 +35,7 @@ import { NotificationsService } from 'src/app/services/notifications.service'; import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service' import { FileValidatorService } from "src/app/services/file/file-validator.service" import { sanitize } from "sanitize-filename-ts"; +import { ChangeDetectorRef } from '@angular/core'; @@ -121,7 +122,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { private fileOpener: FileOpener, private router: Router, public RochetChatConnectorService: RochetChatConnectorService, - private FileValidatorService: FileValidatorService + private FileValidatorService: FileValidatorService, + private ChangeDetectorRef: ChangeDetectorRef ) { try { @@ -140,6 +142,10 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { this.ChatSystemService.getDmRoom(this.roomId).loadHistory({}) this.ChatSystemService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked this.ChatSystemService.openRoom(this.roomId) + this.ChatSystemService.getDmRoom(this.roomId).setChangeDetector(()=> { + + this.changeDetector() + }) setTimeout(() => { this.scrollToBottomClicked() @@ -147,8 +153,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { } catch (error) { //alert(error) } + } - + changeDetector = () => { + console.log('run detection page') + this.ChangeDetectorRef.detectChanges() } ngOnInit() { diff --git a/src/app/services/chat/chat-system.service.ts b/src/app/services/chat/chat-system.service.ts index 175a72db1..551d9aba8 100644 --- a/src/app/services/chat/chat-system.service.ts +++ b/src/app/services/chat/chat-system.service.ts @@ -48,6 +48,7 @@ export class ChatSystemService { loadingUsers = false onRoomsLoad = new Subscribe({ execute: false, deleteOnExecute: true }) + private mainChangeDetector: Function = () => {} constructor( @@ -66,7 +67,7 @@ export class ChatSystemService { private AttachmentsService: AttachmentsService, private NetworkServiceService: NetworkServiceService, private ViewedMessageService: ViewedMessageService, - private notificationService: NotificationsService + private notificationService: NotificationsService, ) { @@ -148,9 +149,15 @@ export class ChatSystemService { }); } } catch(error) {} + } + setMainChangeDetector(x:Function) { + this.mainChangeDetector = x + } - + runMainChangeDetector() { + console.log("change") + this.mainChangeDetector() } loadChat() { diff --git a/src/app/services/chat/room.service.ts b/src/app/services/chat/room.service.ts index 8b9f60be1..07037a32b 100644 --- a/src/app/services/chat/room.service.ts +++ b/src/app/services/chat/room.service.ts @@ -25,6 +25,7 @@ import { ChatSystemService } from './chat-system.service'; import { ViewedMessageService } from './viewed-message.service' import * as FIFOProcessQueue from 'fifo-process-queue'; import { NotificationsService } from '../notifications.service'; +import { ChangeDetectorRef } from '@angular/core'; @Injectable({ providedIn: 'root' @@ -84,6 +85,7 @@ export class RoomService { sortRoomList = () => { } chatServiceDeleteRoom = (roomId) => { } + private changeDetector: Function = () => {} constructor( public RochetChatConnectorService: RochetChatConnectorService, @@ -190,6 +192,11 @@ export class RoomService { } + setChangeDetector(x:Function) { + console.log("set change detector") + this.changeDetector = x + } + get online() { if (!this.isGroup) { @@ -372,8 +379,6 @@ export class RoomService { } this.messageUnread = true - - // this.sortRoomList() setTimeout(() => { this.scrollDown() }, 50) @@ -386,6 +391,7 @@ export class RoomService { this.name = ChatMessage.msg } + this.changeDetector() setTimeout(() => { done() }, 5) diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index 0ce3fde6c..750711340 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -14,9 +14,10 @@ import { notificationObject } from '../models/notifications'; import { Capacitor } from '@capacitor/core'; import { AngularFireMessaging } from '@angular/fire/messaging'; import { NotificationHolderService } from 'src/app/store/notification-holder.service'; - +import { ChatService } from 'src/app/services/chat.service'; import { FCM } from '@capacitor-community/fcm'; - +import { ChatSystemService } from './chat/chat-system.service'; +import {ChatController} from 'src/app/controller/chat' @Injectable({ providedIn: 'root' @@ -42,6 +43,8 @@ export class NotificationsService { notificationReceived: EventEmitter = new EventEmitter(); token = '' + ChatController = ChatController + constructor( private http: HttpClient, private storageService: StorageService, @@ -82,7 +85,7 @@ export class NotificationsService { }) .catch((error) => { console.log("Register device error", error) }) - + } catch (error) { console.log("Granted permission error", error) } @@ -199,6 +202,7 @@ export class NotificationsService { this.active = true console.log('NOtification Listener', notification) this.storenotification(notification) + this.chatNotification(notification) } @@ -206,11 +210,13 @@ export class NotificationsService { } else { this.afMessaging.messages.subscribe((notification) => { + console.log(notification) this.storenotification(notification) this.notificationReceived.emit(); this.eventtrigger.publishSomeData({ notification: "recive" }) + this.chatNotification(notification) // Handle the received message, e.g., show a notification }); } @@ -393,4 +399,13 @@ export class NotificationsService { // })() } + + chatNotification(_notification) { + const notification = this.NotificationHolderService.stractureNotificationObject(_notification) + + if (notification?.notification?.data?.Service === "chat" || notification?.Service === "chat") { + this.ChatController.ChatSystemService.runMainChangeDetector() + } + } + } diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index 002fca5f2..140f92715 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -30,7 +30,7 @@ import { SessionStore } from 'src/app/store/session.service'; import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page'; import { PermissionService } from 'src/app/services/permission.service'; import { FileValidatorService } from "src/app/services/file/file-validator.service" - +import { ChangeDetectorRef } from '@angular/core'; @Component({ selector: 'app-group-messages', templateUrl: './group-messages.page.html', @@ -103,7 +103,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe private platform: Platform, private fileOpener: FileOpener, public p: PermissionService, - private FileValidatorService: FileValidatorService + private FileValidatorService: FileValidatorService, + private ChangeDetectorRef: ChangeDetectorRef ) { this.ChatSystemService.getUser() @@ -119,7 +120,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe this.ChatSystemService.openRoom(this.roomId) this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ') - + this.ChatSystemService.getGroupRoom(this.roomId).setChangeDetector(()=> { + this.changeDetector() + }) this.showAvatar = false setTimeout(() => { @@ -131,6 +134,12 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe } + changeDetector = () => { + console.log('run detection shared') + this.ChangeDetectorRef.detectChanges() + } + + ngOnInit() { this.loggedUser = this.loggedUserChat; //setTimeout(() => { diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 9a0cb18f1..8ef5e2ece 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -34,6 +34,7 @@ import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page'; import { ChatMessageDebuggingPage } from 'src/app/shared/popover/chat-message-debugging/chat-message-debugging.page'; import { PermissionService } from 'src/app/services/permission.service'; import { FileValidatorService } from "src/app/services/file/file-validator.service" +import { ChangeDetectorRef } from '@angular/core'; const IMAGE_DIR = 'stored-images'; @@ -123,7 +124,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy private platform: Platform, private fileOpener: FileOpener, public p: PermissionService, - private FileValidatorService: FileValidatorService + private FileValidatorService: FileValidatorService, + private ChangeDetectorRef: ChangeDetectorRef ) { // update this.checkAudioPermission() @@ -138,6 +140,11 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy this.ChatSystemService.openRoom(this.roomId) + this.ChatSystemService.getDmRoom(this.roomId) + this.ChatSystemService.getDmRoom(this.roomId).setChangeDetector(()=> { + this.changeDetector() + }) + this.showAvatar = false @@ -154,6 +161,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy } + changeDetector = () => { + console.log('run detection shared') + this.ChangeDetectorRef.detectChanges() + } + + async ChatMessageDebuggingPage() { const modal = await this.modalController.create({ diff --git a/src/app/store/notification-holder.service.ts b/src/app/store/notification-holder.service.ts index 4748c0d5a..6d8c80049 100644 --- a/src/app/store/notification-holder.service.ts +++ b/src/app/store/notification-holder.service.ts @@ -114,6 +114,74 @@ export class NotificationHolderService { } + stractureNotificationObject(notification) { + const element = notification + let notificationObject; + + if (element.notification) { + + notificationObject = { + id: notification?.id || uuidv4(), + title: element.notification.title, + Service: element.data.Service, + Object: element.data.Object, + IdObject: element.data.IdObject, + FolderId: element.data.FolderId, + body: element.notification.body, + dateInit: this.getFormatedTime(element.data.dateInit), + dateEnd: this.getFormatedTime(element.data.dateEnd), + Location: element.data.Location, + TypeAgenda: element.data.TypeAgenda, + Role: element.data.Role, + Status: element.data.Status, + read: false, + } + + } else if (element.data) { + notificationObject = { + id: notification?.id || uuidv4(), + title: element.title, + Service: element.data.Service, + Object: element.data.Object, + IdObject: element.data.IdObject, + FolderId: element.data.FolderId, + body: element.body, + dateInit: this.getFormatedTime(element.data.dateInit), + dateEnd: this.getFormatedTime(element.data.dateEnd), + Location: element.data.Location, + TypeAgenda: element.data.TypeAgenda, + Role: element.data.Role, + Status: element.data.Status, + read: false, + } + + } else { + { + notificationObject = { + id: notification?.id || uuidv4(), + FolderId: element.FolderId, + IdObject: element.IdObject, + Location: element.Location, + Object: element.Object, + Role: element.Role, + Service: element.Service, + Status: element.Status, + TypeAgenda: element.TypeAgenda, + body: element.body, + dateEnd: element.dateEnd, + dateInit: element.dateInit, + index: element.index, + title: element.title, + read: false, + } + } + } + + notificationObject.hashCode = (SHA1(notification)).toString() + + return notificationObject + } + addNotification(notification) { From e87b4ccdeff6b855169a3d0919141ea2d4559d67 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Mon, 11 Mar 2024 10:23:33 +0100 Subject: [PATCH 6/7] remove publication mobile --- src/app/pages/login/login.page.ts | 14 ++++++++-- .../new-publication/new-publication.page.html | 2 +- .../new-publication/new-publication.page.ts | 28 +++++++++---------- src/app/services/auth.service.ts | 1 + src/app/services/chat/chat-system.service.ts | 2 +- src/app/services/chat/room.service.ts | 2 +- src/app/shared/header/header.page.ts | 10 +++++++ .../new-publication/new-publication.page.html | 2 +- .../new-publication/new-publication.page.ts | 3 +- 9 files changed, 42 insertions(+), 22 deletions(-) diff --git a/src/app/pages/login/login.page.ts b/src/app/pages/login/login.page.ts index 0be3a9409..ce39c08b8 100644 --- a/src/app/pages/login/login.page.ts +++ b/src/app/pages/login/login.page.ts @@ -144,8 +144,18 @@ export class LoginPage implements OnInit { if (attempt.ChatData) { - await this.authService.loginToChatWs(); - this.ChatService.setheader() + try { + + await MessageModel.deleteAll(); + await DeleteMessageModel.deleteAll(); + this.ChatSystemService.clearChat(); + this.NotificationHolderService.clear() + await this.authService.loginToChatWs(); + this.ChatService.setheader() + + } catch(error) { + console.log("faild to clear chat") + } } diff --git a/src/app/pages/publications/new-publication/new-publication.page.html b/src/app/pages/publications/new-publication/new-publication.page.html index a091392c3..9ea946437 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.html +++ b/src/app/pages/publications/new-publication/new-publication.page.html @@ -40,7 +40,7 @@
+ name="image" ngDefaultControl [src]="'data:image/jpg;base64,' + seleted.FileBase64" style="height: 69px;">
+ name="image" ngDefaultControl [src]="'data:image/jpg;base64,' + seleted.Base64" style="height: 69px;"> - -
diff --git a/src/app/shared/publication/new-publication/new-publication.page.ts b/src/app/shared/publication/new-publication/new-publication.page.ts index 5317377cd..a5795a5f7 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.ts +++ b/src/app/shared/publication/new-publication/new-publication.page.ts @@ -402,6 +402,7 @@ export class NewPublicationPage implements OnInit { let time = new Date() if (this.publicationFormMV.form.Files.length >= 1) { + const loader = this.toastService.loading() const upload = await this.publicationFormMV.uploadVideosFiles() @@ -410,7 +411,10 @@ export class NewPublicationPage implements OnInit { if(e.FileType == 'video' && e.blobFile && e.toUpload) { e.OriginalFileName = e.chucksManager.path.replace(".mp4", "") e.FileExtension = "mp4" + e.Base64 = '' } + + return e }) @@ -427,7 +431,7 @@ export class NewPublicationPage implements OnInit { publication.DocumentId = null; publication.ProcessId = this.folderId - const loader = this.toastService.loading() + try {