From 12cf5831a820fe58168536561141b5daf61d3b48 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Fri, 30 Sep 2022 15:13:36 +0100 Subject: [PATCH] rename files --- src/app/app.module.ts | 2 - .../set-room-owner/set-room-owner.page.ts | 6 +-- src/app/pages/chat/chat.page.html | 12 ++--- src/app/pages/chat/chat.page.ts | 10 ++-- .../group-contacts/group-contacts.page.ts | 8 +-- .../group-messages/group-messages.page.html | 16 +++--- .../group-messages/group-messages.page.ts | 32 ++++++------ .../chat/messages/contacts/contacts.page.html | 2 +- .../chat/messages/contacts/contacts.page.ts | 6 +-- .../pages/chat/messages/messages.page.html | 20 ++++---- src/app/pages/chat/messages/messages.page.ts | 32 ++++++------ .../pages/chat/new-group/new-group.page.ts | 10 ++-- src/app/pages/login/login.page.ts | 16 +++--- src/app/services/alert.service.ts | 8 +-- src/app/services/auth.service.ts | 16 +++--- ...ce.spec.ts => chat-system.service.spec.ts} | 8 +-- ...hods.service.ts => chat-system.service.ts} | 37 +++++++------- src/app/services/chat/message.service.ts | 12 ++--- .../rochet-chat-connector.service.spec.ts | 16 ++++++ ...ce.ts => rochet-chat-connector.service.ts} | 5 +- src/app/services/chat/room.service.ts | 50 +++++++++---------- src/app/services/chat/websocket.service.ts | 43 ---------------- .../chat/ws-chat-methods.service.spec.ts | 16 ------ src/app/services/chat/ws-chat.service.spec.ts | 16 ------ src/app/services/functions/time.service.ts | 8 +-- .../group-messages/group-messages.page.html | 16 +++--- .../group-messages/group-messages.page.ts | 36 ++++++------- .../chat/messages/contacts/contacts.page.html | 2 +- .../chat/messages/contacts/contacts.page.ts | 6 +-- .../shared/chat/messages/messages.page.html | 18 +++---- src/app/shared/chat/messages/messages.page.ts | 40 +++++++-------- .../shared/chat/new-group/new-group.page.ts | 18 +++---- .../chat-debugging/chat-debugging.page.html | 4 +- .../chat-debugging/chat-debugging.page.ts | 4 +- .../chat-message-debugging.page.ts | 6 +-- .../popover/chat-popover/chat-popover.page.ts | 14 +++--- 36 files changed, 256 insertions(+), 315 deletions(-) rename src/app/services/chat/{websocket.service.spec.ts => chat-system.service.spec.ts} (52%) rename src/app/services/chat/{ws-chat-methods.service.ts => chat-system.service.ts} (88%) create mode 100644 src/app/services/chat/rochet-chat-connector.service.spec.ts rename src/app/services/chat/{ws-chat.service.ts => rochet-chat-connector.service.ts} (99%) delete mode 100644 src/app/services/chat/websocket.service.ts delete mode 100644 src/app/services/chat/ws-chat-methods.service.spec.ts delete mode 100644 src/app/services/chat/ws-chat.service.spec.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9a2d12d50..874291c0b 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -25,7 +25,6 @@ import { CalendarModule, DateAdapter } from 'angular-calendar'; import { adapterFactory } from 'angular-calendar/date-adapters/date-fns'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { MessagesPage } from './pages/chat/messages/messages.page'; -import { WebsocketService } from './services/websocket.service' import { ChatService } from './services/chat.service'; import {MatDatepickerModule} from '@angular/material/datepicker'; // import { FCM } from 'cordova-plugin-fcm-with-dependecy-updated/ionic/ngx'; @@ -130,7 +129,6 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */ FilePath, /* FCM, FirebaseX, */ - WebsocketService, ChatService, ScreenOrientation, Network, diff --git a/src/app/modals/set-room-owner/set-room-owner.page.ts b/src/app/modals/set-room-owner/set-room-owner.page.ts index 823571f20..f1d0b9e0c 100644 --- a/src/app/modals/set-room-owner/set-room-owner.page.ts +++ b/src/app/modals/set-room-owner/set-room-owner.page.ts @@ -3,7 +3,7 @@ import { Component, OnInit } from '@angular/core'; import { ModalController, NavParams } from '@ionic/angular'; import { AuthService } from 'src/app/services/auth.service'; import { ChatService } from 'src/app/services/chat.service'; -import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service'; +import { ChatSystemService } from 'src/app/services/chat/chat-system.service'; import { ThemeService } from 'src/app/services/theme.service' import { ToastService } from 'src/app/services/toast.service'; @@ -26,7 +26,7 @@ export class SetRoomOwnerPage implements OnInit { private navParams: NavParams, public ThemeService: ThemeService, private toastService: ToastService, - public wsChatMethodsService: WsChatMethodsService, + public ChatSystemService: ChatSystemService, ) { this.roomId = this.navParams.get('roomId'); this.members = this.navParams.get('members'); @@ -60,7 +60,7 @@ export class SetRoomOwnerPage implements OnInit { async setRoomOwner(user:any){ - let res:any = await this.wsChatMethodsService.addRoomOwner(this.roomId, user._id); + let res:any = await this.ChatSystemService.addRoomOwner(this.roomId, user._id); if(res.error){ diff --git a/src/app/pages/chat/chat.page.html b/src/app/pages/chat/chat.page.html index 854ac1986..5e5a13506 100644 --- a/src/app/pages/chat/chat.page.html +++ b/src/app/pages/chat/chat.page.html @@ -4,7 +4,7 @@ - + @@ -48,7 +48,7 @@
@@ -100,7 +100,7 @@
- +
@@ -118,7 +118,7 @@ -
@@ -157,7 +157,7 @@
- +
@@ -234,7 +234,7 @@ { + this.ChatSystemService._group.forEach((room)=>{ if(room.id == roomId) { @@ -362,7 +362,7 @@ export class ChatPage implements OnInit { } }) - this.wsChatMethodsService._dm.forEach((room)=>{ + this.ChatSystemService._dm.forEach((room)=>{ if(room.id == roomId) { this.openMessagesPage(roomId) } @@ -371,7 +371,7 @@ export class ChatPage implements OnInit { } onSegmentChange() { - this.wsChatMethodsService.getAllRooms(); + this.ChatSystemService.getAllRooms(); } doRefresh(event) { diff --git a/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts index 405ce8086..047c160cb 100644 --- a/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts +++ b/src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts @@ -7,7 +7,7 @@ import { ChatService } from 'src/app/services/chat.service'; import { GroupMessagesPage } from '../group-messages.page'; import { ThemeService } from 'src/app/services/theme.service' import { SessionStore } from 'src/app/store/session.service'; -import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service'; +import { ChatSystemService } from 'src/app/services/chat/chat-system.service'; @Component({ selector: 'app-group-contacts', @@ -41,7 +41,7 @@ export class GroupContactsPage implements OnInit { private authService: AuthService, private navParams: NavParams, public ThemeService: ThemeService, - public wsChatMethodsService: WsChatMethodsService, + public ChatSystemService: ChatSystemService, ) { this.loggedUser = authService.ValidatedUserChat['data']; @@ -93,14 +93,14 @@ export class GroupContactsPage implements OnInit { if(this.room.t == "p"){ this.chatService.getGroupMembers(this.room._id).subscribe(res=>{ this.members = res['members']; - this.wsChatMethodsService.getAllRooms() + this.ChatSystemService.getAllRooms() this.loadUsers(); }); } else if(this.room.t == "c"){ this.chatService.getChannelMembers(this.room._id).subscribe(res=>{ this.members = res['members']; - this.wsChatMethodsService.getAllRooms() + this.ChatSystemService.getAllRooms() this.loadUsers(); }); } 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 b2cf97bac..fdfdc6f16 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.html +++ b/src/app/pages/chat/group-messages/group-messages.page.html @@ -51,7 +51,7 @@ Esta conversa passou a grupo
A conversa original mantêm-se como chat individual
-
+
{{msg.u.name ?? ""}} @@ -217,13 +217,13 @@ -
+
- {{ wsChatMethodsService.getGroupRoom(roomId).userThatIsTyping }} está a escrever... + {{ ChatSystemService.getGroupRoom(roomId).userThatIsTyping }} está a escrever...
@@ -243,7 +243,7 @@
- +
- - - diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index 4e79fcb85..21791070d 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -18,7 +18,7 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag import { ThemeService } from 'src/app/services/theme.service' import { ViewEventPage } from 'src/app/modals/view-event/view-event.page'; import { SqliteService } from 'src/app/services/sqlite.service'; -import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service'; +import { ChatSystemService } from 'src/app/services/chat/chat-system.service'; import { FileType } from 'src/app/models/fileType'; import { Storage } from '@ionic/storage'; @@ -100,7 +100,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { private changeDetectorRef: ChangeDetectorRef, private sqlservice: SqliteService, private platform: Platform, - public wsChatMethodsService: WsChatMethodsService, + public ChatSystemService: ChatSystemService, private storage: Storage, private CameraService: CameraService, private sanitiser: DomSanitizer, @@ -116,10 +116,10 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { } }; - this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory({}); - this.wsChatMethodsService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked; - this.wsChatMethodsService.openRoom(this.roomId) - this.groupNameFormart = this.wsChatMethodsService.getGroupRoom(this.roomId).name.split('-').join(' ') + this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({}); + this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked; + this.ChatSystemService.openRoom(this.roomId) + this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ') setTimeout(() => { this.scrollToBottomClicked() @@ -145,7 +145,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { this.getChatMembers(); this.getRoomMessageDB(this.roomId); - this.wsChatMethodsService.getUserOfRoom(this.roomId).then((value) => { + this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => { }) @@ -162,7 +162,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { } deleteMessage(msgId: string) { - const room = this.wsChatMethodsService.getGroupRoom(this.roomId) + const room = this.ChatSystemService.getGroupRoom(this.roomId) this.alertService.confirmDeleteMessage(msgId, room); } @@ -379,7 +379,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { // this.getGroupContacts(this.room); // this.showLoader = false; // }); - this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory({}); + this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({}); let room = await this.chatService.getRoomInfo(this.roomId).toPromise(); // console.log('ROOM',room) this.room = room['room']; @@ -442,7 +442,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { // }); // } - this.members = this.wsChatMethodsService.getGroupRoom(this.roomId).members + this.members = this.ChatSystemService.getGroupRoom(this.roomId).members } @@ -462,7 +462,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { } sendMessage() { - this.wsChatMethodsService.getGroupRoom(this.roomId).send({}) + this.ChatSystemService.getGroupRoom(this.roomId).send({}) } base64toBlob(base64Data, contentType) { @@ -507,7 +507,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { const formData = new FormData(); formData.append("blobFile", blob); - this.wsChatMethodsService.getGroupRoom(roomId).send({ + this.ChatSystemService.getGroupRoom(roomId).send({ file: { "type": "application/audio", "msDuration": audioFile.value.msDuration, @@ -540,7 +540,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { modal.onDidDismiss().then(res => { if (res.data == 'leave') { - //this.wsChatMethodsService.subscribeToRoomUpdate(this.roomId, this.room); + //this.ChatSystemService.subscribeToRoomUpdate(this.roomId, this.room); } else if (res.data == 'cancel') { @@ -656,7 +656,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { const formData = new FormData(); formData.append("blobFile", blob); - this.wsChatMethodsService.getGroupRoom(roomId).send({ + this.ChatSystemService.getGroupRoom(roomId).send({ file: { "type": "application/img", "guid": '' @@ -695,7 +695,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { if (data.selected) { - this.wsChatMethodsService.getGroupRoom(this.roomId).send({ + this.ChatSystemService.getGroupRoom(this.roomId).send({ file: { "name": res.data.selected.Assunto, "type": "application/webtrix", @@ -740,7 +740,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy { formData.append('blobFile', blob); - this.wsChatMethodsService.getGroupRoom(roomId).send({ + this.ChatSystemService.getGroupRoom(roomId).send({ file: { "type": file.type, "guid": '', diff --git a/src/app/pages/chat/messages/contacts/contacts.page.html b/src/app/pages/chat/messages/contacts/contacts.page.html index 3ac1d542e..13c3dcadc 100644 --- a/src/app/pages/chat/messages/contacts/contacts.page.html +++ b/src/app/pages/chat/messages/contacts/contacts.page.html @@ -29,7 +29,7 @@
- +
{{header}} diff --git a/src/app/pages/chat/messages/contacts/contacts.page.ts b/src/app/pages/chat/messages/contacts/contacts.page.ts index b6d3fdb24..8d509c919 100644 --- a/src/app/pages/chat/messages/contacts/contacts.page.ts +++ b/src/app/pages/chat/messages/contacts/contacts.page.ts @@ -5,7 +5,7 @@ import { AuthService } from 'src/app/services/auth.service'; import { ChatService } from 'src/app/services/chat.service'; import { MessagesPage } from '../messages.page'; import { ThemeService } from 'src/app/services/theme.service' -import { WsChatMethodsService} from 'src/app/services/chat/ws-chat-methods.service' +import { ChatSystemService} from 'src/app/services/chat/chat-system.service' import { SessionStore } from 'src/app/store/session.service'; @Component({ @@ -30,7 +30,7 @@ export class ContactsPage implements OnInit { private chatService: ChatService, private authService: AuthService, public ThemeService: ThemeService, - public WsChatMethodsService: WsChatMethodsService, + public ChatSystemService: ChatSystemService, ) { this.loggedUser = authService.ValidatedUserChat['data']; @@ -100,7 +100,7 @@ export class ContactsPage implements OnInit { this.room = res['room']; - await this.WsChatMethodsService.getAllRooms(); + await this.ChatSystemService.getAllRooms(); this.getDirectMessage(this.room._id); }); } diff --git a/src/app/pages/chat/messages/messages.page.html b/src/app/pages/chat/messages/messages.page.html index b9d0b620f..2658cbf45 100644 --- a/src/app/pages/chat/messages/messages.page.html +++ b/src/app/pages/chat/messages/messages.page.html @@ -10,12 +10,12 @@
- {{wsChatMethodsService.getDmRoom(roomId).name}} + {{ChatSystemService.getDmRoom(roomId).name}}
- +
@@ -45,7 +45,7 @@
@@ -224,8 +224,8 @@ -
- + está a escrever ...
@@ -251,8 +251,8 @@
+ [(ngModel)]="ChatSystemService.getDmRoom(roomId).message" + (ionChange)="ChatSystemService.getDmRoom(roomId).sendTyping()">
- - -
-
+
@@ -240,14 +240,14 @@ -
+
- {{ wsChatMethodsService.getGroupRoom(roomId).userThatIsTyping }} está a escrever... + {{ ChatSystemService.getGroupRoom(roomId).userThatIsTyping }} está a escrever...
@@ -286,7 +286,7 @@
- +
- - - 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 8f09ce6a5..317a312ff 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -19,7 +19,7 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag import { ThemeService } from 'src/app/services/theme.service' import { ViewEventPage } from 'src/app/modals/view-event/view-event.page'; import { Storage } from '@ionic/storage'; -import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service'; +import { ChatSystemService } from 'src/app/services/chat/chat-system.service'; import { MessageService } from 'src/app/services/chat/message.service'; import { AttachmentsService } from 'src/app/services/attachments.service'; @@ -106,7 +106,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe groupNameFormart = ""; constructor( - public wsChatMethodsService: WsChatMethodsService, + public ChatSystemService: ChatSystemService, private modalController: ModalController, public popoverController: PopoverController, private chatService: ChatService, @@ -145,11 +145,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe ngOnChanges(changes: SimpleChanges): void { this.getRoomInfo(); - this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory({}); + this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({}); // - this.wsChatMethodsService.openRoom(this.roomId) - this.wsChatMethodsService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked - this.groupNameFormart = this.wsChatMethodsService.getGroupRoom(this.roomId).name.split('-').join(' ') + this.ChatSystemService.openRoom(this.roomId) + this.ChatSystemService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked + this.groupNameFormart = this.ChatSystemService.getGroupRoom(this.roomId).name.split('-').join(' ') this.showAvatar = false @@ -404,8 +404,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe async getRoomInfo() { - if(this.wsChatMethodsService.getGroupRoom(this.roomId)) { - this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory({}); + if(this.ChatSystemService.getGroupRoom(this.roomId)) { + this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({}); } let room = await this.chatService.getRoomInfo(this.roomId).toPromise(); @@ -448,11 +448,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe // }); // } - this.members = this.wsChatMethodsService.getGroupRoom(this.roomId).members + this.members = this.ChatSystemService.getGroupRoom(this.roomId).members } sendMessage() { - this.wsChatMethodsService.getGroupRoom(this.roomId).send({}) + this.ChatSystemService.getGroupRoom(this.roomId).send({}) } base64toBlob(base64Data, contentType) { @@ -497,7 +497,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe const formData = new FormData(); formData.append("blobFile", blob); - this.wsChatMethodsService.getGroupRoom(roomId).send({ + this.ChatSystemService.getGroupRoom(roomId).send({ file: { "type": "application/audio", "msDuration": audioFile.value.msDuration, @@ -516,7 +516,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe } deleteMessage(msgId: string) { - const room = this.wsChatMethodsService.getGroupRoom(this.roomId) + const room = this.ChatSystemService.getGroupRoom(this.roomId) this.alertService.confirmDeleteMessage(msgId, room); } @@ -577,7 +577,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe this.getRoomInfo(); this.closeAllDesktopComponents.emit(); this.showEmptyContainer.emit(); - this.wsChatMethodsService.hidingRoom(this.roomId); + this.ChatSystemService.hidingRoom(this.roomId); } else if (res.data == 'delete') { this.closeAllDesktopComponents.emit(); @@ -770,7 +770,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe const formData = new FormData(); formData.append("blobFile", blob); - this.wsChatMethodsService.getGroupRoom(roomId).send({ + this.ChatSystemService.getGroupRoom(roomId).send({ file: { "type": "application/img", "guid": '', @@ -799,7 +799,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe const formData = new FormData(); formData.append("blobFile", blob); - this.wsChatMethodsService.getGroupRoom(roomId).send({ + this.ChatSystemService.getGroupRoom(roomId).send({ file: { "type": "application/img", "guid": '' @@ -840,7 +840,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe if (data.selected) { - this.wsChatMethodsService.getGroupRoom(roomId).send({ + this.ChatSystemService.getGroupRoom(roomId).send({ file: { "name": res.data.selected.Assunto, "type": "application/webtrix", @@ -886,7 +886,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe const formData = new FormData(); formData.append("blobFile", blob); - this.wsChatMethodsService.getGroupRoom(roomId).send({ + this.ChatSystemService.getGroupRoom(roomId).send({ file: { "type": "application/img", "guid": '' @@ -919,7 +919,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe const formData = new FormData(); formData.append("blobFile", blob); - this.wsChatMethodsService.getGroupRoom(roomId).send({ + this.ChatSystemService.getGroupRoom(roomId).send({ file: { "type": file.type, "guid": '', diff --git a/src/app/shared/chat/messages/contacts/contacts.page.html b/src/app/shared/chat/messages/contacts/contacts.page.html index 633f41444..58b3bc8ad 100644 --- a/src/app/shared/chat/messages/contacts/contacts.page.html +++ b/src/app/shared/chat/messages/contacts/contacts.page.html @@ -29,7 +29,7 @@
- +
{{header}} diff --git a/src/app/shared/chat/messages/contacts/contacts.page.ts b/src/app/shared/chat/messages/contacts/contacts.page.ts index be380793e..aef23d1ef 100644 --- a/src/app/shared/chat/messages/contacts/contacts.page.ts +++ b/src/app/shared/chat/messages/contacts/contacts.page.ts @@ -5,7 +5,7 @@ import { AuthService } from 'src/app/services/auth.service'; import { ChatService } from 'src/app/services/chat.service'; import { MessagesPage } from '../messages.page'; import { ThemeService } from 'src/app/services/theme.service' -import { WsChatMethodsService} from 'src/app/services/chat/ws-chat-methods.service' +import { ChatSystemService } from 'src/app/services/chat/chat-system.service' import { SessionStore } from 'src/app/store/session.service'; @Component({ @@ -34,7 +34,7 @@ export class ContactsPage implements OnInit { private chatService: ChatService, private authService: AuthService, public ThemeService: ThemeService, - public WsChatMethodsService: WsChatMethodsService + public ChatSystemService: ChatSystemService ) { this.loggedUser = authService.ValidatedUserChat['data']; this.textSearch=""; @@ -124,7 +124,7 @@ export class ContactsPage implements OnInit { this.room = res['room']; this.openMessagesModal(this.room._id); - this.WsChatMethodsService.getAllRooms() + this.ChatSystemService.getAllRooms() }); } diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index 107f816a8..5568bc0da 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -3,7 +3,7 @@
- {{ this.wsChatMethodsService.getDmRoom(this.roomId).name }} + {{ this.ChatSystemService.getDmRoom(this.roomId).name }}
@@ -38,7 +38,7 @@
+ *ngFor="let msg of ChatSystemService.getDmRoom(roomId).messages; index as i; let last = last">
@@ -218,11 +218,11 @@ - + -
+
@@ -268,7 +268,7 @@
- +
- - - diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 9e48737fa..11af6dff5 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -15,8 +15,8 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag import { ThemeService } from 'src/app/services/theme.service' import { ViewEventPage } from 'src/app/modals/view-event/view-event.page'; import { Storage } from '@ionic/storage'; -import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service' -import { WsChatService } from 'src/app/services/chat/ws-chat.service' +import { ChatSystemService } from 'src/app/services/chat/chat-system.service' +import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service' import { MessageService } from 'src/app/services/chat/message.service'; import { AttachmentsService } from 'src/app/services/attachments.service'; import { CameraService } from 'src/app/services/camera.service'; @@ -116,8 +116,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy private gestureController: GestureController, public ThemeService: ThemeService, private storage: Storage, - public wsChatMethodsService: WsChatMethodsService, - public WsChatService: WsChatService, + public ChatSystemService: ChatSystemService, + public RochetChatConnectorService: RochetChatConnectorService, private AttachmentsService: AttachmentsService, private CameraService: CameraService, private sanitiser: DomSanitizer, @@ -131,12 +131,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy ngOnChanges(changes: SimpleChanges): void { - this.wsChatMethodsService.getAllRooms(); - this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory({}) + this.ChatSystemService.getAllRooms(); + this.ChatSystemService.getDmRoom(this.roomId).loadHistory({}) - this.wsChatMethodsService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked + this.ChatSystemService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked - this.wsChatMethodsService.openRoom(this.roomId) + this.ChatSystemService.openRoom(this.roomId) this.showAvatar = false @@ -176,7 +176,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy } ngOnInit() { - this.wsChatMethodsService.getAllRooms(); + this.ChatSystemService.getAllRooms(); this.chatService.refreshtoken(); this.scrollToBottom(); this.getChatMembers(); @@ -406,7 +406,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy } sendMessage() { - this.wsChatMethodsService.getDmRoom(this.roomId).send({}) + this.ChatSystemService.getDmRoom(this.roomId).send({}) } @@ -430,7 +430,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy const formData = new FormData(); formData.append("blobFile", blob); - this.wsChatMethodsService.getDmRoom(roomId).send({ + this.ChatSystemService.getDmRoom(roomId).send({ file: { "type": "application/audio", "msDuration": audioFile.value.msDuration, @@ -450,7 +450,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy deleteMessage(msgId: string, msg: MessageService) { - this.wsChatMethodsService.getDmRoom(this.roomId).sendDeleteRequest(msgId) + this.ChatSystemService.getDmRoom(this.roomId).sendDeleteRequest(msgId) } base64toBlob(base64Data, contentType) { @@ -534,8 +534,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy // this.showLoader = false; // }); - this.members = this.wsChatMethodsService.getDmRoom(this.roomId).members - this.dmUsers = this.wsChatMethodsService.getDmRoom(this.roomId).membersExcludeMe + this.members = this.ChatSystemService.getDmRoom(this.roomId).members + this.dmUsers = this.ChatSystemService.getDmRoom(this.roomId).membersExcludeMe } async openMessagesOptions(ev: any) { @@ -669,7 +669,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy const formData = new FormData(); formData.append("blobFile", blob); - this.wsChatMethodsService.getDmRoom(roomId).send({ + this.ChatSystemService.getDmRoom(roomId).send({ file: { "type": "application/img", "guid": '', @@ -702,7 +702,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy - this.wsChatMethodsService.getDmRoom(roomId).send({ + this.ChatSystemService.getDmRoom(roomId).send({ file: { "type": "application/img", "guid": '' @@ -744,7 +744,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy if (data.selected) { - this.wsChatMethodsService.getDmRoom(roomId).send({ + this.ChatSystemService.getDmRoom(roomId).send({ file: { "name": res.data.selected.Assunto, "type": "application/webtrix", @@ -787,7 +787,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy const formData = new FormData(); formData.append("blobFile", blob); - this.wsChatMethodsService.getDmRoom(roomId).send({ + this.ChatSystemService.getDmRoom(roomId).send({ file: { "type": "application/img", "guid": '' @@ -821,7 +821,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy const formData = new FormData(); formData.append("blobFile", blob); - this.wsChatMethodsService.getDmRoom(roomId).send({ + this.ChatSystemService.getDmRoom(roomId).send({ file: { "type": file.type, "guid": '', @@ -1134,7 +1134,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy } async getRoomInfo() { - // this.wsChatMethodsService.getGroupRoom(this.roomId).loadHistory({}); + // this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({}); let room = await this.chatService.getRoomInfo(this.roomId).toPromise(); // console.log('ROOM',room) this.room = room['room']; diff --git a/src/app/shared/chat/new-group/new-group.page.ts b/src/app/shared/chat/new-group/new-group.page.ts index e7569381c..45e5a92af 100644 --- a/src/app/shared/chat/new-group/new-group.page.ts +++ b/src/app/shared/chat/new-group/new-group.page.ts @@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angu import { NavigationStart, Router } from '@angular/router'; import { ModalController, NavParams, PickerController, PopoverController } from '@ionic/angular'; import { AuthService } from 'src/app/services/auth.service'; -import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service'; +import { ChatSystemService } from 'src/app/services/chat/chat-system.service'; import { DataService } from 'src/app/services/data.service'; import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page'; import { SessionStore } from 'src/app/store/session.service'; @@ -39,7 +39,7 @@ export class NewGroupPage implements OnInit{ private modalController: ModalController, private dataService:DataService, private router: Router, - public wsChatMethodsService: WsChatMethodsService, + public ChatSystemService: ChatSystemService, private authService: AuthService, private toastService: ToastService, public ThemeService: ThemeService @@ -90,10 +90,10 @@ export class NewGroupPage implements OnInit{ let customFields = { "countDownDate":this.thedate } - res = await this.wsChatMethodsService.createPrivateRoom(name, SessionStore.user.UserName, customFields); + res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields); } else { - res = await this.wsChatMethodsService.createPrivateRoom(name, SessionStore.user.UserName, customFields); + res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields); } @@ -104,9 +104,9 @@ export class NewGroupPage implements OnInit{ if(res?.result?.rid) { this.addGroupMessage.emit(res.result.rid); - await this.wsChatMethodsService.getAllRooms(); + await this.ChatSystemService.getAllRooms(); - if(!this.wsChatMethodsService.getGroupRoom(res.result.rid)) { + if(!this.ChatSystemService.getGroupRoom(res.result.rid)) { this.createGroupWithAttachmentsCath(res) } else { setTimeout(()=> { @@ -127,7 +127,7 @@ export class NewGroupPage implements OnInit{ } createGroupWithAttachmentsCath(res: any) { - if(!this.wsChatMethodsService.getGroupRoom(res.result.rid)) { + if(!this.ChatSystemService.getGroupRoom(res.result.rid)) { setTimeout(()=>{ this.createGroupWithAttachmentsCath(res) }, 1500) @@ -137,10 +137,10 @@ export class NewGroupPage implements OnInit{ } createGroupWithAttachments(res: any) { - this.wsChatMethodsService.getGroupRoom(res.result.rid).hasLoadHistory = true; + this.ChatSystemService.getGroupRoom(res.result.rid).hasLoadHistory = true; this.documents.forEach(element => { - this.wsChatMethodsService.getGroupRoom(res.result.rid).send({ + this.ChatSystemService.getGroupRoom(res.result.rid).send({ file: { "name": element.Assunto, "type": "application/webtrix", diff --git a/src/app/shared/popover/chat-debugging/chat-debugging.page.html b/src/app/shared/popover/chat-debugging/chat-debugging.page.html index bcb4b7dc5..2ec64ebdc 100644 --- a/src/app/shared/popover/chat-debugging/chat-debugging.page.html +++ b/src/app/shared/popover/chat-debugging/chat-debugging.page.html @@ -1,9 +1,9 @@
  • Chat login
  • -
  • Chat user list {{ wsChatMethodsService.users | json }}
  • +
  • Chat user list {{ ChatSystemService.users | json }}
    -
  • chat Name: {{room.name}}; subcribe: {{room.status.receive.message}};
  • +
  • chat Name: {{room.name}}; subcribe: {{room.status.receive.message}};
diff --git a/src/app/shared/popover/chat-debugging/chat-debugging.page.ts b/src/app/shared/popover/chat-debugging/chat-debugging.page.ts index 74ddd2445..5f7f81a04 100644 --- a/src/app/shared/popover/chat-debugging/chat-debugging.page.ts +++ b/src/app/shared/popover/chat-debugging/chat-debugging.page.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { WsChatMethodsService} from 'src/app/services/chat/ws-chat-methods.service'; +import { ChatSystemService } from 'src/app/services/chat/chat-system.service'; @Component({ selector: 'app-chat-debugging', @@ -9,7 +9,7 @@ import { WsChatMethodsService} from 'src/app/services/chat/ws-chat-methods.servi export class ChatDebuggingPage implements OnInit { constructor( - public wsChatMethodsService: WsChatMethodsService + public ChatSystemService: ChatSystemService ) { } ngOnInit() {} diff --git a/src/app/shared/popover/chat-message-debugging/chat-message-debugging.page.ts b/src/app/shared/popover/chat-message-debugging/chat-message-debugging.page.ts index 80d3f5767..64c46c02e 100644 --- a/src/app/shared/popover/chat-message-debugging/chat-message-debugging.page.ts +++ b/src/app/shared/popover/chat-message-debugging/chat-message-debugging.page.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { NavParams } from '@ionic/angular'; -import { WsChatMethodsService} from 'src/app/services/chat/ws-chat-methods.service'; +import { ChatSystemService } from 'src/app/services/chat/chat-system.service'; @Component({ selector: 'app-chat-message-debugging', @@ -12,7 +12,7 @@ export class ChatMessageDebuggingPage implements OnInit { roomId: string constructor( - public wsChatMethodsService: WsChatMethodsService, + public ChatSystemService: ChatSystemService, private navParams: NavParams ) { } @@ -23,7 +23,7 @@ export class ChatMessageDebuggingPage implements OnInit { } loadHistory() { - this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory({}); + this.ChatSystemService.getDmRoom(this.roomId).loadHistory({}); } } diff --git a/src/app/shared/popover/chat-popover/chat-popover.page.ts b/src/app/shared/popover/chat-popover/chat-popover.page.ts index 68f54d8ac..57edd3a53 100644 --- a/src/app/shared/popover/chat-popover/chat-popover.page.ts +++ b/src/app/shared/popover/chat-popover/chat-popover.page.ts @@ -4,7 +4,7 @@ import { ChatService } from 'src/app/services/chat.service'; import { ToastService } from 'src/app/services/toast.service'; import { ThemeService } from 'src/app/services/theme.service' import { SetRoomOwnerPage } from 'src/app/modals/set-room-owner/set-room-owner.page'; -import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service'; +import { ChatSystemService } from 'src/app/services/chat/chat-system.service'; import { HttpErrorResponse } from '@angular/common/http'; import { SessionStore } from 'src/app/store/session.service'; @@ -27,7 +27,7 @@ export class ChatPopoverPage implements OnInit { private chatService: ChatService, private toastService: ToastService, public ThemeService: ThemeService, - public wsChatMethodsService: WsChatMethodsService, + public ChatSystemService: ChatSystemService, ) { this.roomId = this.navParams.get('roomId'); this.members = this.navParams.get('members'); @@ -73,7 +73,7 @@ export class ChatPopoverPage implements OnInit { modal.onDidDismiss().then((res)=>{ if(res.data == 'success'){ this.leaveGroup(); - //this.wsChatMethodsService.hidingRoom(this.roomId); + //this.ChatSystemService.hidingRoom(this.roomId); } }); } @@ -82,8 +82,8 @@ export class ChatPopoverPage implements OnInit { let body = { "roomId":this.roomId, } - let res:any = await this.wsChatMethodsService.leaveRoom(this.roomId); - this.wsChatMethodsService.deleteRoom(this.roomId) + let res:any = await this.ChatSystemService.leaveRoom(this.roomId); + this.ChatSystemService.deleteRoom(this.roomId) if(res.error){ if(res.error.error = "error-you-are-last-owner"){ @@ -114,12 +114,12 @@ export class ChatPopoverPage implements OnInit { if(this.room.t === 'p'){ this.chatService.deleteGroup(body).subscribe(res=>{ - this.wsChatMethodsService.deleteRoom(this.roomId) + this.ChatSystemService.deleteRoom(this.roomId) }); } else{ this.chatService.deleteChannel(body).subscribe(res=>{ - this.wsChatMethodsService.deleteRoom(this.roomId) + this.ChatSystemService.deleteRoom(this.roomId) }); } });