mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
improve
This commit is contained in:
@@ -17,13 +17,20 @@
|
||||
|
||||
|
||||
var data= [
|
||||
{a:{aa:10},b:{bb:2}},
|
||||
{a:{aa:10},b:{bb:2}},
|
||||
{a:{aa:2},b:{bb:2}},
|
||||
{a:{aa:3},b:{bb:3}}
|
||||
{ a:{aa:10}, b:{bb:2} },
|
||||
{ a:{aa:10}, b:{bb:2} },
|
||||
{ a:{aa:2} , b:{bb:2} },
|
||||
{ a:{aa:3} , b:{bb:3} }
|
||||
]
|
||||
|
||||
var res = alasql('SELECT a, b FROM ? WHERE b->bb = 2',[data]);
|
||||
|
||||
function db(table, sql) {
|
||||
const data = indexedDB.gettable(table)
|
||||
return alasql(sql, [data]);
|
||||
}
|
||||
|
||||
|
||||
var res = alasql('SELECT a, b FROM ? WHERE b->bb = 2',[ data ]);
|
||||
|
||||
|
||||
console.log(res)
|
||||
|
||||
Generated
+170
-2
@@ -5312,6 +5312,15 @@
|
||||
"regex-parser": "^2.2.11"
|
||||
}
|
||||
},
|
||||
"adler-32": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.2.0.tgz",
|
||||
"integrity": "sha1-aj5r8KY5ALoVZSgIyxXGgT0aXyU=",
|
||||
"requires": {
|
||||
"exit-on-epipe": "~1.0.1",
|
||||
"printj": "~1.1.0"
|
||||
}
|
||||
},
|
||||
"adm-zip": {
|
||||
"version": "0.4.16",
|
||||
"resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz",
|
||||
@@ -5388,6 +5397,35 @@
|
||||
"integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==",
|
||||
"dev": true
|
||||
},
|
||||
"alasql": {
|
||||
"version": "1.7.3",
|
||||
"resolved": "https://registry.npmjs.org/alasql/-/alasql-1.7.3.tgz",
|
||||
"integrity": "sha512-YaMgHfoR4f7n05NXFVgD+WgmlNKlP4BGZpXSkJCYtniioK7DMJUoN6ZZmUpM0LAavPLXxHM+V+4gM+M/82sIoQ==",
|
||||
"requires": {
|
||||
"dom-storage": "^2.1.0",
|
||||
"es6-promise": "^4.2.6",
|
||||
"lodash": "4.17.21",
|
||||
"request": "2.88.2",
|
||||
"xlsx": "0.17.0",
|
||||
"yargs": "16.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"yargs": {
|
||||
"version": "16.2.0",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
|
||||
"integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
|
||||
"requires": {
|
||||
"cliui": "^7.0.2",
|
||||
"escalade": "^3.1.1",
|
||||
"get-caller-file": "^2.0.5",
|
||||
"require-directory": "^2.1.1",
|
||||
"string-width": "^4.2.0",
|
||||
"y18n": "^5.0.5",
|
||||
"yargs-parser": "^20.2.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"alphanum-sort": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz",
|
||||
@@ -6849,6 +6887,38 @@
|
||||
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
|
||||
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
|
||||
},
|
||||
"cfb": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.1.tgz",
|
||||
"integrity": "sha512-wT2ScPAFGSVy7CY+aauMezZBnNrfnaLSrxHUHdea+Td/86vrk6ZquggV+ssBR88zNs0OnBkL2+lf9q0K+zVGzQ==",
|
||||
"requires": {
|
||||
"adler-32": "~1.3.0",
|
||||
"crc-32": "~1.2.0",
|
||||
"printj": "~1.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"adler-32": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.0.tgz",
|
||||
"integrity": "sha512-f5nltvjl+PRUh6YNfUstRaXwJxtfnKEWhAWWlmKvh+Y3J2+98a0KKVYDEhz6NdKGqswLhjNGznxfSsZGOvOd9g==",
|
||||
"requires": {
|
||||
"printj": "~1.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"printj": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/printj/-/printj-1.2.3.tgz",
|
||||
"integrity": "sha512-sanczS6xOJOg7IKDvi4sGOUOe7c1tsEzjwlLFH/zgwx/uyImVM9/rgBkc8AfiQa/Vg54nRd8mkm9yI7WV/O+WA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"printj": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/printj/-/printj-1.3.1.tgz",
|
||||
"integrity": "sha512-GA3TdL8szPK4AQ2YnOe/b+Y1jUFwmmGMMK/qbY7VcE3Z7FU8JstbKiKRzO6CIiAKPhTO8m01NoQ0V5f3jc4OGg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"chalk": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||
@@ -7158,6 +7228,22 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"codepage": {
|
||||
"version": "1.14.0",
|
||||
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.14.0.tgz",
|
||||
"integrity": "sha1-jL4lSBMjVZ19MHVxsP/5HnodL5k=",
|
||||
"requires": {
|
||||
"commander": "~2.14.1",
|
||||
"exit-on-epipe": "~1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "2.14.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.14.1.tgz",
|
||||
"integrity": "sha512-+YR16o3rK53SmWHU3rEM3tPAh2rwb1yPcQX5irVn7mb0gXbwuCCrnkbV5+PBfETdfg1vui07nM6PCG1zndcjQw=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"collect-v8-coverage": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz",
|
||||
@@ -8185,6 +8271,22 @@
|
||||
"yaml": "^1.10.0"
|
||||
}
|
||||
},
|
||||
"crc-32": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.1.tgz",
|
||||
"integrity": "sha512-Dn/xm/1vFFgs3nfrpEVScHoIslO9NZRITWGz/1E/St6u4xw99vfZzVkW0OSnzx2h9egej9xwMCEut6sqwokM/w==",
|
||||
"requires": {
|
||||
"exit-on-epipe": "~1.0.1",
|
||||
"printj": "~1.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"printj": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/printj/-/printj-1.3.1.tgz",
|
||||
"integrity": "sha512-GA3TdL8szPK4AQ2YnOe/b+Y1jUFwmmGMMK/qbY7VcE3Z7FU8JstbKiKRzO6CIiAKPhTO8m01NoQ0V5f3jc4OGg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"critters": {
|
||||
"version": "0.0.10",
|
||||
"resolved": "https://registry.npmjs.org/critters/-/critters-0.0.10.tgz",
|
||||
@@ -9182,6 +9284,11 @@
|
||||
"entities": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"dom-storage": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/dom-storage/-/dom-storage-2.1.0.tgz",
|
||||
"integrity": "sha512-g6RpyWXzl0RR6OTElHKBl7nwnK87GUyZMYC7JWsB/IA73vpqK2K6LT39x4VepLxlSsWBFrPVLnsSR5Jyty0+2Q=="
|
||||
},
|
||||
"dom-walk": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.2.tgz",
|
||||
@@ -9580,8 +9687,7 @@
|
||||
"es6-promise": {
|
||||
"version": "4.2.8",
|
||||
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
|
||||
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",
|
||||
"dev": true
|
||||
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w=="
|
||||
},
|
||||
"es6-promise-plugin": {
|
||||
"version": "4.2.2",
|
||||
@@ -9764,6 +9870,11 @@
|
||||
"resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz",
|
||||
"integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw="
|
||||
},
|
||||
"exit-on-epipe": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz",
|
||||
"integrity": "sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw=="
|
||||
},
|
||||
"expand-brackets": {
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz",
|
||||
@@ -10216,6 +10327,11 @@
|
||||
"resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.1.tgz",
|
||||
"integrity": "sha512-MMMQ0ludy/nBs1/o0zVOiKTpG7qMbonKUzjJgQFEuvq6INZ1OraKPRAWkBq5vlKLOUMpmNYG1JoN3oDPUQ9m3Q=="
|
||||
},
|
||||
"fflate": {
|
||||
"version": "0.3.11",
|
||||
"resolved": "https://registry.npmjs.org/fflate/-/fflate-0.3.11.tgz",
|
||||
"integrity": "sha512-Rr5QlUeGN1mbOHlaqcSYMKVpPbgLy0AWT/W0EHxA6NGI12yO1jpoui2zBBvU2G824ltM6Ut8BFgfHSBGfkmS0A=="
|
||||
},
|
||||
"figures": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz",
|
||||
@@ -10416,6 +10532,11 @@
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="
|
||||
},
|
||||
"frac": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
|
||||
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA=="
|
||||
},
|
||||
"fragment-cache": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
|
||||
@@ -18740,6 +18861,11 @@
|
||||
"react-is": "^17.0.1"
|
||||
}
|
||||
},
|
||||
"printj": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz",
|
||||
"integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ=="
|
||||
},
|
||||
"process": {
|
||||
"version": "0.11.10",
|
||||
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||
@@ -21180,6 +21306,14 @@
|
||||
"integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==",
|
||||
"dev": true
|
||||
},
|
||||
"ssf": {
|
||||
"version": "0.11.2",
|
||||
"resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz",
|
||||
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
|
||||
"requires": {
|
||||
"frac": "~1.1.2"
|
||||
}
|
||||
},
|
||||
"sshpk": {
|
||||
"version": "1.16.1",
|
||||
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
|
||||
@@ -24599,6 +24733,16 @@
|
||||
"pify": "^4.0.1"
|
||||
}
|
||||
},
|
||||
"wmf": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
|
||||
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw=="
|
||||
},
|
||||
"word": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
|
||||
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA=="
|
||||
},
|
||||
"word-wrap": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
|
||||
@@ -24651,6 +24795,30 @@
|
||||
"resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz",
|
||||
"integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q=="
|
||||
},
|
||||
"xlsx": {
|
||||
"version": "0.17.0",
|
||||
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.17.0.tgz",
|
||||
"integrity": "sha512-bZ36FSACiAyjoldey1+7it50PMlDp1pcAJrZKcVZHzKd8BC/z6TQ/QAN8onuqcepifqSznR6uKnjPhaGt6ig9A==",
|
||||
"requires": {
|
||||
"adler-32": "~1.2.0",
|
||||
"cfb": "^1.1.4",
|
||||
"codepage": "~1.14.0",
|
||||
"commander": "~2.17.1",
|
||||
"crc-32": "~1.2.0",
|
||||
"exit-on-epipe": "~1.0.1",
|
||||
"fflate": "^0.3.8",
|
||||
"ssf": "~0.11.2",
|
||||
"wmf": "~1.0.1",
|
||||
"word": "~0.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "2.17.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz",
|
||||
"integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"xml-name-validator": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
"@pdftron/pdfjs-express": "^8.0.1",
|
||||
"@types/jest-environment-puppeteer": "^4.4.1",
|
||||
"@types/puppeteer": "^5.4.4",
|
||||
"alasql": "^1.7.3",
|
||||
"angular-calendar": "^0.28.22",
|
||||
"angular-cropperjs": "^0.1.5",
|
||||
"angular-svg-icon": "^12.0.0",
|
||||
|
||||
@@ -446,13 +446,18 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
await this.fileService.saveImage(image)
|
||||
const lastphoto: any = await this.fileService.loadFiles();
|
||||
const { capturedImage, capturedImageTitle} = await this.fileService.loadFileData(lastphoto);
|
||||
const base64 = await fetch(capturedImage);
|
||||
const blob = await base64.blob();
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
|
||||
const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(this.roomId).send({
|
||||
this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"guid": '',
|
||||
"image_url": capturedImage
|
||||
},
|
||||
temporary: formData,
|
||||
attachments: [{
|
||||
"title": capturedImageTitle ,
|
||||
"text": "description",
|
||||
@@ -460,40 +465,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}]
|
||||
})
|
||||
|
||||
|
||||
const base64 = await fetch(capturedImage);
|
||||
const blob = await base64.blob();
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
console.log('ALL IMAGE', formData)
|
||||
|
||||
|
||||
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
|
||||
updateMessage({
|
||||
file: {
|
||||
type: "application/img",
|
||||
guid: guid.path,
|
||||
image_url: capturedImage
|
||||
}
|
||||
})
|
||||
|
||||
this.AttachmentsService.downloadFile(guid.path).subscribe(async (event) => {
|
||||
|
||||
if (event.type === HttpEventType.DownloadProgress) {
|
||||
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
|
||||
//console.log('FILE TYPE 33', msg.file.type)
|
||||
} else if (event.type === HttpEventType.Response) {
|
||||
var fileImage = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||
console.log('add picture to chat', capturedImage);
|
||||
await this.storage.set(guid.path, capturedImage).then(() => {
|
||||
console.log('add picture to chat IMAGE SAVED')
|
||||
message.getFileFromDb()
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async addImage() {
|
||||
@@ -521,7 +492,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
if(data.selected) {
|
||||
const loader = this.toastService.loading();
|
||||
|
||||
const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(this.roomId).send({
|
||||
this.wsChatMethodsService.getDmRoom(this.roomId).send({
|
||||
file:{
|
||||
"name": res.data.selected.Assunto,
|
||||
"type": "application/webtrix",
|
||||
@@ -536,28 +507,14 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
"title_link_download": true,
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
// "message_link": url_no_options,
|
||||
"type": "webtrix"
|
||||
}]
|
||||
})
|
||||
|
||||
let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise();
|
||||
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
|
||||
console.log(url_no_options);
|
||||
|
||||
updateMessage({
|
||||
attachments: [{
|
||||
"title": res.data.selected.Assunto,
|
||||
"description": res.data.selected.DocTypeDesc,
|
||||
"title_link": url_no_options,
|
||||
"title_link_download": true,
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
"message_link": url_no_options,
|
||||
"type": "webtrix",
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
"text": res.data.selected.DocTypeDesc,
|
||||
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
}]
|
||||
})
|
||||
|
||||
|
||||
loader.remove();
|
||||
|
||||
}
|
||||
@@ -572,12 +529,13 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", file);
|
||||
|
||||
const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(this.roomId).send({
|
||||
this.wsChatMethodsService.getDmRoom(this.roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"guid": '',
|
||||
"image_url": imageData
|
||||
},
|
||||
temporary: formData,
|
||||
attachments: [{
|
||||
"title": file.name ,
|
||||
"text": "description",
|
||||
@@ -585,30 +543,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}]
|
||||
})
|
||||
|
||||
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
|
||||
updateMessage({
|
||||
file: {
|
||||
type: "application/img",
|
||||
guid: guid.path,
|
||||
image_url: imageData
|
||||
}
|
||||
})
|
||||
|
||||
this.AttachmentsService.downloadFile(guid.path).subscribe(async (event) => {
|
||||
|
||||
if (event.type === HttpEventType.DownloadProgress) {
|
||||
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
|
||||
//console.log('FILE TYPE 33', msg.file.type)
|
||||
} else if (event.type === HttpEventType.Response) {
|
||||
var fileImage = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||
console.log('add picture to chat',fileImage);
|
||||
await this.storage.set(guid.path, fileImage).then(() => {
|
||||
console.log('add picture to chat IMAGE SAVED')
|
||||
message.getFileFromDb()
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async openChatOptions(ev?: any) {
|
||||
|
||||
@@ -529,7 +529,14 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
const lastphoto: any = await this.fileService.loadFiles();
|
||||
const { capturedImage, capturedImageTitle} = await this.fileService.loadFileData(lastphoto);
|
||||
|
||||
const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
|
||||
const base64 = await fetch(capturedImage);
|
||||
const blob = await base64.blob();
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
console.log('ALL IMAGE', formData)
|
||||
|
||||
this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"guid": '',
|
||||
@@ -539,43 +546,10 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
"title": capturedImageTitle ,
|
||||
"text": "description",
|
||||
"title_link_download": false,
|
||||
}]
|
||||
}],
|
||||
temporary: formData
|
||||
})
|
||||
|
||||
|
||||
const base64 = await fetch(capturedImage);
|
||||
const blob = await base64.blob();
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
console.log('ALL IMAGE', formData)
|
||||
|
||||
|
||||
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
|
||||
updateMessage({
|
||||
file: {
|
||||
type: "application/img",
|
||||
guid: guid.path,
|
||||
image_url: capturedImage
|
||||
}
|
||||
})
|
||||
|
||||
this.AttachmentsService.downloadFile(guid.path).subscribe(async (event) => {
|
||||
|
||||
if (event.type === HttpEventType.DownloadProgress) {
|
||||
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
|
||||
//console.log('FILE TYPE 33', msg.file.type)
|
||||
} else if (event.type === HttpEventType.Response) {
|
||||
var fileImage = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||
console.log('add picture to chat', capturedImage);
|
||||
await this.storage.set(guid.path, capturedImage).then(() => {
|
||||
console.log('add picture to chat IMAGE SAVED')
|
||||
message.getFileFromDb()
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async addImage() {
|
||||
@@ -604,7 +578,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
if(data.selected) {
|
||||
const loader = this.toastService.loading();
|
||||
|
||||
const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
file:{
|
||||
"name": res.data.selected.Assunto,
|
||||
"type": "application/webtrix",
|
||||
@@ -617,27 +591,10 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
"description": res.data.selected.DocTypeDesc,
|
||||
// "title_link": url_no_options,
|
||||
"title_link_download": true,
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
// "message_link": url_no_options,
|
||||
"type": "webtrix"
|
||||
}]
|
||||
})
|
||||
|
||||
let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise();
|
||||
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
|
||||
console.log(url_no_options);
|
||||
|
||||
updateMessage({
|
||||
attachments: [{
|
||||
"title": res.data.selected.Assunto,
|
||||
"description": res.data.selected.DocTypeDesc,
|
||||
"title_link": url_no_options,
|
||||
"title_link_download": true,
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
"message_link": url_no_options,
|
||||
"type": "webtrix",
|
||||
"text": res.data.selected.DocTypeDesc,
|
||||
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
// "message_link": url_no_options,
|
||||
"text": res.data.selected.DocTypeDesc,
|
||||
"type": "webtrix"
|
||||
}]
|
||||
})
|
||||
|
||||
@@ -658,12 +615,13 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", file);
|
||||
|
||||
const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"guid": '',
|
||||
"image_url": imageData
|
||||
},
|
||||
temporary: formData,
|
||||
attachments: [{
|
||||
"title": file.name ,
|
||||
"text": "description",
|
||||
@@ -671,30 +629,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}]
|
||||
})
|
||||
|
||||
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
|
||||
updateMessage({
|
||||
file: {
|
||||
type: "application/img",
|
||||
guid: guid.path,
|
||||
image_url: imageData
|
||||
}
|
||||
})
|
||||
|
||||
this.AttachmentsService.downloadFile(guid.path).subscribe(async (event) => {
|
||||
|
||||
if (event.type === HttpEventType.DownloadProgress) {
|
||||
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
|
||||
//console.log('FILE TYPE 33', msg.file.type)
|
||||
} else if (event.type === HttpEventType.Response) {
|
||||
var fileImage = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||
console.log('add picture to chat',fileImage);
|
||||
await this.storage.set(guid.path, fileImage).then(() => {
|
||||
console.log('add picture to chat IMAGE SAVED')
|
||||
message.getFileFromDb()
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async openChatOptions(ev?: any) {
|
||||
|
||||
@@ -3,8 +3,8 @@ import { Attachment, EventAttachment } from '../models/attachment.model';
|
||||
import { Observable } from 'rxjs';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { AuthService } from '../services/auth.service';
|
||||
import { LoginUserRespose } from '../models/user.model';
|
||||
import { SessionStore } from '../store/session.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -14,10 +14,10 @@ export class AttachmentsService {
|
||||
loggeduser: LoginUserRespose;
|
||||
headers: HttpHeaders;
|
||||
|
||||
constructor(private http: HttpClient, user: AuthService) {
|
||||
this.loggeduser = user.ValidatedUser;
|
||||
constructor(private http: HttpClient) {
|
||||
this.loggeduser = SessionStore.user
|
||||
this.headers = new HttpHeaders();
|
||||
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey);
|
||||
}
|
||||
|
||||
uploadFile(formData:any) {
|
||||
|
||||
@@ -12,6 +12,12 @@ import { AESEncrypt } from '../services/aesencrypt.service';
|
||||
import { CookieService } from 'ngx-cookie-service';
|
||||
import { WsChatService } from 'src/app/services/chat/ws-chat.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { NfService } from 'src/app/services/chat/nf.service'
|
||||
import { MessageService } from 'src/app/services/chat/message.service';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||
import { RoomService } from './chat/room.service';
|
||||
import { Storage } from '@ionic/storage';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -33,7 +39,11 @@ export class AuthService {
|
||||
private aesencrypt: AESEncrypt,
|
||||
private cookieService: CookieService,
|
||||
private WsChatService: WsChatService,
|
||||
private router: Router,) {
|
||||
private router: Router,
|
||||
private NfService:NfService,
|
||||
private processesService: ProcessesService,
|
||||
private AttachmentsService: AttachmentsService,
|
||||
private storage: Storage ) {
|
||||
|
||||
this.headers = new HttpHeaders();
|
||||
|
||||
@@ -41,13 +51,7 @@ export class AuthService {
|
||||
this.ValidatedUser = SessionStore.user
|
||||
|
||||
console.log('login', SessionStore.user.RochetChatUser, SessionStore.user.Password)
|
||||
this.WsChatService.connect();
|
||||
this.WsChatService.login().then((message) => {
|
||||
console.log('rocket chat login successfully', message)
|
||||
this.WsChatService.setStatus('busy')
|
||||
}).catch((message)=>{
|
||||
console.log('rocket chat login failed', message)
|
||||
})
|
||||
this.loginToChatWs()
|
||||
|
||||
}
|
||||
|
||||
@@ -115,16 +119,7 @@ export class AuthService {
|
||||
|
||||
if(responseChat) {
|
||||
|
||||
setTimeout(()=>{
|
||||
|
||||
this.WsChatService.connect();
|
||||
this.WsChatService.login().then((message) => {
|
||||
console.log('rocket chat login successfully', message)
|
||||
this.WsChatService.setStatus('online')
|
||||
}).catch((message)=>{
|
||||
console.log('rocket chat login failed', message)
|
||||
})
|
||||
}, 1)
|
||||
this.loginToChatWs()
|
||||
|
||||
console.log('Login to Rocket chat OK');
|
||||
this.ValidatedUserChat = responseChat;
|
||||
@@ -143,6 +138,47 @@ export class AuthService {
|
||||
}
|
||||
}
|
||||
|
||||
private loginToChatWs() {
|
||||
setTimeout(()=>{
|
||||
|
||||
this.WsChatService.connect();
|
||||
this.WsChatService.login().then((message) => {
|
||||
console.log('rocket chat login successfully', message)
|
||||
this.WsChatService.setStatus('online')
|
||||
}).catch((message)=>{
|
||||
console.log('rocket chat login failed', message)
|
||||
})
|
||||
|
||||
|
||||
this.NfService.beforeSendAttachment = async (message: MessageService, room?: RoomService) => {
|
||||
|
||||
if(message.hasFile) {
|
||||
if(message.file.type != 'application/webtrix') {
|
||||
const formData = message.temporaryData
|
||||
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
|
||||
message.file.guid = guid.path
|
||||
await this.storage.set(guid.path, message.file.image_url).then(() => {
|
||||
console.log('add picture to chat IMAGE SAVED')
|
||||
message.getFileFromDb()
|
||||
});
|
||||
|
||||
return true
|
||||
} else {
|
||||
const res = message.temporaryData
|
||||
let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise();
|
||||
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
|
||||
message.attachments[0].title_link = url_no_options
|
||||
message.attachments[0].message_link = url_no_options
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
}, 1)
|
||||
}
|
||||
|
||||
autologout(expirationDate:number){
|
||||
setTimeout(()=>{
|
||||
this.logout();
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Message } from 'src/app/models/chatMethod';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
import { capitalizeTxt } from 'src/plugin/text'
|
||||
import { NfService } from 'src/app/services/chat/nf.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -23,9 +24,12 @@ export class MessageService {
|
||||
attachments
|
||||
offline = true
|
||||
displayType = ''
|
||||
temporaryData = {}
|
||||
temporaryData: any = {}
|
||||
hasFile = false
|
||||
hasSendAttachment = false
|
||||
|
||||
constructor(private storage: Storage) {
|
||||
constructor(private storage: Storage,
|
||||
private NfService: NfService) {
|
||||
}
|
||||
|
||||
setData({customFields, channels, mentions, msg ,rid ,ts, u, t, _id, _updatedAt, file, attachments, temporaryData}:Message) {
|
||||
@@ -49,18 +53,20 @@ export class MessageService {
|
||||
this.offline = false
|
||||
}
|
||||
|
||||
|
||||
if (this.file) {
|
||||
this.getFileFromDb()
|
||||
if(this.file.type) {
|
||||
if(this.file.type != 'application/webtrix' && typeof(this.file.type) == 'string') {
|
||||
this.displayType = this.file.type.replace('application/','').toUpperCase()
|
||||
if(typeof(this.file.type) == 'string') {
|
||||
this.hasFile = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(this.hasFile) {
|
||||
this.getFileFromDb()
|
||||
if(this.file.type != 'application/webtrix') {
|
||||
this.displayType = this.file.type.replace('application/','').toUpperCase()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private usernameToDisplayName(username) {
|
||||
@@ -71,13 +77,13 @@ export class MessageService {
|
||||
}
|
||||
|
||||
getFileFromDb() {
|
||||
if (this.file) {
|
||||
|
||||
if(this.hasFile) {
|
||||
if (this.file.guid) {
|
||||
this.storage.get(this.file.guid).then((image) => {
|
||||
if(image != null) {
|
||||
this.file.image_url = image
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MessageService } from './message.service';
|
||||
import { RoomService } from './room.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class NfService {
|
||||
|
||||
beforeSendAttachment = (message: MessageService, room?: RoomService): Promise<boolean> => new Promise ((resolve, reject)=> (resolve(true)))
|
||||
|
||||
|
||||
constructor() { }
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import { SortService } from '../functions/sort.service';
|
||||
import { chatUser } from 'src/app/models/chatMethod';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
import { NfService } from 'src/app/services/chat/nf.service'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -63,11 +64,12 @@ export class RoomService {
|
||||
private NativeNotificationService: NativeNotificationService,
|
||||
private sortService: SortService,
|
||||
private chatService: ChatService,
|
||||
private NfService: NfService
|
||||
) {
|
||||
this.NativeNotificationService.askForPermission()
|
||||
}
|
||||
|
||||
setData({ customFields, id, name, t, lastMessage = new MessageService(this.storage), _updatedAt }) {
|
||||
setData({ customFields, id, name, t, lastMessage = new MessageService(this.storage, this.NfService), _updatedAt }) {
|
||||
this.customFields = customFields
|
||||
this.id = id
|
||||
this.name = name
|
||||
@@ -232,19 +234,21 @@ export class RoomService {
|
||||
})
|
||||
} else {
|
||||
console.log('complex send')
|
||||
return {
|
||||
message: message,
|
||||
updateMessage: (update)=> {
|
||||
offlineChatMessage = Object.assign(offlineChatMessage, update)
|
||||
|
||||
this.WsChatService.send({roomId:this.id, msg:message.msg,attachments:offlineChatMessage.attachments, file:offlineChatMessage.file}).then((data: any) => {
|
||||
console.log('send sucees', data.result)
|
||||
let ChatMessage = data.result
|
||||
this.redefinedMessage(message, ChatMessage)
|
||||
})
|
||||
const result = this.NfService.beforeSendAttachment(message, this)
|
||||
|
||||
}
|
||||
delete message.temporaryData;
|
||||
|
||||
if(result) {
|
||||
message.hasSendAttachment = true
|
||||
|
||||
this.WsChatService.send({roomId:this.id, msg:message.msg, attachments:offlineChatMessage.attachments, file:offlineChatMessage.file}).then((data: any) => {
|
||||
console.log('send sucees', data.result)
|
||||
let ChatMessage = data.result
|
||||
this.redefinedMessage(message, ChatMessage)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -398,7 +402,7 @@ export class RoomService {
|
||||
|
||||
prepareMessage(message): MessageService {
|
||||
message = this.fix_updatedAt(message)
|
||||
const wewMessage = new MessageService(this.storage)
|
||||
const wewMessage = new MessageService(this.storage, this.NfService)
|
||||
wewMessage.setData(message)
|
||||
this.messages.push(wewMessage)
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { ChatService } from 'src/app/services/chat.service';
|
||||
import { NativeNotificationService } from 'src/app/services/native-notification.service';
|
||||
import { SortService } from '../functions/sort.service';
|
||||
import { chatUser } from 'src/app/models/chatMethod';
|
||||
|
||||
import { NfService } from 'src/app/services/chat/nf.service'
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -41,7 +41,8 @@ export class WsChatMethodsService {
|
||||
private sqlservice: SqliteService,
|
||||
private NativeNotificationService: NativeNotificationService,
|
||||
private sortService: SortService,
|
||||
private ChatService: ChatService
|
||||
private ChatService: ChatService,
|
||||
private NfService: NfService
|
||||
) {
|
||||
(async()=>{
|
||||
await this.getAllRooms();
|
||||
@@ -203,7 +204,7 @@ export class WsChatMethodsService {
|
||||
prepareRoom(roomData) {
|
||||
let room:RoomService;
|
||||
|
||||
room = new RoomService(this.WsChatService, new MessageService(this.storage), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService)
|
||||
room = new RoomService(this.WsChatService, new MessageService(this.storage, this.NfService), this.storage, this.platform, this.sqlservice, this.NativeNotificationService, this.sortService, this.ChatService, this.NfService)
|
||||
|
||||
room.setData({
|
||||
customFields: roomData.customFields,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { AuthService } from '../services/auth.service';
|
||||
import { LoginUserRespose } from '../models/user.model';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Observable } from 'rxjs';
|
||||
@@ -10,7 +9,7 @@ import { ExpedienteFullTask } from '../models/Expediente';
|
||||
import { GetTasksListType } from '../models/GetTasksListType';
|
||||
import { fullTaskList } from '../models/dailyworktask.model';
|
||||
import { ChangeProfileService } from './change-profile.service';
|
||||
|
||||
import { SessionStore } from '../store/session.service';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -22,15 +21,14 @@ export class ProcessesService {
|
||||
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
public user: AuthService,
|
||||
private changeProfileService: ChangeProfileService
|
||||
) {
|
||||
|
||||
this.loggeduser = this.user.ValidatedUser;
|
||||
this.loggeduser = SessionStore.user;
|
||||
|
||||
this.setHeader()
|
||||
this.changeProfileService.registerCallback(()=>{
|
||||
this.loggeduser = this.user.ValidatedUser;
|
||||
this.loggeduser = SessionStore.user;
|
||||
this.setHeader()
|
||||
})
|
||||
|
||||
|
||||
@@ -550,7 +550,12 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
const lastphoto: any = await this.fileService.loadFiles();
|
||||
const { capturedImage, capturedImageTitle} = await this.fileService.loadFileData(lastphoto);
|
||||
|
||||
const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
const base64 = await fetch(capturedImage);
|
||||
const blob = await base64.blob();
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
|
||||
this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"guid": '',
|
||||
@@ -563,40 +568,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
}]
|
||||
})
|
||||
|
||||
|
||||
const base64 = await fetch(capturedImage);
|
||||
const blob = await base64.blob();
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
console.log('ALL IMAGE', formData)
|
||||
|
||||
|
||||
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
|
||||
updateMessage({
|
||||
file: {
|
||||
type: "application/img",
|
||||
guid: guid.path,
|
||||
image_url: capturedImage
|
||||
}
|
||||
})
|
||||
|
||||
this.AttachmentsService.downloadFile(guid.path).subscribe(async (event) => {
|
||||
|
||||
if (event.type === HttpEventType.DownloadProgress) {
|
||||
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
|
||||
//console.log('FILE TYPE 33', msg.file.type)
|
||||
} else if (event.type === HttpEventType.Response) {
|
||||
var fileImage = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||
console.log('add picture to chat', capturedImage);
|
||||
await this.storage.set(guid.path, capturedImage).then(() => {
|
||||
console.log('add picture to chat IMAGE SAVED')
|
||||
message.getFileFromDb()
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async addImage() {
|
||||
@@ -626,7 +597,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
if(data.selected) {
|
||||
const loader = this.toastService.loading();
|
||||
|
||||
const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
file:{
|
||||
"name": res.data.selected.Assunto,
|
||||
"type": "application/webtrix",
|
||||
@@ -641,23 +612,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
"title_link_download": true,
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
// "message_link": url_no_options,
|
||||
"type": "webtrix"
|
||||
}]
|
||||
})
|
||||
|
||||
let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise();
|
||||
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
|
||||
console.log(url_no_options);
|
||||
|
||||
updateMessage({
|
||||
attachments: [{
|
||||
"title": res.data.selected.Assunto,
|
||||
"description": res.data.selected.DocTypeDesc,
|
||||
"title_link": url_no_options,
|
||||
"title_link_download": true,
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
"message_link": url_no_options,
|
||||
"type": "webtrix",
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
"text": res.data.selected.DocTypeDesc,
|
||||
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
}]
|
||||
@@ -680,43 +636,19 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", file);
|
||||
|
||||
const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"guid": '',
|
||||
"image_url": imageData
|
||||
},
|
||||
temporary: formData,
|
||||
attachments: [{
|
||||
"title": file.name ,
|
||||
"text": "description",
|
||||
"title_link_download": false,
|
||||
}]
|
||||
})
|
||||
|
||||
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
|
||||
updateMessage({
|
||||
file: {
|
||||
type: "application/img",
|
||||
guid: guid.path,
|
||||
image_url: imageData
|
||||
}
|
||||
})
|
||||
|
||||
this.AttachmentsService.downloadFile(guid.path).subscribe(async (event) => {
|
||||
|
||||
if (event.type === HttpEventType.DownloadProgress) {
|
||||
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
|
||||
//console.log('FILE TYPE 33', msg.file.type)
|
||||
} else if (event.type === HttpEventType.Response) {
|
||||
var fileImage = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||
console.log('add picture to chat',fileImage);
|
||||
await this.storage.set(guid.path, fileImage).then(() => {
|
||||
console.log('add picture to chat IMAGE SAVED')
|
||||
message.getFileFromDb()
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
bookMeeting() {
|
||||
|
||||
@@ -450,13 +450,18 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
await this.fileService.saveImage(image)
|
||||
const lastphoto: any = await this.fileService.loadFiles();
|
||||
const { capturedImage, capturedImageTitle} = await this.fileService.loadFileData(lastphoto);
|
||||
const base64 = await fetch(capturedImage);
|
||||
const blob = await base64.blob();
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
|
||||
const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"guid": '',
|
||||
"image_url": capturedImage
|
||||
},
|
||||
temporary: formData,
|
||||
attachments: [{
|
||||
"title": capturedImageTitle ,
|
||||
"text": "description",
|
||||
@@ -464,40 +469,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
}]
|
||||
})
|
||||
|
||||
|
||||
const base64 = await fetch(capturedImage);
|
||||
const blob = await base64.blob();
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", blob);
|
||||
console.log('ALL IMAGE', formData)
|
||||
|
||||
|
||||
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
|
||||
updateMessage({
|
||||
file: {
|
||||
type: "application/img",
|
||||
guid: guid.path,
|
||||
image_url: capturedImage
|
||||
}
|
||||
})
|
||||
|
||||
this.AttachmentsService.downloadFile(guid.path).subscribe(async (event) => {
|
||||
|
||||
if (event.type === HttpEventType.DownloadProgress) {
|
||||
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
|
||||
//console.log('FILE TYPE 33', msg.file.type)
|
||||
} else if (event.type === HttpEventType.Response) {
|
||||
var fileImage = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||
console.log('add picture to chat', capturedImage);
|
||||
await this.storage.set(guid.path, capturedImage).then(() => {
|
||||
console.log('add picture to chat IMAGE SAVED')
|
||||
message.getFileFromDb()
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async addImage() {
|
||||
@@ -526,7 +497,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
if(data.selected) {
|
||||
const loader = this.toastService.loading();
|
||||
|
||||
const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
file:{
|
||||
"name": res.data.selected.Assunto,
|
||||
"type": "application/webtrix",
|
||||
@@ -537,31 +508,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
attachments: [{
|
||||
"title": res.data.selected.Assunto,
|
||||
"description": res.data.selected.DocTypeDesc,
|
||||
// "title_link": url_no_options,
|
||||
"title_link_download": true,
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
// "message_link": url_no_options,
|
||||
"type": "webtrix"
|
||||
}],
|
||||
temporary: res
|
||||
})
|
||||
|
||||
let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise();
|
||||
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
|
||||
console.log(url_no_options);
|
||||
|
||||
updateMessage({
|
||||
attachments: [{
|
||||
"title": res.data.selected.Assunto,
|
||||
"description": res.data.selected.DocTypeDesc,
|
||||
"title_link": url_no_options,
|
||||
"title_link_download": true,
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
"message_link": url_no_options,
|
||||
"type": "webtrix",
|
||||
"text": res.data.selected.DocTypeDesc,
|
||||
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
}]
|
||||
}],
|
||||
temporary: res
|
||||
})
|
||||
|
||||
loader.remove();
|
||||
@@ -581,7 +533,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", file);
|
||||
|
||||
const { message, updateMessage} = this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
"type": "application/img",
|
||||
"guid": '',
|
||||
@@ -594,30 +546,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
}]
|
||||
})
|
||||
|
||||
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
|
||||
updateMessage({
|
||||
file: {
|
||||
type: "application/img",
|
||||
guid: guid.path,
|
||||
image_url: imageData
|
||||
}
|
||||
})
|
||||
|
||||
this.AttachmentsService.downloadFile(guid.path).subscribe(async (event) => {
|
||||
|
||||
if (event.type === HttpEventType.DownloadProgress) {
|
||||
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
|
||||
//console.log('FILE TYPE 33', msg.file.type)
|
||||
} else if (event.type === HttpEventType.Response) {
|
||||
var fileImage = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||
console.log('add picture to chat',fileImage);
|
||||
await this.storage.set(guid.path, fileImage).then(() => {
|
||||
console.log('add picture to chat IMAGE SAVED')
|
||||
message.getFileFromDb()
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user