mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
git pull made
This commit is contained in:
@@ -105,7 +105,7 @@
|
||||
.attach-title-item{
|
||||
width: 100%;
|
||||
font-size: 15px;
|
||||
color:#0d89d1;
|
||||
color:var(--title-text-color);
|
||||
}
|
||||
/* SPAN */
|
||||
.span-left{
|
||||
|
||||
@@ -10,11 +10,9 @@ import { SearchList } from 'src/app/models/search-document';
|
||||
import { ProcessesService } from '../processes.service';
|
||||
import { ToastService } from '../toast.service';
|
||||
import { Camera, CameraResultType, CameraSource, Photo} from '@capacitor/camera';
|
||||
import {
|
||||
FileSharer} from '@byteowls/capacitor-filesharer';
|
||||
import { Filesystem, Directory } from '@capacitor/filesystem';
|
||||
import { Share } from '@capacitor/share';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
|
||||
@@ -40,6 +38,8 @@ export class FileService {
|
||||
photos: any[] = [];
|
||||
idroom: any;
|
||||
|
||||
headers: HttpHeaders;
|
||||
|
||||
constructor(
|
||||
private fileLoaderService: FileLoaderService,
|
||||
private fileToBase64Service: FileToBase64Service,
|
||||
@@ -50,9 +50,35 @@ export class FileService {
|
||||
private toastService: ToastService,
|
||||
private platform: Platform,
|
||||
private loadingCtrl: LoadingController,
|
||||
private http: HttpClient
|
||||
private http: HttpClient,
|
||||
) { }
|
||||
|
||||
uploadFile(formData:any){
|
||||
alert('OIEE')
|
||||
|
||||
//const geturl = environment.apiURL + 'Tasks/DelegateTask';
|
||||
const geturl = environment.apiURL + 'lakefs/UploadFiles';
|
||||
|
||||
let options = {
|
||||
headers: this.headers
|
||||
};
|
||||
|
||||
return this.http.post(`${geturl}`, formData, options);
|
||||
}
|
||||
|
||||
getFile(guid:any){
|
||||
const geturl = environment.apiURL + 'lakefs/StreamFile';
|
||||
let params = new HttpParams();
|
||||
|
||||
params = params.set("path", guid);
|
||||
|
||||
let options = {
|
||||
headers: this.headers,
|
||||
params: params
|
||||
};
|
||||
return this.http.get<any>(`${geturl}`, options);
|
||||
}
|
||||
|
||||
async takePicture() {
|
||||
const capturedImage = await Camera.getPhoto({
|
||||
quality: 90,
|
||||
@@ -89,9 +115,9 @@ export class FileService {
|
||||
reader.readAsDataURL(blob);
|
||||
});
|
||||
|
||||
loadPicture() {
|
||||
async loadPicture() {
|
||||
const input = this.fileLoaderService.createInput({
|
||||
accept: ['image/apng', 'image/jpeg', 'image/png']
|
||||
accept: ['image/apng', 'image/jpeg', 'image/png', '.pdf']
|
||||
})
|
||||
|
||||
input.onchange = async () => {
|
||||
@@ -195,7 +221,7 @@ export class FileService {
|
||||
console.log('ALL IMAGE', this.images)
|
||||
|
||||
this.capturedImage = this.images[0].data
|
||||
|
||||
|
||||
this.capturedImageTitle = new Date().getTime() + '.jpeg';
|
||||
|
||||
let body = {
|
||||
@@ -236,11 +262,8 @@ export class FileService {
|
||||
await this.saveImage(image,roomId)
|
||||
}
|
||||
|
||||
await Share.share({
|
||||
title: 'Check my image',
|
||||
url: image.path
|
||||
})
|
||||
|
||||
//this.capturedImage = this.capturedImage;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -258,11 +281,6 @@ export class FileService {
|
||||
await this.saveImage(capturedImage,roomId)
|
||||
}
|
||||
|
||||
await Share.share({
|
||||
title: 'Check my image',
|
||||
url: capturedImage.path
|
||||
})
|
||||
|
||||
|
||||
/* const response = await fetch(capturedImage.webPath!);
|
||||
const blob = await response.blob();
|
||||
@@ -303,17 +321,17 @@ export class FileService {
|
||||
reader.onloadend=()=>{
|
||||
const result = reader.result as string
|
||||
const base64Data = result.split(',')[1]
|
||||
|
||||
FileSharer.share({
|
||||
|
||||
/* FileSharer.share({
|
||||
filename:'any.pdf',
|
||||
base64Data,
|
||||
contentType: "application/pdf",
|
||||
})
|
||||
}) */
|
||||
reader.readAsDataURL(res)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
addPictureToChat(roomId) {
|
||||
@@ -335,10 +353,15 @@ export class FileService {
|
||||
const file = this.fileLoaderService.getFirstFile(input)
|
||||
|
||||
console.log(file);
|
||||
const loader = this.toastService.loading();
|
||||
|
||||
const imageData = await this.fileToBase64Service.convert(file)
|
||||
this.capturedImage = imageData;
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append("blobFile", file);
|
||||
let guid: any = await this.uploadFile(formData).toPromise()
|
||||
console.log(guid.path);
|
||||
|
||||
/* const imageData = await this.fileToBase64Service.convert(file)
|
||||
this.capturedImage = imageData; */
|
||||
this.capturedImageTitle = file.name;
|
||||
|
||||
let body = {
|
||||
@@ -350,8 +373,12 @@ export class FileService {
|
||||
//"title": this.capturedImageTitle ,
|
||||
//"text": "description",
|
||||
"title_link_download": false,
|
||||
"image_url": this.capturedImage,
|
||||
}]
|
||||
//"image_url": this.capturedImage,
|
||||
}],
|
||||
"file":{
|
||||
"type": "application/img",
|
||||
"guid": guid.path,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,10 +386,9 @@ export class FileService {
|
||||
console.log(this.capturedImage)
|
||||
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
loader.remove();
|
||||
|
||||
//console.log(res);
|
||||
},(error) => {
|
||||
loader.remove();
|
||||
});
|
||||
//console.log(this.capturedImage)
|
||||
};
|
||||
|
||||
@@ -43,6 +43,19 @@ export class ProcessesService {
|
||||
this.headers = this.headers.set('Authorization', this.loggeduser.BasicAuthKey);
|
||||
}
|
||||
|
||||
uploadFile(formData:any){
|
||||
alert('OIEE')
|
||||
|
||||
//const geturl = environment.apiURL + 'Tasks/DelegateTask';
|
||||
const geturl = environment.apiURL + 'lakefs/UploadFiles';
|
||||
|
||||
let options = {
|
||||
headers: this.headers
|
||||
};
|
||||
|
||||
return this.http.post(`${geturl}`, formData, options);
|
||||
}
|
||||
|
||||
GetTasksList(processname: typeof GetTasksListType, onlycount:boolean): Observable<fullTaskList[]>
|
||||
{
|
||||
const geturl = environment.apiURL + 'tasks/List';
|
||||
|
||||
Reference in New Issue
Block a user