mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
some changes
This commit is contained in:
@@ -489,7 +489,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 88;
|
||||
CURRENT_PROJECT_VERSION = 90;
|
||||
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
INFOPLIST_FILE = App/Info.plist;
|
||||
@@ -498,7 +498,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 3.8;
|
||||
MARKETING_VERSION = 4.0;
|
||||
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
@@ -516,7 +516,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 88;
|
||||
CURRENT_PROJECT_VERSION = 90;
|
||||
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
INFOPLIST_FILE = App/Info.plist;
|
||||
@@ -525,7 +525,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 3.8;
|
||||
MARKETING_VERSION = 4.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
|
||||
|
||||
@@ -143,7 +143,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.ChatSystemService.getDmRoom(this.roomId).loadHistory({})
|
||||
this.ChatSystemService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
|
||||
this.ChatSystemService.openRoom(this.roomId)
|
||||
this.ChatSystemService.getDmRoom(this.roomId).setChangeDetector(()=> {
|
||||
this.ChatSystemService.getDmRoom(this.roomId).setChangeDetector(() => {
|
||||
|
||||
this.changeDetector()
|
||||
})
|
||||
@@ -163,7 +163,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
ngOnInit() {
|
||||
try {
|
||||
// console.log(this.router.url);
|
||||
// console.log(this.router.url);
|
||||
this.createDirectoryImage()
|
||||
// this.chatService.refreshtoken();
|
||||
this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
|
||||
@@ -852,7 +852,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
console.log('add file ')
|
||||
const roomId = this.roomId
|
||||
|
||||
if(this.platform.is('ios')) {
|
||||
if (this.platform.is('ios')) {
|
||||
console.log('ios add file ')
|
||||
|
||||
const resultt = await FilePicker.pickFiles({
|
||||
@@ -861,7 +861,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
readData: true,
|
||||
});
|
||||
|
||||
console.log('RESULT', resultt.files[0])
|
||||
console.log('RESULT', resultt.files[0].data)
|
||||
|
||||
const blobb = this.fileService.base64toBlob(resultt.files[0].data, resultt.files[0].mimeType)
|
||||
|
||||
@@ -886,7 +886,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
})
|
||||
return
|
||||
|
||||
|
||||
}
|
||||
|
||||
const file: any = await this.fileService.getFileFromDevice(types);
|
||||
@@ -904,41 +904,41 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
formData.append('blobFile', blob);
|
||||
console.log('add file', fileBase64) */
|
||||
|
||||
const fileName = file.name
|
||||
const fileName = file.name
|
||||
|
||||
const validation = this.FileValidatorService.fileNameValidation(fileName)
|
||||
const validation = this.FileValidatorService.fileNameValidation(fileName)
|
||||
|
||||
if(validation.isOk) {
|
||||
if (validation.isOk) {
|
||||
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => {
|
||||
console.error(error);
|
||||
})));
|
||||
console.log(encodedData)
|
||||
const blob = this.fileService.base64toBlob(encodedData, file.type)
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => {
|
||||
console.error(error);
|
||||
})));
|
||||
console.log(encodedData)
|
||||
const blob = this.fileService.base64toBlob(encodedData, file.type)
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('blobFile', blob);
|
||||
/* console.log('add file', fileBase64) */
|
||||
const formData = new FormData();
|
||||
formData.append('blobFile', blob);
|
||||
/* console.log('add file', fileBase64) */
|
||||
|
||||
this.ChatSystemService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
"type": file.type,
|
||||
"guid": '',
|
||||
},
|
||||
attachments: [{
|
||||
"title": sanitize(fileName),
|
||||
"name": sanitize(fileName),
|
||||
// "text": "description",
|
||||
"title_link_download": false,
|
||||
}],
|
||||
temporaryData: formData,
|
||||
attachmentsModelData: {
|
||||
fileBase64: encodedData,
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.toastService._badRequest("Ficheiro inválido")
|
||||
}
|
||||
this.ChatSystemService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
"type": file.type,
|
||||
"guid": '',
|
||||
},
|
||||
attachments: [{
|
||||
"title": sanitize(fileName),
|
||||
"name": sanitize(fileName),
|
||||
// "text": "description",
|
||||
"title_link_download": false,
|
||||
}],
|
||||
temporaryData: formData,
|
||||
attachmentsModelData: {
|
||||
fileBase64: encodedData,
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.toastService._badRequest("Ficheiro inválido")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1105,7 +1105,26 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
return blob;
|
||||
}
|
||||
|
||||
blobToBase64(blob) {
|
||||
return new Promise((resolve, _) => {
|
||||
const reader = new FileReader();
|
||||
reader.onloadend = () => resolve(reader.result);
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
}
|
||||
|
||||
async openFile(pdfString, filename, type) {
|
||||
|
||||
var blob = new Blob([pdfString], { type: 'application/pdf' });
|
||||
|
||||
console.log('blob blob', blob)
|
||||
|
||||
this.blobToBase64(blob).then((value) => {
|
||||
console.log(value)
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
let pathFile = ''
|
||||
const fileName = filename
|
||||
if (this.platform.is('ios')) {
|
||||
@@ -1114,13 +1133,17 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
pathFile = this.file.externalRootDirectory
|
||||
}
|
||||
|
||||
console.log('file data', pdfString)
|
||||
console.log(pathFile)
|
||||
|
||||
let removePre = this.removeTextBeforeSlash(pdfString,',')
|
||||
console.log('file data remove ', removePre)
|
||||
|
||||
await Filesystem.writeFile({
|
||||
path: fileName,
|
||||
data: pdfString,
|
||||
data: removePre,
|
||||
directory: Directory.Cache,
|
||||
encoding: Encoding.UTF8,
|
||||
encoding: Encoding.UTF8
|
||||
}).then((dir) => {
|
||||
console.log('DIR ', dir)
|
||||
this.fileOpener
|
||||
@@ -1132,6 +1155,15 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
removeTextBeforeSlash(inputString, controlString) {
|
||||
if (inputString.includes(controlString)) {
|
||||
const parts = inputString.split(controlString);
|
||||
return parts.length > 1 ? parts[1] : inputString;
|
||||
} else {
|
||||
return inputString;
|
||||
}
|
||||
}
|
||||
|
||||
downloadFileFromBrowser(fileName: string, data: any): void {
|
||||
const linkSource = data;
|
||||
const downloadLink = document.createElement("a");
|
||||
@@ -1293,9 +1325,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
for (let i = 0; i < byteString.length; i++) {
|
||||
int8Array[i] = byteString.charCodeAt(i);
|
||||
}
|
||||
const blob = new Blob([int8Array], { type: 'application/pdf' });
|
||||
const blob = new Blob([int8Array], { type: 'application/pdf' });
|
||||
return blob;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -456,9 +456,12 @@ export class MessageService {
|
||||
if (this.file.type == "application/img") {
|
||||
downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||
} else if (this.file.type != "application/img") {
|
||||
|
||||
downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
|
||||
/*
|
||||
let */
|
||||
/* downloadFile = btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '')); */
|
||||
console.log('downloaded file', downloadFile)
|
||||
console.log('event body downloaded file', event.body)
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user