mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
direct message
This commit is contained in:
@@ -47,7 +47,8 @@ import { RoomType } from "src/app/module/chat/domain/entity/group";
|
||||
import { RoomTable } from 'src/app/module/chat/infra/database/dexie/schema/room';
|
||||
import { Logger } from 'src/app/services/logger/main/service';
|
||||
import { tap } from 'rxjs/operators';
|
||||
|
||||
import { AlertController } from '@ionic/angular';
|
||||
import { ViewOncesImagePage, ViewOncesImagePageInput } from '../../modal/view-onces/view-onces.page';
|
||||
|
||||
@Component({
|
||||
selector: 'app-messages',
|
||||
@@ -99,7 +100,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
duration = 0;
|
||||
|
||||
audioPermissionStatus: 'granted' | 'denied' | 'prompt' | null = null
|
||||
sessionStore = SessionStore
|
||||
SessionStore = SessionStore
|
||||
audioPlay: Howl = null;
|
||||
isPlaying = false;
|
||||
audioProgress = 0;
|
||||
@@ -168,6 +169,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
private userTypingLocalRepository: UserTypingLocalRepository,
|
||||
private UserTypingRemoteRepositoryService: UserTypingRemoteRepositoryService,
|
||||
private messageLocalDataSourceService: MessageLocalDataSourceService,
|
||||
private alertController: AlertController
|
||||
) {
|
||||
// update
|
||||
this.checkAudioPermission()
|
||||
@@ -279,6 +281,22 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
async onImageError() {}
|
||||
|
||||
async viewOnce(event: Event, message: MessageEntity, index:number) {
|
||||
const params: ViewOncesImagePageInput = {
|
||||
imageDataUrl: message.attachments[index].safeFile as any,
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewOncesImagePage,
|
||||
cssClass: '',
|
||||
componentProps: params
|
||||
});
|
||||
|
||||
modal.present()
|
||||
|
||||
return modal.onDidDismiss().then((res) => {
|
||||
this.messageDelete(message)
|
||||
});
|
||||
}
|
||||
|
||||
sendReadMessage() {
|
||||
|
||||
@@ -828,6 +846,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
async takePictureMobile() {
|
||||
|
||||
const oneShot = await this.askIfOneShot()
|
||||
|
||||
const picture = await this.CameraService.takePicture({
|
||||
cameraResultType: CameraResultType.DataUrl,
|
||||
quality: 90
|
||||
@@ -847,6 +867,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
const message = new MessageEntity();
|
||||
message.roomId = this.roomId
|
||||
message.oneShot = oneShot
|
||||
|
||||
message.sender = {
|
||||
userPhoto: '',
|
||||
@@ -934,8 +955,43 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
|
||||
|
||||
askIfOneShot(): Promise<boolean> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const alert = await this.alertController.create({
|
||||
header: 'Confirm',
|
||||
message: 'Visualização unica?',
|
||||
buttons: [
|
||||
{
|
||||
text: 'não',
|
||||
role: 'cancel',
|
||||
handler: () => {
|
||||
resolve(false)
|
||||
console.log('User clicked No');
|
||||
// Handle No action here
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Sim',
|
||||
handler: () => {
|
||||
console.log('User clicked Yes');
|
||||
resolve(true)
|
||||
// Handle Yes action here
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
await alert.present();
|
||||
})
|
||||
}
|
||||
|
||||
async pickPicture() {
|
||||
|
||||
const oneShot = await this.askIfOneShot()
|
||||
|
||||
const file = await this.FilePickerService.getPicture({
|
||||
cameraResultType: CameraResultType.Base64
|
||||
})
|
||||
@@ -958,6 +1014,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
message.roomId = this.roomId
|
||||
|
||||
message.sentAt = new Date().toISOString()
|
||||
message.oneShot = oneShot
|
||||
|
||||
message.sender = {
|
||||
userPhoto: '',
|
||||
|
||||
Reference in New Issue
Block a user