mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
improve chat
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Camera, CameraResultType, CameraSource, Photo} from '@capacitor/camera';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class CameraService {
|
||||
|
||||
constructor() { }
|
||||
|
||||
|
||||
async takePicture(){
|
||||
|
||||
return new Promise<Photo>(async (resolve, reject)=>{
|
||||
|
||||
console.log('add camera to picture')
|
||||
|
||||
const image = await Camera.getPhoto({
|
||||
quality: 50,
|
||||
allowEditing: false,
|
||||
resultType: CameraResultType.Uri,
|
||||
source: CameraSource.Camera // Camera, Photos or Prompt!
|
||||
});
|
||||
|
||||
if (image) {
|
||||
resolve(image)
|
||||
|
||||
} else {
|
||||
reject('Error saving image')
|
||||
}
|
||||
|
||||
//this.capturedImage = this.capturedImage;
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user