mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Preview image on chat solved
This commit is contained in:
@@ -31,6 +31,7 @@ import { MessageService } from 'src/app/services/chat/message.service';
|
||||
import { File } from '@awesome-cordova-plugins/file/ngx';
|
||||
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
|
||||
|
||||
@Component({
|
||||
selector: 'app-group-messages',
|
||||
@@ -1054,7 +1055,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
return blob;
|
||||
}
|
||||
|
||||
openFile(pdfString, filename) {
|
||||
openFile(pdfString, filename, type) {
|
||||
const blob = this.b64toBlob(pdfString, 'application/pdf')
|
||||
let pathFile = ''
|
||||
const fileName = filename
|
||||
@@ -1105,21 +1106,38 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
|
||||
this.downloadFileFromBrowser(msg.attachments[0].name, str)
|
||||
/* const modal = await this.modalController.create({
|
||||
component: ViewMediaPage,
|
||||
cssClass: 'modal modal-desktop',
|
||||
componentProps: {
|
||||
image: str,
|
||||
type: msg.file.type,
|
||||
username: msg.u.name,
|
||||
_updatedAt: msg._updatedAt
|
||||
}
|
||||
});
|
||||
modal.present(); */
|
||||
if (msg.file.type == "application/img") {
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewMediaPage,
|
||||
cssClass: 'modal modal-desktop',
|
||||
componentProps: {
|
||||
image: msg.attachments[0].image_url,
|
||||
type: msg.file.type,
|
||||
username: msg.u.name,
|
||||
_updatedAt: msg._updatedAt
|
||||
}
|
||||
});
|
||||
modal.present();
|
||||
} else {
|
||||
this.downloadFileFromBrowser(msg.attachments[0].name, str)
|
||||
}
|
||||
|
||||
} else {
|
||||
this.openFile(str, msg.attachments[0].name);
|
||||
if (msg.file.type == "application/img") {
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewMediaPage,
|
||||
cssClass: 'modal modal-desktop',
|
||||
componentProps: {
|
||||
image: msg.attachments[0].image_url,
|
||||
type: msg.file.type,
|
||||
username: msg.u.name,
|
||||
_updatedAt: msg._updatedAt
|
||||
}
|
||||
});
|
||||
modal.present();
|
||||
} else {
|
||||
this.openFile(str, msg.attachments[0].name, msg.file.type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user