mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2026-02-04 00:06:19 +08:00
Compare commits
83 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ae3cb0d00 | ||
|
|
0dee3500f7 | ||
|
|
b53af8e3c9 | ||
|
|
006f7dc2ad | ||
|
|
19bc8419e0 | ||
|
|
d3d8f8264c | ||
|
|
8262219d05 | ||
|
|
39a91d9520 | ||
|
|
88a19af21e | ||
|
|
1dccff5e49 | ||
|
|
689f0f159c | ||
|
|
5aa484c024 | ||
|
|
ea88c9e4a8 | ||
|
|
bc364d1cb1 | ||
|
|
ffa37e2932 | ||
|
|
f911366c54 | ||
|
|
0ef4a7394e | ||
|
|
68d99461c6 | ||
|
|
6a458b52cc | ||
|
|
a1a4ef94cc | ||
|
|
6e20137340 | ||
|
|
961727ee61 | ||
|
|
9c30a1d0dd | ||
|
|
ee79278503 | ||
|
|
544e7ef4fc | ||
|
|
01aece1fbb | ||
|
|
a7854b7fad | ||
|
|
27d3d2d1c9 | ||
|
|
9074362cae | ||
|
|
fd0a2e9acd | ||
|
|
9348415cf5 | ||
|
|
ad8c04bf9f | ||
|
|
667f9bdde9 | ||
|
|
aedc9d65c8 | ||
|
|
2869c644ed | ||
|
|
200618dee7 | ||
|
|
5d14b16d73 | ||
|
|
b08e3a8ee1 | ||
|
|
3511f24a26 | ||
|
|
fa803f2258 | ||
|
|
d23f13f837 | ||
|
|
d4c876d009 | ||
|
|
d2ef40ccb7 | ||
|
|
8cf332f0ff | ||
|
|
be345ea829 | ||
|
|
c52bb832b4 | ||
|
|
1eebea9df5 | ||
|
|
150b236468 | ||
|
|
df64486a13 | ||
|
|
a1e68a0934 | ||
|
|
a9a511d0f1 | ||
|
|
b6d0e3125d | ||
|
|
d4a9abfc61 | ||
|
|
a5ed62e56a | ||
|
|
7d0f1bd3ff | ||
|
|
a151295654 | ||
|
|
e4fc01a23c | ||
|
|
2fdf61ad5c | ||
|
|
25d5169251 | ||
|
|
cd7612e32e | ||
|
|
4e5b3fa910 | ||
|
|
5589f4d2ff | ||
|
|
841f151b4d | ||
|
|
ead99b1a4f | ||
|
|
cd5ff68bc1 | ||
|
|
261e9cc249 | ||
|
|
0e2d5ac1de | ||
|
|
87916aec20 | ||
|
|
072fe8df94 | ||
|
|
0750e03e04 | ||
|
|
bf2ba2e9e7 | ||
|
|
91c879af27 | ||
|
|
ee40475891 | ||
|
|
b012bb62d7 | ||
|
|
5ccc558380 | ||
|
|
5d775978c6 | ||
|
|
047c236191 | ||
|
|
1536e98ba4 | ||
|
|
baee422090 | ||
|
|
07de25c90f | ||
|
|
027b10a6dd | ||
|
|
bb4308e7d8 | ||
|
|
eb31e9b2a1 |
87
CHANGELOG.md
87
CHANGELOG.md
@@ -1,3 +1,90 @@
|
||||
<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)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **android-full-screen:** add cordova-plugin-fullscreen support (#1255) ([b08e3a8](https://github.com/driftyco/ionic-native/commit/b08e3a8))
|
||||
* **intel-security:** add com-intel-security-cordova-plugin support (#1256) ([aedc9d6](https://github.com/driftyco/ionic-native/commit/aedc9d6))
|
||||
|
||||
|
||||
|
||||
<a name="3.2.4"></a>
|
||||
## [3.2.4](https://github.com/driftyco/ionic-native/compare/v3.2.3...v3.2.4) (2017-03-26)
|
||||
|
||||
|
||||
|
||||
<a name="3.2.3"></a>
|
||||
## [3.2.3](https://github.com/driftyco/ionic-native/compare/v3.2.2...v3.2.3) (2017-03-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **contacts:** fix crash if plugin is unavailable ([a9a511d](https://github.com/driftyco/ionic-native/commit/a9a511d)), closes [#1250](https://github.com/driftyco/ionic-native/issues/1250)
|
||||
* **core:** make properties enumerable ([a151295](https://github.com/driftyco/ionic-native/commit/a151295))
|
||||
|
||||
|
||||
|
||||
<a name="3.2.2"></a>
|
||||
## [3.2.2](https://github.com/driftyco/ionic-native/compare/v3.2.1...v3.2.2) (2017-03-23)
|
||||
|
||||
|
||||
|
||||
<a name="3.2.1"></a>
|
||||
## [3.2.1](https://github.com/driftyco/ionic-native/compare/v3.2.0...v3.2.1) (2017-03-23)
|
||||
|
||||
|
||||
66
DEVELOPER.md
66
DEVELOPER.md
@@ -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
|
||||
}
|
||||
```
|
||||
52
gulpfile.js
52
gulpfile.js
@@ -1,47 +1,49 @@
|
||||
var gulp = require('gulp');
|
||||
var minimist = require('minimist');
|
||||
var rename = require("gulp-rename");
|
||||
var tslint = require('gulp-tslint');
|
||||
var decamelize = require('decamelize');
|
||||
var replace = require('gulp-replace');
|
||||
"use strict";
|
||||
|
||||
var flagConfig = {
|
||||
string: ['port', 'version', 'ngVersion', 'animations'],
|
||||
boolean: ['dry-run'],
|
||||
alias: {'p': 'port', 'v': 'version', 'a': 'ngVersion'},
|
||||
default: { port: 8000 }
|
||||
};
|
||||
var flags = minimist(process.argv.slice(2), flagConfig);
|
||||
const gulp = require('gulp'),
|
||||
minimist = require('minimist'),
|
||||
rename = require("gulp-rename"),
|
||||
tslint = require('gulp-tslint'),
|
||||
decamelize = require('decamelize'),
|
||||
replace = require('gulp-replace'),
|
||||
_ = require('lodash');
|
||||
|
||||
const flagConfig = {
|
||||
string: ['port', 'version', 'ngVersion', 'animations'],
|
||||
boolean: ['dry-run'],
|
||||
alias: {'p': 'port', 'v': 'version', 'a': 'ngVersion'},
|
||||
default: { port: 8000 }
|
||||
},
|
||||
|
||||
flags = minimist(process.argv.slice(2), flagConfig);
|
||||
|
||||
/* Docs tasks */
|
||||
require('./scripts/docs/gulp-tasks')(gulp, flags);
|
||||
|
||||
gulp.task('lint', function() {
|
||||
gulp.src('src/**/*.ts')
|
||||
gulp.task('lint', () => {
|
||||
return gulp.src('src/**/*.ts')
|
||||
.pipe(tslint({
|
||||
formatter: "verbose",
|
||||
configuration: 'tslint.json'
|
||||
}))
|
||||
.pipe(tslint.report())
|
||||
.pipe(tslint.report());
|
||||
});
|
||||
|
||||
gulp.task('plugin:create', function(){
|
||||
if(flags.n && flags.n !== ''){
|
||||
gulp.task('plugin:create', () => {
|
||||
if (flags.n && flags.n !== ''){
|
||||
|
||||
const src = flags.m?'./scripts/templates/wrap-min.tmpl':'./scripts/templates/wrap.tmpl',
|
||||
const src = flags.m ? './scripts/templates/wrap-min.tmpl':'./scripts/templates/wrap.tmpl',
|
||||
pluginName = flags.n,
|
||||
pluginPackageName = decamelize(pluginName, '-'),
|
||||
pluginNameSpaced = pluginName.replace(/(?!^)([A-Z])/g, ' $1');
|
||||
|
||||
return gulp.src(src)
|
||||
.pipe(replace('PluginName', pluginName))
|
||||
.pipe(replace('Plugin Name', pluginNameSpaced))
|
||||
.pipe(replace('$PluginName', pluginName))
|
||||
.pipe(replace('$Plugin_Name', pluginNameSpaced))
|
||||
.pipe(replace('$pluginName', _.lowerFirst(pluginName)))
|
||||
.pipe(rename('index.ts'))
|
||||
.pipe(gulp.dest('./src/@ionic-native/plugins/' + pluginPackageName));
|
||||
.pipe(gulp.dest('./src/@ionic-native/plugins/' + _.kebabCase(pluginName)));
|
||||
|
||||
} else {
|
||||
|
||||
console.log("Usage is: gulp plugin:create -n PluginName");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ionic-native",
|
||||
"version": "3.2.1",
|
||||
"version": "3.4.1",
|
||||
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
@@ -43,7 +43,8 @@
|
||||
"clean": "rimraf dist .tmp",
|
||||
"shipit": "npm run build && gulp readmes && npm run npmpub",
|
||||
"npmpub": "node scripts/build/publish.js",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
||||
"postchangelog": "git commit -am \"chore(): update changelog\""
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
|
||||
@@ -17,8 +17,8 @@ const ROOT = path.resolve(path.join(__dirname, '../../')), // root ionic-native
|
||||
|
||||
|
||||
// dependency versions
|
||||
const ANGULAR_VERSION = '2.4.8',
|
||||
RXJS_VERSION = '5.0.1',
|
||||
const ANGULAR_VERSION = '*',
|
||||
RXJS_VERSION = '^5.0.1',
|
||||
MIN_CORE_VERSION = '^3.1.0',
|
||||
IONIC_NATIVE_VERSION = require(path.resolve(ROOT, 'package.json')).version;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ const FLAGS = '--access public'; // add any flags here if you want... (example:
|
||||
|
||||
const PACKAGES = fs.readdirSync(DIST);
|
||||
|
||||
const failedPackages = [];
|
||||
|
||||
const QUEUE = queue({
|
||||
concurrency: 10
|
||||
@@ -26,7 +27,15 @@ PACKAGES.forEach(packageName => {
|
||||
const packagePath = path.resolve(DIST, packageName);
|
||||
exec(`npm publish ${packagePath} ${FLAGS}`)
|
||||
.then(() => done())
|
||||
.catch(done);
|
||||
.catch((e) => {
|
||||
if (e.stderr && e.stderr.indexOf('previously published version') === -1) {
|
||||
failedPackages.push({
|
||||
cmd: e.cmd,
|
||||
stderr: e.stderr
|
||||
});
|
||||
}
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -36,9 +45,14 @@ QUEUE.start((err) => {
|
||||
|
||||
if (err) {
|
||||
console.log('Error publishing ionic-native. ', err);
|
||||
} else if (failedPackages.length > 0) {
|
||||
console.log(`${failedPackages.length} packages failed to publish.`);
|
||||
console.log(failedPackages);
|
||||
} else {
|
||||
console.log('Done publishing ionic-native!');
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -11,7 +11,9 @@
|
||||
"rootDir": "../../src/",
|
||||
"target": "es5",
|
||||
"skipLibCheck": true,
|
||||
"lib": ["es2015", "dom"]
|
||||
"lib": ["es2015", "dom"],
|
||||
"sourceMap": true,
|
||||
"inlineSources": true
|
||||
},
|
||||
"files": [
|
||||
"../../src/@ionic-native/core/index.ts"
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
"rootDir": "../../../src/@ionic-native/plugins/",
|
||||
"target": "es5",
|
||||
"skipLibCheck": true,
|
||||
"lib": ["es2015", "dom"]
|
||||
"lib": ["es2015", "dom"],
|
||||
"sourceMap": true,
|
||||
"inlineSources": true
|
||||
},
|
||||
"files": []
|
||||
}
|
||||
|
||||
3
scripts/docs/configs/links.js
Normal file
3
scripts/docs/configs/links.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = function(getLinkInfo) {
|
||||
getLinkInfo.useFirstAmbiguousLink = false;
|
||||
};
|
||||
3
scripts/docs/configs/log.js
Normal file
3
scripts/docs/configs/log.js
Normal file
@@ -0,0 +1,3 @@
|
||||
module.exports = function(log) {
|
||||
log.level = 'error'; //'silly', 'debug', 'info', 'warn', 'error'
|
||||
};
|
||||
4
scripts/docs/configs/tag-defs.js
Normal file
4
scripts/docs/configs/tag-defs.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = function(parseTagsProcessor) {
|
||||
parseTagsProcessor.tagDefinitions = parseTagsProcessor.tagDefinitions
|
||||
.concat(require('../tag-defs/tag-defs'));
|
||||
};
|
||||
12
scripts/docs/configs/template-filters.js
Normal file
12
scripts/docs/configs/template-filters.js
Normal file
@@ -0,0 +1,12 @@
|
||||
module.exports = function(templateEngine) {
|
||||
// Nunjucks and Angular conflict in their template bindings so change the Nunjucks
|
||||
// Also conflict with Jekyll
|
||||
templateEngine.config.tags = {
|
||||
variableStart: '<$',
|
||||
variableEnd: '$>',
|
||||
blockStart: '<@',
|
||||
blockEnd: '@>',
|
||||
commentStart: '<#',
|
||||
commentEnd: '#>'
|
||||
};
|
||||
};
|
||||
9
scripts/docs/configs/template-tags.js
Normal file
9
scripts/docs/configs/template-tags.js
Normal file
@@ -0,0 +1,9 @@
|
||||
module.exports = function(templateEngine) {
|
||||
// add custom filters to nunjucks
|
||||
templateEngine.filters.push(
|
||||
require('../filters/capital'),
|
||||
require('../filters/code'),
|
||||
require('../filters/dump'),
|
||||
require('../filters/dashify')
|
||||
);
|
||||
};
|
||||
@@ -1,182 +1,79 @@
|
||||
var Package = require('dgeni').Package;
|
||||
var jsdocPackage = require('dgeni-packages/jsdoc');
|
||||
var nunjucksPackage = require('dgeni-packages/nunjucks');
|
||||
var typescriptPackage = require('dgeni-packages/typescript');
|
||||
var linksPackage = require('dgeni-packages/links');
|
||||
var path = require('path');
|
||||
var semver = require('semver');
|
||||
var fs = require('fs');
|
||||
var _ = require('lodash');
|
||||
var config = require('../config.json');
|
||||
var projectPackage = require('../../package.json');
|
||||
"use strict";
|
||||
const Package = require('dgeni').Package,
|
||||
jsdocPackage = require('dgeni-packages/jsdoc'),
|
||||
nunjucksPackage = require('dgeni-packages/nunjucks'),
|
||||
typescriptPackage = require('dgeni-packages/typescript'),
|
||||
linksPackage = require('dgeni-packages/links'),
|
||||
path = require('path'),
|
||||
config = require('../config.json');
|
||||
|
||||
// Define the dgeni package for generating the docs
|
||||
module.exports = function(currentVersion) {
|
||||
module.exports = currentVersion => {
|
||||
|
||||
return new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage])
|
||||
return new Package('ionic-native-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage])
|
||||
|
||||
// .processor(require('./processors/latest-version'))
|
||||
.processor(require('./processors/jekyll'))
|
||||
.processor(require('./processors/remove-private-members'))
|
||||
.processor(require('./processors/hide-private-api'))
|
||||
.processor(require('./processors/collect-inputs-outputs'))
|
||||
.processor(require('./processors/npm-id'))
|
||||
.processor(require('./processors/remove-private-members'))
|
||||
.processor(require('./processors/hide-private-api'))
|
||||
.processor(require('./processors/parse-optional'))
|
||||
.processor(require('./processors/mark-properties'))
|
||||
.processor(require('./processors/npm-id'))
|
||||
.processor(require('./processors/jekyll'))
|
||||
|
||||
// for debugging docs
|
||||
// .processor(function test(){
|
||||
// return {
|
||||
//
|
||||
// $runBefore: ['rendering-docs'],
|
||||
// $process: function(docs){
|
||||
// docs.forEach(function(doc){
|
||||
// if (doc.name == "Camera"){
|
||||
//
|
||||
// // console.log(doc.tags);
|
||||
// // doc.tags.forEach(function(tag){
|
||||
// // if(tag.tagName == 'classes'){
|
||||
// //
|
||||
// // }
|
||||
// // });
|
||||
//
|
||||
// // doc.moduleDoc.exports.forEach(function(d,i){
|
||||
// // if(d.name === 'CameraOptions') {
|
||||
// // console.log('Name: ' + d.name);
|
||||
// // console.log('Type: ' + d.docType);
|
||||
// // console.log('First member: ', d.members[0]);
|
||||
// // }
|
||||
// // });
|
||||
//
|
||||
//
|
||||
// // var exports = doc.exportSymbol.parent.exports;
|
||||
// // for(var p in exports) {
|
||||
// // if(p == 'CameraOptions')
|
||||
// // {
|
||||
// // var x = exports[p];
|
||||
// // console.log(x.members.quality);
|
||||
// // }
|
||||
// // }
|
||||
// // doc.members.forEach(function(method){
|
||||
// // if (method.name === "getPicture") {
|
||||
// // console.log(method);
|
||||
// // }
|
||||
// // })
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
.config(require('./configs/log'))
|
||||
.config(require('./configs/template-filters'))
|
||||
.config(require('./configs/template-tags'))
|
||||
.config(require('./configs/tag-defs'))
|
||||
.config(require('./configs/links'))
|
||||
|
||||
.config(function(log) {
|
||||
log.level = 'error'; //'silly', 'debug', 'info', 'warn', 'error'
|
||||
})
|
||||
.config(function(renderDocsProcessor, computePathsProcessor) {
|
||||
|
||||
.config(function(renderDocsProcessor, computePathsProcessor) {
|
||||
currentVersion = {
|
||||
href: '/' + config.v2DocsDir.replace('content/', ''),
|
||||
folder: '',
|
||||
name: currentVersion
|
||||
};
|
||||
|
||||
versions = [];
|
||||
// new version, add it to the versions list
|
||||
if (currentVersion != 'nightly' && !_.includes(versions, currentVersion)) {
|
||||
versions.unshift(currentVersion);
|
||||
}
|
||||
//First semver valid version is latest
|
||||
var latestVersion = _.find(versions, semver.valid);
|
||||
versions = versions.map(function(version) {
|
||||
// We don't separate by versions so always put the docs in the root
|
||||
var folder = '';
|
||||
return {
|
||||
href: '/' + config.v2DocsDir.replace('content/',''),
|
||||
folder: folder,
|
||||
name: version
|
||||
};
|
||||
});
|
||||
renderDocsProcessor.extraData.version = {
|
||||
list: [currentVersion],
|
||||
current: currentVersion,
|
||||
latest: currentVersion
|
||||
};
|
||||
|
||||
var versionData = {
|
||||
list: versions,
|
||||
current: _.find(versions, {name: currentVersion}),
|
||||
latest: _.find(versions, {name: latestVersion}) || _.first(versions)
|
||||
};
|
||||
computePathsProcessor.pathTemplates = [{
|
||||
docTypes: ['class'],
|
||||
getOutputPath: doc => 'content/' + config.v2DocsDir + '/' + doc.name + '/index.md'
|
||||
}];
|
||||
|
||||
renderDocsProcessor.extraData.version = versionData;
|
||||
computePathsProcessor.pathTemplates = [{
|
||||
docTypes: ['class', 'var', 'function', 'let'],
|
||||
getOutputPath: function(doc) {
|
||||
var docPath = doc.name + '/index.md';
|
||||
var path = 'content/' + config.v2DocsDir + '/' + docPath;
|
||||
})
|
||||
|
||||
return path;
|
||||
}
|
||||
}];
|
||||
})
|
||||
//configure file reading
|
||||
.config(function(readFilesProcessor, readTypeScriptModules) {
|
||||
|
||||
//configure file reading
|
||||
.config(function(readFilesProcessor, readTypeScriptModules) {
|
||||
// Don't run unwanted processors since we are not using the normal file reading processor
|
||||
readFilesProcessor.$enabled = false;
|
||||
readFilesProcessor.basePath = path.resolve(__dirname, '../..');
|
||||
|
||||
// Don't run unwanted processors since we are not using the normal file reading processor
|
||||
readFilesProcessor.$enabled = false;
|
||||
readFilesProcessor.basePath = path.resolve(__dirname, '../..');
|
||||
readTypeScriptModules.basePath = path.resolve(__dirname, '../..');
|
||||
readTypeScriptModules.sourceFiles = [
|
||||
'./src/@ionic-native/plugins/**/*.ts'
|
||||
];
|
||||
})
|
||||
|
||||
readTypeScriptModules.basePath = path.resolve(__dirname, '../..');
|
||||
readTypeScriptModules.sourceFiles = [
|
||||
'./src/@ionic-native/plugins/**/*.ts'
|
||||
];
|
||||
})
|
||||
// Configure file writing
|
||||
.config(function(writeFilesProcessor) {
|
||||
writeFilesProcessor.outputFolder = '../ionic-site/';
|
||||
})
|
||||
|
||||
.config(function(parseTagsProcessor) {
|
||||
parseTagsProcessor.tagDefinitions = parseTagsProcessor.tagDefinitions
|
||||
.concat(require('./tag-defs/tag-defs'));
|
||||
})
|
||||
// Configure rendering
|
||||
.config(function(templateFinder) {
|
||||
|
||||
// .config(function(parseTagsProcessor) {
|
||||
// // We actually don't want to parse param docs in this package as we are
|
||||
// // getting the data out using TS
|
||||
// parseTagsProcessor.tagDefinitions.forEach(function(tagDef) {
|
||||
// console.log(tagDef);
|
||||
// if (tagDef.name === 'param') {
|
||||
// tagDef.docProperty = 'paramData';
|
||||
// tagDef.transforms = [];
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
templateFinder.templateFolders.unshift(path.resolve(__dirname, 'templates'));
|
||||
|
||||
// Configure links
|
||||
.config(function(getLinkInfo) {
|
||||
getLinkInfo.useFirstAmbiguousLink = false;
|
||||
})
|
||||
|
||||
// Configure file writing
|
||||
.config(function(writeFilesProcessor) {
|
||||
writeFilesProcessor.outputFolder = '../ionic-site/';
|
||||
})
|
||||
|
||||
// Configure rendering
|
||||
.config(function(templateFinder, templateEngine) {
|
||||
|
||||
// Nunjucks and Angular conflict in their template bindings so change the Nunjucks
|
||||
// Also conflict with Jekyll
|
||||
templateEngine.config.tags = {
|
||||
variableStart: '<$',
|
||||
variableEnd: '$>',
|
||||
blockStart: '<@',
|
||||
blockEnd: '@>',
|
||||
commentStart: '<#',
|
||||
commentEnd: '#>'
|
||||
};
|
||||
|
||||
// add custom filters to nunjucks
|
||||
templateEngine.filters.push(
|
||||
require('./filters/capital'),
|
||||
require('./filters/code'),
|
||||
require('./filters/dump'),
|
||||
require('./filters/dashify')
|
||||
);
|
||||
|
||||
templateFinder.templateFolders.unshift(path.resolve(__dirname, 'templates'));
|
||||
|
||||
// Specify how to match docs to templates.
|
||||
templateFinder.templatePatterns = [
|
||||
'${ doc.template }',
|
||||
'${ doc.docType }.template.html',
|
||||
'common.template.html'
|
||||
];
|
||||
});
|
||||
// Specify how to match docs to templates.
|
||||
templateFinder.templatePatterns = [
|
||||
'${ doc.template }',
|
||||
'${ doc.docType }.template.html',
|
||||
'common.template.html'
|
||||
];
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
@@ -1,115 +1,53 @@
|
||||
var Package = require('dgeni').Package;
|
||||
var jsdocPackage = require('dgeni-packages/jsdoc');
|
||||
var nunjucksPackage = require('dgeni-packages/nunjucks');
|
||||
var typescriptPackage = require('dgeni-packages/typescript');
|
||||
var linksPackage = require('dgeni-packages/links');
|
||||
var path = require('path');
|
||||
var semver = require('semver');
|
||||
var fs = require('fs');
|
||||
var _ = require('lodash');
|
||||
var config = require('../config.json');
|
||||
var projectPackage = require('../../package.json');
|
||||
"use strict";
|
||||
const Package = require('dgeni').Package,
|
||||
jsdocPackage = require('dgeni-packages/jsdoc'),
|
||||
nunjucksPackage = require('dgeni-packages/nunjucks'),
|
||||
typescriptPackage = require('dgeni-packages/typescript'),
|
||||
linksPackage = require('dgeni-packages/links'),
|
||||
path = require('path'),
|
||||
config = require('../config.json');
|
||||
|
||||
// jscs:disable validateIndentation
|
||||
module.exports = currentVersion => {
|
||||
|
||||
// Define the dgeni package for generating the docs
|
||||
module.exports = function(currentVersion) {
|
||||
return new Package('ionic-native-readmes', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage])
|
||||
|
||||
return new Package('ionic-v2-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage])
|
||||
|
||||
// .processor(require('./processors/latest-version'))
|
||||
.processor(require('./processors/readmes'))
|
||||
.processor(require('./processors/npm-id'))
|
||||
.processor(require('./processors/remove-private-members'))
|
||||
.processor(require('./processors/hide-private-api'))
|
||||
// .processor(require('./processors/collect-inputs-outputs'))
|
||||
.processor(require('./processors/npm-id'))
|
||||
|
||||
.config(require('./configs/log'))
|
||||
.config(require('./configs/template-filters'))
|
||||
.config(require('./configs/template-tags'))
|
||||
.config(require('./configs/tag-defs'))
|
||||
.config(require('./configs/links'))
|
||||
|
||||
// for debugging docs
|
||||
// .processor(function test(){
|
||||
// return {
|
||||
//
|
||||
// $runBefore: ['rendering-docs'],
|
||||
// $process: function(docs){
|
||||
// docs.forEach(function(doc){
|
||||
// if (doc.name == "Camera"){
|
||||
//
|
||||
// // console.log(doc.tags);
|
||||
// // doc.tags.forEach(function(tag){
|
||||
// // if(tag.tagName == 'classes'){
|
||||
// //
|
||||
// // }
|
||||
// // });
|
||||
//
|
||||
// // doc.moduleDoc.exports.forEach(function(d,i){
|
||||
// // if(d.name === 'CameraOptions') {
|
||||
// // console.log('Name: ' + d.name);
|
||||
// // console.log('Type: ' + d.docType);
|
||||
// // console.log('First member: ', d.members[0]);
|
||||
// // }
|
||||
// // });
|
||||
//
|
||||
//
|
||||
// // var exports = doc.exportSymbol.parent.exports;
|
||||
// // for(var p in exports) {
|
||||
// // if(p == 'CameraOptions')
|
||||
// // {
|
||||
// // var x = exports[p];
|
||||
// // console.log(x.members.quality);
|
||||
// // }
|
||||
// // }
|
||||
// // doc.members.forEach(function(method){
|
||||
// // if (method.name === "getPicture") {
|
||||
// // console.log(method);
|
||||
// // }
|
||||
// // })
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
.config(function(log) {
|
||||
log.level = 'error'; //'silly', 'debug', 'info', 'warn', 'error'
|
||||
})
|
||||
|
||||
.config(function(renderDocsProcessor, computePathsProcessor) {
|
||||
|
||||
versions = [];
|
||||
// new version, add it to the versions list
|
||||
if (currentVersion != 'nightly' && !_.includes(versions, currentVersion)) {
|
||||
versions.unshift(currentVersion);
|
||||
}
|
||||
//First semver valid version is latest
|
||||
var latestVersion = _.find(versions, semver.valid);
|
||||
versions = versions.map(function(version) {
|
||||
// We don't separate by versions so always put the docs in the root
|
||||
var folder = '';
|
||||
return {
|
||||
href: '/' + config.v2DocsDir.replace('content/', ''),
|
||||
folder: folder,
|
||||
name: version
|
||||
};
|
||||
});
|
||||
|
||||
var versionData = {
|
||||
list: versions,
|
||||
current: _.find(versions, {name: currentVersion}),
|
||||
latest: _.find(versions, {name: latestVersion}) || _.first(versions)
|
||||
currentVersion = {
|
||||
href: '/' + config.v2DocsDir.replace('content/', ''),
|
||||
folder: '',
|
||||
name: currentVersion
|
||||
};
|
||||
|
||||
renderDocsProcessor.extraData.version = {
|
||||
list: [currentVersion],
|
||||
current: currentVersion,
|
||||
latest: currentVersion
|
||||
};
|
||||
|
||||
renderDocsProcessor.extraData.version = versionData;
|
||||
computePathsProcessor.pathTemplates = [{
|
||||
docTypes: ['class'],
|
||||
getOutputPath: function(doc) {
|
||||
return doc.originalModule.replace(config.pluginDir + '/', '')
|
||||
.replace('/plugins', '')
|
||||
.replace('/index', '') + '/README.md';
|
||||
}
|
||||
getOutputPath: doc => doc.originalModule.replace(config.pluginDir + '/', '')
|
||||
.replace('/plugins', '')
|
||||
.replace('/index', '/README.md')
|
||||
}];
|
||||
|
||||
})
|
||||
|
||||
//configure file reading
|
||||
.config(function(readFilesProcessor, readTypeScriptModules) {
|
||||
|
||||
// Don't run unwanted processors since we are not using the normal file reading processor
|
||||
readFilesProcessor.$enabled = false;
|
||||
readFilesProcessor.basePath = path.resolve(__dirname, '../..');
|
||||
@@ -118,54 +56,13 @@ module.exports = function(currentVersion) {
|
||||
readTypeScriptModules.sourceFiles = ['./src/@ionic-native/plugins/**/*.ts'];
|
||||
})
|
||||
|
||||
.config(function(parseTagsProcessor) {
|
||||
parseTagsProcessor.tagDefinitions = parseTagsProcessor.tagDefinitions
|
||||
.concat(require('./tag-defs/tag-defs'));
|
||||
})
|
||||
|
||||
// .config(function(parseTagsProcessor) {
|
||||
// // We actually don't want to parse param docs in this package as we are
|
||||
// // getting the data out using TS
|
||||
// parseTagsProcessor.tagDefinitions.forEach(function(tagDef) {
|
||||
// console.log(tagDef);
|
||||
// if (tagDef.name === 'param') {
|
||||
// tagDef.docProperty = 'paramData';
|
||||
// tagDef.transforms = [];
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
|
||||
// Configure links
|
||||
.config(function(getLinkInfo) {
|
||||
getLinkInfo.useFirstAmbiguousLink = false;
|
||||
})
|
||||
|
||||
// Configure file writing
|
||||
.config(function(writeFilesProcessor) {
|
||||
writeFilesProcessor.outputFolder = './dist/';
|
||||
})
|
||||
|
||||
// Configure rendering
|
||||
.config(function(templateFinder, templateEngine) {
|
||||
|
||||
// Nunjucks and Angular conflict in their template bindings so change the Nunjucks
|
||||
// Also conflict with Jekyll
|
||||
templateEngine.config.tags = {
|
||||
variableStart: '<$',
|
||||
variableEnd: '$>',
|
||||
blockStart: '<@',
|
||||
blockEnd: '@>',
|
||||
commentStart: '<#',
|
||||
commentEnd: '#>'
|
||||
};
|
||||
|
||||
// add custom filters to nunjucks
|
||||
templateEngine.filters.push(
|
||||
require('./filters/capital'),
|
||||
require('./filters/code'),
|
||||
require('./filters/dump')
|
||||
);
|
||||
|
||||
.config(function(templateFinder) {
|
||||
templateFinder.templateFolders.unshift(path.resolve(__dirname, 'templates'));
|
||||
|
||||
// Specify how to match docs to templates.
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"use strict";
|
||||
module.exports = {
|
||||
name: 'capital',
|
||||
process: function(str) {
|
||||
str || (str = '');
|
||||
return str.charAt(0).toUpperCase() + str.substring(1);
|
||||
}
|
||||
process: str => str? str.charAt(0).toUpperCase() + str.substring(1) : ''
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
var encoder = new require('node-html-encoder').Encoder();
|
||||
"use strict";
|
||||
const encoder = new require('node-html-encoder').Encoder();
|
||||
|
||||
function code(str, inline, lang) {
|
||||
// Encode any HTML entities in the code string
|
||||
@@ -10,16 +11,14 @@ function code(str, inline, lang) {
|
||||
str = '<code' + lang + '>' + str + '</code>';
|
||||
|
||||
// If not inline then wrap the code element in a pre element
|
||||
if ( !inline ) {
|
||||
if (!inline) {
|
||||
str = '<pre>' + str + '</pre>';
|
||||
}
|
||||
|
||||
return str;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'code',
|
||||
process: function(str, lang) {
|
||||
return code(str, true, lang);
|
||||
}
|
||||
process: (str, lang) => code(str, true, lang)
|
||||
};
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
"use strict";
|
||||
module.exports = {
|
||||
name: 'dashify',
|
||||
process: function(str) {
|
||||
str || (str = '');
|
||||
return str.replace(/\s/g, '-');
|
||||
}
|
||||
process: str => str? str.replace(/\s/g, '-') : ''
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
module.exports = {
|
||||
name: 'dump',
|
||||
process: function(obj) {
|
||||
console.log(obj);
|
||||
}
|
||||
};
|
||||
process: obj => console.log(obj)
|
||||
};
|
||||
|
||||
@@ -1,37 +1,39 @@
|
||||
var config = require('../config.json');
|
||||
var projectPackage = require('../../package.json');
|
||||
var path = require('path');
|
||||
var fs = require('fs-extra-promise').useFs(require('fs-extra'));
|
||||
"use strict";
|
||||
const config = require('../config.json'),
|
||||
projectPackage = require('../../package.json'),
|
||||
path = require('path'),
|
||||
fs = require('fs-extra-promise').useFs(require('fs-extra')),
|
||||
Dgeni = require('dgeni');
|
||||
|
||||
module.exports = gulp => {
|
||||
gulp.task('docs', [], () => {
|
||||
|
||||
module.exports = function(gulp) {
|
||||
gulp.task('docs', [], function() {
|
||||
var Dgeni = require('dgeni');
|
||||
var semver = require('semver');
|
||||
try {
|
||||
var ionicPackage = require('./dgeni-config')(projectPackage.version);
|
||||
var dgeni = new Dgeni([ionicPackage]);
|
||||
return dgeni.generate().then(function(docs) {
|
||||
console.log(docs.length + ' docs generated');
|
||||
});
|
||||
|
||||
const ionicPackage = require('./dgeni-config')(projectPackage.version),
|
||||
dgeni = new Dgeni([ionicPackage]);
|
||||
|
||||
return dgeni.generate().then(docs => console.log(docs.length + ' docs generated'));
|
||||
|
||||
} catch (err) {
|
||||
console.log(err.stack);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
gulp.task('readmes', [], function() {
|
||||
var Dgeni = require('dgeni');
|
||||
var semver = require('semver');
|
||||
|
||||
fs.copySync(path.resolve(__dirname, '..', '..', 'README.md'), path.resolve(__dirname, '..', '..', config.pluginDir, 'core', 'README.md'));
|
||||
|
||||
try {
|
||||
var ionicPackage = require('./dgeni-readmes-config')(projectPackage.version);
|
||||
var dgeni = new Dgeni([ionicPackage]);
|
||||
return dgeni.generate().then(function(docs) {
|
||||
console.log(docs.length + ' README files generated');
|
||||
});
|
||||
|
||||
const ionicPackage = require('./dgeni-readmes-config')(projectPackage.version),
|
||||
dgeni = new Dgeni([ionicPackage]);
|
||||
return dgeni.generate().then(docs => console.log(docs.length + ' README files generated'));
|
||||
|
||||
} catch (err) {
|
||||
console.log(err.stack);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
module.exports = function collectInputsOutputs() {
|
||||
return {
|
||||
|
||||
$runBefore: ['rendering-docs'],
|
||||
$process: function(docs) {
|
||||
docs.forEach(function(doc) {
|
||||
|
||||
if (doc.statics && doc.statics.length) {
|
||||
for (var i in doc.statics) {
|
||||
// identify properties to differentiate from methods
|
||||
if (typeof doc.statics[i].parameters == 'undefined') {
|
||||
doc.statics[i].isProperty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (doc.members && doc.members.length) {
|
||||
var members = [];
|
||||
var inputs = [];
|
||||
var outputs = [];
|
||||
|
||||
memberLoop:
|
||||
for (var i in doc.members) {
|
||||
|
||||
// identify properties to differentiate from methods
|
||||
if (typeof doc.members[i].parameters == 'undefined') {
|
||||
doc.members[i].isProperty = true;
|
||||
}
|
||||
|
||||
if (doc.members[i].decorators && doc.members[i].decorators.length) {
|
||||
|
||||
decoratorLoop:
|
||||
for (var ii in doc.members[i].decorators) {
|
||||
|
||||
if (doc.members[i].decorators[ii].name == 'Input') {
|
||||
inputs.push(parseMember(doc.members[i]));
|
||||
continue memberLoop;
|
||||
}
|
||||
if (doc.members[i].decorators[ii].name == 'Output') {
|
||||
outputs.push(parseMember(doc.members[i]));
|
||||
continue memberLoop;
|
||||
}
|
||||
}
|
||||
// not an input or output, must be a plain member
|
||||
members.push(doc.members[i]);
|
||||
} else {
|
||||
members.push(doc.members[i]);
|
||||
};
|
||||
}
|
||||
|
||||
// update doc with pruned members list and add inputs and outputs
|
||||
doc.members = members;
|
||||
doc.inputs = inputs;
|
||||
doc.outputs = outputs;
|
||||
}
|
||||
|
||||
function parseMember(member) {
|
||||
member.type = member.content.substring(
|
||||
member.content.indexOf('{') + 1,
|
||||
member.content.indexOf('}')
|
||||
);
|
||||
member.description = member.content.substring(
|
||||
member.content.indexOf('}') + 1,
|
||||
member.content.length
|
||||
);
|
||||
return member;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
43
scripts/docs/processors/debug.js
Normal file
43
scripts/docs/processors/debug.js
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
module.exports = function test(){
|
||||
return {
|
||||
name: 'debug',
|
||||
$runBefore: ['rendering-docs'],
|
||||
$process: function(docs){
|
||||
docs.forEach(function(doc){
|
||||
if (doc.name == "Camera"){
|
||||
|
||||
console.log(doc.tags);
|
||||
doc.tags.forEach(function(tag){
|
||||
if(tag.tagName == 'classes'){
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
doc.moduleDoc.exports.forEach(function(d,i){
|
||||
if(d.name === 'CameraOptions') {
|
||||
console.log('Name: ' + d.name);
|
||||
console.log('Type: ' + d.docType);
|
||||
console.log('First member: ', d.members[0]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var exports = doc.exportSymbol.parent.exports;
|
||||
for(var p in exports) {
|
||||
if(p == 'CameraOptions')
|
||||
{
|
||||
var x = exports[p];
|
||||
console.log(x.members.quality);
|
||||
}
|
||||
}
|
||||
doc.members.forEach(function(method){
|
||||
if (method.name === "getPicture") {
|
||||
console.log(method);
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,9 @@
|
||||
"use strict";
|
||||
module.exports = function removePrivateApi() {
|
||||
return {
|
||||
name: 'remove-private-api',
|
||||
description: 'Prevent the private apis from being rendered',
|
||||
$runBefore: ['rendering-docs'],
|
||||
$process: function(docs) {
|
||||
var publicDocs = [];
|
||||
docs.forEach(function(doc){
|
||||
if (!doc.private && (!doc.tags || !doc.tags.tagsByName.get('hidden'))){
|
||||
publicDocs.push(doc);
|
||||
return doc
|
||||
}
|
||||
});
|
||||
docs = publicDocs;
|
||||
return docs;
|
||||
}
|
||||
}
|
||||
$process: docs => docs.filter(doc => !doc.private && (!doc.tags || !doc.tags.tagsByName.get('hidden')))
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,38 +1,37 @@
|
||||
"use strict";
|
||||
module.exports = function jekyll(renderDocsProcessor) {
|
||||
return {
|
||||
name: 'jekyll',
|
||||
description: 'Create jekyll includes',
|
||||
$runAfter: ['paths-computed'],
|
||||
$runBefore: ['rendering-docs'],
|
||||
$process: function(docs) {
|
||||
var currentVersion = renderDocsProcessor.extraData.version.current.name;
|
||||
$process: docs => {
|
||||
|
||||
// pretty up and sort the docs object for menu generation
|
||||
docs = docs.filter(function(doc) {
|
||||
return (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page';
|
||||
});
|
||||
docs.sort(function(a, b) {
|
||||
textA = a.name ? a.name.toUpperCase() : '';
|
||||
textB = b.name ? b.name.toUpperCase() : '';
|
||||
docs = docs.filter(doc => (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page');
|
||||
|
||||
docs.sort((a, b) => {
|
||||
const textA = a.name ? a.name.toUpperCase() : '',
|
||||
textB = b.name ? b.name.toUpperCase() : '';
|
||||
|
||||
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
|
||||
});
|
||||
docs.forEach(function(doc, i) {
|
||||
doc.outputPath = doc.outputPath.toLowerCase().replace(/\s/g, '-');
|
||||
docs[i].URL = doc.outputPath.replace('docs/v2//', 'docs/v2/')
|
||||
.replace('/index.md', '')
|
||||
.replace('content/', '');
|
||||
|
||||
docs[i].demo = !!docs[i].demo;
|
||||
docs.forEach(doc => {
|
||||
doc.outputPath = doc.outputPath.toLowerCase().replace(/\s/g, '-');
|
||||
doc.URL = doc.outputPath.replace('docs/v2//', 'docs/v2/')
|
||||
.replace('/index.md', '')
|
||||
.replace('content/', '');
|
||||
});
|
||||
|
||||
// add side menu
|
||||
docs.push({
|
||||
docType: 'native_menu-menu',
|
||||
id: 'native_menu-menu',
|
||||
docType: 'nativeMenu',
|
||||
id: 'native_menu',
|
||||
template: 'native_menu.template.html',
|
||||
outputPath: 'content/_includes/v2_fluid/native_menu.html'
|
||||
});
|
||||
|
||||
// returning docs will replace docs object in the next process
|
||||
return docs;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
var copy = require('cpr').cpr;
|
||||
var mkdirp = require('mkdirp');
|
||||
var path = require('canonical-path');
|
||||
var q = require('q');
|
||||
var fs = require('fs');
|
||||
|
||||
module.exports = function latestVersion(renderDocsProcessor) {
|
||||
return {
|
||||
name: 'latest-version',
|
||||
$runAfter: ['files-written'],
|
||||
description: 'Copy the latest version (that was compiled to docs/) into docs/versionName',
|
||||
$process: function(docs) {
|
||||
var versionData = renderDocsProcessor.extraData.version;
|
||||
|
||||
var docsBase = 'dist/ionic-site/content/docs/v2/';
|
||||
var versionDir = path.resolve(docsBase, versionData.latest.name);
|
||||
var latestDir = path.resolve(docsBase, 'api');
|
||||
|
||||
var deferred = q.defer();
|
||||
|
||||
mkdirp(versionDir, function() {
|
||||
copy(latestDir, path.join(versionDir, 'api'), {
|
||||
deleteFirst: true,
|
||||
overwrite: true
|
||||
}, function(err, files) {
|
||||
deferred.resolve(docs);
|
||||
});
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
};
|
||||
15
scripts/docs/processors/mark-properties.js
Normal file
15
scripts/docs/processors/mark-properties.js
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
module.exports = function markProperties() {
|
||||
return {
|
||||
name: 'mark-properties',
|
||||
$runBefore: ['rendering-docs'],
|
||||
$process: docs => docs.map(doc => {
|
||||
for (let i in doc.members) {
|
||||
if (doc.members.hasOwnProperty(i) && typeof doc.members[i].parameters === 'undefined') {
|
||||
doc.members[i].isProperty = true;
|
||||
}
|
||||
}
|
||||
return doc;
|
||||
})
|
||||
}
|
||||
};
|
||||
@@ -1,24 +1,19 @@
|
||||
"use strict";
|
||||
module.exports = function npmId(renderDocsProcessor) {
|
||||
return {
|
||||
name: 'npm-id',
|
||||
$runAfter: ['paths-computed'],
|
||||
$runBefore: ['rendering-docs'],
|
||||
$process: function(docs) {
|
||||
var currentVersion = renderDocsProcessor.extraData.version.current.name;
|
||||
|
||||
$process: docs => {
|
||||
// pretty up and sort the docs object for menu generation
|
||||
docs = docs.filter(function(doc) {
|
||||
return (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page';
|
||||
});
|
||||
|
||||
docs.forEach(function(doc, i) {
|
||||
doc.npmId = doc.outputPath.replace('/README.md', '') // for readmes
|
||||
.replace('@ionic-native/plugins/','') // for readmes
|
||||
.replace('content/docs/v2/native/', '') // for docs
|
||||
.replace('/index.md', ''); // for docs
|
||||
docs.forEach(doc => {
|
||||
doc.npmId = doc.id.match(/plugins\/(.*)\/index/)[1];
|
||||
});
|
||||
|
||||
// returning docs will replace docs object in the next process
|
||||
return docs;
|
||||
}
|
||||
};
|
||||
|
||||
22
scripts/docs/processors/parse-optional.js
Normal file
22
scripts/docs/processors/parse-optional.js
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
module.exports = function parseOptional() {
|
||||
return {
|
||||
$runBefore: ['rendering-docs'],
|
||||
$process: docs => {
|
||||
docs.forEach(doc => {
|
||||
if (doc.members && doc.members.length) {
|
||||
for (let i in doc.members) {
|
||||
if (doc.members[i].params && doc.members[i].params.length) {
|
||||
for (let ii in doc.members[i].params) {
|
||||
if (doc.members[i].params[ii].optional) {
|
||||
doc.members[i].params[ii].description += '<strong class="tag">Optional</strong>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return docs;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,22 +1,18 @@
|
||||
"use strict";
|
||||
module.exports = function readmes(renderDocsProcessor) {
|
||||
return {
|
||||
name: 'readmes',
|
||||
description: 'Create jekyll includes',
|
||||
$runAfter: ['paths-computed'],
|
||||
$runBefore: ['rendering-docs'],
|
||||
$process: function(docs) {
|
||||
var currentVersion = renderDocsProcessor.extraData.version.current.name;
|
||||
|
||||
$process: docs => {
|
||||
// pretty up and sort the docs object for menu generation
|
||||
docs = docs.filter(function(doc) {
|
||||
return (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page';
|
||||
});
|
||||
docs = docs.filter(doc => (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page');
|
||||
|
||||
docs.forEach(function(doc, i) {
|
||||
docs.forEach(doc => {
|
||||
doc.outputPath = doc.outputPath.replace('src/', '');
|
||||
});
|
||||
|
||||
// returning docs will replace docs object in the next process
|
||||
return docs;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
"use strict";
|
||||
module.exports = function removePrivateMembers() {
|
||||
return {
|
||||
name: 'remove-private-members',
|
||||
description: 'Remove member docs with @private tags',
|
||||
$runAfter: ['tags-parsed'],
|
||||
$runBefore: ['rendering-docs'],
|
||||
$process: function(docs) {
|
||||
docs.forEach(function(doc) {
|
||||
$process: docs => {
|
||||
docs.forEach(doc => {
|
||||
|
||||
if (doc.members) {
|
||||
doc.members = doc.members.filter(function(member) {
|
||||
return !member.tags.tagsByName.get('hidden');
|
||||
});
|
||||
doc.members = doc.members.filter(member => !member.tags.tagsByName.get('hidden'));
|
||||
}
|
||||
|
||||
if (doc.statics) {
|
||||
doc.statics = doc.statics.filter(function(staticMethod) {
|
||||
return !staticMethod.tags.tagsByName.get('hidden');
|
||||
});
|
||||
doc.statics = doc.statics.filter(staticMethod => !staticMethod.tags.tagsByName.get('hidden'));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
"use strict";
|
||||
module.exports = [
|
||||
{'name': 'advanced'},
|
||||
{'name': 'demo'},
|
||||
{'name': 'beta', transforms: function(doc, tag, value) {
|
||||
// make the value true or undefined instead of '' or undefined
|
||||
return typeof value !== 'undefined';
|
||||
}},
|
||||
{'name': 'beta', transforms: (doc, tag, value) => typeof value !== 'undefined'}, // make the value true or undefined instead of '' or undefined
|
||||
{'name': 'usage'},
|
||||
{'name': 'hidden'}, // hide from docs
|
||||
{'name': 'classes'}, // related classes
|
||||
|
||||
233
scripts/docs/templates/common.template.html
vendored
233
scripts/docs/templates/common.template.html
vendored
@@ -11,7 +11,7 @@ doc: "<$ doc.name $>"
|
||||
docType: "<$ doc.docType $>"
|
||||
---
|
||||
|
||||
<@ macro interfaceTable(interface) @>
|
||||
<@- macro interfaceTable(interface) -@>
|
||||
<@ for export in doc.moduleDoc.exports -@>
|
||||
<@ if export.name == interface @>
|
||||
<table class="table param-table" style="margin:0;">
|
||||
@@ -33,30 +33,21 @@ docType: "<$ doc.docType $>"
|
||||
</td>
|
||||
<td>
|
||||
<$ param.description | marked $>
|
||||
<@ if param.optional @><strong class="tag">Optional</strong><@ endif @>
|
||||
<@ if param.optional @><em>(optional)</em><@ endif @>
|
||||
</td>
|
||||
</tr>
|
||||
<@ endfor @>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<@ endif @>
|
||||
<@- endfor @>
|
||||
<@ endmacro @>
|
||||
|
||||
<@ macro paramList(paramData) -@>
|
||||
<@- if paramData -@><span class="params">(
|
||||
<@- for param in paramData -@>
|
||||
<span class="param"><$ param | escape $><@ if not loop.last @>, <@ endif @></span>
|
||||
<@- endfor @>)</span>
|
||||
<@- endif @>
|
||||
<@- endmacro -@>
|
||||
|
||||
<@ macro githubViewLink(doc) -@>
|
||||
<@- macro githubViewLink(doc) -@>
|
||||
<a href="https://github.com/driftyco/ionic-native/tree/master/<$ doc.fileInfo.relativePath $>#L<$ doc.location.start.line+1 $>-L<$ doc.location.end.line+1 $>"><$ doc.fileInfo.relativePath $> (line <$ doc.location.start.line+1 $>)</a>
|
||||
<@- endmacro -@>
|
||||
|
||||
<@ macro paramTable(params, isDirective) -@>
|
||||
<@- macro paramTable(params, isDirective) -@>
|
||||
<table class="table param-table" style="margin:0;">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -66,140 +57,93 @@ docType: "<$ doc.docType $>"
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<@ for param in params @>
|
||||
<@- for param in params @>
|
||||
<tr>
|
||||
<td>
|
||||
<$ param.name $>
|
||||
<@ if param.alias @>| <$ param.alias $><@ endif @>
|
||||
<@- if param.alias @>| <$ param.alias $><@ endif -@>
|
||||
</td>
|
||||
<td>
|
||||
<$ typeList(param.typeList) $>
|
||||
</td>
|
||||
<td>
|
||||
<$ param.description | marked $>
|
||||
<@ if param.optional @><strong class="tag">Optional</strong><@ endif @>
|
||||
<@ if param.defaultValue @><p><em>(default: <$ param.defaultValue $>)</em></p><@ endif @>
|
||||
<@- if param.defaultValue @><p><em>(default: <$ param.defaultValue $>)</em></p><@ endif -@>
|
||||
</td>
|
||||
</tr>
|
||||
<@ endfor @>
|
||||
<@ endfor -@>
|
||||
</tbody>
|
||||
</table>
|
||||
<@- endmacro -@>
|
||||
|
||||
|
||||
<@- macro functionSyntax(fn) @>
|
||||
<@- set sep = joiner(', ') -@>
|
||||
<code><$ fn.name $><@- if not fn.isProperty @>(<@ endif -@><@- for param in fn.params @><$ sep() $>
|
||||
<@- if param.type.optional @>[<@ endif -@>
|
||||
<@- if param.type.optional @>[<@- endif -@>
|
||||
<$ param.name $>
|
||||
<@- if param.type.optional @>]<@ endif -@>
|
||||
<@ endfor @><@- if not fn.isProperty @>)<@ endif -@></code>
|
||||
<@ if fn.alias @><small>(alias: <$ fn.alias $>)</small><@ endif @>
|
||||
<@ endmacro -@>
|
||||
<@- if param.type.optional -@>]<@- endif -@>
|
||||
<@- endfor -@><@- if not fn.isProperty @>)<@- endif -@></code>
|
||||
<@- endmacro -@>
|
||||
|
||||
<@ macro typeList(types) -@>
|
||||
<@- macro typeList(types) -@>
|
||||
<@ set separator = joiner("|") @>
|
||||
<@ for type in types @><$ separator() $><$ type | code $><@ endfor @>
|
||||
<@- for type in types @><$ separator() $><$ type | code $><@ endfor -@>
|
||||
<@- endmacro -@>
|
||||
|
||||
<@- macro typeInfo(fn) -@>
|
||||
<$ typeList(fn.typeList) $> <$ fn.description $>
|
||||
<@- endmacro -@>
|
||||
|
||||
|
||||
|
||||
<@ macro documentClass(doc) @>
|
||||
<@- if doc.statics.length -@>
|
||||
<h2>Static Members</h2>
|
||||
<@ for method in doc.statics -@>
|
||||
<@ if not method.internal @>
|
||||
<div id="<$ method.name $>"></div>
|
||||
<h3><$ functionSyntax(method) $></h3>
|
||||
<@- macro documentPlatforms(method) -@>
|
||||
<@- if method.decorators @>
|
||||
<@ for prop in method.decorators[0].argumentInfo @>
|
||||
<@ if prop.platforms @>
|
||||
<p>
|
||||
<b>Platforms:</b>
|
||||
<@- for platform in prop.platforms @>
|
||||
<code><$ platform $></code>
|
||||
<@ endfor -@>
|
||||
<strong>Platforms:</strong>
|
||||
<@- for platform in prop.platforms -@>
|
||||
<strong class="tag"><$ platform $></strong>
|
||||
<@- endfor -@>
|
||||
</p>
|
||||
<@ endif @>
|
||||
<@ endfor @>
|
||||
<@- endif @>
|
||||
<@- endmacro -@>
|
||||
|
||||
<$ method.description $>
|
||||
|
||||
<@ if method.params @>
|
||||
<$ paramTable(method.params) $>
|
||||
<@ endif @>
|
||||
|
||||
<@ if method.this -@>
|
||||
<h4> Method's `this`
|
||||
<$ method.this $>
|
||||
</h4>
|
||||
<@- endif @>
|
||||
|
||||
<@ if method.returns @>
|
||||
<div class="return-value" markdown="1">
|
||||
<i class="icon ion-arrow-return-left"></i>
|
||||
<b>Returns:</b> <$ typeInfo(method.returns) $>
|
||||
</div>
|
||||
<@ endif @>
|
||||
<@ endif @>
|
||||
<@ endfor -@>
|
||||
<@ endif @>
|
||||
|
||||
<!-- methods on the class -->
|
||||
<@- if doc.members and doc.members.length @>
|
||||
|
||||
<h2>Instance Members</h2>
|
||||
<@ for method in doc.members -@>
|
||||
<div id="<$ method.name $>"></div>
|
||||
<h3>
|
||||
<$ functionSyntax(method) $>
|
||||
</h3>
|
||||
<@ macro documentMethod(method) -@>
|
||||
<h3><a class="anchor" name="<$ method.name $>" href="#<$ method.name $>"></a><$ functionSyntax(method) $></h3>
|
||||
<$ documentPlatforms(method) $>
|
||||
<$ method.description $>
|
||||
<@ if method.params -@>
|
||||
<$ paramTable(method.params) $>
|
||||
<@- endif @>
|
||||
<@ if method.this -@>
|
||||
<h4> Method's `this`
|
||||
<$ method.this $>
|
||||
</h4>
|
||||
<@- endif @>
|
||||
|
||||
<@ if method.returns -@>
|
||||
<div class="return-value" markdown="1">
|
||||
<i class="icon ion-arrow-return-left"></i>
|
||||
<b>Returns:</b> <$ typeInfo(method.returns) $>
|
||||
</div>
|
||||
<@- endif @>
|
||||
<@- endmacro -@>
|
||||
|
||||
<@- macro documentClass(doc) @>
|
||||
<@- if doc.statics.length -@>
|
||||
<h2>Static Members</h2>
|
||||
<@ for method in doc.statics -@>
|
||||
<$ documentMethod(method) $>
|
||||
<@ endfor -@>
|
||||
<@ endif @>
|
||||
|
||||
<# --- methods in class --- #>
|
||||
<@- if doc.members and doc.members.length @>
|
||||
|
||||
<h2>Instance Members</h2>
|
||||
<@ for method in doc.members -@>
|
||||
<$ documentMethod(method) $>
|
||||
<@- endfor @>
|
||||
<@- endif -@>
|
||||
<@ endmacro @>
|
||||
<@ block body @>
|
||||
<@ block content @>
|
||||
<@ block header @>
|
||||
<h1 class="api-title">
|
||||
<@ if doc.docType == "directive" @>
|
||||
<$ doc.name | dashCase $>
|
||||
<@ else @>
|
||||
<$ doc.name $>
|
||||
<@ endif @>
|
||||
|
||||
<@ if doc.parent @>
|
||||
<br />
|
||||
<small>
|
||||
Child of <$ doc.parent $>
|
||||
</small>
|
||||
<@ endif @>
|
||||
|
||||
<@ if doc.delegate @>
|
||||
<br/>
|
||||
<small>
|
||||
Delegate: <$ doc.delegate $>
|
||||
</small>
|
||||
<@ endif @>
|
||||
<h1 class="api-title"><$ doc.name $>
|
||||
<@- if doc.beta == true -@>
|
||||
<span class="beta" title="beta">β</span>
|
||||
<@- endif -@>
|
||||
@@ -209,13 +153,9 @@ docType: "<$ doc.docType $>"
|
||||
Improve this doc
|
||||
</a>
|
||||
|
||||
<@ endblock @>
|
||||
|
||||
<!-- decorators -->
|
||||
<# --- Decorators --- #>
|
||||
<@- if doc.decorators @>
|
||||
|
||||
<@ for prop in doc.decorators[0].argumentInfo @>
|
||||
|
||||
<@ if doc.beta == true @>
|
||||
<p class="beta-notice">
|
||||
This plugin is still in beta stage and may not work as expected. Please
|
||||
@@ -224,7 +164,8 @@ docType: "<$ doc.docType $>"
|
||||
</p>
|
||||
<@ endif @>
|
||||
|
||||
<pre><code>$ <@ if prop.install @><$ prop.install $><@ else @>ionic plugin add <$ prop.plugin $><@ endif @>
|
||||
<# --- Install commands --- #>
|
||||
<pre><code class="nohighlight">$ <@ if prop.install @><$ prop.install $><@ else @>ionic plugin add <$ prop.plugin $><@ endif @>
|
||||
$ npm install --save @ionic-native/<$ doc.npmId $>
|
||||
</code></pre>
|
||||
<p>Repo:
|
||||
@@ -233,48 +174,34 @@ $ npm install --save @ionic-native/<$ doc.npmId $>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<!-- description -->
|
||||
<@ block description @>
|
||||
<# --- Plugin description --- #>
|
||||
<$ doc.description | marked $>
|
||||
<@ endblock @>
|
||||
|
||||
|
||||
<@- if doc.directiveInfo @>
|
||||
<h2><$ doc.directiveInfo.type $></h2>
|
||||
<h3><$ doc.directiveInfo.properties[0].name $>: <code><$ doc.directiveInfo.properties[0].values $></code></h3>
|
||||
<@ endif -@>
|
||||
|
||||
<# --- Plugin supported platforms --- #>
|
||||
<@ if prop.platforms @>
|
||||
<!-- @platforms tag -->
|
||||
<h2>Supported platforms</h2>
|
||||
<@ block platforms @>
|
||||
<ul>
|
||||
<@ for platform in prop.platforms -@>
|
||||
<li><$ platform $></li>
|
||||
<@- endfor @>
|
||||
</ul>
|
||||
<@ endblock @>
|
||||
<!-- @platforms tag end -->
|
||||
<@ endif @>
|
||||
<@ endfor @>
|
||||
<@ endif -@><!-- if doc.decorators -->
|
||||
<@ endif -@> <# --- end of: if doc.decorators --- #>
|
||||
|
||||
<!-- @usage tag -->
|
||||
<# --- Plugin usage --- #>
|
||||
<@ if doc.usage @>
|
||||
<h2>Usage</h2>
|
||||
<@ block usage @>
|
||||
<$ doc.usage | marked $>
|
||||
<@ endblock @>
|
||||
<@ endif @>
|
||||
|
||||
<!-- @property tags -->
|
||||
<@ if doc.properties @>
|
||||
<# --- Plugin attributes --- #>
|
||||
<@- if doc.properties -@>
|
||||
<h2>Attributes:</h2>
|
||||
<table class="table" style="margin:0;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Attribute</th>
|
||||
|
||||
<@ set hasTypes = false @>
|
||||
<@ for prop in doc.properties @>
|
||||
<@ if prop.type @>
|
||||
@@ -284,12 +211,11 @@ $ npm install --save @ionic-native/<$ doc.npmId $>
|
||||
<@ if hasTypes @>
|
||||
<th>Type</th>
|
||||
<@ endif @>
|
||||
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<@ for prop in doc.properties -@>
|
||||
<@- for prop in doc.properties -@>
|
||||
<tr>
|
||||
<td>
|
||||
<$ prop.name $>
|
||||
@@ -299,48 +225,44 @@ $ npm install --save @ionic-native/<$ doc.npmId $>
|
||||
<$ prop.type.name $>
|
||||
</td>
|
||||
<@ endif @>
|
||||
|
||||
<td>
|
||||
<$ prop.description $>
|
||||
</td>
|
||||
</tr>
|
||||
<@- endfor @>
|
||||
<@ endfor -@>
|
||||
</tbody>
|
||||
</table>
|
||||
<@ endif @>
|
||||
<@- endif -@>
|
||||
|
||||
<# --- Plugin class documentation --- #>
|
||||
<$ documentClass(doc) $>
|
||||
|
||||
<@ block advanced @>
|
||||
<# --- Advanced usage --- #>
|
||||
<@- if doc.advanced -@>
|
||||
<h2><a class="anchor" name="advanced" href="#advanced"></a>Advanced</h2>
|
||||
<$ doc.advanced | marked $>
|
||||
<@- endif -@>
|
||||
<@ endblock @>
|
||||
|
||||
<!-- other classes -->
|
||||
<@ for tag in doc.tags.tags -@>
|
||||
<@ if tag.tagName == 'classes' -@>
|
||||
<!--<h2><a class="anchor" name="related-classes" href="#related-classes"></a>Related Classes</h2>-->
|
||||
<@ set classes = tag.description.split('\n') @>
|
||||
<@ for item in classes -@>
|
||||
<@ if item.length > 1 @>
|
||||
<@ for export in doc.moduleDoc.exports -@>
|
||||
<@ if export.name == item @>
|
||||
<# --- Other classes --- #>
|
||||
<@- for tag in doc.tags.tags -@>
|
||||
<@- if tag.tagName == 'classes' -@>
|
||||
<@- set classes = tag.description.split('\n') -@>
|
||||
<@- for item in classes -@>
|
||||
<@- if item.length > 1 -@>
|
||||
<@- for export in doc.moduleDoc.exports -@>
|
||||
<@- if export.name == item -@>
|
||||
<h2><a class="anchor" name="<$ item $>" href="#<$ item $>"></a><$ item $></h2>
|
||||
<$ documentClass(export) $>
|
||||
<@ endif @>
|
||||
<@- endfor @>
|
||||
<@ endif @>
|
||||
<@- endfor @>
|
||||
<@- endif @>
|
||||
<@- endfor @>
|
||||
<!-- end other classes -->
|
||||
<@- endif -@>
|
||||
<@- endfor -@>
|
||||
<@- endif -@>
|
||||
<@- endfor -@>
|
||||
<@- endif -@>
|
||||
<@- endfor -@>
|
||||
|
||||
<!-- interfaces -->
|
||||
<# --- Other interfaces --- #>
|
||||
<@ for tag in doc.tags.tags -@>
|
||||
<@ if tag.tagName == 'interfaces' @>
|
||||
<!--<h2><a class="anchor" name="interfaces" href="#interfaces"></a>Interfaces</h2>-->
|
||||
<@ set interfaces = tag.description.split('\n') @>
|
||||
<@ for item in interfaces -@>
|
||||
<@ if item.length > 1 @>
|
||||
@@ -350,21 +272,12 @@ $ npm install --save @ionic-native/<$ doc.npmId $>
|
||||
<@- endfor @>
|
||||
<@ endif @>
|
||||
<@- endfor @>
|
||||
<!-- end interfaces -->
|
||||
|
||||
<!-- related link -->
|
||||
|
||||
<# --- Related links --- #>
|
||||
<@- if doc.see @>
|
||||
|
||||
<h2>Related</h2>
|
||||
<h2><a class="anchor" name="related" href="#related"></a>Related</h2>
|
||||
<@ for s in doc.see @>
|
||||
<$ s | safe $>
|
||||
<@- endfor -@>
|
||||
|
||||
<@- endif -@>
|
||||
|
||||
|
||||
<!-- end content block -->
|
||||
<@ endblock @>
|
||||
|
||||
<!-- end body block -->
|
||||
<@ endblock @>
|
||||
|
||||
11
scripts/docs/templates/native_menu.template.html
vendored
11
scripts/docs/templates/native_menu.template.html
vendored
@@ -1,9 +1,14 @@
|
||||
<@ for doc in docs @><@ if doc.URL and doc.private != true and doc.beta != true @>
|
||||
<li class="capitalize {% if page.id == 'overview' %}active{% endif %}">
|
||||
<a href="/docs/v2/native/">Overview</a>
|
||||
</li>
|
||||
<li class="capitalize {% if page.id == 'mocking' %}active{% endif %}">
|
||||
<a href="/docs/v2/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 %}">
|
||||
<a href="/<$ doc.URL $>"><$ doc.name $></a>
|
||||
</li><@ endif @><@ endfor @>
|
||||
|
||||
<@ for doc in docs @><@ if doc.URL and doc.private != true and doc.beta == true @>
|
||||
<@- 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 %}">
|
||||
<a href="/<$ doc.URL $>"><$ doc.name $> <span class="beta">β</span></a>
|
||||
</li><@ endif @><@ endfor @>
|
||||
|
||||
@@ -23,16 +23,18 @@ function run {
|
||||
# CD in to the site dir to commit updated docs
|
||||
cd $SITE_DIR
|
||||
|
||||
# Add all files to git
|
||||
git add .
|
||||
|
||||
# if no changes, don't commit
|
||||
CHANGED=$(git diff-index --name-only HEAD --)
|
||||
if [ -z "$CHANGED" ];
|
||||
CHANGED=$(git diff-index --name-only HEAD 2>/dev/null | wc -l)
|
||||
if [ $CHANGED -eq 0 ];
|
||||
then
|
||||
echo "-- No changes detected for the following commit, docs not updated."
|
||||
echo "https://github.com/driftyco/$CIRCLE_PROJECT_REPONAME/commit/$CIRCLE_SHA1"
|
||||
else
|
||||
git config --global user.email "hi@ionicframework.com"
|
||||
git config --global user.name "Ionitron"
|
||||
git add -A
|
||||
git commit -am "Automated build of native docs driftyco/$CIRCLE_PROJECT_REPONAME@$CIRCLE_SHA1"
|
||||
# in case a different commit was pushed to ionic-site during doc/demo gen,
|
||||
# try to rebase around it before pushing
|
||||
|
||||
@@ -2,23 +2,29 @@ import { Plugin } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/**
|
||||
* @name Plugin Name
|
||||
* @name $Plugin_Name
|
||||
* @description
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { PluginName } from 'ionic-native';
|
||||
* import { $PluginName } from 'ionic-native';
|
||||
*
|
||||
*
|
||||
* constructor(private $pluginName: $PluginName) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PluginName',
|
||||
pluginName: '$PluginName',
|
||||
plugin: '',
|
||||
pluginRef: '',
|
||||
repo: ''
|
||||
repo: '',
|
||||
platforms: []
|
||||
})
|
||||
@Injectable()
|
||||
export class PluginName {
|
||||
export class $PluginName {
|
||||
|
||||
}
|
||||
|
||||
@@ -15,29 +15,36 @@ import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
/**
|
||||
* @name Plugin Name
|
||||
* @name $Plugin_Name
|
||||
* @description
|
||||
* This plugin does something
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { PluginName } from 'ionic-native';
|
||||
* import { $PluginName } from 'ionic-native';
|
||||
*
|
||||
* PluginName.functionName('Hello', 123)
|
||||
* .then((something: any) => doSomething(something))
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* constructor(private $pluginName: $PluginName) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* this.$pluginName.functionName('Hello', 123)
|
||||
* .then((res: any) => console.log(res))
|
||||
* .catch((error: any) => console.error(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'PluginName',
|
||||
pluginName: '$PluginName',
|
||||
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 {
|
||||
export class $PluginName {
|
||||
|
||||
/**
|
||||
* This function does something
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -203,15 +205,19 @@ export function Plugin(config: PluginConfig) {
|
||||
cls['getPluginName'] = function() {
|
||||
return config.pluginName;
|
||||
};
|
||||
|
||||
cls['getPluginRef'] = function() {
|
||||
return config.pluginRef;
|
||||
};
|
||||
|
||||
cls['getPluginInstallName'] = function() {
|
||||
return config.plugin;
|
||||
};
|
||||
|
||||
cls['getPluginRepo'] = function() {
|
||||
return config.repo;
|
||||
};
|
||||
|
||||
cls['getSupportedPlatforms'] = function() {
|
||||
return config.platforms;
|
||||
};
|
||||
@@ -259,6 +265,7 @@ export function CordovaInstance(opts: any = {}) {
|
||||
*/
|
||||
export function CordovaProperty(target: any, key: string) {
|
||||
Object.defineProperty(target, key, {
|
||||
enumerable: true,
|
||||
get: () => {
|
||||
if (checkAvailability(target, key) === true) {
|
||||
return getPlugin(target.constructor.getPluginRef())[key];
|
||||
@@ -282,6 +289,7 @@ export function CordovaProperty(target: any, key: string) {
|
||||
*/
|
||||
export function InstanceProperty(target: any, key: string) {
|
||||
Object.defineProperty(target, key, {
|
||||
enumerable: true,
|
||||
get: function(){
|
||||
return this._objectInstance[key];
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
294
src/@ionic-native/plugins/admob-free/index.ts
Normal file
294
src/@ionic-native/plugins/admob-free/index.ts
Normal 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';
|
||||
*
|
||||
*
|
||||
* 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; }
|
||||
|
||||
}
|
||||
@@ -242,7 +242,8 @@ export class AdMob {
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onAdFailLoad'
|
||||
event: 'onAdFailLoad',
|
||||
element: document
|
||||
})
|
||||
onAdFailLoad(): Observable<any> { return; }
|
||||
|
||||
@@ -252,7 +253,8 @@ export class AdMob {
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onAdLoaded'
|
||||
event: 'onAdLoaded',
|
||||
element: document
|
||||
})
|
||||
onAdLoaded(): Observable<any> { return; }
|
||||
|
||||
@@ -262,7 +264,8 @@ export class AdMob {
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onAdPresent'
|
||||
event: 'onAdPresent',
|
||||
element: document
|
||||
})
|
||||
onAdPresent(): Observable<any> { return; }
|
||||
|
||||
@@ -272,7 +275,8 @@ export class AdMob {
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onAdLeaveApp'
|
||||
event: 'onAdLeaveApp',
|
||||
element: document
|
||||
})
|
||||
onAdLeaveApp(): Observable<any> { return; }
|
||||
|
||||
@@ -282,7 +286,8 @@ export class AdMob {
|
||||
*/
|
||||
@Cordova({
|
||||
eventObservable: true,
|
||||
event: 'onAdDismiss'
|
||||
event: 'onAdDismiss',
|
||||
element: document
|
||||
})
|
||||
onAdDismiss(): Observable<any> { return; }
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
95
src/@ionic-native/plugins/android-full-screen/index.ts
Normal file
95
src/@ionic-native/plugins/android-full-screen/index.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Cordova, Plugin } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name Android Full Screen
|
||||
* @description
|
||||
* This plugin enables developers to offer users a true full screen experience in their Cordova and PhoneGap apps for Android.
|
||||
* Using Android 4.0+, you can use true full screen in "lean mode", the way you see in apps like YouTube, expanding the app right to the edges of the screen, hiding the status and navigation bars until the user next interacts. This is ideally suited to video or cut-scene content.
|
||||
* In Android 4.4+, however, you can now enter true full screen, fully interactive immersive mode. In this mode, your app will remain in true full screen until you choose otherwise; users can swipe down from the top of the screen to temporarily display the system UI.
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { AndroidFullScreen } from '@ionic-native/android-full-screen';
|
||||
*
|
||||
* constructor(private androidFullScreen: AndroidFullScreen) { }
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* this.androidFullScreen.isImmersiveModeSupported()
|
||||
* .then(() => this.androidFullScreen.immersiveMode())
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* ```
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'AndroidFullScreen',
|
||||
plugin: 'cordova-plugin-fullscreen',
|
||||
pluginRef: 'AndroidFullScreen',
|
||||
repo: 'https://github.com/mesmotronic/cordova-plugin-fullscreen',
|
||||
platforms: ['Android']
|
||||
})
|
||||
@Injectable()
|
||||
export class AndroidFullScreen {
|
||||
/**
|
||||
* Is this plugin supported?
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
isSupported(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Is immersive mode supported?
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
isImmersiveModeSupported(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* The width of the screen in immersive mode.
|
||||
* @return {Promise<number>}
|
||||
*/
|
||||
@Cordova()
|
||||
immersiveWidth(): Promise<number> { return; }
|
||||
|
||||
/**
|
||||
* The height of the screen in immersive mode.
|
||||
* @return {Promise<number>}
|
||||
*/
|
||||
@Cordova()
|
||||
immersiveHeight(): Promise<number> { return; }
|
||||
|
||||
/**
|
||||
* Hide system UI until user interacts.
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
leanMode(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Show system UI.
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
showSystemUI(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Extend your app underneath the status bar (Android 4.4+ only).
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
showUnderStatusBar(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Extend your app underneath the system UI (Android 4.4+ only).
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
showUnderSystemUI(): Promise<void> { return; }
|
||||
|
||||
/**
|
||||
* Hide system UI and keep it hidden (Android 4.4+ only).
|
||||
* @return {Promise<void>}
|
||||
*/
|
||||
@Cordova()
|
||||
immersiveMode(): Promise<void> { return; }
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,7 +33,7 @@ export class Base64ToGallery {
|
||||
/**
|
||||
* Converts a base64 string to an image file in the device gallery
|
||||
* @param {string} data The actual base64 string that you want to save
|
||||
* @param {any} options (optional) An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS.
|
||||
* @param {any} [options] An object with properties: prefix: string, mediaScanner: boolean. Prefix will be prepended to the filename. If true, mediaScanner runs Media Scanner on Android and saves to Camera Roll on iOS; if false, saves to Library folder on iOS.
|
||||
* @returns {Promise<any>} returns a promise that resolves when the image is saved.
|
||||
*/
|
||||
@Cordova({
|
||||
|
||||
@@ -17,7 +17,7 @@ import { Injectable } from '@angular/core';
|
||||
*
|
||||
* if (isAvailable) {
|
||||
*
|
||||
* browserTab.open('https://ionic.io');
|
||||
* browserTab.openUrl('https://ionic.io');
|
||||
*
|
||||
* } else {
|
||||
*
|
||||
|
||||
@@ -57,7 +57,7 @@ export interface CameraPreviewPictureOptions {
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
* import { CameraPreview, PictureOptions, CameraPreviewOptions, CameraPreviewDimensions } from 'ionic-native';
|
||||
* import { CameraPreview, PictureOptions, CameraPreviewOptions, CameraPreviewDimensions } from '@ionic-native/camera-preview';
|
||||
*
|
||||
* constructor(private cameraPreview: CameraPreview) { }
|
||||
*
|
||||
@@ -187,7 +187,7 @@ export class CameraPreview {
|
||||
|
||||
/**
|
||||
* Take the picture (base64)
|
||||
* @param options {CameraPreviewPictureOptions} optional - size and quality of the picture to take
|
||||
* @param [options] {CameraPreviewPictureOptions} size and quality of the picture to take
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@@ -211,7 +211,7 @@ export class CameraPreview {
|
||||
|
||||
/**
|
||||
* Set the zoom (Android)
|
||||
* @param zoom {number} Zoom value
|
||||
* @param [zoom] {number} Zoom value
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@@ -223,7 +223,7 @@ export class CameraPreview {
|
||||
|
||||
/**
|
||||
* Set the preview Size
|
||||
* @param dimensions {CameraPreviewDimensions}
|
||||
* @param [dimensions] {CameraPreviewDimensions}
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
@@ -235,7 +235,7 @@ export class CameraPreview {
|
||||
|
||||
/**
|
||||
* Set the flashmode
|
||||
* @param flashMode {string} 'off' (iOS & Android), 'on' (iOS & Android), 'auto' (iOS & Android), 'torch' (Android)
|
||||
* @param [flashMode] {string} 'off' (iOS & Android), 'on' (iOS & Android), 'auto' (iOS & Android), 'torch' (Android)
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
@Cordova({
|
||||
|
||||
@@ -90,7 +90,7 @@ export interface CameraPopoverOptions {
|
||||
* @description
|
||||
* Take a photo or capture video.
|
||||
*
|
||||
* Requires {@link module:driftyco/ionic-native} and the Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera).
|
||||
* Requires and the Cordova plugin: `cordova-plugin-camera`. For more info, please see the [Cordova Camera Plugin Docs](https://github.com/apache/cordova-plugin-camera).
|
||||
*
|
||||
* @usage
|
||||
* ```typescript
|
||||
@@ -101,10 +101,10 @@ export interface CameraPopoverOptions {
|
||||
* ...
|
||||
*
|
||||
*
|
||||
* constant options: CameraOptions = {
|
||||
* const options: CameraOptions = {
|
||||
* quality: 100,
|
||||
* destinationType: this.camera.DestinationType.DATA_URL,
|
||||
* enodingType: this.camera.EncodingType.JPEG,
|
||||
* encodingType: this.camera.EncodingType.JPEG,
|
||||
* mediaType: this.camera.MediaType.PICTURE
|
||||
* }
|
||||
*
|
||||
@@ -120,7 +120,6 @@ export interface CameraPopoverOptions {
|
||||
* CameraOptions
|
||||
* CameraPopoverOptions
|
||||
*/
|
||||
@Injectable()
|
||||
@Plugin({
|
||||
pluginName: 'Camera',
|
||||
plugin: 'cordova-plugin-camera',
|
||||
@@ -128,6 +127,7 @@ export interface CameraPopoverOptions {
|
||||
repo: 'https://github.com/apache/cordova-plugin-camera',
|
||||
platforms: ['Android', 'BlackBerry', 'Browser', 'Firefox', 'FireOS', 'iOS', 'Windows', 'Windows Phone 8', 'Ubuntu']
|
||||
})
|
||||
@Injectable()
|
||||
export class Camera {
|
||||
|
||||
/**
|
||||
@@ -201,7 +201,7 @@ export class Camera {
|
||||
|
||||
/**
|
||||
* Take a picture or video, or load one from the library.
|
||||
* @param {CameraOptions?} options optional. Options that you want to pass to the camera. Encoding type, quality, etc. Platform-specific quirks are described in the [Cordova plugin docs](https://github.com/apache/cordova-plugin-camera#cameraoptions-errata-).
|
||||
* @param {CameraOptions} [options] Options that you want to pass to the camera. Encoding type, quality, etc. Platform-specific quirks are described in the [Cordova plugin docs](https://github.com/apache/cordova-plugin-camera#cameraoptions-errata-).
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with Base64 encoding of the image data, or the image file URI, depending on cameraOptions, otherwise rejects with an error.
|
||||
*/
|
||||
@Cordova({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CordovaInstance, InstanceProperty, Plugin, getPromise } from '@ionic-native/core';
|
||||
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability, CordovaCheck } from '@ionic-native/core';
|
||||
|
||||
declare var window: any,
|
||||
navigator: any;
|
||||
@@ -72,9 +72,12 @@ export class Contact implements IContactProperties {
|
||||
@InstanceProperty urls: IContactField[];
|
||||
|
||||
constructor() {
|
||||
this._objectInstance = navigator.contacts.create();
|
||||
if (checkAvailability('navigator.contacts', 'create', 'Contacts') === true) {
|
||||
this._objectInstance = navigator.contacts.create();
|
||||
}
|
||||
}
|
||||
|
||||
@InstanceCheck()
|
||||
clone(): Contact {
|
||||
let newContact = new Contact();
|
||||
for (let prop in this) {
|
||||
@@ -87,6 +90,7 @@ export class Contact implements IContactProperties {
|
||||
@CordovaInstance()
|
||||
remove(): Promise<any> { return; }
|
||||
|
||||
@InstanceCheck()
|
||||
save(): Promise<any> {
|
||||
return getPromise((resolve, reject) => {
|
||||
this._objectInstance.save((contact) => {
|
||||
@@ -286,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 {
|
||||
@@ -305,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) => {
|
||||
@@ -317,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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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']
|
||||
})
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
@@ -234,7 +235,7 @@ export class Diagnostic {
|
||||
* Returns the location authorization status for the application.
|
||||
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
|
||||
*
|
||||
* mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
|
||||
* @param {string} [mode] iOS only: location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
@Cordova({ platforms: ['Android', 'iOS'], callbackOrder: 'reverse' })
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -84,7 +84,7 @@ export class EmailComposer {
|
||||
/**
|
||||
* Verifies if sending emails is supported on the device.
|
||||
*
|
||||
* @param app {string?} An optional app id or uri scheme.
|
||||
* @param [app] {string} App id or uri scheme.
|
||||
* @returns {Promise<any>} Resolves if available, rejects if not available
|
||||
*/
|
||||
@CordovaCheck()
|
||||
@@ -123,7 +123,7 @@ export class EmailComposer {
|
||||
* Displays the email composer pre-filled with data.
|
||||
*
|
||||
* @param options {EmailComposerOptions} Email
|
||||
* @param scope {any?} An optional scope for the promise
|
||||
* @param [scope] {any} Scope for the promise
|
||||
* @returns {Promise<any>} Resolves promise when the EmailComposer has been opened
|
||||
*/
|
||||
@Cordova({
|
||||
|
||||
@@ -381,7 +381,7 @@ export class EstimoteBeacons {
|
||||
* @param [notifyEntryStateOnDisplay=false] {boolean} Set to true to detect if you
|
||||
* are inside a region when the user turns display on, see
|
||||
* {@link https://developer.apple.com/library/prerelease/ios/documentation/CoreLocation/Reference/CLBeaconRegion_class/index.html#//apple_ref/occ/instp/CLBeaconRegion/notifyEntryStateOnDisplay|iOS documentation}
|
||||
* for further details (optional, defaults to false, iOS only).
|
||||
* for further details (iOS only).
|
||||
* @returns {Observable<any>} Returns an Observable that notifies of each region state discovered.
|
||||
*/
|
||||
@Cordova({
|
||||
|
||||
@@ -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 {
|
||||
@@ -268,9 +269,8 @@ export class Facebook {
|
||||
*
|
||||
*
|
||||
* @param {Object} options An object containing an [App Link](https://developers.facebook.com/docs/applinks) URL to your app and an optional image URL.
|
||||
* url: [App Link](https://developers.facebook.com/docs/applinks) to your app
|
||||
* picture: image to be displayed in the App Invite dialog
|
||||
*
|
||||
* @param {string} options.url [App Link](https://developers.facebook.com/docs/applinks) to your app
|
||||
* @param {string} [options.picture] image to be displayed in the App Invite dialog
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the result data, or rejects with an error
|
||||
*/
|
||||
@Cordova()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -39,7 +39,7 @@ export interface FingerprintOptions {
|
||||
* clientSecret: "password", //Only necessary for Android
|
||||
* disableBackup:true //Only for Android(optional)
|
||||
* })
|
||||
* .then((result: any) => console.log(any))
|
||||
* .then((result: any) => console.log(result))
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* ```
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -82,7 +82,6 @@ declare var window: any;
|
||||
repo: 'https://github.com/cowbell/cordova-plugin-geofence/',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone 8', 'Windows Phone']
|
||||
})
|
||||
|
||||
@Injectable()
|
||||
export class Geofence {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -399,14 +399,14 @@ export class GoogleMap {
|
||||
* // create a new map by passing HTMLElement
|
||||
* let element: HTMLElement = document.getElementById('map');
|
||||
*
|
||||
* let map: GoogleMap = GoogleMaps.create(element);
|
||||
* let map: GoogleMap = this.googleMaps.create(element);
|
||||
*
|
||||
* // listen to MAP_READY event
|
||||
* // You must wait for this event to fire before adding something to the map or modifying it in anyway
|
||||
* 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 {
|
||||
|
||||
@@ -85,7 +85,7 @@ export class Gyroscope {
|
||||
|
||||
/**
|
||||
* Watching for gyroscope sensor changes
|
||||
* @param options {GyroscopeOptions} (optional)
|
||||
* @param {GyroscopeOptions} [options]
|
||||
* @return {Observable<GyroscopeOrientation>} Returns an Observable that resolves GyroscopeOrientation
|
||||
*/
|
||||
watch(options?: GyroscopeOptions): Observable<GyroscopeOrientation> {
|
||||
@@ -99,7 +99,7 @@ export class Gyroscope {
|
||||
|
||||
/**
|
||||
* Get current data from gyroscope sensor
|
||||
* @param options {GyroscopeOptions} (optional)
|
||||
* @param {GyroscopeOptions} [options]
|
||||
* @return {Promise<GyroscopeOrientation>} Returns a promise that resolves GyroscopeOrientation
|
||||
*/
|
||||
@Cordova({
|
||||
|
||||
@@ -167,13 +167,14 @@ export interface HealthData {
|
||||
* HealthStoreOptions
|
||||
* HealthData
|
||||
*/
|
||||
@Injectable()
|
||||
@Plugin({
|
||||
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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -69,9 +69,9 @@ export class InAppBrowserObject {
|
||||
|
||||
/**
|
||||
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
|
||||
* @param url The URL to load.
|
||||
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
|
||||
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
|
||||
* @param {string} url The URL to load.
|
||||
* @param {string} [target="self"] The target in which to load the URL, an optional parameter that defaults to _self.
|
||||
* @param {string | InAppBrowserOptions} [options] Options for the InAppBrowser. Optional, defaulting to: location=yes.
|
||||
* The options string must not contain any blank space, and each feature's
|
||||
* name/value pairs must be separated by a comma. Feature names are case insensitive.
|
||||
*/
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
251
src/@ionic-native/plugins/intel-security/index.ts
Normal file
251
src/@ionic-native/plugins/intel-security/index.ts
Normal file
@@ -0,0 +1,251 @@
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
declare var window: any;
|
||||
|
||||
export interface IntelSecurityDataOptions {
|
||||
/** Non-empty string. **/
|
||||
data: String;
|
||||
/** Tag text. */
|
||||
tag?: String;
|
||||
/** Valid secure data instance ID. */
|
||||
extraKey?: Number;
|
||||
/** Application access control policy. */
|
||||
appAccessControl?: Number;
|
||||
/** Device locality policy. */
|
||||
deviceLocality?: Number;
|
||||
/** Sensitivity level policy. */
|
||||
sensitivityLevel?: Number;
|
||||
/** Disallow sealed blob access. */
|
||||
noStore?: Boolean;
|
||||
/** Disallow plain-text data access. */
|
||||
noRead?: Boolean;
|
||||
/** Creator unique ID. */
|
||||
creator?: Number;
|
||||
/** Array of owners unique IDs. */
|
||||
owners?: Number[];
|
||||
/** List of trusted web domains. */
|
||||
webOwners?: String[];
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Intel Security
|
||||
* @description
|
||||
* The App Security API enables the use of security properties and capabilities on the platform, using a new set of API defined for application developers. You are not required to be a security expert to make good use of the API. Key elements, such as encryption of data and establishments of capabilities, is abstracted and done by the API implementation, for you.
|
||||
*
|
||||
* For example:
|
||||
* - Use the API to store (E.g. cache) data locally, using the device non-volatile storage. Data protection/encryption will be done for you by the API implementation
|
||||
* - Establish a connection with remote server (E.g. XHR) using a protected channel. SSL/TLS establishment and usage will be done for you by the API implementation
|
||||
*
|
||||
* For more information please visit the [API documentation](https://software.intel.com/en-us/app-security-api/api).
|
||||
*
|
||||
* @usage
|
||||
* ```
|
||||
* import { IntelSecurity } from '@ionic-native/intel-security';
|
||||
* ...
|
||||
* constructor(private intelSecurity: IntelSecurity) { }
|
||||
* ...
|
||||
*
|
||||
* let storageID = 'id';
|
||||
*
|
||||
* this.intelSecurity.data.createFromData({ data: 'Sample Data' })
|
||||
* .then((instanceID: Number) => this.IntelSecurity.storage.write({ id: storageId, instanceID: instanceID }))
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* this.intelSecurity.storage.read({id: storageID })
|
||||
* .then(this.intelSecurity.data.getData)
|
||||
* .then((data: string) => console.log(data)) // Resolves to 'Sample Data'
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* this.intelSecurity.storage.delete({ id: storageID })
|
||||
* .then(() => console.log('Deleted Successfully'))
|
||||
* .catch((error: any) => console.log(error));
|
||||
*
|
||||
* ```
|
||||
* @classes
|
||||
* IntelSecurityData
|
||||
* IntelSecurityStorage
|
||||
* @interfaces
|
||||
* IntelSecurityDataOptions
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'IntelSecurity',
|
||||
plugin: 'com-intel-security-cordova-plugin',
|
||||
pluginRef: 'intel.security',
|
||||
repo: 'https://github.com/AppSecurityApi/com-intel-security-cordova-plugin',
|
||||
platforms: ['Android', 'iOS', 'Windows']
|
||||
})
|
||||
@Injectable()
|
||||
export class IntelSecurity {
|
||||
|
||||
/**
|
||||
* returns an IntelSecurityStorage object
|
||||
* @type {IntelSecurityStorage}
|
||||
*/
|
||||
storage: IntelSecurityStorage = new IntelSecurityStorage();
|
||||
|
||||
/**
|
||||
* Returns an IntelSecurityData object
|
||||
* @type {IntelSecurityData}
|
||||
*/
|
||||
data: IntelSecurityData = new IntelSecurityData();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'IntelSecurity',
|
||||
plugin: 'com-intel-security-cordova-plugin',
|
||||
pluginRef: 'intel.security.secureData'
|
||||
})
|
||||
export class IntelSecurityData {
|
||||
|
||||
/**
|
||||
* This creates a new instance of secure data using plain-text data.
|
||||
* @param options {IntelSecurityDataOptions}
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the instanceID of the created data instance, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
createFromData(options: IntelSecurityDataOptions): Promise<Number> { return; }
|
||||
|
||||
/**
|
||||
* This creates a new instance of secure data (using sealed data)
|
||||
* @param options {Object}
|
||||
* @param options.sealedData {string} Sealed data in string format.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with the instanceID of the created data instance, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
createFromSealedData(options: { sealedData: string }): Promise<Number> { return; }
|
||||
|
||||
/**
|
||||
* This returns the plain-text data of the secure data instance.
|
||||
* @param instanceID {Number} Secure data instance ID.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves to the data as plain-text, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
getData(instanceID: Number): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* This returns the sealed chunk of a secure data instance.
|
||||
* @param instanceID {any} Secure data instance ID.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves to the sealed data, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
getSealedData(instanceID: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* This returns the tag of the secure data instance.
|
||||
* @param instanceID {any} Secure data instance ID.
|
||||
* @returns {Promise<string>} Returns a Promise that resolves to the tag, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
getTag(instanceID: any): Promise<string> { return; }
|
||||
|
||||
/**
|
||||
* This returns the data policy of the secure data instance.
|
||||
* @param instanceID {any} Secure data instance ID.
|
||||
* @returns {Promise<any>} Returns a promise that resolves to the policy object, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
getPolicy(instanceID: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* This returns an array of the data owners unique IDs.
|
||||
* @param instanceID {any} Secure data instance ID.
|
||||
* @returns {Promise<Array>} Returns a promise that resolves to an array of owners' unique IDs, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
getOwners(instanceID: any): Promise<Array<any>> { return; }
|
||||
|
||||
/**
|
||||
* This returns the data creator unique ID.
|
||||
* @param instanceID {any} Secure data instance ID.
|
||||
* @returns {Promise<Number>} Returns a promsie that resolves to the creator's unique ID, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
getCreator(instanceID: any): Promise<Number> { return; }
|
||||
|
||||
/**
|
||||
* This returns an array of the trusted web domains of the secure data instance.
|
||||
* @param instanceID {any} Secure data instance ID.
|
||||
* @returns {Promise<Array>} Returns a promise that resolves to a list of web owners, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
getWebOwners(instanceID: any): Promise<Array<any>> { return; }
|
||||
|
||||
/**
|
||||
* This changes the extra key of a secure data instance. To successfully replace the extra key, the calling application must have sufficient access to the plain-text data.
|
||||
* @param options {Object}
|
||||
* @param options.instanceID {any} Secure data instance ID.
|
||||
* @param options.extraKey {Number} Extra sealing secret for secure data instance.
|
||||
* @returns {Promise<any>} Returns a promise that resolves with no parameters, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
changeExtraKey(options: any): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* This releases a secure data instance.
|
||||
* @param instanceID {any} Secure data instance ID.
|
||||
* @returns {Promise<any>} Returns a promise that resovles with no parameters, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
destroy(instanceID: any): Promise<any> { return; }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@Plugin({
|
||||
pluginName: 'IntelSecurity',
|
||||
plugin: 'com-intel-security-cordova-plugin',
|
||||
pluginRef: 'intel.security.secureStorage'
|
||||
})
|
||||
export class IntelSecurityStorage {
|
||||
|
||||
/**
|
||||
* This deletes a secure storage resource (indicated by id).
|
||||
* @param options {Object}
|
||||
* @param options.id {String} Storage resource identifier.
|
||||
* @param [options.storageType] {Number} Storage type.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with no parameters, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
delete(options: {
|
||||
id: string,
|
||||
storageType?: Number
|
||||
}): Promise<any> { return; }
|
||||
|
||||
/**
|
||||
* This reads the data from secure storage (indicated by id) and creates a new secure data instance.
|
||||
* @param options {Object}
|
||||
* @param options.id {String} Storage resource identifier.
|
||||
* @param [options.storageType] {Number} Storage type.
|
||||
* @param [options.extraKey] {Number} Valid secure data instance ID.
|
||||
* @returns {Promise<Number>} Returns a Promise that resolves with the instance ID of the created secure data instance, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
read(options: {
|
||||
id: string,
|
||||
storageType?: Number,
|
||||
extraKey?: Number
|
||||
}): Promise<Number> { return; }
|
||||
|
||||
/**
|
||||
* This writes the data contained in a secure data instance into secure storage.
|
||||
* @param options {Object}
|
||||
* @param options.id {String} Storage resource identifier.
|
||||
* @param options.instanceID {Number} Valid secure data instance ID
|
||||
* @param [options.storageType] {Number} Storage type.
|
||||
* @returns {Promise<any>} Returns a Promise that resolves with no parameters, or rejects with an error.
|
||||
*/
|
||||
@Cordova({ otherPromise: true })
|
||||
write(options: {
|
||||
id: String,
|
||||
instanceID: Number,
|
||||
storageType?: Number
|
||||
}): Promise<any> { return; }
|
||||
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -27,7 +27,8 @@ 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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Plugin, Cordova } from '@ionic-native/core';
|
||||
|
||||
/**
|
||||
* @name LocationAccuracy
|
||||
* @name Location Accuracy
|
||||
* @description
|
||||
* This Cordova/Phonegap plugin for Android and iOS to request enabling/changing of Location Services by triggering a native dialog from within the app, avoiding the need for the user to leave your app to change location settings manually.
|
||||
*
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -127,7 +127,7 @@ export class MediaObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* @name MediaPlugin
|
||||
* @name Media
|
||||
* @description
|
||||
* @usage
|
||||
* ```typescript
|
||||
|
||||
@@ -109,12 +109,12 @@ export class Mixpanel {
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@Injectable()
|
||||
@Plugin({
|
||||
plugin: 'cordova-plugin-mixpanel',
|
||||
pluginRef: 'mixpanel.people',
|
||||
pluginName: 'Mixpanel'
|
||||
})
|
||||
@Injectable()
|
||||
export class MixpanelPeople {
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,7 +56,7 @@ export interface MusicControlsOptions {
|
||||
* ticker : 'Now playing "Time is Running Out"'
|
||||
* });
|
||||
*
|
||||
* this.musicControls.subscribe().subscribe(action => {
|
||||
* this.musicControls.subscribe(action => {
|
||||
*
|
||||
* switch(action) {
|
||||
* case 'music-controls-next':
|
||||
|
||||
@@ -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/observable/merge';
|
||||
|
||||
|
||||
declare var navigator: any;
|
||||
@@ -34,7 +35,7 @@ declare var navigator: any;
|
||||
*
// before we determine the connection type. Might need to wait
|
||||
* // prior to doing any api requests as well.
|
||||
* setTimeout(() => {
|
||||
* if (Network.type === 'wifi') {
|
||||
* if (this.network.type === 'wifi') {
|
||||
* console.log('we got a wifi connection, woohoo!');
|
||||
* }
|
||||
* }, 3000);
|
||||
@@ -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
|
||||
|
||||
@@ -184,12 +184,12 @@ export class NFC {
|
||||
/**
|
||||
* @hidden
|
||||
*/
|
||||
@Injectable()
|
||||
@Plugin({
|
||||
pluginName: 'NFC',
|
||||
plugin: 'phonegap-nfc',
|
||||
pluginRef: 'ndef'
|
||||
})
|
||||
@Injectable()
|
||||
export class Ndef {
|
||||
|
||||
@Cordova({ sync: true })
|
||||
|
||||
@@ -379,6 +379,8 @@ export class OneSignal {
|
||||
/**
|
||||
* Retrieve a list of tags that have been set on the user from the OneSignal server.
|
||||
*
|
||||
* **Quirk**: You must wait for `getTags` to resolve before calling it again, as the plugin will only process the last method call and discard any previous ones.
|
||||
*
|
||||
* @returns {Promise<any>} Returns a Promise that resolves when tags are recieved.
|
||||
*/
|
||||
@Cordova()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -53,7 +53,7 @@ export class SecureStorageObject {
|
||||
* @usage
|
||||
*
|
||||
* ```typescript
|
||||
* import { SecureStorage, SecureStorageOBject } from '@ionic-native/secure-storage';
|
||||
* import { SecureStorage, SecureStorageObject } from '@ionic-native/secure-storage';
|
||||
*
|
||||
* constructor(private secureStorage: SecureStorage) { }
|
||||
*
|
||||
@@ -92,7 +92,7 @@ export class SecureStorageObject {
|
||||
plugin: 'cordova-plugin-secure-storage',
|
||||
pluginRef: 'cordova.plugins.SecureStorage',
|
||||
repo: 'https://github.com/Crypho/cordova-plugin-secure-storage',
|
||||
platforms: ['Android', 'iOS', 'Windows Phone', 'Browser']
|
||||
platforms: ['Android', 'iOS', 'Windows Phone']
|
||||
})
|
||||
@Injectable()
|
||||
export class SecureStorage {
|
||||
|
||||
113
src/@ionic-native/plugins/sqlite-porter/index.ts
Normal file
113
src/@ionic-native/plugins/sqlite-porter/index.ts
Normal 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; }
|
||||
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
}
|
||||
|
||||
62
src/@ionic-native/plugins/taptic-engine/index.ts
Normal file
62
src/@ionic-native/plugins/taptic-engine/index.ts
Normal 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; }
|
||||
|
||||
}
|
||||
126
src/@ionic-native/plugins/zeroconf/index.ts
Normal file
126
src/@ionic-native/plugins/zeroconf/index.ts
Normal 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; }
|
||||
}
|
||||
Reference in New Issue
Block a user