mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
save
This commit is contained in:
@@ -10,11 +10,15 @@ 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';
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
|
||||
|
||||
interface LocalFile {
|
||||
name: string;
|
||||
path: string;
|
||||
@@ -45,7 +49,8 @@ export class FileService {
|
||||
private processesService: ProcessesService,
|
||||
private toastService: ToastService,
|
||||
private platform: Platform,
|
||||
private loadingCtrl: LoadingController
|
||||
private loadingCtrl: LoadingController,
|
||||
private http: HttpClient
|
||||
) { }
|
||||
|
||||
async takePicture() {
|
||||
@@ -230,15 +235,11 @@ export class FileService {
|
||||
if (image) {
|
||||
await this.saveImage(image,roomId)
|
||||
}
|
||||
/* const response = await fetch(capturedImage.webPath!);
|
||||
const blob = await response.blob();
|
||||
|
||||
this.photos.unshift({
|
||||
filepath: "soon...",
|
||||
webviewPath: capturedImage.webPath
|
||||
}); */
|
||||
|
||||
//this.capturedImage = this.capturedImage;
|
||||
await Share.share({
|
||||
title: 'Check my image',
|
||||
url: image.path
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
@@ -256,6 +257,13 @@ export class FileService {
|
||||
if (capturedImage) {
|
||||
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();
|
||||
|
||||
@@ -289,6 +297,24 @@ export class FileService {
|
||||
//loader.remove();
|
||||
});
|
||||
*/ }
|
||||
async shareLocalFile(){
|
||||
this.http.get('./assets/any.svg', {responseType: 'blob'}).subscribe(res=>{
|
||||
const reader = new FileReader()
|
||||
reader.onloadend=()=>{
|
||||
const result = reader.result as string
|
||||
const base64Data = result.split(',')[1]
|
||||
|
||||
FileSharer.share({
|
||||
filename:'any.pdf',
|
||||
base64Data,
|
||||
contentType: "application/pdf",
|
||||
})
|
||||
reader.readAsDataURL(res)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
addPictureToChat(roomId) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user