mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
1 line
23 KiB
JSON
1 line
23 KiB
JSON
|
|
{"ast":null,"code":"import _asyncToGenerator from \"C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { __decorate } from \"tslib\";\nimport __NG_CLI_RESOURCE__0 from \"./group-contacts.page.html?ngResource\";\nimport __NG_CLI_RESOURCE__1 from \"./group-contacts.page.scss?ngResource\";\nimport { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { ModalController } from '@ionic/angular';\nimport { ChatService } from 'src/app/services/chat.service';\nimport { NewGroupPage } from '../../new-group/new-group.page';\nimport { GroupMessagesPage } from '../group-messages.page';\nimport { ThemeService } from 'src/app/services/theme.service';\nimport { SessionStore } from 'src/app/store/session.service';\nimport { ChatSystemService } from 'src/app/services/chat/chat-system.service';\nlet GroupContactsPage = class GroupContactsPage {\n constructor(modalController, chatService, ThemeService, ChatSystemService) {\n this.modalController = modalController;\n this.chatService = chatService;\n this.ThemeService = ThemeService;\n this.ChatSystemService = ChatSystemService;\n this.users = [];\n this.contact = [\" Ana M.\", \"Andre F.\", \"Bruno G.\", \"Catarina T\", \"Tiago\"];\n this.sessionStore = SessionStore;\n this.openGroupMessage = new EventEmitter();\n this.loggedUser = SessionStore.user.ChatData['data'];\n this.textSearch = \"\";\n this.dm = null;\n this.room = null;\n }\n ngOnInit() {\n // this.chatService.refreshtoken();\n //this.getRoomInfo();\n this.loadUsers();\n this.getChatInfo();\n //\n }\n\n getChatInfo() {\n this.chatService.getRoomInfo(this.roomId).subscribe(room => {\n this.getGroupContacts(room['room']);\n });\n }\n deleteMember(data) {\n let body = {\n \"roomId\": this.roomId,\n \"userId\": data._id\n };\n this.chatService.getRoomInfo(this.roomId).subscribe(room => {\n if (room['room'].t == \"p\") {\n this.chatService.removeGroupMember(body).subscribe(res => {\n this.getMembers();\n this.getChatInfo();\n });\n } else if (room['room'].t == \"c\") {\n this.chatService.removeChannelMember(body).subscribe(res => {\n this.getMembers();\n this.getChatInfo();\n });\n }\n });\n }\n getMembers() {\n this.chatService.getRoomInfo(this.roomId).subscribe(res => {\n let room = res['room'];\n if (room.t == \"p\") {\n this.chatService.getGroupMembers(this.roomId).subscribe(res => {\n this.members = res['members'];\n });\n } else if (room.t == \"c\") {\n this.chatService.getChannelMembers(this.roomId).subscribe(res => {\n this.members = res['members'];\n });\n }\n });\n }\n getGroupContacts(room) {\n this.showLoader = true;\n if (room.t === 'p') {\n this.chatService.getGroupMembers(this.roomId).subscribe(res => {\n this.members = res['members'];\n this.loadUsers1(this.members);\n this.showLoader = false;\n });\n } else {\n this.chatService.getChannelMembers(this.roomId).subscribe(res => {\n this.members = res['members'];\n this.loadUsers1(this.members);\n this.showLoader = false;\n });\n }\n }\n updateGroup() {\n this.showLoader = true;\n this.addContacts(this.roomId);\n this.openGroupMessage.emit(this.roomId);\n this.showLoader = false;\n }\n openGroupMessagesPage() {\n this.showLoader = true;\n this.openGroupMessage.emit(this.roomId);\n this.showLoader = false;\n }\n loadUsers1(members) {\n this.chatService.getAllUsers().subscribe(res => {\n if (members) {\n this.contacts = res.users.filter(f => !this.members.some(item => item._id === f._id));\n } else {\n this.contacts = res.users.filter(data => data.username != this.sessionStore.user.UserName);\n }\n this.users = this.contacts.sort((a, b) => {\n if (a.name < b.name) {\n return -1;\n
|