mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
header page footer
This commit is contained in:
@@ -300,49 +300,25 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
|
||||
}
|
||||
|
||||
async checkAudioPermission() {
|
||||
const permissionStatus = await navigator.permissions.query({ name: 'microphone' } as any)
|
||||
|
||||
console.log('permission', permissionStatus.state); // granted, denied, prompt
|
||||
|
||||
this.audioPermissionStatus = permissionStatus.state
|
||||
|
||||
permissionStatus.onchange = (data : any) => {
|
||||
// console.log("Permission changed to " + data.state);
|
||||
// console.log('permission', permissionStatus.state); // granted, denied, prompt
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async startRecording() {
|
||||
|
||||
await this.checkAudioPermission();
|
||||
|
||||
if(this.audioPermissionStatus == 'granted') {
|
||||
if (this.recording) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.recording = true;
|
||||
VoiceRecorder.startRecording();
|
||||
this.calculateDuration();
|
||||
} else {
|
||||
|
||||
const alertPopup = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Necessita de permissão para gravar áudio',
|
||||
buttons: [{
|
||||
text: 'Ok',
|
||||
handler: () => {
|
||||
|
||||
if(await VoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) =>{return result.value})){
|
||||
if(await VoiceRecorder.requestAudioRecordingPermission().then((result: GenericResponse) => {return result.value})){
|
||||
//if(await this.hasAudioRecordingPermission()){
|
||||
if (this.recording) {
|
||||
return;
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
await alertPopup.present();
|
||||
|
||||
this.recording = true;
|
||||
VoiceRecorder.startRecording();
|
||||
this.calculateDuration();
|
||||
//}
|
||||
}
|
||||
else{
|
||||
this.toastService._badRequest('Para gravar uma mensagem de voz, permita o acesso do Gabinete Digital ao seu microfone.');
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.toastService._badRequest('Este dispositivo não tem capacidade para gravação de áudio!');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
stopRecording() {
|
||||
@@ -924,7 +900,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
|
||||
this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
this.wsChatMethodsService.getGroupRoom(roomId).send({
|
||||
file: {
|
||||
"type": file.type,
|
||||
"guid": '',
|
||||
|
||||
Reference in New Issue
Block a user