remove rocket chat

This commit is contained in:
Peter Maquiran
2024-08-09 10:50:32 +01:00
parent 45e829bec3
commit 6cbd8d903c
67 changed files with 962 additions and 5618 deletions
+94 -95
View File
@@ -3,7 +3,6 @@ import { ModalController, NavParams, PickerController, PopoverController } from
import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page';
import { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page';
import { ThemeService } from 'src/app/services/theme.service';
import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
import { SessionStore } from 'src/app/store/session.service';
import { ToastService } from 'src/app/services/toast.service';
import { catchError } from 'rxjs/operators';
@@ -30,7 +29,7 @@ export class NewGroupPage implements OnInit {
private modalController: ModalController,
private navParams: NavParams,
public ThemeService: ThemeService,
public ChatSystemService: ChatSystemService,
// public ChatSystemService: ChatSystemService,
private toastService: ToastService,
) {
this.loggedUserChat = SessionStore.user.ChatData['data'];
@@ -60,133 +59,133 @@ export class NewGroupPage implements OnInit {
async createGroup() {
let name = this.groupName.split(' ').join('-');
//Take out all special characters in string
name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
// let name = this.groupName.split(' ').join('-');
// //Take out all special characters in string
// name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
let customFields = {}
let res: any;
// let customFields = {}
// let res: any;
if(!SessionStore.user?.ChatData?.data) {
this.toastService._successMessage("Chat temporariamente indisponível")
}
// if(!SessionStore.user?.ChatData?.data) {
// this.toastService._successMessage("Chat temporariamente indisponível")
// }
try {
// try {
if (this.thedate) {
let customFields = {
"countDownDate": this.thedate
}
res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
}
else {
res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
}
// if (this.thedate) {
// let customFields = {
// "countDownDate": this.thedate
// }
// res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
// }
// else {
// res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
// }
try {
this.isGroupCreated = true;
this.addContacts(res.result);
this.ChatSystemService.getRoom([res.result]);
// try {
// this.isGroupCreated = true;
// this.addContacts(res.result);
// this.ChatSystemService.getRoom([res.result]);
setTimeout(() => {
this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
}, 10)
// setTimeout(() => {
// this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
// }, 10)
} catch (error) {
await this.ChatSystemService.getUser();
await this.ChatSystemService.getAllRooms();
await this.ChatSystemService.subscribeToRoom();
// } catch (error) {
// await this.ChatSystemService.getUser();
// await this.ChatSystemService.getAllRooms();
// await this.ChatSystemService.subscribeToRoom();
this.isGroupCreated = true;
this.addContacts(res.result);
this.ChatSystemService.getRoom([res.result]);
// this.isGroupCreated = true;
// this.addContacts(res.result);
// this.ChatSystemService.getRoom([res.result]);
setTimeout(() => {
this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
}, 10)
// setTimeout(() => {
// this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
// }, 10)
}
// }
if (res?.result?.rid) {
// if (res?.result?.rid) {
this.ChatSystemService.getAllRooms(() => {
if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
this.createGroupWithAttachmentsCath(res)
} else {
setTimeout(() => {
// this.ChatSystemService.getAllRooms(() => {
// if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
// this.createGroupWithAttachmentsCath(res)
// } else {
// setTimeout(() => {
this.createGroupWithAttachments(res)
// this.createGroupWithAttachments(res)
}, 500)
}
}, res.result.rid);
// }, 500)
// }
// }, res.result.rid);
} else {
// } else {
this.toastService._badRequest('Existe um grupo com este nome!');
// this.toastService._badRequest('Existe um grupo com este nome!');
}
// }
} catch(error) {
this.toastService._successMessage("Chat temporariamente indisponível")
}
// } catch(error) {
// this.toastService._successMessage("Chat temporariamente indisponível")
// }
}
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) {
this.ChatSystemService.getGroupRoom(res.result.rid).hasLoadHistory = true;
// this.ChatSystemService.getGroupRoom(res.result.rid).hasLoadHistory = true;
if (this.documents) {
this.documents.forEach(element => {
this.ChatSystemService.getGroupRoom(res.result.rid).send({
file: {
"name": element.Assunto,
"type": "application/webtrix",
"ApplicationId": element.ApplicationId,
"DocId": element.DocId,
"Assunto": element.Assunto,
},
temporaryData: {
data: {
selected: {
Id: element.DocId,
ApplicationType: element.ApplicationId
}
}
},
attachments: [{
"title": element.Assunto,
"description": element.Assunto,
"title_link_download": true,
"type": "webtrix",
"text": element.Assunto,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
}],
})
});
}
// if (this.documents) {
// this.documents.forEach(element => {
// this.ChatSystemService.getGroupRoom(res.result.rid).send({
// file: {
// "name": element.Assunto,
// "type": "application/webtrix",
// "ApplicationId": element.ApplicationId,
// "DocId": element.DocId,
// "Assunto": element.Assunto,
// },
// temporaryData: {
// data: {
// selected: {
// Id: element.DocId,
// ApplicationType: element.ApplicationId
// }
// }
// },
// attachments: [{
// "title": element.Assunto,
// "description": element.Assunto,
// "title_link_download": true,
// "type": "webtrix",
// "text": element.Assunto,
// "thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
// }],
// })
// });
// }
this.ChatSystemService.getAllRooms();
// this.ChatSystemService.getAllRooms();
setTimeout(() => {
this.groupName = ""
}, 150);
// setTimeout(() => {
// this.groupName = ""
// }, 150);
}
async addContacts(room) {