replicate download file from chat conversation mobile and web

This commit is contained in:
tiago.kayaya
2021-10-05 16:29:33 +01:00
parent db3cda5050
commit 9a629628f3
18 changed files with 252 additions and 21 deletions
@@ -59,10 +59,11 @@
<div>
<div class="file">
<!-- <canvas id="pdf_canvas"></canvas> -->
<div class="file-details add-ellipsis" *ngIf="msg.file">
<span (click)="viewDocument(file.title_link)" class="cursor-pointer">
<div (click)="viewDocument(file)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<span *ngIf="msg.file.type">
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'" icon="file-word" class="excel-icon"></fa-icon>
<ion-icon *ngIf="msg.file.type == 'application/webtrix'" src="assets/icon/webtrix.svg"></ion-icon>
</span>
<ion-label class="file-title">{{file.title}}</ion-label>
@@ -17,6 +17,7 @@ import { SearchPage } from 'src/app/pages/search/search.page';
import { SearchList } from 'src/app/models/search-document';
import { ProcessesService } from 'src/app/services/processes.service';
import { FileService } from 'src/app/services/functions/file.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
/*
@@ -607,8 +608,28 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
});
}
viewDocument(url:string){
this.fileService.viewDocumentByUrl(url);
viewDocument(file:any){
if(file.type == "file"){
let fullUrl = "https://www.tabularium.pt" + file.title_link;
this.fileService.viewDocumentByUrl(fullUrl);
}
else{
this.fileService.viewDocumentByUrl(file.title_link);
//this.openViewDocumentModal(file);
}
}
async openViewDocumentModal(file:any){
const modal = await this.modalController.create({
component: ViewDocumentPage,
componentProps: {
file: file,
},
cssClass: 'modal modal-desktop',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
}
async _openChatOptions() {
@@ -51,7 +51,7 @@
<div>
<div class="file">
<!-- <canvas id="pdf_canvas"></canvas> -->
<div (click)="viewDocument(file.title_link, msg.file.type)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<div (click)="viewDocument(file)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<span *ngIf="msg.file.type">
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
+21 -6
View File
@@ -15,6 +15,7 @@ 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';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
@Component({
selector: 'app-messages',
@@ -241,14 +242,28 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
})
}
viewDocument(url:string, documentType?:string){
if(documentType == "application/webtrix"){
this.fileService.viewDocumentByUrl(url);
}
else{
let fullUrl = "https://www.tabularium.pt" + url;
viewDocument(file:any){
if(file.type == "file"){
let fullUrl = "https://www.tabularium.pt" + file.title_link;
this.fileService.viewDocumentByUrl(fullUrl);
}
else{
this.fileService.viewDocumentByUrl(file.title_link);
//this.openViewDocumentModal(file);
}
}
async openViewDocumentModal(file:any){
const modal = await this.modalController.create({
component: ViewDocumentPage,
componentProps: {
file: file,
},
cssClass: 'modal modal-desktop',
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
}
getChatMembers() {