diff --git a/src/app/shared/chat/new-group/new-group.page.ts b/src/app/shared/chat/new-group/new-group.page.ts index 311d5e962..7a3625799 100644 --- a/src/app/shared/chat/new-group/new-group.page.ts +++ b/src/app/shared/chat/new-group/new-group.page.ts @@ -109,65 +109,11 @@ export class NewGroupPage implements OnInit{ await this.wsChatMethodsService.getAllRooms(); if(!this.wsChatMethodsService.getGroupRoom(res.result.rid)) { - setTimeout(()=> { - this.documents.forEach(element => { - this.wsChatMethodsService.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", - }], - }) - }); - - }, 1500) + this.createGroupWithAttachmentsCath(res) } else { setTimeout(()=> { - this.documents.forEach(element => { - this.wsChatMethodsService.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.createGroupWithAttachments(res) }, 500) } @@ -182,6 +128,46 @@ export class NewGroupPage implements OnInit{ } + createGroupWithAttachmentsCath(res: any) { + if(!this.wsChatMethodsService.getGroupRoom(res.result.rid)) { + setTimeout(()=>{ + this.createGroupWithAttachmentsCath(res) + }, 1500) + } else { + this.createGroupWithAttachments(res) + } + } + + createGroupWithAttachments(res: any) { + this.documents.forEach(element => { + this.wsChatMethodsService.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", + }], + }) + }); + } + async addContacts(){ this.close();