mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Commit to get icon and splash
This commit is contained in:
@@ -61,7 +61,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' (click)="openPreview(msg)" *ngIf="msg.msg !=''">
|
||||
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' (click)="openPreview(msg)" *ngIf="msg.msg !=''">
|
||||
<div class="title">
|
||||
<ion-label>{{msg.u.name}}</ion-label>
|
||||
<span class="time">{{msg.duration}}</span>
|
||||
@@ -70,7 +70,7 @@
|
||||
<ion-label>{{msg.msg}}</ion-label>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf="msg.file">
|
||||
@@ -88,7 +88,7 @@
|
||||
</div>
|
||||
<div *ngIf="msg.file.type != 'application/img'">
|
||||
<div class="file">
|
||||
<div (click)="docIndex(i); viewDocument(msg.file, file.title_link)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
|
||||
<div (click)="docIndex(i); viewDocument(msg, file.title_link)" 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>
|
||||
@@ -120,7 +120,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <div *ngIf="msg.file">
|
||||
<div *ngIf="msg.file">
|
||||
<div *ngIf="msg.file.type == 'application/meeting'" class="info-meeting">
|
||||
<ion-label class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
|
||||
<button (click)="goToEvent(msg.file.id)" class="btn-no-color info-meeting-normal"><ion-label class="info-meeting-normal">{{msg.file.subject}}</ion-label></button><br />
|
||||
@@ -128,7 +128,7 @@
|
||||
<ion-label class="info-meeting-medium"><ion-icon></ion-icon><ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}</ion-label><br />
|
||||
</div>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ion-fab horizontal="end" vertical="bottom" slot="fixed">
|
||||
|
||||
@@ -19,7 +19,8 @@ import { ChatMessageStore } from 'src/app/store/chat/chat-message.service';
|
||||
import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
|
||||
|
||||
import { Directory, Encoding, FilesystemDirectory } from '@capacitor/filesystem';
|
||||
import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder';
|
||||
import { Haptics, ImpactStyle } from '@capacitor/haptics';
|
||||
import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page';
|
||||
@@ -39,6 +40,10 @@ import { SearchPage } from 'src/app/pages/search/search.page';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
|
||||
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
|
||||
import {Plugins} from '@capacitor/core';
|
||||
|
||||
const { Filesystem } = Plugins;
|
||||
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
|
||||
@@ -352,10 +357,41 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.wsChatMethodsService.getDmRoom(this.roomId).send({})
|
||||
}
|
||||
|
||||
viewDocument(file: any, url?: string) {
|
||||
viewDocument(msg: any, url?: string) {
|
||||
console.log(msg)
|
||||
if (msg.attachments.type == "application/webtrix") {
|
||||
//this.openViewDocumentModal(file);
|
||||
}
|
||||
|
||||
if (file.type == "application/webtrix") {
|
||||
this.openViewDocumentModal(file);
|
||||
if (msg.attachments.type == "application/pdf") {
|
||||
|
||||
try {
|
||||
const writeSecretFile = async () => {
|
||||
await Filesystem.writeFile({
|
||||
path: msg.attachments.name,
|
||||
data: msg.attachments.image_url,
|
||||
directory: Directory.Documents,
|
||||
encoding: Encoding.UTF8,
|
||||
});
|
||||
};
|
||||
|
||||
console.log('WRITE',writeSecretFile);
|
||||
|
||||
const readSecretFile = async () => {
|
||||
const contents = await Filesystem.readFile({
|
||||
path: msg.attachments.name,
|
||||
directory: Directory.Documents,
|
||||
encoding: Encoding.UTF8,
|
||||
});
|
||||
|
||||
console.log('secrets:', contents);
|
||||
};
|
||||
|
||||
console.log('READ',readSecretFile);
|
||||
|
||||
} catch (e) {
|
||||
console.error("Unable to write file", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,7 +409,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
FolderID: '',
|
||||
Subject: file.Assunto,
|
||||
SourceSecFsID: file.ApplicationId,
|
||||
SourceType: 'DOC',
|
||||
SourceType: 'PDF',
|
||||
SourceID: file.DocId,
|
||||
DispatchNumber: ''
|
||||
}
|
||||
@@ -638,30 +674,36 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
|
||||
async addFileToChat(types: typeof FileType[] ) {
|
||||
|
||||
const roomId = this.roomId
|
||||
|
||||
const file: any = await this.fileService.getFileFromDevice(types);
|
||||
console.log('ADDFILECHAT', file)
|
||||
const imageData = await this.fileToBase64Service.convert(file)
|
||||
console.log('ADDFILECHAT', imageData)
|
||||
console.log('Add file', file)
|
||||
/* const imageData = await this.fileToBase64Service.convert(file).then((filee) => {
|
||||
console.log('Add file', filee)
|
||||
}) */
|
||||
const blob = new Blob([file],{type: file.type})
|
||||
console.log('Add file', blob)
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", file);
|
||||
formData.append("blobFile", blob);
|
||||
|
||||
this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"type": file.type,
|
||||
"guid": '',
|
||||
},
|
||||
temporaryData: formData,
|
||||
attachments: [{
|
||||
"title": file.name ,
|
||||
"image_url": imageData,
|
||||
"text": "description",
|
||||
"name": file.name ,
|
||||
// "text": "description",
|
||||
"image_url": file, // rocketchat
|
||||
"title_link_download": false,
|
||||
}]
|
||||
}],
|
||||
temporaryData: formData
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
async openChatOptions(ev?: any) {
|
||||
@@ -847,6 +889,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// async ShareEmail(msg){
|
||||
// // Check if sharing via email is supported
|
||||
// await Share.share({
|
||||
|
||||
Reference in New Issue
Block a user