mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
1 line
13 KiB
JSON
1 line
13 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 \"./chat-popover.page.html?ngResource\";\nimport __NG_CLI_RESOURCE__1 from \"./chat-popover.page.scss?ngResource\";\nimport { Component } from '@angular/core';\nimport { ModalController, NavParams, PopoverController } from '@ionic/angular';\nimport { ChatService } from 'src/app/services/chat.service';\nimport { ToastService } from 'src/app/services/toast.service';\nimport { ThemeService } from 'src/app/services/theme.service';\nimport { SetRoomOwnerPage } from 'src/app/modals/set-room-owner/set-room-owner.page';\nimport { ChatSystemService } from 'src/app/services/chat/chat-system.service';\nlet ChatPopoverPage = class ChatPopoverPage {\n constructor(popoverController, modalController, navParams, chatService, toastService, ThemeService, ChatSystemService) {\n this.popoverController = popoverController;\n this.modalController = modalController;\n this.navParams = navParams;\n this.chatService = chatService;\n this.toastService = toastService;\n this.ThemeService = ThemeService;\n this.ChatSystemService = ChatSystemService;\n this.isAdmin = false;\n this.roomId = this.navParams.get('roomId');\n this.members = this.navParams.get('members');\n this.isAdmin = this.navParams.get('isAdmin');\n }\n ngOnInit() {\n // this.chatService.refreshtoken();\n }\n close(action) {\n if (window.innerWidth < 701) {\n this.popoverController.dismiss(action);\n } else {\n this.modalController.dismiss(action);\n }\n }\n //Top menu options\n //Close\n setRoomOwner() {\n var _this = this;\n return _asyncToGenerator(function* () {\n let classs;\n if (window.innerWidth < 701) {\n classs = 'modal modal-desktop';\n } else {\n classs = 'centered-rounded-modal';\n }\n const modal = yield _this.modalController.create({\n component: SetRoomOwnerPage,\n cssClass: classs,\n backdropDismiss: true,\n componentProps: {\n roomId: _this.roomId,\n members: _this.members,\n isAdmin: _this.isAdmin\n }\n });\n yield modal.present();\n modal.onDidDismiss().then(res => {\n if (res.data == 'success') {\n _this.leaveGroup();\n //this.ChatSystemService.hidingRoom(this.roomId);\n }\n });\n })();\n }\n\n leaveGroup() {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n let body = {\n \"roomId\": _this2.roomId\n };\n let res;\n try {\n res = yield _this2.ChatSystemService.leaveRoom(_this2.roomId);\n } catch (error) {\n console.error(error);\n }\n if (res.error) {\n if (res.error.error = \"error-you-are-last-owner\") {\n _this2.toastService._badRequest(\"Você é o último administrador do grupo. Por favor, defina o novo administrador antes de sair da grupo.\");\n _this2.setRoomOwner();\n } else if (res.error.error == 'error-user-not-in-room') {\n _this2.toastService._badRequest(\"Você já não esta nesta conversa\");\n } else {\n _this2.toastService._badRequest(\"Não foi possível sair do grupo\");\n }\n } else {\n _this2.ChatSystemService.deleteRoom(_this2.roomId);\n _this2.close('leave');\n }\n })();\n }\n //Delete\n deleteGroup() {\n let body = {\n \"roomId\": this.roomId\n };\n this.chatService.getRoomInfo(this.roomId).subscribe(room => {\n this.room = room['room'];\n if (this.room.t === 'p') {\n this.chatService.deleteGroup(body).subscribe(res => {\n this.ChatSystemService.deleteRoom(this.roomId);\n });\n } else {\n this.chatService.deleteChannel(body).subscribe(res => {\n this.ChatSystemService.deleteRoom(this.roomId);\n });\n }\n });\n this.close('
|