mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
Add storage to web chat
This commit is contained in:
@@ -12,7 +12,7 @@ import { ToastService } from '../toast.service';
|
||||
import { Camera, CameraResultType, CameraSource, Photo} from '@capacitor/camera';
|
||||
import { Filesystem, Directory } from '@capacitor/filesystem';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { HttpClient, HttpEventType, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
|
||||
@@ -39,6 +39,8 @@ export class FileService {
|
||||
idroom: any;
|
||||
|
||||
headers: HttpHeaders;
|
||||
downloadProgess = 0;
|
||||
downloadFilename: any;
|
||||
|
||||
constructor(
|
||||
private fileLoaderService: FileLoaderService,
|
||||
@@ -57,7 +59,7 @@ export class FileService {
|
||||
alert('OIEE')
|
||||
|
||||
//const geturl = environment.apiURL + 'Tasks/DelegateTask';
|
||||
const geturl = environment.apiURL + 'lakefs/UploadFiles';
|
||||
const geturl = environment.apiURL + 'ObjectServer/UploadFiles';
|
||||
|
||||
let options = {
|
||||
headers: this.headers
|
||||
@@ -79,6 +81,28 @@ export class FileService {
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
downloadFile(guid:any) {
|
||||
|
||||
let downloadUrl = 'https://equilibrium.dyndns.info/GabineteDigital.Services/V5/api/objectserver/streamfiles?path='+guid;
|
||||
var name = new Date().getTime();
|
||||
return this.http.get(downloadUrl, {
|
||||
responseType: "arraybuffer",
|
||||
reportProgress: true, observe: 'events'
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
_arrayBufferToBase64( buffer ) {
|
||||
var binary = '';
|
||||
var bytes = new Uint8Array( buffer );
|
||||
var len = bytes.byteLength;
|
||||
for (var i = 0; i < len; i++) {
|
||||
binary += String.fromCharCode( bytes[ i ] );
|
||||
}
|
||||
return window.btoa( binary );
|
||||
}
|
||||
|
||||
|
||||
async takePicture() {
|
||||
const capturedImage = await Camera.getPhoto({
|
||||
quality: 90,
|
||||
@@ -378,6 +402,7 @@ export class FileService {
|
||||
"file":{
|
||||
"type": "application/img",
|
||||
"guid": guid.path,
|
||||
"image_url": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user