mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
remove rocket chat
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user