mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
remove rocket chat
This commit is contained in:
@@ -24,7 +24,7 @@ import { ViewChild } from '@angular/core';
|
||||
import { FormGroup, Validators } from '@angular/forms';
|
||||
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service';
|
||||
//import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
@@ -142,7 +142,7 @@ export class NewEventPage implements OnInit {
|
||||
private toastService: ToastService,
|
||||
private dateAdapter: DateAdapter<any>,
|
||||
public ThemeService: ThemeService,
|
||||
private chatMethodService: ChatMethodsService,
|
||||
// private chatMethodService: ChatMethodsService,
|
||||
private hhtpErrorHandle: HttpErrorHandle,
|
||||
private processeService: ProcessesService,
|
||||
public TaskService: TaskService,
|
||||
@@ -579,9 +579,9 @@ export class NewEventPage implements OnInit {
|
||||
"calendarId": CalendarId
|
||||
}
|
||||
|
||||
if (this.roomId) {
|
||||
this.chatMethodService.sendMessage(this.roomId, data);
|
||||
}
|
||||
// if (this.roomId) {
|
||||
// this.chatMethodService.sendMessage(this.roomId, data);
|
||||
// }
|
||||
|
||||
},
|
||||
error => {
|
||||
@@ -637,9 +637,9 @@ export class NewEventPage implements OnInit {
|
||||
"id": id,
|
||||
"calendarId": CalendarId
|
||||
}
|
||||
if (this.roomId) {
|
||||
this.chatMethodService.sendMessage(this.roomId, data);
|
||||
}
|
||||
// if (this.roomId) {
|
||||
// this.chatMethodService.sendMessage(this.roomId, data);
|
||||
// }
|
||||
}, (error) => {
|
||||
|
||||
//const connectionToServer = this.ServerConnectionService.BaseAPI()
|
||||
@@ -812,9 +812,9 @@ export class NewEventPage implements OnInit {
|
||||
"id": id,
|
||||
"calendarId": CalendarId
|
||||
}
|
||||
if (this.roomId) {
|
||||
this.chatMethodService.sendMessage(this.roomId, data);
|
||||
}
|
||||
// if (this.roomId) {
|
||||
// this.chatMethodService.sendMessage(this.roomId, data);
|
||||
// }
|
||||
}, (error) => {
|
||||
|
||||
loader.remove()
|
||||
@@ -878,9 +878,9 @@ export class NewEventPage implements OnInit {
|
||||
"id": id,
|
||||
"calendarId": CalendarId
|
||||
}
|
||||
if (this.roomId) {
|
||||
this.chatMethodService.sendMessage(this.roomId, data);
|
||||
}
|
||||
// if (this.roomId) {
|
||||
// this.chatMethodService.sendMessage(this.roomId, data);
|
||||
// }
|
||||
}, (error) => {
|
||||
|
||||
loader.remove()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
import { ContactRepositoryService } from 'src/app/services/Repositorys/contacts/repository/contacts-repository.service';
|
||||
import { UserContacts } from 'src/app/services/Repositorys/contacts/data-source/contacts-data-source.service';
|
||||
import { RoomRepositoryService } from 'src/app/module/chat/data/repository/room-repository.service'
|
||||
@@ -36,7 +36,7 @@ export class GroupContactsPage implements OnInit {
|
||||
|
||||
constructor(
|
||||
public ThemeService: ThemeService,
|
||||
public ChatSystemService: ChatSystemService,
|
||||
// public ChatSystemService: ChatSystemService,
|
||||
private contactsRepositoryService: ContactRepositoryService,
|
||||
private RoomRepositoryService: RoomRepositoryService,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
|
||||
@@ -14,8 +14,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 { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
import { MessageService } from 'src/app/services/chat/message.service';
|
||||
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
// simport { MessageService } from 'src/app/services/chat/message.service';
|
||||
|
||||
import { CameraService } from 'src/app/services/camera.service';
|
||||
import { FileType } from 'src/app/models/fileType';
|
||||
@@ -84,7 +84,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
groupNameFormart = "";
|
||||
|
||||
constructor(
|
||||
public ChatSystemService: ChatSystemService,
|
||||
// public ChatSystemService: ChatSystemService,
|
||||
private modalController: ModalController,
|
||||
public popoverController: PopoverController,
|
||||
private chatService: ChatService,
|
||||
@@ -104,7 +104,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
private FileValidatorService: FileValidatorService
|
||||
) {
|
||||
|
||||
this.ChatSystemService.getUser()
|
||||
// this.ChatSystemService.getUser()
|
||||
this.loggedUserChat = SessionStore.user.ChatData['data'];
|
||||
this.isGroupCreated = true;
|
||||
|
||||
@@ -113,11 +113,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
|
||||
this.getRoomInfo();
|
||||
this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({});
|
||||
//
|
||||
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).loadHistory({});
|
||||
// //
|
||||
// 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
|
||||
|
||||
setTimeout(() => {
|
||||
@@ -128,11 +128,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
this.deleteRecording();
|
||||
|
||||
|
||||
if (SessionStore.user.ChatData.data.userId == this.ChatSystemService.getGroupRoom(this.roomId).u._id) {
|
||||
this.isAdmin = true
|
||||
} else {
|
||||
this.isAdmin = false
|
||||
}
|
||||
// if (SessionStore.user.ChatData.data.userId == this.ChatSystemService.getGroupRoom(this.roomId).u._id) {
|
||||
// this.isAdmin = true
|
||||
// } else {
|
||||
// this.isAdmin = false
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -340,9 +340,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
// });
|
||||
|
||||
|
||||
if(this.ChatSystemService.users.length == 0) {
|
||||
this.ChatSystemService.getUser()
|
||||
}
|
||||
// if(this.ChatSystemService.users.length == 0) {
|
||||
// this.ChatSystemService.getUser()
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -375,9 +375,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
|
||||
async getRoomInfo() {
|
||||
|
||||
if(this.ChatSystemService.getGroupRoom(this.roomId)) {
|
||||
this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({});
|
||||
}
|
||||
// if(this.ChatSystemService.getGroupRoom(this.roomId)) {
|
||||
// this.ChatSystemService.getGroupRoom(this.roomId).loadHistory({});
|
||||
// }
|
||||
|
||||
this.getGroupContacts(this.room);
|
||||
}
|
||||
@@ -401,11 +401,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
// });
|
||||
// }
|
||||
|
||||
this.members = this.ChatSystemService.getGroupRoom(this.roomId).members
|
||||
// this.members = this.ChatSystemService.getGroupRoom(this.roomId).members
|
||||
}
|
||||
|
||||
sendMessage() {
|
||||
this.ChatSystemService.getGroupRoom(this.roomId).send({})
|
||||
// this.ChatSystemService.getGroupRoom(this.roomId).send({})
|
||||
}
|
||||
|
||||
|
||||
@@ -429,30 +429,30 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
|
||||
this.ChatSystemService.getGroupRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/audio",
|
||||
"msDuration": audioFile.value.msDuration,
|
||||
"mimeType": audioFile.value.mimeType,
|
||||
},
|
||||
attachments: [{
|
||||
"title": fileName,
|
||||
"title_link_download": true,
|
||||
"type": "audio"
|
||||
}],
|
||||
temporaryData: formData,
|
||||
attachmentsModelData: {
|
||||
fileBase64: encodedData,
|
||||
}
|
||||
})
|
||||
// this.ChatSystemService.getGroupRoom(roomId).send({
|
||||
// file: {
|
||||
// "type": "application/audio",
|
||||
// "msDuration": audioFile.value.msDuration,
|
||||
// "mimeType": audioFile.value.mimeType,
|
||||
// },
|
||||
// attachments: [{
|
||||
// "title": fileName,
|
||||
// "title_link_download": true,
|
||||
// "type": "audio"
|
||||
// }],
|
||||
// temporaryData: formData,
|
||||
// attachmentsModelData: {
|
||||
// fileBase64: encodedData,
|
||||
// }
|
||||
// })
|
||||
|
||||
});
|
||||
this.deleteRecording();
|
||||
}
|
||||
|
||||
deleteMessage(msgId: string) {
|
||||
const room = this.ChatSystemService.getGroupRoom(this.roomId)
|
||||
this.alertService.confirmDeleteMessage(msgId, room);
|
||||
// const room = this.ChatSystemService.getGroupRoom(this.roomId)
|
||||
// this.alertService.confirmDeleteMessage(msgId, room);
|
||||
}
|
||||
|
||||
async openGroupMessagesOptions() {
|
||||
@@ -497,7 +497,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
this.getRoomInfo();
|
||||
this.closeAllDesktopComponents.emit();
|
||||
this.showEmptyContainer.emit();
|
||||
this.ChatSystemService.hidingRoom(this.roomId).catch((error) => console.error(error));
|
||||
// this.ChatSystemService.hidingRoom(this.roomId).catch((error) => console.error(error));
|
||||
}
|
||||
else if (res.data == 'delete') {
|
||||
this.closeAllDesktopComponents.emit();
|
||||
@@ -711,22 +711,22 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
|
||||
this.ChatSystemService.getGroupRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"guid": '',
|
||||
},
|
||||
temporaryData: formData,
|
||||
attachments: [{
|
||||
"title": file.path,
|
||||
"image_url": 'data:image/jpeg;base64,' + file.base64String,
|
||||
"text": "description",
|
||||
"title_link_download": false,
|
||||
}],
|
||||
attachmentsModelData: {
|
||||
fileBase64: base64,
|
||||
}
|
||||
})
|
||||
// this.ChatSystemService.getGroupRoom(roomId).send({
|
||||
// file: {
|
||||
// "type": "application/img",
|
||||
// "guid": '',
|
||||
// },
|
||||
// temporaryData: formData,
|
||||
// attachments: [{
|
||||
// "title": file.path,
|
||||
// "image_url": 'data:image/jpeg;base64,' + file.base64String,
|
||||
// "text": "description",
|
||||
// "title_link_download": false,
|
||||
// }],
|
||||
// attachmentsModelData: {
|
||||
// fileBase64: base64,
|
||||
// }
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
@@ -760,21 +760,21 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
|
||||
this.ChatSystemService.getGroupRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"guid": ''
|
||||
},
|
||||
attachments: [{
|
||||
"title": 'file.jpg',
|
||||
"text": "description",
|
||||
"title_link_download": false,
|
||||
}],
|
||||
temporaryData: formData,
|
||||
attachmentsModelData: {
|
||||
fileBase64: imageBase64,
|
||||
}
|
||||
})
|
||||
// this.ChatSystemService.getGroupRoom(roomId).send({
|
||||
// file: {
|
||||
// "type": "application/img",
|
||||
// "guid": ''
|
||||
// },
|
||||
// attachments: [{
|
||||
// "title": 'file.jpg',
|
||||
// "text": "description",
|
||||
// "title_link_download": false,
|
||||
// }],
|
||||
// temporaryData: formData,
|
||||
// attachmentsModelData: {
|
||||
// fileBase64: imageBase64,
|
||||
// }
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
@@ -804,28 +804,28 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
|
||||
if (data.selected) {
|
||||
|
||||
this.ChatSystemService.getGroupRoom(roomId).send({
|
||||
file: {
|
||||
"name": res.data.selected.Assunto,
|
||||
"type": "application/webtrix",
|
||||
"ApplicationId": res.data.selected.ApplicationType,
|
||||
"DocId": res.data.selected.Id,
|
||||
"Assunto": res.data.selected.Assunto,
|
||||
},
|
||||
attachments: [{
|
||||
"title": res.data.selected.Assunto,
|
||||
"description": res.data.selected.DocTypeDesc,
|
||||
// "title_link": url_no_options,
|
||||
"title_link_download": true,
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
// "message_link": url_no_options,
|
||||
"type": "webtrix",
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
"text": res.data.selected.DocTypeDesc,
|
||||
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
}],
|
||||
temporaryData: res
|
||||
})
|
||||
// this.ChatSystemService.getGroupRoom(roomId).send({
|
||||
// file: {
|
||||
// "name": res.data.selected.Assunto,
|
||||
// "type": "application/webtrix",
|
||||
// "ApplicationId": res.data.selected.ApplicationType,
|
||||
// "DocId": res.data.selected.Id,
|
||||
// "Assunto": res.data.selected.Assunto,
|
||||
// },
|
||||
// attachments: [{
|
||||
// "title": res.data.selected.Assunto,
|
||||
// "description": res.data.selected.DocTypeDesc,
|
||||
// // "title_link": url_no_options,
|
||||
// "title_link_download": true,
|
||||
// //"thumb_url": "assets/images/webtrix-logo.png",
|
||||
// // "message_link": url_no_options,
|
||||
// "type": "webtrix",
|
||||
// //"thumb_url": "assets/images/webtrix-logo.png",
|
||||
// "text": res.data.selected.DocTypeDesc,
|
||||
// "thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
// }],
|
||||
// temporaryData: res
|
||||
// })
|
||||
|
||||
|
||||
}
|
||||
@@ -851,22 +851,22 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
|
||||
this.ChatSystemService.getGroupRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"guid": ''
|
||||
},
|
||||
temporaryData: formData,
|
||||
attachments: [{
|
||||
"title": file.path,
|
||||
"image_url": 'data:image/jpeg;base64,' + file.base64String,
|
||||
"text": "description",
|
||||
"title_link_download": false,
|
||||
}],
|
||||
attachmentsModelData: {
|
||||
fileBase64: imageBase64,
|
||||
}
|
||||
})
|
||||
// this.ChatSystemService.getGroupRoom(roomId).send({
|
||||
// file: {
|
||||
// "type": "application/img",
|
||||
// "guid": ''
|
||||
// },
|
||||
// temporaryData: formData,
|
||||
// attachments: [{
|
||||
// "title": file.path,
|
||||
// "image_url": 'data:image/jpeg;base64,' + file.base64String,
|
||||
// "text": "description",
|
||||
// "title_link_download": false,
|
||||
// }],
|
||||
// attachmentsModelData: {
|
||||
// fileBase64: imageBase64,
|
||||
// }
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
@@ -907,23 +907,23 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
formData.append('blobFile', file);
|
||||
}
|
||||
|
||||
this.ChatSystemService.getGroupRoom(roomId).send({
|
||||
file: {
|
||||
"type": file.type,
|
||||
"guid": '',
|
||||
},
|
||||
attachments: [{
|
||||
"title": file.name,
|
||||
"name": file.name,
|
||||
//"image_url": res,
|
||||
// "text": "description",
|
||||
"title_link_download": false,
|
||||
}],
|
||||
temporaryData: formData,
|
||||
attachmentsModelData: {
|
||||
fileBase64: fileBase64,
|
||||
}
|
||||
})
|
||||
// this.ChatSystemService.getGroupRoom(roomId).send({
|
||||
// file: {
|
||||
// "type": file.type,
|
||||
// "guid": '',
|
||||
// },
|
||||
// attachments: [{
|
||||
// "title": file.name,
|
||||
// "name": file.name,
|
||||
// //"image_url": res,
|
||||
// // "text": "description",
|
||||
// "title_link_download": false,
|
||||
// }],
|
||||
// temporaryData: formData,
|
||||
// attachmentsModelData: {
|
||||
// fileBase64: fileBase64,
|
||||
// }
|
||||
// })
|
||||
} else {
|
||||
this.toastService._badRequest("Ficheiro inválido")
|
||||
}
|
||||
@@ -1033,7 +1033,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
}
|
||||
|
||||
|
||||
downloadFileMsg(msg: MessageService) {
|
||||
downloadFileMsg(msg: any) {
|
||||
msg.downloadFileMsg()
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { MessagesPage } from '../messages.page';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
|
||||
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { ContactRepositoryService } from 'src/app/services/Repositorys/contacts/repository/contacts-repository.service';
|
||||
import { UserContacts } from 'src/app/services/Repositorys/contacts/data-source/contacts-data-source.service';
|
||||
@@ -46,7 +46,7 @@ export class ContactsPage implements OnInit {
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
public ThemeService: ThemeService,
|
||||
public ChatSystemService: ChatSystemService,
|
||||
// public ChatSystemService: ChatSystemService,
|
||||
private contactsRepositoryService: ContactRepositoryService,
|
||||
private roomRepositoryService: RoomRepositoryService,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
|
||||
@@ -13,8 +13,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 { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'
|
||||
import { MessageService } from 'src/app/services/chat/message.service';
|
||||
// import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'
|
||||
// simport { MessageService } from 'src/app/services/chat/message.service';
|
||||
import { FileType } from 'src/app/models/fileType';
|
||||
import { SearchPage } from 'src/app/pages/search/search.page';
|
||||
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
|
||||
@@ -46,6 +46,8 @@ import { tap } from 'rxjs/operators';
|
||||
import { MessageEntity } from 'src/app/module/chat/domain/entity/message';
|
||||
import { MemberTable } from 'src/app/module/chat/infra/database/dexie/schema/members';
|
||||
import { TypingTable } from 'src/app/module/chat/infra/database/dexie/schema/typing';
|
||||
import { MessageAttachmentFileType, MessageAttachmentSource } from 'src/app/module/chat/data/dto/message/messageOutputDTO';
|
||||
import { JSFileToBase64 } from 'src/app/utils/ToBase64';
|
||||
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
@@ -92,7 +94,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
longPressActive = false;
|
||||
frameUrl: any;
|
||||
downloadFile: string;
|
||||
massages: MessageService[] = []
|
||||
massages = []
|
||||
|
||||
showAvatar = true;
|
||||
|
||||
@@ -145,7 +147,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
private gestureController: GestureController,
|
||||
public ThemeService: ThemeService,
|
||||
private storage: Storage,
|
||||
public RochetChatConnectorService: RochetChatConnectorService,
|
||||
// public RochetChatConnectorService: RochetChatConnectorService,
|
||||
private sanitiser: DomSanitizer,
|
||||
private file: File,
|
||||
private platform: Platform,
|
||||
@@ -155,7 +157,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
private roomRepositoryService: RoomRepositoryService,
|
||||
private messageRepositoryService: MessageRepositoryService,
|
||||
private userTypingServiceRepository: UserTypingServiceRepository,
|
||||
private chatServiceService: ChatServiceService
|
||||
private chatServiceService: ChatServiceService,
|
||||
) {
|
||||
// update
|
||||
this.checkAudioPermission()
|
||||
@@ -201,7 +203,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
}
|
||||
|
||||
|
||||
toggleEmojiPicker(message: any) {
|
||||
toggleEmojiPicker(message: MessageEntity) {
|
||||
if (this.selectedMessage === message) {
|
||||
this.selectedMessage = null; // Close the picker if it's already open
|
||||
} else {
|
||||
@@ -209,7 +211,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
}
|
||||
}
|
||||
|
||||
addReaction(message: any, emoji: string) {
|
||||
addReaction(message: MessageEntity, emoji: string) {
|
||||
// Logic to add reaction to the message
|
||||
console.log(`Reacting to message ${message.id} with emoji ${emoji.codePointAt(0).toString(16)}`);
|
||||
this.selectedMessage = null; // Close the picker after adding reaction
|
||||
@@ -235,7 +237,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
this.userTypingServiceRepository.addUserTyping(this.roomId)
|
||||
}
|
||||
|
||||
async editMessage(message: any) {
|
||||
async editMessage(message: MessageEntity) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: EditMessagePage,
|
||||
@@ -888,7 +890,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
}
|
||||
|
||||
async addFile() {
|
||||
this.addFileToChat(['.doc', '.docx', '.pdf'])
|
||||
this.addFileToChat(['.doc', '.docx', '.pdf'], MessageAttachmentFileType.Doc)
|
||||
}
|
||||
|
||||
async addFileWebtrix() {
|
||||
@@ -991,20 +993,17 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
}
|
||||
|
||||
|
||||
messageDelete({messageId}) {
|
||||
messageDelete(message: MessageEntity) {
|
||||
// this.messageRepositoryService.sendMessageDelete()
|
||||
this.chatServiceService.messageDelete({
|
||||
messageId: messageId,
|
||||
messageId: message.id,
|
||||
roomId: this.roomId,
|
||||
})
|
||||
}
|
||||
|
||||
async addFileToChat(types: typeof FileType[]) {
|
||||
async addFileToChat(types: typeof FileType[], attachmentFileType:MessageAttachmentFileType) {
|
||||
|
||||
|
||||
const roomId = this.roomId
|
||||
|
||||
const file: any = await this.fileService.getFileFromDevice(types);
|
||||
const file = await this.fileService.getFileFromDevice(types);
|
||||
|
||||
if (file.type == 'application/pdf' || file.type == 'application/doc' || file.type == 'application/docx' ||
|
||||
file.type == 'application/xls' || file.type == 'application/xlsx' || file.type == 'application/ppt' ||
|
||||
@@ -1014,56 +1013,33 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
const fileName = file.name
|
||||
|
||||
const validation = this.FileValidatorService.fileNameValidation(fileName)
|
||||
const FilenameValidation = this.FileValidatorService.fileNameValidation(fileName)
|
||||
|
||||
if (validation.isOk) {
|
||||
if (FilenameValidation.isOk) {
|
||||
let fileBase64 = await JSFileToBase64(file);
|
||||
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => {
|
||||
console.error(error);
|
||||
})));
|
||||
if(fileBase64.isOk()) {
|
||||
|
||||
let blob;
|
||||
let formData
|
||||
let fileBase64
|
||||
if (this.platform.is("tablet")) {
|
||||
const message = new MessageEntity();
|
||||
message.roomId = this.roomId
|
||||
|
||||
blob = this.fileService.base64toBlob(encodedData, file.type)
|
||||
console.log('BLOB BLOB', blob)
|
||||
message.sender = {
|
||||
userPhoto: '',
|
||||
wxeMail: SessionStore.user.Email,
|
||||
wxFullName: SessionStore.user.FullName,
|
||||
wxUserId: SessionStore.user.UserId
|
||||
}
|
||||
|
||||
formData = new FormData();
|
||||
formData.append('blobFile', file);
|
||||
/* console.log('add file', fileBase64) */
|
||||
message.attachments = [{
|
||||
file: fileBase64.value,
|
||||
fileName: file.name,
|
||||
source: MessageAttachmentSource.Device,
|
||||
fileType: MessageAttachmentFileType.Doc
|
||||
}]
|
||||
|
||||
} else {
|
||||
console.log('encode data', encodedData)
|
||||
blob = this.fileService.base64toBlob(encodedData, file.type)
|
||||
|
||||
fileBase64 = await this._getBase64(file)
|
||||
|
||||
formData = new FormData();
|
||||
formData.append('blobFile', file);
|
||||
this.chatServiceService.sendMessage(message)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// this.ChatSystemService.getDmRoom(roomId).send({
|
||||
// file: {
|
||||
// "type": file.type,
|
||||
// "guid": '',
|
||||
// },
|
||||
// attachments: [{
|
||||
// "title": file.name,
|
||||
// "name": file.name,
|
||||
// //"image_url": res,
|
||||
// // "text": "description",
|
||||
// "title_link_download": false,
|
||||
// }],
|
||||
// temporaryData: formData,
|
||||
// attachmentsModelData: {
|
||||
// fileBase64: fileBase64,
|
||||
// }
|
||||
// })
|
||||
} else {
|
||||
this.toastService._badRequest("Ficheiro inválido")
|
||||
}
|
||||
@@ -1197,11 +1173,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
|
||||
|
||||
|
||||
downloadFileMsg(msg: MessageService) {
|
||||
msg.downloadFileMsg()
|
||||
}
|
||||
|
||||
pdfPreview() {
|
||||
const options: DocumentViewerOptions = {
|
||||
title: 'My App'
|
||||
@@ -1212,7 +1183,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
async audioPreview(msg) {
|
||||
|
||||
if (!msg.attachments[0].title_link || msg.attachments[0].title_link === null || msg.attachments[0].title_link === '') {
|
||||
this.downloadFileMsg(msg)
|
||||
// this.downloadFileMsg(msg)
|
||||
} else { }
|
||||
}
|
||||
|
||||
@@ -1294,7 +1265,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
} else {
|
||||
|
||||
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
|
||||
this.downloadFileMsg(msg)
|
||||
// this.downloadFileMsg(msg)
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</ion-item>
|
||||
</ion-list> -->
|
||||
|
||||
<ion-virtual-scroll [items]="ChatSystemService.users" approxItemHeight="70px" [headerFn]="separateLetter">
|
||||
<!-- <ion-virtual-scroll [items]="ChatSystemService.users" approxItemHeight="70px" [headerFn]="separateLetter">
|
||||
|
||||
<div class="item-divider" *virtualHeader="let header">
|
||||
<ion-label>{{header}}</ion-label>
|
||||
@@ -48,7 +48,7 @@
|
||||
<ion-icon name="ellipse"></ion-icon>
|
||||
</div>
|
||||
|
||||
</ion-virtual-scroll>
|
||||
</ion-virtual-scroll> -->
|
||||
|
||||
</div>
|
||||
</ion-content>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { GroupMessagesPage } from '../../group-messages/group-messages.page';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
|
||||
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service'
|
||||
|
||||
@Component({
|
||||
selector: 'app-contacts',
|
||||
@@ -15,9 +15,9 @@ export class ContactsPage implements OnInit {
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
public ThemeService: ThemeService,
|
||||
public ChatSystemService: ChatSystemService
|
||||
)
|
||||
{
|
||||
// public ChatSystemService: ChatSystemService
|
||||
)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export class ContactsPage implements OnInit {
|
||||
}
|
||||
|
||||
loadUsers(){
|
||||
this.ChatSystemService.getUser()
|
||||
// sthis.ChatSystemService.getUser()
|
||||
}
|
||||
|
||||
separateLetter(record, recordIndex, records){
|
||||
@@ -55,13 +55,13 @@ export class ContactsPage implements OnInit {
|
||||
|
||||
}
|
||||
clicked(){
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
async groupMessages(){
|
||||
const modal = await this.modalController.create({
|
||||
component: GroupMessagesPage,
|
||||
componentProps: {},
|
||||
componentProps: {},
|
||||
cssClass: 'contacts',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output,ViewContainerRef } from '@angular/core';
|
||||
import { PickerController, PopoverController } from '@ionic/angular';
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.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';
|
||||
@@ -46,7 +46,7 @@ export class NewGroupPage implements OnInit{
|
||||
private pickerController: PickerController,
|
||||
private popoverController: PopoverController,
|
||||
private dataService:DataService,
|
||||
public ChatSystemService: ChatSystemService,
|
||||
// public ChatSystemService: ChatSystemService,
|
||||
public ThemeService: ThemeService,
|
||||
private RouteService: RouteService,
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
@@ -136,13 +136,13 @@ export class NewGroupPage implements OnInit{
|
||||
}
|
||||
|
||||
createGroupWithAttachmentsCath(res: any) {
|
||||
if(!this.ChatSystemService.getGroupRoom(res.result.rid)) {
|
||||
setTimeout(() => {
|
||||
this.createGroupWithAttachmentsCath(res)
|
||||
}, 1500)
|
||||
} else {
|
||||
this.createGroupWithAttachments(res)
|
||||
}
|
||||
// if(!this.ChatSystemService.getGroupRoom(res.result.rid)) {
|
||||
// setTimeout(() => {
|
||||
// this.createGroupWithAttachmentsCath(res)
|
||||
// }, 1500)
|
||||
// } else {
|
||||
// this.createGroupWithAttachments(res)
|
||||
// }
|
||||
}
|
||||
|
||||
createGroupWithAttachments(res: any) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<ion-content>
|
||||
<!-- <ion-content>
|
||||
<ul>
|
||||
<li>Chat login</li>
|
||||
<li>Chat user list {{ ChatSystemService.users | json }}</li>
|
||||
@@ -6,4 +6,4 @@
|
||||
<ul>
|
||||
<li *ngFor="let room of ChatSystemService._dm">chat Name: {{room.name}}; subcribe: {{room.status.receive.message}}; </li>
|
||||
</ul>
|
||||
</ion-content>
|
||||
</ion-content> -->
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-chat-debugging',
|
||||
@@ -9,7 +9,7 @@ import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
export class ChatDebuggingPage implements OnInit {
|
||||
|
||||
constructor(
|
||||
public ChatSystemService: ChatSystemService
|
||||
// public ChatSystemService: ChatSystemService
|
||||
) { }
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { NavParams } from '@ionic/angular';
|
||||
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-chat-message-debugging',
|
||||
@@ -12,18 +12,18 @@ export class ChatMessageDebuggingPage implements OnInit {
|
||||
roomId: string
|
||||
|
||||
constructor(
|
||||
public ChatSystemService: ChatSystemService,
|
||||
// public ChatSystemService: ChatSystemService,
|
||||
private navParams: NavParams
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.roomId = this.navParams.get('roomId')
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
loadHistory() {
|
||||
this.ChatSystemService.getDmRoom(this.roomId).loadHistory({});
|
||||
// this.ChatSystemService.getDmRoom(this.roomId).loadHistory({});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user