merge master into v5

This commit is contained in:
Daniel
2018-08-16 22:43:50 +02:00
parent 2f560d619a
commit f2728f26fe
18 changed files with 1846 additions and 130 deletions

View File

@@ -1,6 +1,5 @@
[![Circle CI](https://circleci.com/gh/ionic-team/ionic-native.svg?style=shield)](https://circleci.com/gh/ionic-team/ionic-native) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) ![](https://img.shields.io/npm/v/@ionic-native/core.svg)
# Ionic Native
Ionic Native is a curated set of wrappers for Cordova plugins that make adding any native functionality you need to your [Ionic](https://ionicframework.com/) mobile app easy.
@@ -10,6 +9,7 @@ Ionic Native wraps plugin callbacks in a Promise or Observable, providing a comm
## Installation
Run following command to install Ionic Native in your project.
```bash
npm install @ionic-native/core@beta --save
```
@@ -72,9 +72,9 @@ export class MyComponent {
// to stop watching
watch.unsubscribe();
});
}
}
```
@@ -151,8 +151,8 @@ Then create a new class that extends the `Camera` class with a mock implementati
class CameraMock extends Camera {
getPicture(options) {
return new Promise((resolve, reject) => {
resolve("BASE_64_ENCODED_DATA_GOES_HERE");
})
resolve('BASE_64_ENCODED_DATA_GOES_HERE');
});
}
}
```
@@ -160,9 +160,7 @@ class CameraMock extends Camera {
Finally, override the previous `Camera` class in your `providers` for this module:
```typescript
providers: [
{ provide: Camera, useClass: CameraMock }
]
providers: [{ provide: Camera, useClass: CameraMock }];
```
Here's the full example:
@@ -188,37 +186,26 @@ class CameraMock extends Camera {
}
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp)
],
declarations: [MyApp, HomePage],
imports: [BrowserModule, IonicModule.forRoot(MyApp)],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
entryComponents: [MyApp, HomePage],
providers: [
{ provide: ErrorHandler, useClass: IonicErrorHandler },
{ provide: Camera, useClass: CameraMock }
]
})
export class AppModule {}
```
### Runtime Diagnostics
Spent way too long diagnosing an issue only to realize a plugin wasn't firing or installed? Ionic Native lets you know what the issue is and how you can resolve it.
![img](https://ionic-io-assets.s3.amazonaws.com/ionic-native-console.png)
## Plugin Missing?
Let us know or submit a PR! Take a look at [the Developer Guide](https://github.com/ionic-team/ionic-native/blob/master/DEVELOPER.md) for more on how to contribute. :heart: