From 847a9ec999ccc167485597d52479e974ecd6b47d Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Fri, 1 Oct 2021 09:40:11 +0100 Subject: [PATCH 01/16] Fix --- .../expediente/expediente-detail/expediente-detail.page.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts index 2f964a629..8e08806de 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.ts @@ -316,9 +316,6 @@ export class ExpedienteDetailPage implements OnInit { modal.onDidDismiss().then( async (res)=> { }); - - - } // viewDocument(DocId:string) { From 3f99ea222cb637f66b58c9bc22cb40990b7cf4ed Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Mon, 4 Oct 2021 13:49:35 +0100 Subject: [PATCH 02/16] save --- angular.json | 5 ++-- .../group-messages/group-messages.page.html | 23 ------------------- src/app/services/chat.service.ts | 18 +++++++++++++++ .../shared/chat/messages/messages.page.html | 6 +++-- src/app/shared/chat/messages/messages.page.ts | 3 +++ 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/angular.json b/angular.json index ff682adde..50ef54e6d 100644 --- a/angular.json +++ b/angular.json @@ -84,7 +84,8 @@ "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { - "browserTarget": "app:build" + "browserTarget": "app:build", + "proxyConfig": "proxy.config.json" }, "configurations": { "production": { @@ -197,4 +198,4 @@ "styleext": "scss" } } -} \ No newline at end of file +} diff --git a/src/app/pages/chat/group-messages/group-messages.page.html b/src/app/pages/chat/group-messages/group-messages.page.html index 493a39586..9e2e53232 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.html +++ b/src/app/pages/chat/group-messages/group-messages.page.html @@ -118,29 +118,6 @@ -
diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts index 910ffa9e1..6dcdf578d 100644 --- a/src/app/services/chat.service.ts +++ b/src/app/services/chat.service.ts @@ -9,6 +9,7 @@ import { Storage } from '@ionic/storage'; import { Message } from 'src/app/models/message.model'; import { Observable, Subject } from "rxjs/Rx"; import { WebsocketService } from './websocket.service'; +import { FileService } from './functions/file.service'; @Injectable({ providedIn: 'root' @@ -31,6 +32,7 @@ export class ChatService { private authService: AuthService, private storage: Storage, private storageService:StorageService, + private fileService: FileService, //private wsService: WebsocketService, ) { @@ -49,6 +51,22 @@ export class ChatService { }); */ } + getDocumentDetails(url:string){ + let headersc = new HttpHeaders(); + headersc = headersc.set('X-User-Id', this.loggedUserChat['data'].userId); + headersc = headersc.set('X-Auth-Token', this.loggedUserChat['data'].authToken); + // headersc = headersc.set("Host", "www.tabularium.pt"); + // headersc = headersc.set("Origin", "http://localhost:8100"); + // headersc = headersc.set("Referer", "http://localhost:8100/"); + let optionsc = { + headers: headersc, + }; + let fullUrl = "https://www.tabularium.pt/" + url; + return this.http.get(fullUrl, optionsc).subscribe(()=>{ + this.fileService.viewDocumentByUrl(url) + }); + } + getAllChannels(){ return this.http.get(environment.apiChatUrl+'channels.list', this.options); } diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index d722ff16d..2884c0109 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -51,14 +51,16 @@
-
- +
+ {{file.title}} +
+ {{file.title_link}}
diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 3bffc01df..0a4df27f6 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -241,6 +241,9 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy viewDocument(url:string){ this.fileService.viewDocumentByUrl(url); + /* this.chatService.getDocumentDetails(url).subscribe(res => { + console.log(res); + }) */ } getChatMembers() { From 5d4490e287659b50785785c3032a894557348d75 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Tue, 5 Oct 2021 10:18:38 +0100 Subject: [PATCH 03/16] solved unauthorized rockect chat url --- angular.json | 3 +-- src/app/home/home.page.ts | 22 +++++++++---------- src/app/services/auth.service.ts | 4 +++- src/app/services/chat.service.ts | 4 +--- src/app/services/functions/file.service.ts | 2 +- .../shared/chat/messages/messages.page.html | 2 +- src/app/shared/chat/messages/messages.page.ts | 15 ++++++++----- src/index.html | 12 +++++----- 8 files changed, 34 insertions(+), 30 deletions(-) diff --git a/angular.json b/angular.json index 50ef54e6d..ecd38fe24 100644 --- a/angular.json +++ b/angular.json @@ -84,8 +84,7 @@ "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { - "browserTarget": "app:build", - "proxyConfig": "proxy.config.json" + "browserTarget": "app:build" }, "configurations": { "production": { diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index b28faf780..41d4fa1de 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -95,7 +95,7 @@ export class HomePage implements OnInit { } - + goto(url) { this.router.navigate([url]) } @@ -106,10 +106,10 @@ export class HomePage implements OnInit { /* this.network.checkNetworkConnection; this.network.checkNetworkDisconnection; */ // console.log('Active route ', this.router.url) - + if (this.platform.is('desktop') || this.platform.is('mobileweb')) { - this.webnotification.webconnection(); - this.webnotification.onReceviNotificationWeb(); + /* this.webnotification.webconnection(); + this.webnotification.onReceviNotificationWeb(); */ } else { this.mobilefirstConnect(); this.notificationsService.getAndpostToken2(); @@ -132,13 +132,13 @@ export class HomePage implements OnInit { if(window['WLAuthorizationManager']) { if(window['WLAuthorizationManager'].obtainAccessToken) { window['WLAuthorizationManager'].obtainAccessToken("").then((token) => { - + console.log('MobileFirst Server connect: Success ' + token); - + var resourceRequest = new WLResourceRequest("/adapters/javaAdapter/resource/greet/", WLResourceRequest.GET ); - + resourceRequest.setQueryParameter("name", "world"); resourceRequest.send().then( (response) => { @@ -178,7 +178,7 @@ export class HomePage implements OnInit { synchro.registerCallback('Offline',()=>{ - + }) synchro.conected @@ -186,7 +186,7 @@ export class HomePage implements OnInit { synchro.registerCallback('Notification', (DataArray)=> { this.webNotificationPopupService.sendNotification(DataArray) - + this.storageService.get('Notifications').then((data:any)=>{ data.push(DataArray) this.storageService.store("Notifications", data) @@ -196,7 +196,7 @@ export class HomePage implements OnInit { a.push(DataArray) this.storageService.store("Notifications",a) }) - + }, 'any') @@ -204,7 +204,7 @@ export class HomePage implements OnInit { document.addEventListener('pause', function () { // console.log('App going to background'); }); - + document.addEventListener('resume', function () { // console.log('App coming to foreground'); }); diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index d8094ed39..ca61b3319 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -65,7 +65,7 @@ export class AuthService { } SetSession(response: LoginUserRespose, user:UserForm) { - const session: UserSession = Object.assign(SessionStore.user, response) + const session: UserSession = Object.assign(SessionStore.user, response) if (response) { if( session.RoleID == 100000014) { @@ -102,6 +102,8 @@ export class AuthService { console.log('Login to Rocket chat OK'); this.ValidatedUserChat = responseChat; localStorage.setItem('userChat', JSON.stringify(responseChat)); + localStorage.setItem('Meteor.loginToken', JSON.stringify(responseChat['data'].userId)); + localStorage.setItem('Meteor.userId', JSON.stringify(responseChat['data'].authToken)); this.storageService.store(AuthConnstants.AUTH, responseChat); return true; } diff --git a/src/app/services/chat.service.ts b/src/app/services/chat.service.ts index 6dcdf578d..3a26458bf 100644 --- a/src/app/services/chat.service.ts +++ b/src/app/services/chat.service.ts @@ -9,7 +9,6 @@ import { Storage } from '@ionic/storage'; import { Message } from 'src/app/models/message.model'; import { Observable, Subject } from "rxjs/Rx"; import { WebsocketService } from './websocket.service'; -import { FileService } from './functions/file.service'; @Injectable({ providedIn: 'root' @@ -32,7 +31,6 @@ export class ChatService { private authService: AuthService, private storage: Storage, private storageService:StorageService, - private fileService: FileService, //private wsService: WebsocketService, ) { @@ -63,7 +61,7 @@ export class ChatService { }; let fullUrl = "https://www.tabularium.pt/" + url; return this.http.get(fullUrl, optionsc).subscribe(()=>{ - this.fileService.viewDocumentByUrl(url) + //this.fileService.viewDocumentByUrl(url) }); } diff --git a/src/app/services/functions/file.service.ts b/src/app/services/functions/file.service.ts index 037f7031a..7c5ef6289 100644 --- a/src/app/services/functions/file.service.ts +++ b/src/app/services/functions/file.service.ts @@ -252,7 +252,7 @@ export class FileService { } viewDocumentByUrl(url) { - const browser = this.iab.create(url,"_blank"); + const browser = this.iab.create(url,"_parent"); browser.show(); } } diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index 2884c0109..e49e36a1c 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -51,7 +51,7 @@
-
+
diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts index 0a4df27f6..842086692 100644 --- a/src/app/shared/chat/messages/messages.page.ts +++ b/src/app/shared/chat/messages/messages.page.ts @@ -14,6 +14,7 @@ import { ChatMessageStore } from 'src/app/store/chat/chat-message.service'; import { ChatUserStorage } from 'src/app/store/chat/chat-user.service'; import { TimeService } from 'src/app/services/functions/time.service'; import { FileService } from 'src/app/services/functions/file.service'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; @Component({ selector: 'app-messages', @@ -68,6 +69,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy private timeService: TimeService, private fileService: FileService, private gestureController: GestureController, + private http:HttpClient, ) { this.loggedUser = authService.ValidatedUserChat['data']; @@ -239,11 +241,14 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy }) } - viewDocument(url:string){ - this.fileService.viewDocumentByUrl(url); - /* this.chatService.getDocumentDetails(url).subscribe(res => { - console.log(res); - }) */ + viewDocument(url:string, documentType?:string){ + if(documentType == "application/webtrix"){ + this.fileService.viewDocumentByUrl(url); + } + else{ + let fullUrl = "https://www.tabularium.pt" + url; + this.fileService.viewDocumentByUrl(fullUrl); + } } getChatMembers() { diff --git a/src/index.html b/src/index.html index fb77a3f7a..2cc52887a 100644 --- a/src/index.html +++ b/src/index.html @@ -7,13 +7,13 @@ - - + - - - --> From db3cda505025775ac799d5d52eeffb6ca7157182 Mon Sep 17 00:00:00 2001 From: "tiago.kayaya" Date: Tue, 5 Oct 2021 10:29:07 +0100 Subject: [PATCH 04/16] save --- src/app/shared/chat/messages/messages.page.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index e49e36a1c..594c4cb19 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -51,16 +51,14 @@
-
- +
+ {{file.title}} -
- {{file.title_link}}
From d8757b4c583e73e4518325afcee5ce8efb6b7332 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Tue, 5 Oct 2021 15:02:52 +0100 Subject: [PATCH 05/16] Fix viewer --- .../document-viewer/document-viewer.page.html | 5 +- .../document-viewer/document-viewer.page.ts | 170 +----------------- src/app/pages/agenda/agenda.page.ts | 2 +- .../despachos/despacho/despacho.page.ts | 2 +- .../despachos/despachos.page.ts | 4 +- .../expediente-detail.page.ts | 11 +- src/app/services/notifications.service.ts | 3 +- src/assets/www/pdfjs/build/pdf.js | 2 + 8 files changed, 11 insertions(+), 188 deletions(-) diff --git a/src/app/modals/document-viewer/document-viewer.page.html b/src/app/modals/document-viewer/document-viewer.page.html index b4664b350..78dd8f681 100644 --- a/src/app/modals/document-viewer/document-viewer.page.html +++ b/src/app/modals/document-viewer/document-viewer.page.html @@ -14,9 +14,8 @@ - +
- +
-
diff --git a/src/app/modals/document-viewer/document-viewer.page.ts b/src/app/modals/document-viewer/document-viewer.page.ts index c03b9b3f3..c8711fe32 100644 --- a/src/app/modals/document-viewer/document-viewer.page.ts +++ b/src/app/modals/document-viewer/document-viewer.page.ts @@ -10,7 +10,7 @@ import { ProcessesService } from 'src/app/services/processes.service'; }) export class DocumentViewerPage implements OnInit { - pdfSrc = 'http://laptop-46/FileShare/Test_25MB.pdf'; + pdfSrc = null; task = null DocId = null fileName = '' @@ -24,10 +24,7 @@ export class DocumentViewerPage implements OnInit { this.task = this.navParams.get('task') || null; this.DocId = this.navParams.get('DocId'); - if(this.navParams.get('pdfSrc')) { - this.pdfSrc = this.navParams.get('pdfSrc') || null; - } - + this.pdfSrc = 'https://equilibrium.dyndns.info/FileShare/pdfjs/web/viewer.html?file=' } @@ -41,169 +38,6 @@ export class DocumentViewerPage implements OnInit { }) - // this.setPdfViewer() - - - // setTimeout(() => { - - // document.getElementById('iframe')['contentWindow'].postMessage( - // { - // sender: "get_page_button1", - // message: 'url' - // }, "*") - - // }, 3000) - - } - - - setPdfViewer() { - setTimeout( async () => { - - // If absolute URL from the remote server is provided, configure the CORS - // header on that server. - var url = 'http://192.168.0.87:3000/000634977.pdf'; - - const pdfjsWorker = await import('pdfjs-dist/build/pdf.worker.entry'); - // Loaded via