diff --git a/src/app/pages/chat/group-messages/group-messages.module.ts b/src/app/pages/chat/group-messages/group-messages.module.ts
index cc970708b..d5c64132d 100644
--- a/src/app/pages/chat/group-messages/group-messages.module.ts
+++ b/src/app/pages/chat/group-messages/group-messages.module.ts
@@ -19,15 +19,14 @@ import { AngularCropperjsModule } from 'angular-cropperjs';
@NgModule({
imports: [
CommonModule,
- BrowserModule,
FormsModule,
FontAwesomeModule,
IonicModule,
GroupMessagesPageRoutingModule,
ChatPopoverPageModule,
BtnModalDismissPageModule,
- ImageCropperModule,
- AngularCropperjsModule
+ /* ImageCropperModule,
+ AngularCropperjsModule */
],
declarations: [GroupMessagesPage]
diff --git a/src/app/pages/chat/group-messages/group-messages.page.html b/src/app/pages/chat/group-messages/group-messages.page.html
index fe648ee08..f521c4176 100644
--- a/src/app/pages/chat/group-messages/group-messages.page.html
+++ b/src/app/pages/chat/group-messages/group-messages.page.html
@@ -53,7 +53,7 @@
- Esta conversa passou a grupo
+ Esta conversa passou a grupo TIAGO
A conversa original mantêm-se como chat individual
@@ -90,9 +90,9 @@
-
+
-
+
{{last ? scrollToBottom() : ''}}
diff --git a/src/app/services/functions/file.service.ts b/src/app/services/functions/file.service.ts
index 146f8cb91..90f969fdf 100644
--- a/src/app/services/functions/file.service.ts
+++ b/src/app/services/functions/file.service.ts
@@ -12,6 +12,8 @@ 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';
const IMAGE_DIR = 'stored-images';
@@ -36,6 +38,8 @@ export class FileService {
photos: any[] = [];
idroom: any;
+ headers: HttpHeaders;
+
constructor(
private fileLoaderService: FileLoaderService,
private fileToBase64Service: FileToBase64Service,
@@ -45,9 +49,36 @@ export class FileService {
private processesService: ProcessesService,
private toastService: ToastService,
private platform: Platform,
- private loadingCtrl: LoadingController
+ private loadingCtrl: LoadingController,
+ 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(`${geturl}`, options);
+ }
+
async takePicture() {
const capturedImage = await Camera.getPhoto({
quality: 90,
@@ -84,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 () => {
@@ -190,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 = {
@@ -239,7 +270,7 @@ export class FileService {
}); */
//this.capturedImage = this.capturedImage;
-
+
}
@@ -309,10 +340,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 = {
@@ -324,8 +360,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,
+ }
}
}
@@ -333,10 +373,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)
};
diff --git a/src/app/services/processes.service.ts b/src/app/services/processes.service.ts
index 24404944e..0385d53b5 100644
--- a/src/app/services/processes.service.ts
+++ b/src/app/services/processes.service.ts
@@ -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
{
const geturl = environment.apiURL + 'tasks/List';
diff --git a/src/app/shared/chat/messages/messages.page.ts b/src/app/shared/chat/messages/messages.page.ts
index b3eec13c2..d48d45c12 100644
--- a/src/app/shared/chat/messages/messages.page.ts
+++ b/src/app/shared/chat/messages/messages.page.ts
@@ -246,7 +246,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
viewDocument(file:any, url?:string){
- if(file.type == "application/webtrix") {
+ if(file.type == "application/img"){
+ console.log(file);
+
+ //this.fileService.getFile().toPromise();
+ }
+ else if(file.type == "application/webtrix") {
this.openViewDocumentModal(file);
}
else{
@@ -428,8 +433,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.fileService.addCameraPictureToChat(roomId);
}
addImage(){
- const roomId = this.roomId
+ const roomId = this.roomId;
this.fileService.addPictureToChat(roomId);
+ //this.fileService.loadPicture();
+ //this.fileService.addPictureToChat(roomId);
}
addFile(){
this.fileService.addDocumentToChat(this.roomId);
@@ -563,7 +570,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
};
zoomActive = false;
zoomScale = 1;
-
+
sliderZoomOpts = {
allowSlidePrev: false,
allowSlideNext: false,
@@ -571,27 +578,27 @@ sliderZoomOpts = {
maxRatio: 5
},
on: {
- zoomChange: (scale, imageEl, slideEl) => {
+ zoomChange: (scale, imageEl, slideEl) => {
this.zoomActive = true;
this.zoomScale = scale/5;
- this.changeDetectorRef.detectChanges();
+ this.changeDetectorRef.detectChanges();
}
}
}
-
+
async touchEnd(zoomslides: IonSlides, card) {
// Zoom back to normal
const slider = await zoomslides.getSwiper();
const zoom = slider.zoom;
zoom.out();
-
+
// Card back to normal
card.el.style['z-index'] = 9;
-
+
this.zoomActive = false;
this.changeDetectorRef.detectChanges();
}
-
+
touchStart(card) {
// Make card appear above backdrop
card.el.style['z-index'] = 11;