-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
114 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> | ||
<name>MyApp</name> | ||
<name>chat-app</name> | ||
<description>An awesome Ionic/Cordova app.</description> | ||
<author email="[email protected]" href="http://ionicframework.com/">Ionic Framework Team</author> | ||
<content src="index.html" /> | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
export class User { | ||
|
||
key: string; | ||
role: string; | ||
email : string; | ||
password: string; | ||
password: string; | ||
picture: string; | ||
name : string; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { CameraService } from './camera.service'; | ||
|
||
describe('CameraService', () => { | ||
beforeEach(() => TestBed.configureTestingModule({})); | ||
|
||
it('should be created', () => { | ||
const service: CameraService = TestBed.get(CameraService); | ||
expect(service).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Camera, CameraOptions} from "@ionic-native/camera/ngx"; | ||
import { UserService } from '../user/user.service'; | ||
import { AngularFireDatabase } from '@angular/fire/database'; | ||
|
||
@Injectable() | ||
|
||
export class CameraService { | ||
|
||
constructor(private userSevice: UserService, private db: AngularFireDatabase, private camera: Camera) { | ||
|
||
} | ||
|
||
getPicture() { | ||
|
||
let options: CameraOptions = { | ||
|
||
// quality: 100, // quality of the image | ||
allowEdit: true, // alow simple editing of the image before selection | ||
saveToPhotoAlbum: true, | ||
destinationType : this.camera.DestinationType.DATA_URL, | ||
sourceType : this.camera.PictureSourceType.PHOTOLIBRARY, | ||
encodingType: this.camera.EncodingType.JPEG, | ||
mediaType: this.camera.MediaType.PICTURE, | ||
|
||
}; | ||
// select the user object | ||
let pictureRef = this.db.object(`/users/${this.userSevice.getUID()}`); | ||
// get the picture | ||
this.camera.getPicture(options).then((imageData) => { | ||
let base64Image ='data:image/jpeg;base64,' + imageData; | ||
// save the image data:image on that db | ||
pictureRef.update({picture: base64Image}); | ||
},(err) => { | ||
console.log("Error ", err); | ||
}); | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters