Compare commits

..

66 Commits

Author SHA1 Message Date
Ibby Hadeed
390f474ad5 chore(): update changelog 2017-03-29 19:21:14 -04:00
Ibby Hadeed
d8655f055e 3.4.3 2017-03-29 19:21:07 -04:00
Ibby Hadeed
65cf94b67b fix(app-preferences): fix bug with fetch method
closes #1299
2017-03-29 19:20:46 -04:00
Ibby Hadeed
b91757e7e9 fix(secure-storage): return unfunctional SecureStorageObject if plugin doesn't exist 2017-03-29 19:15:54 -04:00
Ibby Hadeed
612cb963e1 Merge branch 'master' of github.com:driftyco/ionic-native 2017-03-29 19:11:01 -04:00
Odd Christer Brovig
8b31d72139 feat(secure-storage): add keys() and clear() methods (#1281) 2017-03-29 19:10:49 -04:00
mchristofersenrealnets
3b9e7253db docs(admob): @ionic-native (#1298)
Can't import from 'ionic-native'. need to use "@ionic-native/admob-free".
2017-03-29 19:08:54 -04:00
Ibby Hadeed
8b86a12e07 docs(native-storage): add platforms info 2017-03-29 19:02:12 -04:00
Josh Babb
543ae7abf8 docs(jins-meme): add extended usage example (#1286) 2017-03-29 18:56:35 -04:00
Ibby Hadeed
6ccf3a66bb docs(native-page-transitions): improve docs
closes #1294
2017-03-29 18:56:15 -04:00
Ibby Hadeed
2b94ffdc44 fix(admob): add missing license property
fixes #1291
2017-03-29 18:39:46 -04:00
Ibby Hadeed
208748a660 fix(push): add missing plugin decorator
closes #1297
2017-03-29 18:34:02 -04:00
perry
47b593b43d chore(docs): moving docs from /docs/v2/native to /docs/native 2017-03-29 11:19:31 -05:00
Perry Govier
947bf227d0 Running CI2 on master 2017-03-29 10:23:28 -05:00
Perry Govier
4f7718b03e Merge pull request #1289 from driftyco/cci2
chore(): use CircleCI 2
2017-03-29 10:22:41 -05:00
Ibby Hadeed
31d0f71cc9 works 100% 2017-03-28 20:32:14 -04:00
Ibby Hadeed
723ac779df test doc update 2017-03-28 20:30:41 -04:00
Ibby Hadeed
ebd272e30a revert last test commit 2017-03-28 20:28:27 -04:00
Ibby Hadeed
029a196f38 test doc update 2017-03-28 20:27:35 -04:00
Ibby Hadeed
b872bd01ce docs(): update docs 2017-03-28 20:26:43 -04:00
Ibby Hadeed
d6711080e3 update docs on master only 2017-03-28 20:22:34 -04:00
Ibby Hadeed
3e124f1807 update docs only master 2017-03-28 20:13:44 -04:00
Ibby Hadeed
e474b2987f replace cache pattern since we messed it up 2017-03-28 20:06:28 -04:00
Ibby Hadeed
75ee0418bf replace cache pattern since we messed it up 2017-03-28 20:04:03 -04:00
Ibby Hadeed
7c8c71bdc8 fix node_modules path 2017-03-28 20:02:33 -04:00
Ibby Hadeed
3d82d0d592 fix restore cache key 2017-03-28 20:01:17 -04:00
Ibby Hadeed
3f2a983c6e more caching 2017-03-28 19:59:33 -04:00
Ibby Hadeed
7953ca0e72 fixes 2017-03-28 19:46:17 -04:00
Ibby Hadeed
117b0578b0 fixes 2017-03-28 19:45:44 -04:00
Ibby Hadeed
cadafaa3b6 build timeouts 2017-03-28 19:41:50 -04:00
Ibby Hadeed
4778637bd5 Remove machine option 2017-03-28 19:37:52 -04:00
Ibby Hadeed
a1ff059e90 try building 2017-03-28 19:37:05 -04:00
Ibby Hadeed
15237ea983 fix syntax 2017-03-28 19:32:07 -04:00
Ibby Hadeed
b0710cad1e test cci2 2017-03-28 19:31:39 -04:00
Ibby Hadeed
ee269669aa 3.4.2 2017-03-28 11:23:37 -04:00
Ibby Hadeed
97307a2b8c amend(network): fix observable import 2017-03-28 09:41:12 -04:00
Ibby Hadeed
0ae3cb0d00 chore(): update changelog 2017-03-28 09:34:55 -04:00
Ibby Hadeed
0dee3500f7 3.4.1 2017-03-28 09:34:37 -04:00
Ibby Hadeed
b53af8e3c9 fix(admob): fix event listeners
fixes #1165
2017-03-28 09:28:02 -04:00
Ibby Hadeed
006f7dc2ad fix(network): fix onchange method
fixes #1173
2017-03-28 09:07:12 -04:00
Ibby Hadeed
19bc8419e0 fix(network): remove ontypechange method 2017-03-28 09:04:45 -04:00
Ibby Hadeed
d3d8f8264c docs(): add platforms tag 2017-03-28 08:54:40 -04:00
Ibby Hadeed
8262219d05 docs(): update developer docs
closes #1210
2017-03-28 08:49:36 -04:00
Ibby Hadeed
39a91d9520 chore(): update changelog 2017-03-28 08:26:22 -04:00
Ibby Hadeed
88a19af21e 3.4.0 2017-03-28 08:25:59 -04:00
Ibby Hadeed
1dccff5e49 3.3.2 2017-03-28 08:25:38 -04:00
Ibby Hadeed
689f0f159c chore(): add platforms tag 2017-03-28 08:25:07 -04:00
Ibby Hadeed
5aa484c024 docs(): add platforms 2017-03-28 08:24:04 -04:00
Ibby Hadeed
ea88c9e4a8 fix(sqlite): fix SQLiteDatabaseConfig interface
closes #1280
2017-03-28 08:09:07 -04:00
Ibby Hadeed
bc364d1cb1 docs(admob-free): improve docs 2017-03-28 06:54:03 -04:00
Ibby Hadeed
ffa37e2932 feat(taptic-engine): add taptic engine plugin support (#1271)
* Added taptic plugin. #571

* docs(taptic): improve docs

* update to v3
2017-03-28 06:49:32 -04:00
Ibby Hadeed
f911366c54 feat(sqlite-porter): add SQLite porter plugin (#1273)
closes #485
2017-03-28 06:49:27 -04:00
Ibby Hadeed
0ef4a7394e feat(admob-free): add AdMobFree plugin (#1272)
closes #1170
2017-03-28 06:49:22 -04:00
Thomas Kemmer
68d99461c6 feat(zeroconf): add cordova-plugin-zeroconf support (#1260)
* feat(zeroconf): add cordova-plugin-zeroconf support

* feat(zeroconf): restructure documentation
2017-03-28 06:48:43 -04:00
Ibby Hadeed
6a458b52cc chore(): update changelog 2017-03-28 04:45:08 -04:00
Ibby Hadeed
a1a4ef94cc 3.3.1 2017-03-28 04:44:59 -04:00
Ibby Hadeed
6e20137340 fix(contacts): fix major bug 2017-03-28 04:44:48 -04:00
Ibby Hadeed
961727ee61 fix(contacts): handle cordova_not_found errors 2017-03-28 04:37:35 -04:00
Ibby Hadeed
9c30a1d0dd fix(background-mode): add missing config options
closes #1277
2017-03-28 04:31:53 -04:00
Ibby Hadeed
ee79278503 docs(sqlite): improve echoTest and deleteDatabase docs 2017-03-28 04:27:49 -04:00
Ibby Hadeed
544e7ef4fc feat(sqlite): add SQLiteDatabaseConfig interface 2017-03-28 04:13:29 -04:00
Ibby Hadeed
01aece1fbb fix(sqlite): fixes echoTest and deleteDatabase
echoTest and deleteDatabase methods belong to the SQLite class, and not the SQLiteObject class

closes #1275
2017-03-28 04:11:19 -04:00
MobGG
a7854b7fad docs(google-map): change GoogleMapsLatLng to LatLng
change GoogleMapsLatLng to LatLng
2017-03-28 02:16:48 -04:00
Ibby Hadeed
27d3d2d1c9 chore(templates): fix variable 2017-03-27 15:07:48 -04:00
Ibby Hadeed
9074362cae fix(core): handle unexpected errors in wrapOtherPromise
fixes #1185
2017-03-27 15:00:04 -04:00
Ibby Hadeed
fd0a2e9acd fix(core): return errors from CordovaCheck decorators
fixes comment mentioned in #1268
2017-03-27 14:54:25 -04:00
64 changed files with 1032 additions and 156 deletions

View File

@@ -4,7 +4,7 @@
#### There are no rules, but here are a few things to consider:
###### Before you submit an issue:
* Do a quick search to see if there are similar issues
* Make sure that you are waiting for `deviceready` to fire before interacting with any plugin. If you are using Ionic 2, this can be done using [the `Platform.ready()` function](http://ionicframework.com/docs/v2/api/platform/Platform/#ready).
* Make sure that you are waiting for `deviceready` to fire before interacting with any plugin. If you are using Ionic 2, this can be done using [the `Platform.ready()` function](http://ionicframework.com/docs/api/platform/Platform/#ready).
* **Check that you are using the latest version of** `ionic-native`, you can install the latest version by running `npm i --save ionic-native@latest`
###### Still having problems? submit an issue with the following details:

View File

@@ -1,3 +1,81 @@
<a name="3.4.3"></a>
## [3.4.3](https://github.com/driftyco/ionic-native/compare/v3.4.2...v3.4.3) (2017-03-29)
### Bug Fixes
* **admob:** add missing license property ([2b94ffd](https://github.com/driftyco/ionic-native/commit/2b94ffd)), closes [#1291](https://github.com/driftyco/ionic-native/issues/1291)
* **app-preferences:** fix bug with fetch method ([65cf94b](https://github.com/driftyco/ionic-native/commit/65cf94b)), closes [#1299](https://github.com/driftyco/ionic-native/issues/1299)
* **push:** add missing plugin decorator ([208748a](https://github.com/driftyco/ionic-native/commit/208748a)), closes [#1297](https://github.com/driftyco/ionic-native/issues/1297)
* **secure-storage:** return unfunctional SecureStorageObject if plugin doesn't exist ([b91757e](https://github.com/driftyco/ionic-native/commit/b91757e))
### Features
* **secure-storage:** add keys() and clear() methods (#1281) ([8b31d72](https://github.com/driftyco/ionic-native/commit/8b31d72))
<a name="3.4.2"></a>
## [3.4.2](https://github.com/driftyco/ionic-native/compare/v3.4.1...v3.4.2) (2017-03-28)
<a name="3.4.1"></a>
## [3.4.1](https://github.com/driftyco/ionic-native/compare/v3.4.0...v3.4.1) (2017-03-28)
### Bug Fixes
* **admob:** fix event listeners ([b53af8e](https://github.com/driftyco/ionic-native/commit/b53af8e)), closes [#1165](https://github.com/driftyco/ionic-native/issues/1165)
* **network:** fix onchange method ([006f7dc](https://github.com/driftyco/ionic-native/commit/006f7dc)), closes [#1173](https://github.com/driftyco/ionic-native/issues/1173)
* **network:** remove ontypechange method ([19bc841](https://github.com/driftyco/ionic-native/commit/19bc841))
<a name="3.4.0"></a>
# [3.4.0](https://github.com/driftyco/ionic-native/compare/v3.3.2...v3.4.0) (2017-03-28)
<a name="3.3.2"></a>
## [3.3.2](https://github.com/driftyco/ionic-native/compare/v3.3.1...v3.3.2) (2017-03-28)
### Bug Fixes
* **sqlite:** fix SQLiteDatabaseConfig interface ([ea88c9e](https://github.com/driftyco/ionic-native/commit/ea88c9e)), closes [#1280](https://github.com/driftyco/ionic-native/issues/1280)
### Features
* **admob-free:** add AdMobFree plugin (#1272) ([0ef4a73](https://github.com/driftyco/ionic-native/commit/0ef4a73)), closes [#1170](https://github.com/driftyco/ionic-native/issues/1170)
* **sqlite-porter:** add SQLite porter plugin (#1273) ([f911366](https://github.com/driftyco/ionic-native/commit/f911366)), closes [#485](https://github.com/driftyco/ionic-native/issues/485)
* **taptic-engine:** add taptic engine plugin support (#1271) ([ffa37e2](https://github.com/driftyco/ionic-native/commit/ffa37e2))
* **zeroconf:** add cordova-plugin-zeroconf support (#1260) ([68d9946](https://github.com/driftyco/ionic-native/commit/68d9946))
<a name="3.3.1"></a>
## [3.3.1](https://github.com/driftyco/ionic-native/compare/v3.3.0...v3.3.1) (2017-03-28)
### Bug Fixes
* **background-mode:** add missing config options ([9c30a1d](https://github.com/driftyco/ionic-native/commit/9c30a1d)), closes [#1277](https://github.com/driftyco/ionic-native/issues/1277)
* **contacts:** fix major bug ([6e20137](https://github.com/driftyco/ionic-native/commit/6e20137))
* **contacts:** handle cordova_not_found errors ([961727e](https://github.com/driftyco/ionic-native/commit/961727e))
* **core:** handle unexpected errors in wrapOtherPromise ([9074362](https://github.com/driftyco/ionic-native/commit/9074362)), closes [#1185](https://github.com/driftyco/ionic-native/issues/1185)
* **core:** return errors from CordovaCheck decorators ([fd0a2e9](https://github.com/driftyco/ionic-native/commit/fd0a2e9)), closes [#1268](https://github.com/driftyco/ionic-native/issues/1268)
* **sqlite:** fixes echoTest and deleteDatabase ([01aece1](https://github.com/driftyco/ionic-native/commit/01aece1)), closes [#1275](https://github.com/driftyco/ionic-native/issues/1275)
### Features
* **sqlite:** add SQLiteDatabaseConfig interface ([544e7ef](https://github.com/driftyco/ionic-native/commit/544e7ef))
<a name="3.3.0"></a>
# [3.3.0](https://github.com/driftyco/ionic-native/compare/v3.2.4...v3.3.0) (2017-03-27)

View File

@@ -17,6 +17,7 @@ gulp plugin:create -n PluginName
gulp plugin:create -m -n PluginName
```
Running the command above will create a new directory `src/@ionic-native/plugins/plugin-name/` with a single file in there: `index.ts`. This file is where all the plugin definitions should be.
Let's take a look at the existing plugin wrapper for Geolocation to see what goes into an Ionic Native plugin (comments have been removed for clarity):
@@ -110,7 +111,7 @@ The `@Cordova` decorator has a few more options now.
### Testing your changes
You need to run `npm run build` in the `ionic-native` project, this will create a `dist` directory. Then, you must go to your ionic application folder and replace your current `node_modules/ionic-native/dist/` with the newly generated one.
You need to run `npm run build` in the `ionic-native` project, this will create a `dist` directory. The `dist` directory will contain a sub directory `@ionic-native` with all the packages compiled in there. Copy the package(s) you created/modified to your app's node_modules under the `@ionic-native` directory. (e.g. `cp -r dist/@ionic-native/plugin-name ../my-app/node_modules/@ionic-native/`).
### Cleaning the code
@@ -147,4 +148,65 @@ The subject contains succinct description of the change:
* use the imperative, present tense: "change" not "changed" nor "changes"
* do not capitalize first letter
* do not place a period (.) at the end
* entire length of the commit message must not go over 50 characters
* entire length of the commit message must not go over 50 characters
### Ionic Native Decorators
#### Plugin
A decorator to wrap the main plugin class, and any other classes that will use `@Cordova` or `@CordovaProperty` decorators. This decorator accepts the following configuration:
- *pluginName*: Plugin name, this should match the class name
- *plugin*: The plugin's NPM package, or Github URL if NPM is not available.
- *pluginRef*: The plugin object reference. Example: 'cordova.file'.
- *repo*: The plugin's Github Repository URL
- *install*: (optional) Install command. This is used in case a plugin has a custom install command (takes variables).
- *platforms*: An array of strings indicating the supported platforms.
#### Cordova
Checks if the plugin and the method are available before executing. By default, the decorator will wrap the callbacks of the function and return a Promise. This decorator takes the following configuration options:
- **observable**: set to true to return an Observable
- **clearFunction**: an optional name of a method to clear the observable we returned
- **clearWithArgs**: This can be used if clearFunction is set. Set this to true to call the clearFunction with the same arguments used in the initial function.
- **sync**: set to true if the method should return the value as-is without wrapping with Observable/Promise
- **callbackOrder**: set to `reverse` if the success and error callbacks are the first two arguements of the method
- **callbackStyle**: set to `node` if the plugin has one callback with a node style (e.g: `function(err, result){}`), or set to `object` if the callbacks are part of an object
- **successName**: Success function property name. This must be set if callbackStyle is set to object.
- **errorName**: Error function property name. This must be set if callbackStyle is set to object.
- **successIndex**: Set a custom index for the success callback function. This doesn't work if callbackOrder or callbackStyle are set.
- **errorIndex**: Set a custom index for the error callback function. This doesn't work if callbackOrder or callbackStyle are set.
- **eventObservable**: set to true to return an observable that wraps an event listener
- **event**: Event name, this must be set if eventObservable is set to true
- **element**: Element to attach the event listener to, this is optional, defaults to `window`
- **otherPromise**: Set to true if the wrapped method returns a promise
- **platforms**: array of strings indicating supported platforms. Specify this if the supported platforms doesn't match the plugin's supported platforms.
Example:
```ts
@Cordova()
someMethod(): Promise<any> { return; }
@Cordova({ sync: true })
syncMethod(): number { }
```
#### CordovaProperty
Checks if the plugin and property exist before getting/setting the property's value
Example:
```ts
@CordovaProperty
someProperty: string;
```
#### CordovaCheck
Checks if the plugin exists before performing a custom written method. By default, the method will return a promise that will reject with an error if the plugin is not available. This wrapper accepts two optional configurations:
- **observable**: set to true to return an empty Observable if the plugin isn't available
- **sync**: set to true to return nothing if the plugin isn't available
Example:
```ts
@CordovaCheck()
someMethod(): Promise<any> {
// anything here will only run if the plugin is available
}
```

View File

@@ -14,11 +14,11 @@ Run following command to install Ionic Native in your project.
npm install @ionic-native/core --save
```
You also need to install the Ionic Native package for each plugin you want to add. Please see the [Ionic Native documentation](http://ionicframework.com/docs/v2/native/) for complete instructions on how to add and use the plugins.
You also need to install the Ionic Native package for each plugin you want to add. Please see the [Ionic Native documentation](http://ionicframework.com/docs/native/) for complete instructions on how to add and use the plugins.
## Documentation
For the full Ionic Native documentation, please visit [http://ionicframework.com/docs/v2/native/](http://ionicframework.com/docs/v2/native/).
For the full Ionic Native documentation, please visit [http://ionicframework.com/docs/native/](http://ionicframework.com/docs/native/).
### Basic Usage

View File

@@ -1,26 +1,38 @@
machine:
node:
version: 5.5.0
ruby:
version: 2.1.2
general:
branches:
only:
- master # ignore PRs and branches
dependencies:
pre:
- ./scripts/docs/prepare.sh
cache_directories:
- "~/ionic-site" # cache ionic-site
test:
override:
- echo "No tests to run"
deployment:
staging:
branch: master
commands:
- ./scripts/docs/update_docs.sh
version: 2
jobs:
build:
working_directory: ~/ionic-native/
docker:
- image: node:7
steps:
- checkout
- restore_cache:
key: ionic-site
- run:
name: Prepare ionic-site repo
command: ./scripts/docs/prepare.sh
- save_cache:
key: ionic-site
paths:
- ~/ionic-site/
- restore_cache:
key: node_modules_{{ checksum "package.json" }}
- run:
name: Install node modules
command: npm i
- save_cache:
key: node_modules_{{ checksum "package.json" }}
paths:
- ~/ionic-native/node_modules/
- run:
name: Run tslint
command: npm run lint
- add_ssh_keys
- deploy:
name: Update docs
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
./scripts/docs/update_docs.sh
else
echo "We are on ${CIRCLE_BRANCH} branch, not going to update docs."
fi

View File

@@ -1,6 +1,6 @@
{
"name": "ionic-native",
"version": "3.3.0",
"version": "3.4.3",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"license": "MIT",
"devDependencies": {

View File

@@ -1,6 +1,6 @@
{
"sitePath": "../ionic-site",
"v2DocsDir": "docs/v2/native",
"docsDest": "../ionic-site/content/docs/v2/native",
"v2DocsDir": "docs/native",
"docsDest": "../ionic-site/content/docs/native",
"pluginDir": "dist/@ionic-native"
}

View File

@@ -30,7 +30,7 @@ function run {
git pull origin master
fi
git rm -rf content/docs/v2/native/*/ || true
git rm -rf content/docs/native/*/ || true
}

View File

@@ -19,7 +19,7 @@ module.exports = function jekyll(renderDocsProcessor) {
docs.forEach(doc => {
doc.outputPath = doc.outputPath.toLowerCase().replace(/\s/g, '-');
doc.URL = doc.outputPath.replace('docs/v2//', 'docs/v2/')
doc.URL = doc.outputPath.replace('docs//', 'docs/')
.replace('/index.md', '')
.replace('content/', '');
});
@@ -29,7 +29,7 @@ module.exports = function jekyll(renderDocsProcessor) {
docType: 'nativeMenu',
id: 'native_menu',
template: 'native_menu.template.html',
outputPath: 'content/_includes/v2_fluid/native_menu.html'
outputPath: 'content/_includes/fluid/native_menu.html'
});
return docs;

View File

@@ -1,5 +1,5 @@
---
layout: "v2_fluid/docs_base"
layout: "fluid/docs_base"
version: "<$ version.current.name $>"
versionHref: "<$ version.current.href.replace('content/','') $>"
path: "<$ doc.path $>"

View File

@@ -1,8 +1,8 @@
<li class="capitalize {% if page.id == 'overview' %}active{% endif %}">
<a href="/docs/v2/native/">Overview</a>
<a href="/docs/native/">Overview</a>
</li>
<li class="capitalize {% if page.id == 'mocking' %}active{% endif %}">
<a href="/docs/v2/native/browser.html">Browser Usage</a>
<a href="/docs/native/browser.html">Browser Usage</a>
</li>
<@- for doc in docs @><@ if doc.URL and doc.private != true and doc.beta != true @>
<li class="capitalize {% if page.id == '<$ doc.name|lower|dashify $>' %}active{% endif %}">

View File

@@ -20,7 +20,7 @@ $ <@ if prop.install @><$ prop.install $><@ else @>ionic plugin add <$ prop.plug
$ npm install --save @ionic-native/<$ doc.npmId $>
```
## [Usage Documentation](https://ionicframework.com/docs/v2/native/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic-native/', '')|replace('//','/')|replace('index.ts','')|replace('src/@ionic-native/plugins/','') $>)
## [Usage Documentation](https://ionicframework.com/docs/native/<$ doc.fileInfo.relativePath|replace('/home/ubuntu/ionic-native/', '')|replace('//','/')|replace('index.ts','')|replace('src/@ionic-native/plugins/','') $>)
Plugin Repo: [<$ prop.repo $>](<$ prop.repo $>)

View File

@@ -2,7 +2,7 @@ import { Plugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
/**
* @name Plugin Name
* @name $Plugin_Name
* @description
*
* @usage
@@ -21,7 +21,8 @@ import { Injectable } from '@angular/core';
pluginName: '$PluginName',
plugin: '',
pluginRef: '',
repo: ''
repo: '',
platforms: []
})
@Injectable()
export class $PluginName {

View File

@@ -40,7 +40,8 @@ import { Observable } from 'rxjs/Observable';
plugin: '', // npm package name, example: cordova-plugin-camera
pluginRef: '', // the variable reference to call the plugin, example: navigator.geolocation
repo: '', // the github repository URL for the plugin
install: '' // OPTIONAL install command, in case the plugin requires variables
platforms: [], // Array of platforms supported, example: ['Android', 'iOS']
install: '', // OPTIONAL install command, in case the plugin requires variables
})
@Injectable()
export class $PluginName {

View File

@@ -1,6 +1,7 @@
import { instanceAvailability, checkAvailability, wrap, wrapInstance, overrideFunction } from './plugin';
import { getPlugin, getPromise } from './util';
import { Observable } from 'rxjs/Observable';
import 'rxjs/observable/throw';
export interface PluginConfig {
/**
@@ -145,15 +146,16 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) {
return (pluginObj: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>): TypedPropertyDescriptor<any> => {
return {
value: function(...args: any[]): any {
if (checkAvailability(pluginObj) === true) {
const check = checkAvailability(pluginObj);
if (check === true) {
return descriptor.value.apply(this, args);
} else {
if (opts.sync) {
return;
return null;
} else if (opts.observable) {
return new Observable<any>(() => {});
return Observable.throw(new Error(check && check.error));
}
return getPromise(() => {});
return Promise.reject(check && check.error);
}
}
};

View File

@@ -152,11 +152,16 @@ function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any
function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any= {}) {
return getPromise((resolve, reject) => {
let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
if (pluginResult && pluginResult.error) {
reject(pluginResult.error);
const pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
if (pluginResult) {
if (pluginResult.error) {
reject(pluginResult.error);
} else if (pluginResult.then) {
pluginResult.then(resolve).catch(reject);
}
} else {
reject({ error: 'unexpected_error' });
}
pluginResult.then(resolve).catch(reject);
});
}

View File

@@ -0,0 +1,294 @@
import { Plugin, Cordova } from '@ionic-native/core';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/fromEvent';
export interface AdMobFreeBannerConfig {
/**
* Ad Unit ID
*/
id?: string;
/**
* Receiving test ad
*/
isTesting?: boolean;
/**
* Auto show ad when loaded
*/
autoShow?: boolean;
/**
* Set to true, to put banner at top
*/
bannerAtTop?: boolean;
/**
* Set to true, to allow banner overlap WebView
*/
overlap?: boolean;
/**
* Set to true to avoid ios7 status bar overlap
*/
offsetTopBar?: boolean;
/**
* Banner size
*/
size?: string;
}
export interface AdMobFreeInterstitialConfig {
/**
* Ad Unit ID
*/
id?: string;
/**
* Receiving test ad
*/
isTesting?: boolean;
/**
* Auto show ad when loaded
*/
autoShow?: boolean;
}
export interface AdMobFreeRewardVideoConfig {
/**
* Ad Unit ID
*/
id?: string;
/**
* Receiving test ad
*/
isTesting?: boolean;
/**
* Auto show ad when loaded
*/
autoShow?: boolean;
}
/**
* @name AdbMobFree
* @description
*
* @usage
* ```
* import { AdMobFree, AdMobFreeBannerConfig } from '@ionic-native/admob-free';
*
*
* constructor(private admobFree: AdMobFree) { }
*
*
* ...
*
*
* const bannerConfig: AdMobFreeBannerConfig = {
* // add your config here
* // for the sake of this example we will just use the test config
* isTesting: true,
* autoShow: true
* };
* this.admobFree.banner.config(bannerConfig);
*
* this.admobFree.banner.prepare()
* .then(() => {
* // banner Ad is ready
* // if we set autoShow to false, then we will need to call the show method here
* })
* .catch(e => console.log(e));
*
*
* ```
*/
@Plugin({
pluginName: 'AdMobFree',
plugin: 'cordova-plugin-admob-free',
pluginRef: 'admob',
repo: 'https://github.com/ratson/cordova-plugin-admob-free',
platforms: ['Android', 'iOS']
})
@Injectable()
export class AdMobFree {
/**
* Convenience constructor to get event names
*/
events = {
BANNER_LOAD: 'admob.banner.events.LOAD',
BANNER_LOAD_FAIL: 'admob.banner.events.LOAD_FAIL',
BANNER_OPEN: 'admob.banner.events.OPEN',
BANNER_CLOSE: 'admob.banner.events.CLOSE',
BANNER_EXIT_APP: 'admob.banner.events.EXIT_APP',
INTERSTITIAL_LOAD: 'admob.interstitial.events.LOAD',
INTERSTITIAL_LOAD_FAIL: 'admob.interstitial.events.LOAD_FAIL',
INTERSTITIAL_OPEN: 'admob.interstitial.events.OPEN',
INTERSTITIAL_CLOSE: 'admob.interstitial.events.CLOSE',
INTERSTITIAL_EXIT_APP: 'admob.interstitial.events.EXIT_APP',
REWARD_VIDEO_LOAD: 'admob.rewardvideo.events.LOAD',
REWARD_VIDEO_LOAD_FAIL: 'admob.rewardvideo.events.LOAD_FAIL',
REWARD_VIDEO_OPEN: 'admob.rewardvideo.events.OPEN',
REWARD_VIDEO_CLOSE: 'admob.rewardvideo.events.CLOSE',
REWARD_VIDEO_EXIT_APP: 'admob.rewardvideo.events.EXIT_APP',
REWARD_VIDEO_START: 'admob.rewardvideo.events.START',
REWARD_VIDEO_REWARD: 'admob.rewardvideo.events.REWARD'
};
/**
* Watch an event
* @param event {string} event name
* @return {Observable<any>}
*/
on(event: string): Observable<any> {
return Observable.fromEvent(document, event);
}
/**
*
* @type {AdMobFreeBanner}
*/
banner: AdMobFreeBanner = new AdMobFreeBanner();
/**
*
* @type {AdMobFreeInterstitial}
*/
interstitial: AdMobFreeInterstitial = new AdMobFreeInterstitial();
/**
*
* @type {AdMobFreeRewardVideo}
*/
rewardVideo: AdMobFreeRewardVideo = new AdMobFreeRewardVideo();
}
/**
* @hidden
*/
@Plugin({
pluginName: 'AdMobFree',
plugin: 'cordova-plugin-admob-free',
pluginRef: 'admob.banner',
})
export class AdMobFreeBanner {
/**
* Update config.
* @param options
* @return {AdMobFreeBannerConfig}
*/
@Cordova({ sync: true })
config(options: AdMobFreeBannerConfig): AdMobFreeBannerConfig { return; }
/**
* Hide the banner.
* @return {Promise<any>}
*/
@Cordova({ sync: true })
hide(): Promise<any> { return; }
/**
* Create banner.
* @return {Promise<any>}
*/
@Cordova({ sync: true })
prepare(): Promise<any> { return; }
/**
* Remove the banner.
* @return {Promise<any>}
*/
@Cordova({ sync: true })
remove(): Promise<any> { return; }
/**
* Show the banner.
* @return {Promise<any>}
*/
@Cordova({ sync: true })
show(): Promise<any> { return; }
}
/**
* @hidden
*/
@Plugin({
pluginName: 'AdMobFree',
plugin: 'cordova-plugin-admob-free',
pluginRef: 'admob.interstitial',
})
export class AdMobFreeInterstitial {
/**
* Update config.
* @param options
* @return {AdMobFreeInterstitialConfig}
*/
@Cordova({ sync: true })
config(options: AdMobFreeInterstitialConfig): AdMobFreeInterstitialConfig { return; }
/**
* Check if interstitial is ready
* @return {Promise<any>}
*/
@Cordova({ sync: true })
isReady(): Promise<any> { return; }
/**
* Prepare interstitial
* @return {Promise<any>}
*/
@Cordova({ sync: true })
prepare(): Promise<any> { return; }
/**
* Show the interstitial
* @return {Promise<any>}
*/
@Cordova({ sync: true })
show(): Promise<any> { return; }
}
/**
* @hidden
*/
@Plugin({
pluginName: 'AdMobFree',
plugin: 'cordova-plugin-admob-free',
pluginRef: 'admob.rewardvideo',
})
export class AdMobFreeRewardVideo {
/**
* Update config.
* @param options
* @return {AdMobFreeRewardVideoConfig}
*/
@Cordova({ sync: true })
config(options: AdMobFreeRewardVideoConfig): AdMobFreeRewardVideoConfig { return; }
/**
* Check if reward video is ready
* @return {Promise<any>}
*/
@Cordova({ sync: true })
isReady(): Promise<any> { return; }
/**
* Prepare reward video
* @return {Promise<any>}
*/
@Cordova({ sync: true })
prepare(): Promise<any> { return; }
/**
* Show the reward video
* @return {Promise<any>}
*/
@Cordova({ sync: true })
show(): Promise<any> { return; }
}

View File

@@ -66,6 +66,11 @@ export interface AdMobOptions {
*/
adExtras?: AdExtras;
/**
* License key for the plugin
*/
license?: any;
}
export interface AdExtras {
@@ -242,7 +247,8 @@ export class AdMob {
*/
@Cordova({
eventObservable: true,
event: 'onAdFailLoad'
event: 'onAdFailLoad',
element: document
})
onAdFailLoad(): Observable<any> { return; }
@@ -252,7 +258,8 @@ export class AdMob {
*/
@Cordova({
eventObservable: true,
event: 'onAdLoaded'
event: 'onAdLoaded',
element: document
})
onAdLoaded(): Observable<any> { return; }
@@ -262,7 +269,8 @@ export class AdMob {
*/
@Cordova({
eventObservable: true,
event: 'onAdPresent'
event: 'onAdPresent',
element: document
})
onAdPresent(): Observable<any> { return; }
@@ -272,7 +280,8 @@ export class AdMob {
*/
@Cordova({
eventObservable: true,
event: 'onAdLeaveApp'
event: 'onAdLeaveApp',
element: document
})
onAdLeaveApp(): Observable<any> { return; }
@@ -282,7 +291,8 @@ export class AdMob {
*/
@Cordova({
eventObservable: true,
event: 'onAdDismiss'
event: 'onAdDismiss',
element: document
})
onAdDismiss(): Observable<any> { return; }

View File

@@ -144,7 +144,8 @@ export interface AFAEncryptResponse {
pluginName: 'AndroidFingerprintAuth',
plugin: 'cordova-plugin-android-fingerprint-auth',
pluginRef: 'FingerprintAuth',
repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth'
repo: 'https://github.com/mjwheatley/cordova-plugin-android-fingerprint-auth',
platforms: ['Android']
})
@Injectable()
export class AndroidFingerprintAuth {

View File

@@ -21,9 +21,10 @@ import { Injectable } from '@angular/core';
*/
@Plugin({
pluginName: 'AppPreferences',
plugin: 'cordova-plugin-app-preferences', // npm package name, example: cordova-plugin-camera
pluginRef: 'plugins.appPreferences', // the variable reference to call the plugin, example: navigator.geolocation
repo: 'https://github.com/apla/me.apla.cordova.app-preferences', // the github repository URL for the plugin
plugin: 'cordova-plugin-app-preferences',
pluginRef: 'plugins.appPreferences',
repo: 'https://github.com/apla/me.apla.cordova.app-preferences',
platforms: ['Android', 'BlackBerry 10', 'Browser', 'iOS', 'OS X', 'Windows 8', 'Windows Phone']
})
@Injectable()
export class AppPreferences {
@@ -36,7 +37,6 @@ export class AppPreferences {
* @return {Promise<any>} Returns a promise
*/
@Cordova({
sync: true,
callbackOrder: 'reverse'
})
fetch(dict: string, key?: string): Promise<any> { return; }

View File

@@ -28,7 +28,7 @@ import { Injectable } from '@angular/core';
plugin: 'https://github.com/appodeal/appodeal-cordova-plugin',
pluginRef: 'Appodeal',
repo: 'https://github.com/appodeal/appodeal-cordova-plugin.git',
platforms: [ 'ios', 'android' ]
platforms: [ 'iOS', 'Android' ]
})
@Injectable()
export class Appodeal {

View File

@@ -13,26 +13,37 @@ export interface BackgroundModeConfiguration {
*/
title?: String;
/**
* The text that scrolls itself on statusbar
*/
ticker?: String;
/**
* Description of background task
*/
text?: String;
/**
* if true plugin will not display a notification. Default is false.
* This will look for <icon name>.png in platforms/android/res/drawable|mipmap
*/
silent?: boolean;
icon?: string;
color?: string;
/**
* By default the app will come to foreground when taping on the notification. If false, plugin wont come to foreground when tapped.
*/
resume?: boolean;
hidden?: boolean;
bigText?: boolean;
/**
* The text that scrolls itself on statusbar
*/
ticker?: String;
/**
* if true plugin will not display a notification. Default is false.
*/
silent?: boolean;
}
/**

View File

@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability } from '@ionic-native/core';
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability, CordovaCheck } from '@ionic-native/core';
declare var window: any,
navigator: any;
@@ -72,7 +72,7 @@ export class Contact implements IContactProperties {
@InstanceProperty urls: IContactField[];
constructor() {
if (checkAvailability(navigator.contacts, 'create', 'Contacts') === true) {
if (checkAvailability('navigator.contacts', 'create', 'Contacts') === true) {
this._objectInstance = navigator.contacts.create();
}
}
@@ -290,7 +290,8 @@ export class ContactFindOptions implements IContactFindOptions {
pluginName: 'Contacts',
plugin: 'cordova-plugin-contacts',
pluginRef: 'navigator.contacts',
repo: 'https://github.com/apache/cordova-plugin-contacts'
repo: 'https://github.com/apache/cordova-plugin-contacts',
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Ubuntu', 'Windows', 'Windows 8', 'Windows Phone']
})
@Injectable()
export class Contacts {
@@ -309,6 +310,7 @@ export class Contacts {
* @param options {IContactFindOptions} Optional options for the query
* @returns {Promise<Contact[]>} Returns a Promise that resolves with the search results (an array of Contact objects)
*/
@CordovaCheck()
find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
return getPromise((resolve, reject) => {
navigator.contacts.find(fields, (contacts) => {
@@ -321,6 +323,7 @@ export class Contacts {
* Select a single Contact.
* @returns {Promise<Contact>} Returns a Promise that resolves with the selected Contact
*/
@CordovaCheck()
pickContact(): Promise<Contact> {
return getPromise((resolve, reject) => {
navigator.contacts.pickContact((contact) => resolve(processContact(contact)), reject);

View File

@@ -26,6 +26,7 @@ import { Injectable } from '@angular/core';
plugin: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin',
pluginRef: 'cblite',
repo: 'https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin',
platforms: ['Android', 'iOS']
})
@Injectable()
export class CouchbaseLite {

View File

@@ -23,7 +23,8 @@ import { Cordova, Plugin } from '@ionic-native/core';
pluginName: 'Crop',
plugin: 'cordova-plugin-crop',
pluginRef: 'plugins',
repo: 'https://github.com/jeduan/cordova-plugin-crop'
repo: 'https://github.com/jeduan/cordova-plugin-crop',
platforms: ['Android', 'iOS']
})
@Injectable()
export class Crop {

View File

@@ -78,7 +78,7 @@ export interface DeeplinkMatch {
plugin: 'ionic-plugin-deeplinks',
pluginRef: 'IonicDeeplink',
repo: 'https://github.com/driftyco/ionic-plugin-deeplinks',
platforms: ['iOS', 'Android'],
platforms: ['iOS', 'Android', 'Browser'],
install: 'ionic plugin add ionic-plugin-deeplinks --variable URL_SCHEME=myapp --variable DEEPLINK_SCHEME=https --variable DEEPLINK_HOST=example.com --variable ANDROID_PATH_PREFIX=/',
installVariables: ['URL_SCHEME', 'DEEPLINK_SCHEME', 'DEEPLINK_HOST', 'ANDROID_PATH_PREFIX']
})

View File

@@ -71,7 +71,8 @@ export interface DeviceMotionAccelerometerOptions {
pluginName: 'DeviceMotion',
plugin: 'cordova-plugin-device-motion',
pluginRef: 'navigator.accelerometer',
repo: 'https://github.com/apache/cordova-plugin-device-motion'
repo: 'https://github.com/apache/cordova-plugin-device-motion',
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone']
})
@Injectable()
export class DeviceMotion {

View File

@@ -76,7 +76,8 @@ export interface DeviceOrientationCompassOptions {
pluginName: 'DeviceOrientation',
plugin: 'cordova-plugin-device-orientation',
pluginRef: 'navigator.compass',
repo: 'https://github.com/apache/cordova-plugin-device-orientation'
repo: 'https://github.com/apache/cordova-plugin-device-orientation',
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone']
})
@Injectable()
export class DeviceOrientation {

View File

@@ -23,7 +23,8 @@ declare var window: any;
pluginName: 'Device',
plugin: 'cordova-plugin-device',
pluginRef: 'device',
repo: 'https://github.com/apache/cordova-plugin-device'
repo: 'https://github.com/apache/cordova-plugin-device',
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'OS X', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone']
})
@Injectable()
export class Device {

View File

@@ -38,7 +38,8 @@ import {Cordova, Plugin, CordovaProperty} from '@ionic-native/core';
pluginName: 'Diagnostic',
plugin: 'cordova.plugins.diagnostic',
pluginRef: 'cordova.plugins.diagnostic',
repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin'
repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin',
platforms: ['Android', 'iOS', 'Windows']
})
@Injectable()
export class Diagnostic {

View File

@@ -45,7 +45,8 @@ export interface DialogsPromptCallback {
pluginName: 'Dialogs',
plugin: 'cordova-plugin-dialogs',
pluginRef: 'navigator.notification',
repo: 'https://github.com/apache/cordova-plugin-dialogs.git'
repo: 'https://github.com/apache/cordova-plugin-dialogs.git',
platforms: ['Android', 'BlackBerry 10', 'Firefox OS', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone']
})
@Injectable()
export class Dialogs {

View File

@@ -113,7 +113,8 @@ export interface FacebookLoginResponse {
pluginRef: 'facebookConnectPlugin',
repo: 'https://github.com/jeduan/cordova-plugin-facebook4',
install: 'ionic plugin add cordova-plugin-facebook4 --variable APP_ID="123456789" --variable APP_NAME="myApplication"',
installVariables: ['APP_ID', 'APP_NAME']
installVariables: ['APP_ID', 'APP_NAME'],
platforms: ['Android', 'iOS']
})
@Injectable()
export class Facebook {

View File

@@ -24,7 +24,8 @@ import { Plugin, Cordova } from '@ionic-native/core';
pluginName: 'FileOpener',
plugin: 'cordova-plugin-file-opener2',
pluginRef: 'cordova.plugins.fileOpener2',
repo: 'https://github.com/pwlin/cordova-plugin-file-opener2'
repo: 'https://github.com/pwlin/cordova-plugin-file-opener2',
platforms: ['Android', 'iOS', 'Windows', 'Windows Phone 8']
})
@Injectable()
export class FileOpener {

View File

@@ -367,7 +367,8 @@ export declare var FileError: {
pluginName: 'File',
plugin: 'cordova-plugin-file',
pluginRef: 'cordova.file',
repo: 'https://github.com/apache/cordova-plugin-file'
repo: 'https://github.com/apache/cordova-plugin-file',
platforms: ['Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'OS X', 'Ubuntu', 'Windows', 'Windows Phone']
})
@Injectable()
export class File {

View File

@@ -24,7 +24,8 @@ import { Cordova, Plugin } from '@ionic-native/core';
pluginName: 'Flashlight',
plugin: 'cordova-plugin-flashlight',
pluginRef: 'window.plugins.flashlight',
repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git'
repo: 'https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
@Injectable()
export class Flashlight {

View File

@@ -152,7 +152,8 @@ export interface GeolocationOptions {
pluginName: 'Geolocation',
plugin: 'cordova-plugin-geolocation',
pluginRef: 'navigator.geolocation',
repo: 'https://github.com/apache/cordova-plugin-geolocation'
repo: 'https://github.com/apache/cordova-plugin-geolocation',
platforms: ['Android', 'Firefox OS', 'iOS', 'Ubuntu', 'Windows', 'Windows Phone']
})
@Injectable()
export class Geolocation {

View File

@@ -406,7 +406,7 @@ export class GoogleMap {
* map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!'));
*
* // create LatLng object
* let ionic: LatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);
* let ionic: LatLng = new LatLng(43.0741904,-89.3809802);
*
* // create CameraPosition
* let position: CameraPosition = {
@@ -451,7 +451,8 @@ export class GoogleMap {
plugin: 'cordova-plugin-googlemaps',
repo: 'https://github.com/mapsplugin/cordova-plugin-googlemaps',
install: 'ionic plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="YOUR_ANDROID_API_KEY_IS_HERE" --variable API_KEY_FOR_IOS="YOUR_IOS_API_KEY_IS_HERE"',
installVariables: ['API_KEY_FOR_ANDROID', 'API_KEY_FOR_IOS']
installVariables: ['API_KEY_FOR_ANDROID', 'API_KEY_FOR_IOS'],
platforms: ['Android', 'iOS']
})
@Injectable()
export class GoogleMaps {

View File

@@ -171,7 +171,8 @@ export interface HealthData {
pluginName: 'Health',
plugin: 'cordova-plugin-health',
pluginRef: 'navigator.health',
repo: 'https://github.com/dariosalvi78/cordova-plugin-health'
repo: 'https://github.com/dariosalvi78/cordova-plugin-health',
platforms: ['Android', 'iOS']
})
@Injectable()
export class Health {

View File

@@ -59,7 +59,8 @@ export interface ImagePickerOptions {
pluginName: 'ImagePicker',
plugin: 'https://github.com/Telerik-Verified-Plugins/ImagePicker',
pluginRef: 'window.imagePicker',
repo: 'https://github.com/Telerik-Verified-Plugins/ImagePicker'
repo: 'https://github.com/Telerik-Verified-Plugins/ImagePicker',
platforms: ['Android', 'iOS']
})
@Injectable()
export class ImagePicker {

View File

@@ -76,7 +76,8 @@ export interface ImageResizerOptions {
pluginName: 'ImageResizer',
plugin: 'https://github.com/protonet/cordova-plugin-image-resizer.git',
pluginRef: 'ImageResizer',
repo: 'https://github.com/protonet/cordova-plugin-image-resizer'
repo: 'https://github.com/protonet/cordova-plugin-image-resizer',
platforms: ['Android', 'iOS', 'Windows']
})
@Injectable()
export class ImageResizer {

View File

@@ -162,7 +162,8 @@ export class InAppBrowserObject {
pluginName: 'InAppBrowser',
plugin: 'cordova-plugin-inappbrowser',
pluginRef: 'cordova.InAppBrowser',
repo: 'https://github.com/apache/cordova-plugin-inappbrowser'
repo: 'https://github.com/apache/cordova-plugin-inappbrowser',
platforms: ['Amazon', 'Android', 'BlackBerry 10', 'Browser', 'Firefox OS', 'iOS', 'OS X', 'Ubuntu', 'Windows', 'Windows Phone']
})
@Injectable()
export class InAppBrowser {

View File

@@ -23,7 +23,8 @@ import { Plugin, Cordova } from '@ionic-native/core';
pluginName: 'Instagram',
plugin: 'cordova-instagram-plugin',
pluginRef: 'Instagram',
repo: 'https://github.com/vstirbu/InstagramPlugin'
repo: 'https://github.com/vstirbu/InstagramPlugin',
platforms: ['Android', 'iOS']
})
@Injectable()
export class Instagram {

View File

@@ -72,7 +72,8 @@ export interface IntelSecurityDataOptions {
pluginName: 'IntelSecurity',
plugin: 'com-intel-security-cordova-plugin',
pluginRef: 'intel.security',
repo: 'https://github.com/AppSecurityApi/com-intel-security-cordova-plugin'
repo: 'https://github.com/AppSecurityApi/com-intel-security-cordova-plugin',
platforms: ['Android', 'iOS', 'Windows']
})
@Injectable()
export class IntelSecurity {

View File

@@ -25,7 +25,8 @@ import { Plugin, Cordova } from '@ionic-native/core';
pluginName: 'IsDebug',
plugin: 'cordova-plugin-is-debug',
pluginRef: 'cordova.plugins.IsDebug',
repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug'
repo: 'https://github.com/mattlewis92/cordova-plugin-is-debug',
platforms: ['Android', 'iOS']
})
@Injectable()
export class IsDebug {

View File

@@ -17,9 +17,16 @@ declare var cordova: any;
*
* ...
*
* this.jinsMeme.setAppClientID(appClientId: string, clientSecret: string)
* .then(this.jinsMeme.startScan())
* .catch(console.log('jinsMeme.setAppClientID authentication error!'));
* this.jinsMeme.setAppClientID(appClientId: string, clientSecret: string).then(
* // Bluetooth should be enabled and the JINS MEME powered on (blinking blue light)
* this.jinsMeme.startScan().subscribe((meme_addr) => {
* this.jinsMeme.connect(meme_addr).subscribe((connectResult) => {
* this.memeService.startDataReport().subscribe((dataReport) => {
* console.log(dataReport);
* });
* });
* });
* .catch(console.log('jinsMeme.setAppClientID authentication error'));
*
* ```
*/
@@ -27,13 +34,15 @@ declare var cordova: any;
pluginName: 'Jins Meme',
plugin: 'JinsMemeSDK-Plugin-Cordova',
pluginRef: 'cordova.plugins.JinsMemePlugin',
repo: 'https://github.com/jins-meme/JinsMemeSDK-Plugin-Cordova.git'
repo: 'https://github.com/jins-meme/JinsMemeSDK-Plugin-Cordova',
platforms: ['Android', 'iOS']
})
@Injectable()
export class JinsMeme {
/**
* Authentication and authorization of App and SDK.
* Must call this method at first.
* Must call this method first.
* Sign up for an app ID (and get an app/client secret) at developers.jins.com
*
*@param {string} setAppClientID
*@param {string} clientSecret

View File

@@ -24,7 +24,8 @@ import { Observable } from 'rxjs/Observable';
pluginName: 'Keyboard',
plugin: 'ionic-plugin-keyboard',
pluginRef: 'cordova.plugins.Keyboard',
repo: 'https://github.com/driftyco/ionic-plugin-keyboard'
repo: 'https://github.com/driftyco/ionic-plugin-keyboard',
platforms: ['Android', 'BlackBerry 10', 'iOS', 'Windows']
})
@Injectable()
export class Keyboard {

View File

@@ -91,7 +91,8 @@ export interface LaunchNavigatorOptions {
pluginName: 'LaunchNavigator',
plugin: 'uk.co.workingedge.phonegap.plugin.launchnavigator',
pluginRef: 'launchnavigator',
repo: 'https://github.com/dpa99c/phonegap-launch-navigator.git'
repo: 'https://github.com/dpa99c/phonegap-launch-navigator',
platforms: ['Android', 'iOS']
})
@Injectable()
export class LaunchNavigator {

View File

@@ -53,7 +53,8 @@ export type LinkedInLoginScopes = 'r_basicprofile' | 'r_emailaddress' | 'rw_comp
plugin: 'cordova-plugin-linkedin',
pluginRef: 'cordova.plugins.LinkedIn',
repo: 'https://github.com/zyramedia/cordova-plugin-linkedin',
install: 'ionic plugin add cordova-plugin-linkedin --variable APP_ID=YOUR_APP_ID'
install: 'ionic plugin add cordova-plugin-linkedin --variable APP_ID=YOUR_APP_ID',
platforms: ['Android', 'iOS']
})
@Injectable()
export class LinkedIn {

View File

@@ -144,7 +144,8 @@ export interface ILocalNotification {
pluginName: 'LocalNotifications',
plugin: 'de.appplant.cordova.plugin.local-notification',
pluginRef: 'cordova.plugins.notification.local',
repo: 'https://github.com/katzer/cordova-plugin-local-notifications'
repo: 'https://github.com/katzer/cordova-plugin-local-notifications',
platforms: ['Android', 'iOS', 'Windows']
})
@Injectable()
export class LocalNotifications {

View File

@@ -32,7 +32,8 @@ import { Plugin, Cordova } from '@ionic-native/core';
pluginName: 'LocationAccuracy',
plugin: 'cordova-plugin-request-location-accuracy',
pluginRef: 'cordova.plugins.locationAccuracy',
repo: 'https://github.com/dpa99c/cordova-plugin-request-location-accuracy'
repo: 'https://github.com/dpa99c/cordova-plugin-request-location-accuracy',
platforms: ['Android', 'iOS']
})
@Injectable()
export class LocationAccuracy {

View File

@@ -21,7 +21,8 @@ import { Plugin, Cordova } from '@ionic-native/core';
pluginName: 'Market',
plugin: 'cordova-plugin-market',
pluginRef: 'cordova.plugins.market',
repo: 'https://github.com/xmartlabs/cordova-plugin-market'
repo: 'https://github.com/xmartlabs/cordova-plugin-market',
platforms: ['Android', 'iOS']
})
@Injectable()
export class Market {

View File

@@ -29,21 +29,35 @@ export interface NativeTransitionOptions {
*
* ...
*
* let options: NativeTransitionOptions = {
* direction: 'up',
* duration: 500,
* slowdownfactor: 3,
* slidePixels: 20,
* iosdelay: 100,
* androiddelay: 150,
* winphonedelay: 250,
* fixedPixelsTop: 0,
* fixedPixelsBottom: 60
* };
*
* this.nativePageTransitions.slide(options)
* .then(onSuccess)
* .catch(onError);
* // example of adding a transition when a page/modal closes
* ionViewWillLeave() {
*
* let options: NativeTransitionOptions = {
* direction: 'up',
* duration: 500,
* slowdownfactor: 3,
* slidePixels: 20,
* iosdelay: 100,
* androiddelay: 150,
* fixedPixelsTop: 0,
* fixedPixelsBottom: 60
* };
*
* this.nativePageTransitions.slide(options)
* .then(onSuccess)
* .catch(onError);
*
* }
*
*
* // example of adding a transition when pushing a new page
* openPage(page: any) {
*
* this.nativePageTransitions.slide(options);
* this.navCtrl.push(page);
*
* }
*
* ```
*/

View File

@@ -31,7 +31,8 @@ import { Cordova, Plugin } from '@ionic-native/core';
pluginName: 'NativeStorage',
plugin: 'cordova-plugin-nativestorage',
pluginRef: 'NativeStorage',
repo: 'https://github.com/TheCocoaProject/cordova-plugin-nativestorage'
repo: 'https://github.com/TheCocoaProject/cordova-plugin-nativestorage',
platforms: ['Android', 'iOS', 'Windows']
})
@Injectable()
export class NativeStorage {

View File

@@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import {Cordova, CordovaProperty, Plugin, CordovaFunctionOverride} from '@ionic-native/core';
import { Cordova, CordovaProperty, Plugin, CordovaCheck } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/merge';
declare var navigator: any;
@@ -75,15 +76,10 @@ export class Network {
* Returns an observable to watch connection changes
* @return {Observable<any>}
*/
@CordovaFunctionOverride()
onchange(): Observable<any> { return; }
/**
* Returns an observable to watch connection type changes
* @return {Observable<any>}
*/
@CordovaFunctionOverride()
ontypechange(): Observable<any> { return; }
@CordovaCheck()
onchange(): Observable<any> {
return Observable.merge(this.onConnect(), this.onDisconnect());
}
/**
* Get notified when the device goes offline

View File

@@ -67,7 +67,8 @@ import { Plugin, Cordova } from '@ionic-native/core';
pluginName: 'PayPal',
plugin: 'com.paypal.cordova.mobilesdk',
pluginRef: 'PayPalMobile',
repo: 'https://github.com/paypal/PayPal-Cordova-Plugin'
repo: 'https://github.com/paypal/PayPal-Cordova-Plugin',
platforms: ['Android', 'iOS']
})
@Injectable()
export class PayPal {

View File

@@ -44,7 +44,8 @@ import { Injectable } from '@angular/core';
plugin: 'cordova-plugin-photo-library',
pluginRef: 'cordova.plugins.photoLibrary',
repo: 'https://github.com/terikon/cordova-plugin-photo-library',
install: 'ionic plugin add cordova-plugin-photo-library --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="To choose photos"'
install: 'ionic plugin add cordova-plugin-photo-library --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="To choose photos"',
platforms: ['Android', 'Browser', 'iOS']
})
@Injectable()
export class PhotoLibrary {

View File

@@ -20,7 +20,8 @@ import { Plugin, Cordova } from '@ionic-native/core';
pluginName: 'PhotoViewer',
plugin: 'com-sarriaroman-photoviewer',
pluginRef: 'PhotoViewer',
repo: 'https://github.com/sarriaroman/photoviewer'
repo: 'https://github.com/sarriaroman/photoviewer',
platforms: ['Android', 'iOS']
})
@Injectable()
export class PhotoViewer {

View File

@@ -269,6 +269,11 @@ export class Push {
/**
* @hidden
*/
@Plugin({
pluginName: 'Push',
plugin: 'phonegap-plugin-push',
pluginRef: 'PushNotification'
})
export class PushObject {
private _objectInstance: any;

View File

@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, Plugin, CordovaCheck } from '@ionic-native/core';
import { CordovaInstance, Plugin, checkAvailability } from '@ionic-native/core';
declare var cordova: any;
@@ -8,7 +8,7 @@ declare var cordova: any;
*/
export class SecureStorageObject {
constructor(private _objectInstance: any) {}
constructor(private _objectInstance?: any) {}
/**
* Gets a stored item
@@ -41,6 +41,24 @@ export class SecureStorageObject {
})
remove(reference: string): Promise<any> { return; }
/**
* Get all references from the storage.
* @returns {Promise<any>}
*/
@CordovaInstance({
callbackOrder: 'reverse'
})
keys(): Promise<any> { return; }
/**
* Clear all references from the storage.
* @returns {Promise<any>}
*/
@CordovaInstance({
callbackOrder: 'reverse'
})
clear(): Promise<any> { return; }
}
/**
@@ -102,10 +120,13 @@ export class SecureStorage {
* @param store {string}
* @returns {Promise<SecureStorageObject>}
*/
@CordovaCheck()
create(store: string): Promise<SecureStorageObject> {
return new Promise((res, rej) => {
const instance = new cordova.plugins.SecureStorage(() => res(new SecureStorageObject(instance)), rej, store);
if (checkAvailability('cordova.plugins.SecureStorage', null, 'SecureStorage') === true) {
const instance = new cordova.plugins.SecureStorage(() => res(new SecureStorageObject(instance)), rej, store);
} else {
res(new SecureStorageObject());
}
});
}

View File

@@ -0,0 +1,113 @@
import { Plugin, Cordova } from '@ionic-native/core';
import { Injectable } from '@angular/core';
/**
* @name SQLite Porter
* @description
* This Cordova/Phonegap plugin can be used to import/export to/from a SQLite database using either SQL or JSON.
*
* @usage
* ```
* import { SQLitePorter } from 'ionic-native';
*
*
* constructor(private sqlitePorter: SQLitePorter) { }
*
* ...
*
* let db = window.openDatabase("Test", "1.0", "TestDB", 1 * 1024);
* // or we can use SQLite plugin
* // we will assume that we injected SQLite into this component as sqlite
* this.sqlite.create({
* name: 'data.db',
* location: 'default'
* })
* .then((db: any) => {
* let dbInstance = db._objectInstance;
* // we can pass db._objectInstance as the database option in all SQLitePorter methods
* });
*
*
* let sql = "CREATE TABLE Artist ([Id] PRIMARY KEY, [Title]);" +
* "INSERT INTO Artist(Id,Title) VALUES ('1','Fred');";
*
* this.sqlitePorter.importSqlToDb(db, sql)
* .then(() => console.log('Imported'))
* .catch(e => console.error(e));
*
*
* ```
*/
@Plugin({
pluginName: 'SQLitePorter',
plugin: 'uk.co.workingedge.cordova.plugin.sqliteporter',
pluginRef: 'cordova.plugins.sqlitePorter',
repo: 'https://github.com/dpa99c/cordova-sqlite-porter',
platforms: ['Android', 'iOS', 'Tizen', 'BlackBerry 10']
})
@Injectable()
export class SQLitePorter {
/**
* Executes a set of SQL statements against the defined database. Can be used to import data defined in the SQL statements into the database, and may additionally include commands to create the table structure.
* @param db {Object} Database object
* @param sql {string} SQL statements to execute against the database
* @return {Promise<any>}
*/
@Cordova({
callbackStyle: 'object',
successName: 'successFn',
errorName: 'errorFn'
})
importSqlToDb(db: any, sql: string): Promise<any> { return; }
/**
* Exports a SQLite DB as a set of SQL statements.
* @param db {Object} Database object
* @return {Promise<any>}
*/
@Cordova({
callbackStyle: 'object',
successName: 'successFn',
errorName: 'errorFn'
})
exportDbToSql(db: any): Promise<any> { return; }
/**
* Converts table structure and/or row data contained within a JSON structure into SQL statements that can be executed against a SQLite database. Can be used to import data into the database and/or create the table structure.
* @param db {Object} Database object
* @param json {Object|string} JSON structure containing row data and/or table structure as either a JSON object or string
* @return {Promise<any>}
*/
@Cordova({
callbackStyle: 'object',
successName: 'successFn',
errorName: 'errorFn'
})
importJsonToDb(db: any, json: any): Promise<any> { return; }
/**
* Exports a SQLite DB as a JSON structure
* @param db {Object} Database object
* @return {Promise<any>}
*/
@Cordova({
callbackStyle: 'object',
successName: 'successFn',
errorName: 'errorFn'
})
exportDbToJson(db: any): Promise<any> { return; }
/**
* Wipes all data from a database by dropping all existing tables
* @param db {Object} Database object
* @return {Promise<any>}
*/
@Cordova({
callbackStyle: 'object',
successName: 'successFn',
errorName: 'errorFn'
})
wipeDb(db: any): Promise<any> { return; }
}

View File

@@ -4,12 +4,27 @@ import { Cordova, CordovaInstance, Plugin, CordovaCheck, InstanceProperty } from
declare var sqlitePlugin;
export interface SQLiteDatabaseConfig {
/**
* Name of the database. Example: 'my.db'
*/
name: string;
/**
* Location of the database. Example: 'default'
*/
location?: string;
/**
* iOS Database Location. Example: 'Library'
*/
iosDatabaseLocation?: string;
}
/**
* @hidden
*/
export class SQLiteObject {
constructor(private _objectInstance: any) { }
constructor(public _objectInstance: any) { }
@InstanceProperty databaseFeatures: any;
@@ -124,19 +139,6 @@ export class SQLiteObject {
})
abortFromQ(sqlerror): void { }
/**
* @returns {Promise<any>}
*/
@Cordova()
echoTest(): Promise<any> { return; }
/**
* @param first
* @returns {Promise<any>}
*/
@Cordova()
deleteDatabase(first): Promise<any> { return; }
}
/**
@@ -173,6 +175,8 @@ export class SQLiteObject {
*
* @classes
* SQLiteObject
* @interfaces
* SQLiteDatabaseConfig
*/
@Plugin({
pluginName: 'SQLite',
@@ -188,14 +192,29 @@ export class SQLite {
*
* See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database
*
* @param config the config for opening the database.
* @param config {SQLiteDatabaseConfig} database configuration
* @return Promise<SQLiteObject>
*/
@CordovaCheck()
create(config: any): Promise<SQLiteObject> {
create(config: SQLiteDatabaseConfig): Promise<SQLiteObject> {
return new Promise((resolve, reject) => {
sqlitePlugin.openDatabase(config, db => resolve(new SQLiteObject(db)), reject);
});
}
/**
* Verify that both the Javascript and native part of this plugin are installed in your application
* @returns {Promise<any>}
*/
@Cordova()
echoTest(): Promise<any> { return; }
/**
* Deletes a database
* @param config {SQLiteDatabaseConfig} database configuration
* @returns {Promise<any>}
*/
@Cordova()
deleteDatabase(config: SQLiteDatabaseConfig): Promise<any> { return; }
}

View File

@@ -19,10 +19,11 @@ declare var window;
*
* ...
*
* // let status bar overlay webview
* this.statusBar.overlaysWebView(true);
*
* this.statusBar.overlaysWebView(true); // let status bar overlay webview
*
* this.statusBar.backgroundColorByHexString('#ffffff'); // set status bar to white
* // set status bar to white
* this.statusBar.backgroundColorByHexString('#ffffff');
* ```
*
*/

View File

@@ -0,0 +1,62 @@
import { Cordova, Plugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
/**
* @name Taptic Engine
* @description
* An Ionic plugin to use Taptic Engine API on iPHone 7, 7 Plus or newer.
*
* @usage
* ```ts
* import { TapticEngine } from '@ionic-native/taptic-engine;
*
* ...
*
* constructor(private taptic: TapticEngine) { }
*
* ...
*
* this.taptic.selection();
*
* this.taptic.notification();
*
* this.taptic.impact();
*
* ```
*/
@Plugin({
pluginName: 'TapticEngine',
plugin: 'cordova-plugin-taptic-engine',
pluginRef: 'TapticEngine',
repo: 'https://github.com/EddyVerbruggen/cordova-plugin-taptic-engine',
platforms: ['iOS']
})
@Injectable()
export class TapticEngine {
/**
* Use selection feedback generators to indicate a change in selection.
* @returns {Promise<any>} Returns a promise that resolves on success and rejects on error
*/
@Cordova()
selection(): Promise<any> { return; }
/**
* Use this to indicate success/failure/warning to the user.
* @param options {Object} should be of the type { type: 'success' } (or 'warning'/'error')
* @param options.type {string}
* @returns {Promise<any>} Returns a promise that resolves on success and rejects on error
*/
@Cordova()
notification(options: { type: string }): Promise<any> { return; }
/**
* Use this to indicate success/failure/warning to the user.
* @param options {Object} should be of the type { style: 'light' } (or 'medium'/'heavy')
* @param options.type {string}
* @returns {Promise<any>} Returns a promise that resolves on success and rejects on error
*/
@Cordova()
impact(options: { style: string }): Promise<any> { return; }
}

View File

@@ -0,0 +1,126 @@
import { Injectable } from '@angular/core';
import { Cordova, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
export interface ZeroconfService {
domain: string;
type: string;
name: string;
port: number;
hostname: string;
ipv4Addresses: Array<string>;
ipv6Addresses: Array<string>;
txtRecord: any;
}
export interface ZeroconfResult {
action: 'registered' | 'added' | 'removed';
service: ZeroconfService;
}
/**
* @name Zeroconf
* @description
* This plugin allows you to browse and publish Zeroconf/Bonjour/mDNS services.
* @usage
* ```typescript
* import { Zeroconf } from '@ionic-native/zeroconf';
*
* constructor(private zeroconf: Zeroconf) { }
*
* ...
*
* // watch for services of a specified type
* this.zeroconf.watch('_http._tcp.', 'local.').subscribe(result => {
* if (result.action == 'added') {
* console.log('service added', result.service);
* } else {
* console.log('service removed', result.service);
* }
* });
*
* // publish a zeroconf service of your own
* this.zeroconf.register('_http._tcp.', 'local.', 'Becvert\'s iPad', 80, {
* 'foo': 'bar'
* }).then(result => {
* console.log('Service registered', result.service);
* });
*
*
* // unregister your service
* this.zeroconf.unregister('_http._tcp.', 'local.', 'Becvert\'s iPad');
* ```
*/
@Plugin({
pluginName: 'Zeroconf',
plugin: 'cordova-plugin-zeroconf',
pluginRef: 'cordova.plugins.zeroconf',
repo: 'https://github.com/becvert/cordova-plugin-zeroconf'
})
@Injectable()
export class Zeroconf {
/**
* Returns this device's hostname.
* @return {Promise<string>}
*/
@Cordova()
getHostname(): Promise<string> { return; }
/**
* Publishes a new service.
* @param type {string} Service type name, e.g. "_http._tcp".
* @param domain {string} Domain scope of the service, typically "local.".
* @param name {string} Unqualified service instance name.
* @param port {number} Local port on which the service runs.
* @param txtRecord {any} Arbitrary key/value pairs describing the service.
* @return {Promise<ZeroconfResult>} Returns a Promise that resolves with the registered service.
*/
@Cordova()
register(type: string, domain: string, name: string, port: number, txtRecord: any): Promise<ZeroconfResult> { return; }
/**
* Unregisters a service.
* @param type {string} Service type name, e.g. "_http._tcp".
* @param domain {string} Domain scope of the service, typically "local.".
* @param name {string} Unqualified service instance name.
* @return {Promise<void>}
*/
@Cordova()
unregister(type: string, domain: string, name: string): Promise<void> { return; }
/**
* Unregisters all published services.
* @return {Promise<void>}
*/
@Cordova()
stop(): Promise<void> { return; }
/**
* Starts watching for services of the specified type.
* @param type {string} Service type name, e.g. "_http._tcp".
* @param domain {string} Domain scope of the service, typically "local.".
* @return {Observable<ZeroconfResult>} Returns an Observable that notifies of each service added or removed.
*/
@Cordova({
observable: true,
clearFunction: 'unwatch',
clearWithArgs: true
})
watch(type: string, domain: string): Observable<ZeroconfResult> { return; }
/**
* Stops watching for services of the specified type.
* @param type {string} Service type name, e.g. "_http._tcp".
* @param domain {string} Domain scope of the service, typically "local.".
* @return {Promise<void>}
*/
@Cordova()
unwatch(type: string, domain: string): Promise<void> { return; }
/**
* Closes the service browser and stops watching.
* @return {Promise<void>}
*/
@Cordova()
close(): Promise<void> { return; }
}