mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
merge with developer_prod
This commit is contained in:
@@ -30,7 +30,7 @@ import { File } from '@awesome-cordova-plugins/file/ngx';
|
|||||||
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
|
||||||
import { SessionStore } from 'src/app/store/session.service';
|
import { SessionStore } from 'src/app/store/session.service';
|
||||||
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
|
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
|
||||||
|
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-group-messages',
|
selector: 'app-group-messages',
|
||||||
templateUrl: './group-messages.page.html',
|
templateUrl: './group-messages.page.html',
|
||||||
@@ -474,7 +474,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
if (recordData?.value?.recordDataBase64.includes('data:audio')) {
|
if (recordData?.value?.recordDataBase64.includes('data:audio')) {
|
||||||
this.audioRecorded = recordData?.value?.recordDataBase64;
|
this.audioRecorded = recordData?.value?.recordDataBase64;
|
||||||
}
|
}
|
||||||
else if(recordData?.value?.mimeType && recordData?.value?.recordDataBase64){
|
else if (recordData?.value?.mimeType && recordData?.value?.recordDataBase64) {
|
||||||
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
|
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,7 +498,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}],
|
}],
|
||||||
temporaryData: formData,
|
temporaryData: formData,
|
||||||
attachmentsModelData: {
|
attachmentsModelData: {
|
||||||
fileBase64: await this.fileService.blobToBase64(blob),
|
fileBase64: encodedData,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -640,12 +640,18 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
async takePicture() {
|
async takePicture() {
|
||||||
const roomId = this.roomId
|
const roomId = this.roomId
|
||||||
|
|
||||||
const image = await this.CameraService.takePicture();
|
const file = await Camera.getPhoto({
|
||||||
await this.fileService.saveImage(image)
|
quality: 90,
|
||||||
const lastphoto: any = await this.fileService.loadFiles();
|
// allowEditing: true,
|
||||||
const { capturedImage, capturedImageTitle } = await this.fileService.loadFileData(lastphoto);
|
resultType: CameraResultType.Base64,
|
||||||
const base64 = await fetch(capturedImage);
|
source: CameraSource.Camera
|
||||||
const blob = await base64.blob();
|
});
|
||||||
|
|
||||||
|
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String
|
||||||
|
const blob = this.dataURItoBlob(imageBase64)
|
||||||
|
|
||||||
|
console.log(imageBase64)
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("blobFile", blob);
|
formData.append("blobFile", blob);
|
||||||
|
|
||||||
@@ -654,14 +660,14 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
"type": "application/img",
|
"type": "application/img",
|
||||||
"guid": ''
|
"guid": ''
|
||||||
},
|
},
|
||||||
temporaryData: formData,
|
|
||||||
attachments: [{
|
attachments: [{
|
||||||
"title": capturedImageTitle,
|
"title": "file.jpg",
|
||||||
"text": "description",
|
"text": "description",
|
||||||
"title_link_download": false,
|
"title_link_download": false,
|
||||||
}],
|
}],
|
||||||
|
temporaryData: formData,
|
||||||
attachmentsModelData: {
|
attachmentsModelData: {
|
||||||
fileBase64: await this.fileService.blobToBase64(blob),
|
fileBase64: imageBase64,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -675,6 +681,51 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.addFileToChat(['.doc', '.docx', '.pdf'])
|
this.addFileToChat(['.doc', '.docx', '.pdf'])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async addImageMobile() {
|
||||||
|
this.addFileToChatMobile(['image/apng', 'image/jpeg', 'image/png'])
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async addFileToChatMobile(types: typeof FileType[]) {
|
||||||
|
const roomId = this.roomId
|
||||||
|
|
||||||
|
const file = await Camera.getPhoto({
|
||||||
|
quality: 90,
|
||||||
|
// allowEditing: true,
|
||||||
|
resultType: CameraResultType.Base64,
|
||||||
|
source: CameraSource.Photos
|
||||||
|
});
|
||||||
|
|
||||||
|
//const imageData = await this.fileToBase64Service.convert(file)
|
||||||
|
//
|
||||||
|
|
||||||
|
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String
|
||||||
|
const response = await fetch(imageBase64);
|
||||||
|
const blob = await response.blob();
|
||||||
|
|
||||||
|
console.log(imageBase64)
|
||||||
|
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("blobFile", blob);
|
||||||
|
|
||||||
|
this.ChatSystemService.getGroupRoom(roomId).send({
|
||||||
|
file: {
|
||||||
|
"type": "application/img",
|
||||||
|
"guid": ''
|
||||||
|
},
|
||||||
|
temporaryData: formData,
|
||||||
|
attachments: [{
|
||||||
|
"title": file.path,
|
||||||
|
"text": "description",
|
||||||
|
"title_link_download": false,
|
||||||
|
}],
|
||||||
|
attachmentsModelData: {
|
||||||
|
fileBase64: imageBase64,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
async addFileWebtrix() {
|
async addFileWebtrix() {
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: SearchPage,
|
component: SearchPage,
|
||||||
@@ -719,6 +770,19 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_getBase64(file) {
|
||||||
|
return new Promise((resolve, reject)=>{
|
||||||
|
var reader = new FileReader();
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
reader.onload = function () {
|
||||||
|
resolve(reader.result)
|
||||||
|
};
|
||||||
|
reader.onerror = function (error) {
|
||||||
|
console.log('Error: ', error);
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
async addFileToChat(types: typeof FileType[]) {
|
async addFileToChat(types: typeof FileType[]) {
|
||||||
|
|
||||||
const roomId = this.roomId
|
const roomId = this.roomId
|
||||||
@@ -734,6 +798,9 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
})));
|
})));
|
||||||
const blob = this.fileService.base64toBlob(encodedData, file.type)
|
const blob = this.fileService.base64toBlob(encodedData, file.type)
|
||||||
|
|
||||||
|
|
||||||
|
const fileBase64 = await this._getBase64(file)
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('blobFile', blob);
|
formData.append('blobFile', blob);
|
||||||
|
|
||||||
@@ -751,7 +818,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}],
|
}],
|
||||||
temporaryData: formData,
|
temporaryData: formData,
|
||||||
attachmentsModelData: {
|
attachmentsModelData: {
|
||||||
fileBase64: await this.fileService.blobToBase64(blob),
|
fileBase64: fileBase64
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -806,7 +873,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.takePicture()
|
this.takePicture()
|
||||||
}
|
}
|
||||||
else if (res['data'] == 'add-picture') {
|
else if (res['data'] == 'add-picture') {
|
||||||
this.addImage()
|
this.addImageMobile()
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (res['data'] == 'add-document') {
|
else if (res['data'] == 'add-document') {
|
||||||
@@ -1090,5 +1157,31 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
this.downloadFileMsg(msg)
|
this.downloadFileMsg(msg)
|
||||||
} else { }
|
} else { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dataURItoBlob(dataURI) {
|
||||||
|
// convert base64 to raw binary data held in a string
|
||||||
|
// doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
|
||||||
|
var byteString = atob(dataURI.split(',')[1]);
|
||||||
|
|
||||||
|
// separate out the mime component
|
||||||
|
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]
|
||||||
|
|
||||||
|
// write the bytes of the string to an ArrayBuffer
|
||||||
|
var ab = new ArrayBuffer(byteString.length);
|
||||||
|
|
||||||
|
// create a view into the buffer
|
||||||
|
var ia = new Uint8Array(ab);
|
||||||
|
|
||||||
|
// set the bytes of the buffer to the correct values
|
||||||
|
for (var i = 0; i < byteString.length; i++) {
|
||||||
|
ia[i] = byteString.charCodeAt(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// write the ArrayBuffer to a blob, and you're done
|
||||||
|
var blob = new Blob([ab], {type: mimeString});
|
||||||
|
return blob;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -781,6 +781,20 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
return zoneOriginalInstance || fileReader;
|
return zoneOriginalInstance || fileReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_getBase64(file) {
|
||||||
|
return new Promise((resolve, reject)=>{
|
||||||
|
var reader = new FileReader();
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
reader.onload = function () {
|
||||||
|
resolve(reader.result)
|
||||||
|
};
|
||||||
|
reader.onerror = function (error) {
|
||||||
|
console.log('Error: ', error);
|
||||||
|
};
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
async addFileToChat(types: typeof FileType[]) {
|
async addFileToChat(types: typeof FileType[]) {
|
||||||
|
|
||||||
const roomId = this.roomId
|
const roomId = this.roomId
|
||||||
@@ -796,11 +810,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
})));
|
})));
|
||||||
const blob = this.fileService.base64toBlob(encodedData, file.type)
|
const blob = this.fileService.base64toBlob(encodedData, file.type)
|
||||||
|
|
||||||
|
const fileBase64 = await this._getBase64(file)
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('blobFile', blob);
|
formData.append('blobFile', blob);
|
||||||
|
|
||||||
|
|
||||||
this.ChatSystemService.getDmRoom(roomId).send({
|
this.ChatSystemService.getDmRoom(roomId).send({
|
||||||
file: {
|
file: {
|
||||||
"type": file.type,
|
"type": file.type,
|
||||||
@@ -814,7 +828,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
}],
|
}],
|
||||||
temporaryData: formData,
|
temporaryData: formData,
|
||||||
attachmentsModelData: {
|
attachmentsModelData: {
|
||||||
fileBase64: await this.fileService.blobToBase64(blob),
|
fileBase64: fileBase64,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
export let versionData = {
|
export let versionData = {
|
||||||
"shortSHA": "fc83f1dd5",
|
"shortSHA": "471d05653",
|
||||||
"SHA": "fc83f1dd5cb04722615efe6a93480b83142920f1",
|
"SHA": "471d05653d40a9c316a6bdcbdce15d9e552d25c0",
|
||||||
"branch": "developer",
|
"branch": "developer",
|
||||||
"lastCommitAuthor": "'Eudes Inácio'",
|
"lastCommitAuthor": "'Eudes Inácio'",
|
||||||
"lastCommitTime": "'Fri Aug 18 12:48:54 2023 +0100'",
|
"lastCommitTime": "'Fri Aug 18 20:27:37 2023 +0100'",
|
||||||
"lastCommitMessage": "remove save racunho button and cancelar",
|
"lastCommitMessage": "users picture added",
|
||||||
"lastCommitNumber": "5170",
|
"lastCommitNumber": "5171",
|
||||||
"change": "",
|
"change": "",
|
||||||
"changeStatus": "On branch developer\nYour branch is ahead of 'origin/developer' by 1 commit.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tnew file: src/assets/images/md.webp\n\tnew file: src/assets/images/presidente.jpeg\n\tnew file: src/assets/images/sg.jpeg",
|
"changeStatus": "On branch developer\nYour branch and 'origin/developer' have diverged,\nand have 2 and 5 different commits each, respectively.\n (use \"git pull\" to merge the remote branch into yours)\n\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/app/pages/chat/group-messages/group-messages.page.ts\n\tmodified: src/app/pages/chat/messages/messages.page.ts",
|
||||||
"changeAuthor": "eudes.inacio"
|
"changeAuthor": "eudes.inacio"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user