diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts index 89a76b4d7..744e95d1c 100644 --- a/src/app/pages/chat/chat.page.ts +++ b/src/app/pages/chat/chat.page.ts @@ -235,7 +235,7 @@ export class ChatPage implements OnInit { this.idSelected = ''; this.groupRoomId = data; this.closeAllDesktopComponents(); - if (window.innerWidth < 801) { + if (window.innerWidth < 701) { } else { @@ -270,7 +270,7 @@ export class ChatPage implements OnInit { } openNewGroupPage() { this.idSelected = ''; - if (window.innerWidth < 801) { + if (window.innerWidth < 701) { this.newGroup(); } else { @@ -280,7 +280,7 @@ export class ChatPage implements OnInit { } openEditGroupPage(rid) { - if (window.innerWidth < 801) { + if (window.innerWidth < 701) { this.editGroup(rid); } else { diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index 2fbcdb08d..6dc135f23 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -820,7 +820,7 @@ downloadFileMsg(msg) { async openPreview(msg) { - if (msg.file.image_url === null || msg.file.image_url === '' ) { + if (msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) { this.downloadFileMsg(msg) } else { @@ -828,7 +828,7 @@ async openPreview(msg) { component: ViewMediaPage, cssClass: 'modal modal-desktop', componentProps: { - image: msg.file.image_url, + image: msg.attachments[0].image_url, username: msg.u.name, _updatedAt: msg._updatedAt } diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index ad78dcbe1..5f84d826b 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -108,7 +108,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { private sqlservice: SqliteService, public wsChatMethodsService: WsChatMethodsService, private AttachmentsService: AttachmentsService, - + private CameraService: CameraService, private processesService: ProcessesService, private storage: Storage, @@ -127,7 +127,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory({}) this.wsChatMethodsService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked this.wsChatMethodsService.openRoom(this.roomId) - + setTimeout(()=>{ this.scrollToBottomClicked() }, 150) @@ -518,13 +518,13 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { async takePicture() { const roomId = this.roomId - + const image = await this.CameraService.takePicture(); await this.fileService.saveImage(image) const lastphoto: any = await this.fileService.loadFiles(); const { capturedImage, capturedImageTitle} = await this.fileService.loadFileData(lastphoto); - + const base64 = await fetch(capturedImage); const blob = await base64.blob(); const formData = new FormData(); @@ -550,11 +550,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { async addImageMobile() { this.addFileToChatMobile(['image/apng', 'image/jpeg', 'image/png']) } - + async addImage() { this.addFileToChat(['image/apng', 'image/jpeg', 'image/png']) } - + async addFile() { this.addFileToChat(['.doc', '.docx', '.pdf']) } @@ -618,7 +618,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { const formData = new FormData(); formData.append("blobFile", blob); - + this.wsChatMethodsService.getDmRoom(roomId).send({ file: { "type": "application/img", @@ -647,7 +647,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { const formData = new FormData(); formData.append("blobFile", file); - + this.wsChatMethodsService.getDmRoom(roomId).send({ file: { "type": "application/img", @@ -809,7 +809,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { async openPreview(msg) { - if (msg.file.image_url === null || msg.file.image_url === '' ) { + if (msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) { this.downloadFileMsg(msg) } else { @@ -817,7 +817,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { component: ViewMediaPage, cssClass: 'modal modal-desktop', componentProps: { - image: msg.file.image_url, + image: msg.attachments[0].image_url, username: msg.u.name, _updatedAt: msg._updatedAt } diff --git a/src/app/pages/chat/new-group/new-group.page.ts b/src/app/pages/chat/new-group/new-group.page.ts index 5ca806462..8fcd410e7 100644 --- a/src/app/pages/chat/new-group/new-group.page.ts +++ b/src/app/pages/chat/new-group/new-group.page.ts @@ -87,62 +87,6 @@ export class NewGroupPage implements OnInit { this.wsChatMethodsService.subscribeToRoomUpdate(res.result.rid, res.result); //this.addGroupMessage.emit(res.result.rid); - - /* - let body = { "name":name, } - this.chatService.addGroup(body).subscribe(res=>{ - console.log('group created'); - console.log(res['group']); - - //this.addGroupMessage.emit(res['group']._id); - - if(this.thedate){ - let countDownBody = { - "roomId": res['group']._id, - "customFields":{"countDownDate":this.thedate} - } - this.chatService.setGroupCustomFields(countDownBody).subscribe(res=>{ - console.log(res); - }); - } - - this.isGroupCreated = true; - this.addContacts(res['group']); - - if(this.documents.length > 0){ - //If there is documents add - this.documents.forEach(async document => { - - let url = await this.processesService.GetDocumentUrl(document.DocId, document.ApplicationId).toPromise(); - let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1"); - - let body = { - "message": - { - "rid": res['group']._id, - "msg": "", - "attachments": [{ - "title": document.Assunto, - "description": document.DocTypeDesc, - "title_link": url_no_options, - "title_link_download": true, - //"thumb_url": "assets/images/webtrix-logo.png", - "message_link": url_no_options, - "type": "webtrix" - }], - "file":{ - "name": document.Assunto, - "type": "application/webtrix", - "ApplicationId": document.ApplicationType, - "DocId": document.Id, - "Assunto": document.Assunto, - } - } - } - this.chatService.sendMessage(body).toPromise(); - }); - } - }); */ } async addContacts(room){ diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts index 5d2a2aba2..58f696aa8 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -132,22 +132,21 @@ export class ViewPublicationsPage implements OnInit { this.showLoader = true; const folderId = this.folderId - this.getFromDB() this.publications.GetPublicationsImages(this.folderId).subscribe(res => { console.log('publications ids', res) this.publicationList = new Array(); - for(let i = 0; i < res.length; i++) { + /* for(let i = 0; i < res.length; i++) { this.publications.GetPublicationById(res[i]).subscribe(ress => { console.log('publications by ids', ress) let item: Publication = this.publicationPipe.itemList(ress) console.log('publications by ids 2', item) this.publicationList.push(item); }) - } + } */ - /* res.forEach(element => { + res.forEach(element => { console.log('publications elements', element) this.publications.GetPublicationById(element).subscribe(ress => { console.log('publications by ids', ress) @@ -156,7 +155,7 @@ export class ViewPublicationsPage implements OnInit { this.publicationList.push(item); }) - }); */ + }); console.log('PUBLICATIONS IMAGEs',this.publicationList) this.sqliteservice.updateactions(this.folderId, JSON.stringify(this.publicationList)); console.log('PUBLICATIONS IMAGEs',this.publicationList) @@ -175,6 +174,8 @@ export class ViewPublicationsPage implements OnInit { this.publicationListStorage.add(folderId, this.publicationList) this.getpublication = this.publicationList; */ + }, (error) => { + this.getFromDB() }); } diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts index 92c5e5c4c..f933bd0f6 100644 --- a/src/app/services/chat.service.ts +++ b/src/app/services/chat.service.ts @@ -83,8 +83,8 @@ export class ChatService { params: params } return this.http.get(environment.apiChatUrl+'rooms.info', opts); - } + customsRooms(params:any){ let opts = { headers: this.headers, diff --git a/src/app/services/chat/ws-chat-methods.service.ts b/src/app/services/chat/ws-chat-methods.service.ts index d541b7ce9..34069b028 100644 --- a/src/app/services/chat/ws-chat-methods.service.ts +++ b/src/app/services/chat/ws-chat-methods.service.ts @@ -44,7 +44,7 @@ export class WsChatMethodsService { private NfService: NfService, private changeProfileService: ChangeProfileService, ) { - + this.loadChat() this.WsChatService.registerCallback({ @@ -63,7 +63,7 @@ export class WsChatMethodsService { for (const id in this.dm) { this.dm[id].hasLoadHistory = false } - + for (const id in this.group) { this.group[id].hasLoadHistory = false } @@ -79,7 +79,7 @@ export class WsChatMethodsService { this.storage.remove('Rooms'); }) - + // this.WsChatService.registerCallback({ // type:'Onmessage', // funx:(message) => { @@ -97,7 +97,7 @@ export class WsChatMethodsService { // } // } else if(message.msg =='changed' && message.collection == "stream-notify-room") { // if(message.fields.eventName.includes('deleteMessage')) { - // // delete message + // // delete message // const DeletedMessageId = message.fields.args[0]._id; // setTimeout(()=>{ @@ -131,7 +131,7 @@ export class WsChatMethodsService { clearChat() { this.dm = {} - this.group = {} + this.group = {} this._dm = [] this._group = [] @@ -139,7 +139,7 @@ export class WsChatMethodsService { this.dmCount = 0; this.groupCount = 0; - + this.currentRoom = null this.users = [] } @@ -154,11 +154,11 @@ export class WsChatMethodsService { if(this.getDmRoom(roomId)) { this.currentRoom = this.getDmRoom(roomId) } else if(this.getGroupRoom(roomId)) { - this.currentRoom = this.getGroupRoom(roomId) + this.currentRoom = this.getGroupRoom(roomId) } this.currentRoom.open() - + } @@ -171,7 +171,7 @@ export class WsChatMethodsService { await rooms.result.update.forEach( async (roomData: room) => { await this.prepareRoom(roomData); }); - + } } catch(e){} @@ -271,7 +271,7 @@ export class WsChatMethodsService { lastMessage: this.getRoomLastMessage(roomData), _updatedAt: new Date(roomData._updatedAt['$date']) } - + let roomId = this.getRoomId(roomData) // create room @@ -284,19 +284,20 @@ export class WsChatMethodsService { room.sortRoomList = this.sortRoomList // create individual room + if(this.isIndividual(roomData)) { - + this.dm[roomId] = room this._dm.push(room) this.dmCount++ - + } else { // create group room this.group[roomId] = room this._group.push(room) this.groupCount++ - + } } else { // in this case room is already present, therefor it will only be necessary, @@ -379,12 +380,29 @@ export class WsChatMethodsService { return this.WsChatService.leaveRoom(id); } + async hideRoom(id) { + this._dm.forEach((md, index)=>{ + if(md.id == id) { + this._dm.splice(index, 1) + delete this.dm[id] + } + }); + + this._group.forEach((group, index)=>{ + if(group.id == id) { + this._group.splice(index, 1) + delete this.group[id] + } + }) + } + hidingRoom(id?) { return this.WsChatService.hidingRoom(id).then(()=>{ // this.hideRoom(id) }) + return this.WsChatService.hidingRoom(id); } addRoomOwner(roomid, userId){ diff --git a/src/app/services/chat/ws-chat.service.ts b/src/app/services/chat/ws-chat.service.ts index d6f8908dd..f0f1911bc 100644 --- a/src/app/services/chat/ws-chat.service.ts +++ b/src/app/services/chat/ws-chat.service.ts @@ -277,6 +277,8 @@ export class WsChatService { this.ws.registerCallback({type:'Onmessage', funx:(message)=>{ if(message.id == requestId ) { // same request send resolve(message) + console.log(message); + return true } }}) @@ -659,7 +661,7 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) { setTimeout(()=>{ this.ws.wsMsgQueue() }, 10) - + if(this.wsReconnect >= 1) { for (const [key, value] of Object.entries(this.wsCallbacks)) { if(value.type== 'reConnect') { @@ -702,7 +704,7 @@ updateRoomEventss(roomId, collection:string, funx: Function, ) { } else { let messageStr = JSON.stringify(message) // console.log('messageStr', messageStr) - + this.socket.send(messageStr) } return requestId diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index 021643fad..bef09ff69 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -367,9 +367,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe console.log(res); if (res.data == 'leave') { this.getRoomInfo(); - this.wsChatMethodsService.hidingRoom(this.roomId); this.closeAllDesktopComponents.emit(); this.showEmptyContainer.emit(); + this.wsChatMethodsService.hidingRoom(this.roomId); } else if (res.data == 'delete') { this.closeAllDesktopComponents.emit(); @@ -559,7 +559,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe const formData = new FormData(); formData.append("blobFile", blob); - + this.wsChatMethodsService.getGroupRoom(roomId).send({ file: { "type": "application/img", @@ -676,7 +676,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe const formData = new FormData(); formData.append("blobFile", blob); - + this.wsChatMethodsService.getGroupRoom(roomId).send({ file: { "type": "application/img", @@ -833,7 +833,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe async openPreview(msg) { - if (msg.file.image_url === null || msg.file.image_url === '' ) { + if (msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) { this.downloadFileMsg(msg) } else { @@ -841,7 +841,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe component: ViewMediaPage, cssClass: 'modal modal-desktop', componentProps: { - image: msg.file.image_url, + image: msg.attachments[0].image_url, username: msg.u.name, _updatedAt: msg._updatedAt } diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 4642904b9..290ef5669 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -101,7 +101,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy public wsChatMethodsService: WsChatMethodsService, public WsChatService: WsChatService, private AttachmentsService: AttachmentsService, - + private CameraService: CameraService, private processesService: ProcessesService, private fileToBase64Service: FileToBase64Service, @@ -458,7 +458,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy const formData = new FormData(); formData.append("blobFile", blob); - + this.wsChatMethodsService.getDmRoom(roomId).send({ file: { "type": "application/img", @@ -477,7 +477,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy async takePicture() { const roomId = this.roomId - + const image = await this.CameraService.takePicture(); await this.fileService.saveImage(image) const lastphoto: any = await this.fileService.loadFiles(); @@ -505,11 +505,11 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy }) } - + async addImage() { this.addFileToChatMobile(['image/apng', 'image/jpeg', 'image/png']) } - + async addFile() { this.addFileToChat(['.doc', '.docx', '.pdf']) } @@ -572,7 +572,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy const formData = new FormData(); formData.append("blobFile", blob); - + this.wsChatMethodsService.getDmRoom(roomId).send({ file: { "type": "application/img", @@ -592,7 +592,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy async addFileToChat(types: typeof FileType[] ) { - + const roomId = this.roomId const file: any = await this.fileService.getFileFromDevice(types); @@ -602,10 +602,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy }) */ const blob = new Blob([file],{type: file.type}) console.log('Add file', blob) - + const formData = new FormData(); formData.append("blobFile", blob); - + this.wsChatMethodsService.getDmRoom(roomId).send({ file: { "type": file.type, @@ -623,7 +623,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy } - + bookMeeting() { let data = { @@ -678,7 +678,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy await modal.present(); modal.onDidDismiss().then( async (res) => { console.log(res['data']); - + if (res['data'] == 'meeting') { //this.closeAllDesktopComponents.emit(); @@ -706,7 +706,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy else if (res['data'] == 'documentoGestaoDocumental') { this.addFileWebtrix() - + this.showLoader = false; } @@ -755,8 +755,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy } async openPreview(msg) { +console.log(msg); - if (msg.file.image_url === null || msg.file.image_url === '' ) { + if (msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) { this.downloadFileMsg(msg) } else { @@ -764,7 +765,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy component: ViewMediaPage, cssClass: 'modal modal-desktop', componentProps: { - image: msg.file.image_url, + image: msg.attachments[0].image_url, username: msg.u.name, _updatedAt: msg._updatedAt } 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 75b4f7d37..dcd87d645 100644 --- a/src/app/shared/chat/new-group/new-group.page.ts +++ b/src/app/shared/chat/new-group/new-group.page.ts @@ -113,64 +113,6 @@ export class NewGroupPage implements OnInit{ this.wsChatMethodsService.subscribeToRoomUpdate(res.result.rid, res.result); this.addGroupMessage.emit(res.result.rid); - - /* - let body = { "name":name, } - this.chatService.addGroup(body).subscribe(res=>{ - console.log('group created'); - console.log(res['group']); - - this.addGroupMessage.emit(res['group']._id); */ - - /* this.addGroupMessage.emit(res['group']._id); - - if(this.thedate){ - let countDownBody = { - "roomId": res['group']._id, - "customFields":{"countDownDate":this.thedate} - } - this.chatService.setGroupCustomFields(countDownBody).subscribe(res=>{ - console.log(res); - }); - } - - if(this.documents.length > 0){ - //If there is documents add - this.documents.forEach(async document => { - - let url = await this.processesService.GetDocumentUrl(document.DocId, document.ApplicationId).toPromise(); - let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1"); - - let body = { - "message": - { - "rid": res['group']._id, - "msg": "", - "attachments": [{ - "title": document.Assunto, - "description": document.DocTypeDesc, - "title_link": url_no_options, - "title_link_download": true, - //"thumb_url": "assets/images/webtrix-logo.png", - "message_link": url_no_options, - "type": "webtrix" - }], - "file":{ - "name": document.Assunto, - "type": "application/webtrix", - "ApplicationId": document.ApplicationType, - "DocId": document.Id, - "Assunto": document.Assunto, - } - } - } - this.chatService.sendMessage(body).toPromise(); - }); - } */ - - - - //}); } async addContacts(){ diff --git a/src/app/shared/popover/chat-popover/chat-popover.page.ts b/src/app/shared/popover/chat-popover/chat-popover.page.ts index 374f807ab..026cb6d3d 100644 --- a/src/app/shared/popover/chat-popover/chat-popover.page.ts +++ b/src/app/shared/popover/chat-popover/chat-popover.page.ts @@ -35,7 +35,7 @@ export class ChatPopoverPage implements OnInit { } close(action:any){ - if( window.innerWidth <= 701){ + if( window.innerWidth < 701){ this.popoverController.dismiss(action); this.modalController.dismiss(action); } @@ -50,7 +50,7 @@ export class ChatPopoverPage implements OnInit { async setRoomOwner(){ let classs; - if (window.innerWidth <= 800) { + if (window.innerWidth < 701) { classs = 'modal modal-desktop' } else { classs = 'centered-rounded-modal' @@ -68,6 +68,7 @@ export class ChatPopoverPage implements OnInit { modal.onDidDismiss().then((res)=>{ if(res.data == 'success'){ this.leaveGroup(); + //this.wsChatMethodsService.hidingRoom(this.roomId); } }); } diff --git a/src/app/shared/publication/new-publication/new-publication.page.ts b/src/app/shared/publication/new-publication/new-publication.page.ts index 723dcae5c..28e6bfcb1 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.ts +++ b/src/app/shared/publication/new-publication/new-publication.page.ts @@ -94,65 +94,26 @@ export class NewPublicationPage implements OnInit { const capturedImage = await Camera.getPhoto({ quality: 90, // allowEditing: true, - resultType: CameraResultType.Uri, + resultType: CameraResultType.Base64, source: CameraSource.Camera }); - const response = await fetch(capturedImage.webPath!); - const blob = await response.blob(); - this.photos.unshift({ - filepath: "soon...", - webviewPath: capturedImage.webPath - }); - this.capturedImage = await this.convertBlobToBase64(blob); - this.capturedImageTitle = new Date().getTime() + '.jpeg'; + this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String; + this.capturedImageTitle = capturedImage.path; //console.log(this.capturedImage); } - convertBlobToBase64 = (blob: Blob) => new Promise((resolve, reject) => { - const reader = new FileReader; - reader.onerror = reject; - reader.onload = () => { - resolve(reader.result); - }; - reader.readAsDataURL(blob); - }); - async laodPicture() { const capturedImage = await Camera.getPhoto({ - resultType: CameraResultType.Uri, - source: CameraSource.Photos, quality: 90, - width: 1080, - height: 720, + resultType: CameraResultType.Base64, + source: CameraSource.Photos }); - const response = await fetch(capturedImage.webPath!); - const blob = await response.blob(); - - this.photos.unshift({ - filepath: "soon...", - webviewPath: capturedImage.webPath - }); - - this.capturedImage = await this.convertBlobToBase64(blob); - this.capturedImageTitle = new Date().getTime() + '.jpeg'; + this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String; + this.capturedImageTitle = capturedImage.path; } - /* laodPicture() { - const input = this.fileLoaderService.createInput({ - accept: ['image/apng', 'image/jpeg', 'image/png'] - }) - - input.onchange = async () => { - const file = this.fileLoaderService.getFirstFile(input) - - const imageData = await this.fileToBase64Service.convert(file) - this.capturedImage = imageData; - this.capturedImageTitle = file.name - }; - } */ - runValidation() { this.validateFrom = true diff --git a/src/app/shared/publication/view-publications/view-publications.page.html b/src/app/shared/publication/view-publications/view-publications.page.html index 69095520f..83acf49c6 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.html +++ b/src/app/shared/publication/view-publications/view-publications.page.html @@ -41,7 +41,7 @@
image diff --git a/src/app/shared/publication/view-publications/view-publications.page.ts b/src/app/shared/publication/view-publications/view-publications.page.ts index 88f9b4d01..d92cc069f 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.ts +++ b/src/app/shared/publication/view-publications/view-publications.page.ts @@ -53,7 +53,7 @@ export class ViewPublicationsPage implements OnInit { this.folderId = this.folderId['ProcessId'] } - this.getPublications(); + this.getPublicationsIds(); this.getPublicationDetail(); window['app-view-publications-page-doRefresh'] = this.doRefresh @@ -67,15 +67,16 @@ export class ViewPublicationsPage implements OnInit { console.log('change view to ',this.folderId) //setTimeout(()=>{ - this.getPublications(); this.getPublicationDetail(); + this.getPublicationsIds(); + //}, 100) } doRefresh =(event) => { - this.getPublications(); + this.getPublicationsIds(); setTimeout(() => { this.getPublicationDetail(); @@ -97,22 +98,22 @@ export class ViewPublicationsPage implements OnInit { this.showLoader = true; const folderId = this.folderId - this.getFromDB() + //this.getFromDB() this.publications.GetPublicationsImages(this.folderId).subscribe(res => { console.log('publications ids', res) this.publicationList = new Array(); - for(let i = 0; i < res.length; i++) { + /* for(let i = 0; i < res.length; i++) { this.publications.GetPublicationById(res[i]).subscribe(ress => { console.log('publications by ids', ress) let item: Publication = this.publicationPipe.itemList(ress) console.log('publications by ids 2', item) this.publicationList.push(item); }) - } + } */ - /* res.forEach(element => { + res.forEach(element => { console.log('publications elements', element) this.publications.GetPublicationById(element).subscribe(ress => { console.log('publications by ids', ress) @@ -121,7 +122,7 @@ export class ViewPublicationsPage implements OnInit { this.publicationList.push(item); }) - }); */ + }); console.log('PUBLICATIONS IMAGEs',this.publicationList) this.storage.remove('view_publications'); this.storage.set('view_publications', this.publicationList); @@ -129,6 +130,8 @@ export class ViewPublicationsPage implements OnInit { this.getpublication = this.publicationList; this.showLoader = false; + },() => { + this.getFromDB(); }); } @@ -142,7 +145,7 @@ export class ViewPublicationsPage implements OnInit { this.showLoader = true; const folderId = this.folderId this.publicationList = new Array(); - this.getFromDB(); + //this.getFromDB(); this.publications.GetPublications(folderId).subscribe(async res=> { res.forEach(element => {