mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
save
This commit is contained in:
@@ -300,15 +300,25 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
}
|
||||
|
||||
startRecording() {
|
||||
console.log('Recording');
|
||||
|
||||
if (this.recording) {
|
||||
return;
|
||||
async startRecording() {
|
||||
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;
|
||||
}
|
||||
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!');
|
||||
}
|
||||
this.recording = true;
|
||||
VoiceRecorder.startRecording();
|
||||
this.calculateDuration();
|
||||
}
|
||||
|
||||
|
||||
@@ -1076,14 +1086,14 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
} else {
|
||||
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
|
||||
this.downloadFileMsg(msg)
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
var str = msg.attachments[0].image_url;
|
||||
str = str.substring(1, ((str.length) - 1));
|
||||
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
|
||||
|
||||
this.downloadFileFromBrowser(msg.attachments[0].name, str)
|
||||
/* const modal = await this.modalController.create({
|
||||
component: ViewMediaPage,
|
||||
@@ -1096,7 +1106,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
});
|
||||
modal.present(); */
|
||||
|
||||
|
||||
} else {
|
||||
this.openFile(str, msg.attachments[0].name);
|
||||
}
|
||||
|
||||
@@ -237,17 +237,25 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
}
|
||||
|
||||
startRecording() {
|
||||
console.log('Recording');
|
||||
|
||||
if (this.recording) {
|
||||
return;
|
||||
async startRecording() {
|
||||
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;
|
||||
}
|
||||
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!');
|
||||
}
|
||||
this.recording = true;
|
||||
VoiceRecorder.startRecording()
|
||||
.then((result: GenericResponse) => console.log(result.value))
|
||||
.catch(error => console.log(error));
|
||||
this.calculateDuration();
|
||||
}
|
||||
|
||||
stopRecording() {
|
||||
@@ -990,13 +998,13 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
|
||||
this.downloadFileMsg(msg)
|
||||
//this.testDownlod(msg)
|
||||
|
||||
|
||||
} else {
|
||||
var str = msg.attachments[0].image_url;
|
||||
str = str.substring(1, ((str.length) - 1));
|
||||
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
|
||||
|
||||
this.downloadFileFromBrowser(msg.attachments[0].name, str)
|
||||
/* const modal = await this.modalController.create({
|
||||
component: ViewMediaPage,
|
||||
@@ -1009,11 +1017,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
});
|
||||
modal.present(); */
|
||||
|
||||
|
||||
} else {
|
||||
this.openFile(str, msg.attachments[0].name, msg.file.type);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -282,14 +282,25 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
});
|
||||
}
|
||||
|
||||
startRecording() {
|
||||
|
||||
if (this.recording) {
|
||||
return;
|
||||
async startRecording() {
|
||||
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;
|
||||
}
|
||||
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!');
|
||||
}
|
||||
this.recording = true;
|
||||
VoiceRecorder.startRecording();
|
||||
this.calculateDuration();
|
||||
}
|
||||
|
||||
stopRecording() {
|
||||
@@ -1021,42 +1032,42 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
|
||||
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
|
||||
this.downloadFileMsg(msg)
|
||||
|
||||
|
||||
|
||||
|
||||
/* } else if (msg.file.type === "application/pdf") {
|
||||
|
||||
|
||||
|
||||
|
||||
console.log(str);
|
||||
const win = window.open("", "_blank");
|
||||
let html = '';
|
||||
|
||||
|
||||
html += '<html>';
|
||||
html += '<body style="margin:0!important">';
|
||||
html += '<iframe width="100%" height="100%" src="' + str + '" type="application/pdf" />';
|
||||
html += '</body>';
|
||||
html += '</html>';
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
win.document.write(html);
|
||||
}, 0); */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//this.viewDocument(msg, msg.attachments.image_url)
|
||||
} else {
|
||||
|
||||
|
||||
var str = msg.attachments[0].image_url;
|
||||
str = str.substring(1, ((str.length) - 1));
|
||||
|
||||
|
||||
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||
this.downloadFileFromBrowser(msg.attachments[0].name, str)
|
||||
} else if (this.platform.is('tablet')) {
|
||||
this.openFile(str, msg.attachments[0].name, msg.file.type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user