diff --git a/src/app/pages/chat/messages/messages.page.html b/src/app/pages/chat/messages/messages.page.html index cf18ead3b..452809c49 100644 --- a/src/app/pages/chat/messages/messages.page.html +++ b/src/app/pages/chat/messages/messages.page.html @@ -175,21 +175,22 @@ - - {{audio}} - - - - + +
diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index 60dc2074d..05cd38bb7 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -44,9 +44,6 @@ import { Camera, CameraResultType, CameraSource } from '@capacitor/camera'; const { Filesystem } = Plugins; */ - -const IMAGE_DIR = 'stored-images'; - @Component({ selector: 'app-messages', templateUrl: './messages.page.html', @@ -87,6 +84,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { recording = false; storedFileNames = []; + lastAudioRecorded = ''; durationDisplay = ''; duration = 0; @ViewChild('recordbtn', { read: ElementRef }) recordBtn: ElementRef; @@ -143,15 +141,14 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { this.wsChatMethodsService.getUserOfRoom(this.roomId).then((value) => { console.log('MEMBER', value) }) - this.loadFiles(); VoiceRecorder.requestAudioRecordingPermission(); this.getChatMembers(); - Filesystem.mkdir({ + /* Filesystem.mkdir({ path: IMAGE_DIR, directory: Directory.Data, recursive: true - }); + }); */ } ngAfterViewInit() { @@ -170,6 +167,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { onEnd: ev => { Haptics.impact({ style: ImpactStyle.Light }) this.stopRecording(); + setTimeout(() => { + this.loadFiles(); + }, 500); } }, true); longpress.enable(); @@ -197,10 +197,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { directory: Directory.Data }).then(result => { console.log(result); - this.storedFileNames = result.files; - /* const temp: any[] = result.files.reverse(); - this.storedFileNames = temp[0]; - console.log(this.storedFileNames); */ + this.storedFileNames = result.files.reverse(); + this.lastAudioRecorded = this.storedFileNames[0]; }) } @@ -234,7 +232,15 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { }) } }) + } + async deleteRecording(fileName){ + await Filesystem.deleteFile({ + directory: Directory.Data, + path: fileName + }); + this.lastAudioRecorded = ''; + this.loadFiles(); } async playFile(fileName?: any) {