mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
remove console
This commit is contained in:
@@ -308,12 +308,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.messageDeleteSubject?.unsubscribe();
|
this.messageDeleteSubject?.unsubscribe();
|
||||||
|
|
||||||
this.messageDeleteSubject = this.chatServiceService.listenToDeleteMessage(this.roomId).subscribe((deleteMessage) => {
|
this.messageDeleteSubject = this.chatServiceService.listenToDeleteMessage(this.roomId).subscribe((deleteMessage) => {
|
||||||
console.log('delete class', deleteMessage);
|
|
||||||
|
|
||||||
const index = this.messages1[this.roomId].findIndex(e => e?.id === deleteMessage.id); // Use triple equals for comparison
|
const index = this.messages1[this.roomId].findIndex(e => e?.id === deleteMessage.id); // Use triple equals for comparison
|
||||||
|
|
||||||
if (index !== -1) { // Check if the item was found
|
if (index !== -1) { // Check if the item was found
|
||||||
console.log('delete ==')
|
|
||||||
this.messages1[this.roomId].splice(index, 1);
|
this.messages1[this.roomId].splice(index, 1);
|
||||||
// console.log('removed index', index);
|
// console.log('removed index', index);
|
||||||
} else {
|
} else {
|
||||||
@@ -330,7 +327,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
const index = this.messages1[this.roomId].findIndex(e => e?.id === updateMessage.id); // Use triple equals for comparison
|
const index = this.messages1[this.roomId].findIndex(e => e?.id === updateMessage.id); // Use triple equals for comparison
|
||||||
|
|
||||||
if (index !== -1) { // Check if the item was found
|
if (index !== -1) { // Check if the item was found
|
||||||
console.log('update ==')
|
|
||||||
this.messages1[this.roomId][index].message = updateMessage.message
|
this.messages1[this.roomId][index].message = updateMessage.message
|
||||||
this.messages1[this.roomId][index].reactions = updateMessage.reactions
|
this.messages1[this.roomId][index].reactions = updateMessage.reactions
|
||||||
} else {
|
} else {
|
||||||
@@ -344,19 +340,16 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.messageSendSubject?.unsubscribe();
|
this.messageSendSubject?.unsubscribe();
|
||||||
|
|
||||||
this.messageSendSubject = this.chatServiceService.listenToSendMessage(this.roomId).subscribe((updateMessage) => {
|
this.messageSendSubject = this.chatServiceService.listenToSendMessage(this.roomId).subscribe((updateMessage) => {
|
||||||
console.log('update message', updateMessage);
|
|
||||||
|
|
||||||
const index = this.messages1[this.roomId].findIndex(e => e?.requestId === updateMessage.requestId); // Use triple equals for comparison
|
const index = this.messages1[this.roomId].findIndex(e => e?.requestId === updateMessage.requestId); // Use triple equals for comparison
|
||||||
|
|
||||||
if (index !== -1) { // Check if the item was found
|
if (index !== -1) { // Check if the item was found
|
||||||
console.log('update ==')
|
|
||||||
|
|
||||||
this.messages1[this.roomId][index].id = updateMessage.id
|
this.messages1[this.roomId][index].id = updateMessage.id
|
||||||
|
|
||||||
let attachmentIndex = 0;
|
let attachmentIndex = 0;
|
||||||
|
|
||||||
for(const message of updateMessage.attachments) {
|
for(const message of updateMessage.attachments) {
|
||||||
console.log('set attachmen id', message)
|
|
||||||
this.messages1[this.roomId][index].attachments[attachmentIndex].id = message.id
|
this.messages1[this.roomId][index].attachments[attachmentIndex].id = message.id
|
||||||
attachmentIndex++;
|
attachmentIndex++;
|
||||||
}
|
}
|
||||||
@@ -891,7 +884,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
800, // maxHeight
|
800, // maxHeight
|
||||||
0.9 // quality
|
0.9 // quality
|
||||||
).then((picture) => {
|
).then((picture) => {
|
||||||
console.log('Selected: ', picture)
|
|
||||||
imageBase64 = picture
|
imageBase64 = picture
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1081,39 +1073,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// getRoomMessageDB(roomId) {
|
|
||||||
// if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
|
||||||
// } else {
|
|
||||||
// this.sqlservice.getAllChatMSG(roomId).then((msg: any) => {
|
|
||||||
|
|
||||||
// let chatmsgArray = [];
|
|
||||||
// msg.forEach(element => {
|
|
||||||
|
|
||||||
|
|
||||||
// let msgChat = {
|
|
||||||
// _id: element.Id,
|
|
||||||
// attachments: this.isJson(element.Attachments),
|
|
||||||
// channels: this.isJson(element.Channels),
|
|
||||||
// file: this.isJson(element.File),
|
|
||||||
// mentions: this.isJson(element.Mentions),
|
|
||||||
// msg: element.Msg,
|
|
||||||
// rid: element.Rid,
|
|
||||||
// ts: element.Ts,
|
|
||||||
// u: this.isJson(element.U),
|
|
||||||
// _updatedAt: element.UpdatedAt,
|
|
||||||
// image_url: this.isJson(element.image_url)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// chatmsgArray.push(msgChat)
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
isJson(str) {
|
isJson(str) {
|
||||||
try {
|
try {
|
||||||
JSON.parse(str);
|
JSON.parse(str);
|
||||||
@@ -1125,46 +1084,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
transformDataMSG(res) {
|
|
||||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
|
||||||
} else {
|
|
||||||
res.forEach(element => {
|
|
||||||
|
|
||||||
let chatmsg = {
|
|
||||||
_id: element._id,
|
|
||||||
attachments: element.attachments,
|
|
||||||
channels: element.channels,
|
|
||||||
file: element.file,
|
|
||||||
mentions: element.mentions,
|
|
||||||
msg: element.msg,
|
|
||||||
rid: element.rid,
|
|
||||||
ts: element.ts,
|
|
||||||
u: element.u,
|
|
||||||
_updatedAt: element._updatedAt,
|
|
||||||
/* image_url: {
|
|
||||||
name: name,
|
|
||||||
path: `${IMAGE_DIR}/${name}`,
|
|
||||||
data: `data:image/jpeg;base64,${readFile.data}`,
|
|
||||||
}, */
|
|
||||||
}
|
|
||||||
|
|
||||||
// this.sqlservice.addChatMSG(chatmsg)
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* testeDownload(msg: MessageService) {
|
|
||||||
this.downloadFile = "";
|
|
||||||
this.AttachmentsService.downloadFileAndStore(msg.file.guid);
|
|
||||||
} */
|
|
||||||
|
|
||||||
|
|
||||||
downloadFileMsg(msg: any) {
|
|
||||||
msg.downloadFileMsg();
|
|
||||||
}
|
|
||||||
|
|
||||||
b64toBlob(b64Data, contentType) {
|
b64toBlob(b64Data, contentType) {
|
||||||
contentType = contentType || '';
|
contentType = contentType || '';
|
||||||
var sliceSize = 512;
|
var sliceSize = 512;
|
||||||
@@ -1273,13 +1192,12 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
|
|
||||||
async openPreview(msg) {
|
async openPreview(msg) {
|
||||||
|
|
||||||
|
|
||||||
if (msg.file.type === "application/webtrix") {
|
if (msg.file.type === "application/webtrix") {
|
||||||
this.viewDocument(msg.file, msg.attachments.image_url)
|
this.viewDocument(msg.file, msg.attachments.image_url)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
|
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
|
||||||
this.downloadFileMsg(msg)
|
// this.downloadFileMsg(msg)
|
||||||
// this.testDownlod(msg)
|
// this.testDownlod(msg)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1334,14 +1252,6 @@ export class MessagesPage implements OnInit, 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)
|
|
||||||
} else { }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
imageSize(img) {
|
imageSize(img) {
|
||||||
var canvas = document.createElement('canvas');
|
var canvas = document.createElement('canvas');
|
||||||
var ctx = canvas.getContext('2d');
|
var ctx = canvas.getContext('2d');
|
||||||
@@ -1361,25 +1271,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// async ShareEmail(msg){
|
|
||||||
// // Check if sharing via email is supported
|
|
||||||
// await Share.share({
|
|
||||||
// title: msg.u.username,
|
|
||||||
// text: msg._updatedAt,
|
|
||||||
// url: msg.attachments[0].image_url,
|
|
||||||
// dialogTitle: 'Share with buddies',
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
async createDirectoryImage() {
|
|
||||||
await Filesystem.mkdir({
|
|
||||||
path: IMAGE_DIR,
|
|
||||||
directory: Directory.Data,
|
|
||||||
recursive: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
|
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const image = new (window as any).Image();
|
const image = new (window as any).Image();
|
||||||
@@ -1429,7 +1320,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
|
|
||||||
|
|
||||||
messageDelete(message: MessageEntity) {
|
messageDelete(message: MessageEntity) {
|
||||||
// this.messageRepositoryService.sendMessageDelete()
|
|
||||||
this.chatServiceService.messageDelete({
|
this.chatServiceService.messageDelete({
|
||||||
messageId: message.id,
|
messageId: message.id,
|
||||||
roomId: this.roomId,
|
roomId: this.roomId,
|
||||||
|
|||||||
Reference in New Issue
Block a user