mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
1 line
12 KiB
JSON
1 line
12 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 \"./contacts.page.html?ngResource\";\nimport __NG_CLI_RESOURCE__1 from \"./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 { MessagesPage } from '../messages.page';\nimport { ThemeService } from 'src/app/services/theme.service';\nimport { ChatSystemService } from 'src/app/services/chat/chat-system.service';\nimport { SessionStore } from 'src/app/store/session.service';\nlet ContactsPage = class ContactsPage {\n constructor(modalController, chatService, ThemeService, ChatSystemService) {\n this.modalController = modalController;\n this.chatService = chatService;\n this.ThemeService = ThemeService;\n this.ChatSystemService = ChatSystemService;\n this.sessionStore = SessionStore;\n this.openMessage = new EventEmitter();\n this.emptyTextDescriptionOpen = new EventEmitter();\n this.backToChat = new EventEmitter();\n this.closeAllDesktopComponents = new EventEmitter();\n this.userList = this.ChatSystemService.users;\n this.loggedUser = SessionStore.user.ChatData['data'];\n this.textSearch = \"\";\n this.dm = null;\n this.room = null;\n }\n ngOnInit() {\n var _this = this;\n return _asyncToGenerator(function* () {\n _this.loadUsers();\n })();\n }\n onChange(event) {\n this.textSearch = event.detail.value.toLowerCase();\n this.userList = this.ChatSystemService.users.filter(e => {\n const username = e.name.toLowerCase();\n return username.includes(this.textSearch);\n });\n }\n openMessagesPage(username) {\n if (window.innerWidth < 701) {\n this.createRoom(username);\n } else {\n let body = {\n username: username\n };\n this.chatService.createRoom(body).subscribe(res => {\n this.room = res['room'];\n this.openMessage.emit(this.room._id);\n });\n }\n }\n loadUsers() {\n this.ChatSystemService.getUser();\n }\n separateLetter(record, recordIndex, records) {\n if (recordIndex == 0) {\n return record.name[0];\n }\n let first_prev = records[recordIndex - 1].name[0];\n let first_current = record.name[0];\n if (first_prev != first_current) {\n return first_current;\n }\n return null;\n }\n doRefresh(event) {}\n close() {\n if (this.roomId) {\n this.backToChat.emit({\n roomId: this.roomId\n });\n } else {\n this.closeAllDesktopComponents.emit();\n }\n }\n clicked() {}\n createRoom(username) {\n let body = {\n username: username\n };\n this.chatService.createRoom(body).subscribe(res => {\n this.room = res['room'];\n this.openMessagesModal(this.room._id);\n this.ChatSystemService.getAllRooms();\n });\n }\n openMessagesModal(roomId) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n const modal = yield _this2.modalController.create({\n component: MessagesPage,\n cssClass: 'modal modal-desktop isMessagesChatOpened',\n componentProps: {\n roomId: roomId\n }\n });\n yield modal.present();\n modal.onDidDismiss();\n })();\n }\n openMessages(username) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n /* this.close(); */\n let dm;\n //Create new room\n _this3.createRoom(username);\n })();\n }\n};\nContactsPage.ctorParameters = () => [{\n type: ModalController\n}, {\n type: ChatService\n}, {\n type: ThemeService\n}, {\n type: ChatSystemService\n}];\nContactsPage.propDecorators = {\n roomId: [{\n type: Input\n }],\n openMessage: [{\n type: Output\n }],\n emptyTextDescriptionOpen: [{\n type: Output\n }],\n backToChat: [{\n type: Output\n }],
|