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;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 88;
|
CURRENT_PROJECT_VERSION = 90;
|
||||||
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
INFOPLIST_FILE = App/Info.plist;
|
INFOPLIST_FILE = App/Info.plist;
|
||||||
@@ -498,7 +498,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 3.8;
|
MARKETING_VERSION = 4.0;
|
||||||
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
@@ -516,7 +516,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 88;
|
CURRENT_PROJECT_VERSION = 90;
|
||||||
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
DEVELOPMENT_TEAM = 94BRNM2LSS;
|
||||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||||
INFOPLIST_FILE = App/Info.plist;
|
INFOPLIST_FILE = App/Info.plist;
|
||||||
@@ -525,7 +525,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 3.8;
|
MARKETING_VERSION = 4.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
PRODUCT_BUNDLE_IDENTIFIER = com.gpr.gabinetedigital.teste;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
|
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).loadHistory({})
|
||||||
this.ChatSystemService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
|
this.ChatSystemService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
|
||||||
this.ChatSystemService.openRoom(this.roomId)
|
this.ChatSystemService.openRoom(this.roomId)
|
||||||
this.ChatSystemService.getDmRoom(this.roomId).setChangeDetector(()=> {
|
this.ChatSystemService.getDmRoom(this.roomId).setChangeDetector(() => {
|
||||||
|
|
||||||
this.changeDetector()
|
this.changeDetector()
|
||||||
})
|
})
|
||||||
@@ -163,7 +163,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
try {
|
try {
|
||||||
// console.log(this.router.url);
|
// console.log(this.router.url);
|
||||||
this.createDirectoryImage()
|
this.createDirectoryImage()
|
||||||
// this.chatService.refreshtoken();
|
// this.chatService.refreshtoken();
|
||||||
this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
|
this.ChatSystemService.getUserOfRoom(this.roomId).then((value) => {
|
||||||
@@ -852,7 +852,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
console.log('add file ')
|
console.log('add file ')
|
||||||
const roomId = this.roomId
|
const roomId = this.roomId
|
||||||
|
|
||||||
if(this.platform.is('ios')) {
|
if (this.platform.is('ios')) {
|
||||||
console.log('ios add file ')
|
console.log('ios add file ')
|
||||||
|
|
||||||
const resultt = await FilePicker.pickFiles({
|
const resultt = await FilePicker.pickFiles({
|
||||||
@@ -861,7 +861,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
readData: true,
|
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)
|
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
|
return
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const file: any = await this.fileService.getFileFromDevice(types);
|
const file: any = await this.fileService.getFileFromDevice(types);
|
||||||
@@ -904,41 +904,41 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
formData.append('blobFile', blob);
|
formData.append('blobFile', blob);
|
||||||
console.log('add file', fileBase64) */
|
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) => {
|
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
})));
|
})));
|
||||||
console.log(encodedData)
|
console.log(encodedData)
|
||||||
const blob = this.fileService.base64toBlob(encodedData, file.type)
|
const blob = this.fileService.base64toBlob(encodedData, file.type)
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('blobFile', blob);
|
formData.append('blobFile', blob);
|
||||||
/* console.log('add file', fileBase64) */
|
/* console.log('add file', fileBase64) */
|
||||||
|
|
||||||
this.ChatSystemService.getDmRoom(roomId).send({
|
this.ChatSystemService.getDmRoom(roomId).send({
|
||||||
file: {
|
file: {
|
||||||
"type": file.type,
|
"type": file.type,
|
||||||
"guid": '',
|
"guid": '',
|
||||||
},
|
},
|
||||||
attachments: [{
|
attachments: [{
|
||||||
"title": sanitize(fileName),
|
"title": sanitize(fileName),
|
||||||
"name": sanitize(fileName),
|
"name": sanitize(fileName),
|
||||||
// "text": "description",
|
// "text": "description",
|
||||||
"title_link_download": false,
|
"title_link_download": false,
|
||||||
}],
|
}],
|
||||||
temporaryData: formData,
|
temporaryData: formData,
|
||||||
attachmentsModelData: {
|
attachmentsModelData: {
|
||||||
fileBase64: encodedData,
|
fileBase64: encodedData,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.toastService._badRequest("Ficheiro inválido")
|
this.toastService._badRequest("Ficheiro inválido")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1105,7 +1105,26 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
return blob;
|
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) {
|
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 = ''
|
let pathFile = ''
|
||||||
const fileName = filename
|
const fileName = filename
|
||||||
if (this.platform.is('ios')) {
|
if (this.platform.is('ios')) {
|
||||||
@@ -1114,13 +1133,17 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
pathFile = this.file.externalRootDirectory
|
pathFile = this.file.externalRootDirectory
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('file data', pdfString)
|
||||||
console.log(pathFile)
|
console.log(pathFile)
|
||||||
|
|
||||||
|
let removePre = this.removeTextBeforeSlash(pdfString,',')
|
||||||
|
console.log('file data remove ', removePre)
|
||||||
|
|
||||||
await Filesystem.writeFile({
|
await Filesystem.writeFile({
|
||||||
path: fileName,
|
path: fileName,
|
||||||
data: pdfString,
|
data: removePre,
|
||||||
directory: Directory.Cache,
|
directory: Directory.Cache,
|
||||||
encoding: Encoding.UTF8,
|
encoding: Encoding.UTF8
|
||||||
}).then((dir) => {
|
}).then((dir) => {
|
||||||
console.log('DIR ', dir)
|
console.log('DIR ', dir)
|
||||||
this.fileOpener
|
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 {
|
downloadFileFromBrowser(fileName: string, data: any): void {
|
||||||
const linkSource = data;
|
const linkSource = data;
|
||||||
const downloadLink = document.createElement("a");
|
const downloadLink = document.createElement("a");
|
||||||
@@ -1293,9 +1325,9 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
for (let i = 0; i < byteString.length; i++) {
|
for (let i = 0; i < byteString.length; i++) {
|
||||||
int8Array[i] = byteString.charCodeAt(i);
|
int8Array[i] = byteString.charCodeAt(i);
|
||||||
}
|
}
|
||||||
const blob = new Blob([int8Array], { type: 'application/pdf' });
|
const blob = new Blob([int8Array], { type: 'application/pdf' });
|
||||||
return blob;
|
return blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -456,9 +456,12 @@ export class MessageService {
|
|||||||
if (this.file.type == "application/img") {
|
if (this.file.type == "application/img") {
|
||||||
downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||||
} else if (this.file.type != "application/img") {
|
} else if (this.file.type != "application/img") {
|
||||||
|
|
||||||
downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), '');
|
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('downloaded file', downloadFile)
|
||||||
|
console.log('event body downloaded file', event.body)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user