mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-02-22 09:49:35 +08:00
refactor(): run prettier
This commit is contained in:
parent
3896aca5aa
commit
99a0e0282d
@ -135,8 +135,8 @@ import { Camera } from '@awesome-cordova-plugins/camera';
|
|||||||
|
|
||||||
document.addEventListener('deviceready', () => {
|
document.addEventListener('deviceready', () => {
|
||||||
Camera.getPicture()
|
Camera.getPicture()
|
||||||
.then(data => console.log('Took a picture!', data))
|
.then((data) => console.log('Took a picture!', data))
|
||||||
.catch(e => console.log('Error occurred while taking a picture', e));
|
.catch((e) => console.log('Error occurred while taking a picture', e));
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -5,12 +5,4 @@ module.exports = {
|
|||||||
semi: true,
|
semi: true,
|
||||||
singleQuote: true,
|
singleQuote: true,
|
||||||
trailingComma: 'es5',
|
trailingComma: 'es5',
|
||||||
bracketSpacing: true,
|
|
||||||
jsxBracketSameLine: false,
|
|
||||||
arrowParens: 'avoid',
|
|
||||||
rangeStart: 0,
|
|
||||||
rangeEnd: Infinity,
|
|
||||||
requirePragma: false,
|
|
||||||
insertPragma: false,
|
|
||||||
proseWrap: 'preserve',
|
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,7 @@ export const ROOT = resolve(__dirname, '../../');
|
|||||||
export const TS_CONFIG = clone(require(resolve(ROOT, 'tsconfig.json')));
|
export const TS_CONFIG = clone(require(resolve(ROOT, 'tsconfig.json')));
|
||||||
export const COMPILER_OPTIONS = TS_CONFIG.compilerOptions;
|
export const COMPILER_OPTIONS = TS_CONFIG.compilerOptions;
|
||||||
export const PLUGINS_ROOT = join(ROOT, 'src/@awesome-cordova-plugins/plugins/');
|
export const PLUGINS_ROOT = join(ROOT, 'src/@awesome-cordova-plugins/plugins/');
|
||||||
export const PLUGIN_PATHS = readdirSync(PLUGINS_ROOT).map(d => join(PLUGINS_ROOT, d, 'index.ts'));
|
export const PLUGIN_PATHS = readdirSync(PLUGINS_ROOT).map((d) => join(PLUGINS_ROOT, d, 'index.ts'));
|
||||||
|
|
||||||
export function getDecorator(node: Node, index = 0): Decorator {
|
export function getDecorator(node: Node, index = 0): Decorator {
|
||||||
if (node.decorators && node.decorators[index]) {
|
if (node.decorators && node.decorators[index]) {
|
||||||
@ -31,7 +31,7 @@ export function hasDecorator(decoratorName: string, node: Node): boolean {
|
|||||||
return (
|
return (
|
||||||
node.decorators &&
|
node.decorators &&
|
||||||
node.decorators.length &&
|
node.decorators.length &&
|
||||||
node.decorators.findIndex(d => getDecoratorName(d) === decoratorName) > -1
|
node.decorators.findIndex((d) => getDecoratorName(d) === decoratorName) > -1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ export function getDecoratorArgs(decorator: any) {
|
|||||||
const properties: any[] = getRawDecoratorArgs(decorator);
|
const properties: any[] = getRawDecoratorArgs(decorator);
|
||||||
const args = {};
|
const args = {};
|
||||||
|
|
||||||
properties.forEach(prop => {
|
properties.forEach((prop) => {
|
||||||
let val: number | boolean;
|
let val: number | boolean;
|
||||||
|
|
||||||
switch (prop.initializer.kind) {
|
switch (prop.initializer.kind) {
|
||||||
|
@ -53,14 +53,14 @@ export function transpileNgx() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function generateDeclarationFiles() {
|
export function generateDeclarationFiles() {
|
||||||
generateDeclarations(PLUGIN_PATHS.map(p => p.replace('index.ts', 'ngx/index.ts')));
|
generateDeclarations(PLUGIN_PATHS.map((p) => p.replace('index.ts', 'ngx/index.ts')));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateLegacyBundles() {
|
export function generateLegacyBundles() {
|
||||||
[
|
[
|
||||||
resolve(ROOT, 'dist/@awesome-cordova-plugins/core/index.js'),
|
resolve(ROOT, 'dist/@awesome-cordova-plugins/core/index.js'),
|
||||||
...PLUGIN_PATHS.map(p => p.replace(join(ROOT, 'src'), join(ROOT, 'dist')).replace('index.ts', 'ngx/index.js')),
|
...PLUGIN_PATHS.map((p) => p.replace(join(ROOT, 'src'), join(ROOT, 'dist')).replace('index.ts', 'ngx/index.js')),
|
||||||
].forEach(p =>
|
].forEach((p) =>
|
||||||
rollup({
|
rollup({
|
||||||
input: p,
|
input: p,
|
||||||
onwarn(warning, warn) {
|
onwarn(warning, warn) {
|
||||||
@ -68,7 +68,7 @@ export function generateLegacyBundles() {
|
|||||||
warn(warning);
|
warn(warning);
|
||||||
},
|
},
|
||||||
external: ['@angular/core', '@awesome-cordova-plugins/core', 'rxjs', 'tslib'],
|
external: ['@angular/core', '@awesome-cordova-plugins/core', 'rxjs', 'tslib'],
|
||||||
}).then(bundle =>
|
}).then((bundle) =>
|
||||||
bundle.write({
|
bundle.write({
|
||||||
file: join(dirname(p), 'bundle.js'),
|
file: join(dirname(p), 'bundle.js'),
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
@ -79,9 +79,9 @@ export function generateLegacyBundles() {
|
|||||||
|
|
||||||
// remove reference to @awesome-cordova-plugins/core decorators
|
// remove reference to @awesome-cordova-plugins/core decorators
|
||||||
export function modifyMetadata() {
|
export function modifyMetadata() {
|
||||||
PLUGIN_PATHS.map(p =>
|
PLUGIN_PATHS.map((p) =>
|
||||||
p.replace(join(ROOT, 'src'), join(ROOT, 'dist')).replace('index.ts', 'ngx/index.metadata.json')
|
p.replace(join(ROOT, 'src'), join(ROOT, 'dist')).replace('index.ts', 'ngx/index.metadata.json')
|
||||||
).forEach(p => {
|
).forEach((p) => {
|
||||||
const content = readJSONSync(p);
|
const content = readJSONSync(p);
|
||||||
let _prop: { members: { [x: string]: any[] } };
|
let _prop: { members: { [x: string]: any[] } };
|
||||||
for (const prop in content[0].metadata) {
|
for (const prop in content[0].metadata) {
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
// removes the __extends method that is added automatically by typescript
|
// removes the __extends method that is added automatically by typescript
|
||||||
module.exports = source => source.replace(/var\s__extends\s=\s\(this\s&&[\sa-z\._\(\)\|{}=:\[\]&,;?]+}\)\(\);/i, '');
|
module.exports = (source) => source.replace(/var\s__extends\s=\s\(this\s&&[\sa-z\._\(\)\|{}=:\[\]&,;?]+}\)\(\);/i, '');
|
||||||
|
@ -23,11 +23,11 @@ export const EMIT_PATH = resolve(ROOT, 'injectable-classes.json');
|
|||||||
*/
|
*/
|
||||||
export function extractInjectables() {
|
export function extractInjectables() {
|
||||||
return (ctx: TransformationContext) => {
|
return (ctx: TransformationContext) => {
|
||||||
return tsSourceFile => {
|
return (tsSourceFile) => {
|
||||||
if (tsSourceFile.fileName.indexOf('src/@awesome-cordova-plugins/plugins') > -1) {
|
if (tsSourceFile.fileName.indexOf('src/@awesome-cordova-plugins/plugins') > -1) {
|
||||||
visitEachChild(
|
visitEachChild(
|
||||||
tsSourceFile,
|
tsSourceFile,
|
||||||
node => {
|
(node) => {
|
||||||
if (node.kind !== SyntaxKind.ClassDeclaration) {
|
if (node.kind !== SyntaxKind.ClassDeclaration) {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
@ -39,22 +39,22 @@ function transformImports(file: SourceFile, ctx: TransformationContext, ngcBuild
|
|||||||
if (decorators.length) {
|
if (decorators.length) {
|
||||||
let methods = [];
|
let methods = [];
|
||||||
|
|
||||||
decorators.forEach(d => (methods = getMethodsForDecorator(d).concat(methods)));
|
decorators.forEach((d) => (methods = getMethodsForDecorator(d).concat(methods)));
|
||||||
|
|
||||||
const methodElements = methods.map(m => factory.createIdentifier(m));
|
const methodElements = methods.map((m) => factory.createIdentifier(m));
|
||||||
const methodNames = methodElements.map(el => el.escapedText);
|
const methodNames = methodElements.map((el) => el.escapedText);
|
||||||
|
|
||||||
importStatement.importClause.namedBindings.elements = [
|
importStatement.importClause.namedBindings.elements = [
|
||||||
factory.createIdentifier('AwesomeCordovaNativePlugin'),
|
factory.createIdentifier('AwesomeCordovaNativePlugin'),
|
||||||
...methodElements,
|
...methodElements,
|
||||||
...importStatement.importClause.namedBindings.elements.filter(
|
...importStatement.importClause.namedBindings.elements.filter(
|
||||||
el => keep.indexOf(el.name.text) !== -1 && methodNames.indexOf(el.name.text) === -1
|
(el) => keep.indexOf(el.name.text) !== -1 && methodNames.indexOf(el.name.text) === -1
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (ngcBuild) {
|
if (ngcBuild) {
|
||||||
importStatement.importClause.namedBindings.elements = importStatement.importClause.namedBindings.elements.map(
|
importStatement.importClause.namedBindings.elements = importStatement.importClause.namedBindings.elements.map(
|
||||||
binding => {
|
(binding) => {
|
||||||
if (binding.escapedText) {
|
if (binding.escapedText) {
|
||||||
binding.name = {
|
binding.name = {
|
||||||
text: binding.escapedText,
|
text: binding.escapedText,
|
||||||
@ -71,7 +71,7 @@ function transformImports(file: SourceFile, ctx: TransformationContext, ngcBuild
|
|||||||
|
|
||||||
export function importsTransformer(ngcBuild?: boolean) {
|
export function importsTransformer(ngcBuild?: boolean) {
|
||||||
return (ctx: TransformationContext) => {
|
return (ctx: TransformationContext) => {
|
||||||
return tsSourceFile => {
|
return (tsSourceFile) => {
|
||||||
return transformImports(tsSourceFile, ctx, ngcBuild);
|
return transformImports(tsSourceFile, ctx, ngcBuild);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,7 @@ export function transformMembers(cls: ClassDeclaration) {
|
|||||||
members.push(getter, setter);
|
members.push(getter, setter);
|
||||||
});
|
});
|
||||||
|
|
||||||
propertyIndices.reverse().forEach(i => members.splice(i, 1));
|
propertyIndices.reverse().forEach((i) => members.splice(i, 1));
|
||||||
|
|
||||||
return members;
|
return members;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ function transformClass(cls: any, ngcBuild?: boolean) {
|
|||||||
|
|
||||||
cls = factory.createClassDeclaration(
|
cls = factory.createClassDeclaration(
|
||||||
ngcBuild && cls.decorators && cls.decorators.length
|
ngcBuild && cls.decorators && cls.decorators.length
|
||||||
? cls.decorators.filter(d => getDecoratorName(d) === 'Injectable')
|
? cls.decorators.filter((d) => getDecoratorName(d) === 'Injectable')
|
||||||
: undefined, // remove Plugin and Injectable decorators
|
: undefined, // remove Plugin and Injectable decorators
|
||||||
[factory.createToken(SyntaxKind.ExportKeyword)],
|
[factory.createToken(SyntaxKind.ExportKeyword)],
|
||||||
cls.name,
|
cls.name,
|
||||||
@ -55,10 +55,10 @@ function transformClasses(file: SourceFile, ctx: TransformationContext, ngcBuild
|
|||||||
Logger.silly('Transforming file: ' + file.fileName);
|
Logger.silly('Transforming file: ' + file.fileName);
|
||||||
return visitEachChild(
|
return visitEachChild(
|
||||||
file,
|
file,
|
||||||
node => {
|
(node) => {
|
||||||
if (
|
if (
|
||||||
node.kind !== SyntaxKind.ClassDeclaration ||
|
node.kind !== SyntaxKind.ClassDeclaration ||
|
||||||
(node.modifiers && node.modifiers.find(v => v.kind === SyntaxKind.DeclareKeyword))
|
(node.modifiers && node.modifiers.find((v) => v.kind === SyntaxKind.DeclareKeyword))
|
||||||
) {
|
) {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ function transformClasses(file: SourceFile, ctx: TransformationContext, ngcBuild
|
|||||||
|
|
||||||
export function pluginClassTransformer(ngcBuild?: boolean): TransformerFactory<SourceFile> {
|
export function pluginClassTransformer(ngcBuild?: boolean): TransformerFactory<SourceFile> {
|
||||||
return (ctx: TransformationContext) => {
|
return (ctx: TransformationContext) => {
|
||||||
return tsSourceFile => {
|
return (tsSourceFile) => {
|
||||||
if (tsSourceFile.fileName.indexOf('src/@awesome-cordova-plugins/plugins') > -1) {
|
if (tsSourceFile.fileName.indexOf('src/@awesome-cordova-plugins/plugins') > -1) {
|
||||||
return transformClasses(tsSourceFile, ctx, ngcBuild);
|
return transformClasses(tsSourceFile, ctx, ngcBuild);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ async function run(pluginsDir: string) {
|
|||||||
|
|
||||||
async function generateTypedoc(root: string, outputPath = typedocTmp, outputDocsPath = typedocDocsTmp) {
|
async function generateTypedoc(root: string, outputPath = typedocTmp, outputDocsPath = typedocDocsTmp) {
|
||||||
const pluginDirs = await readdir(root);
|
const pluginDirs = await readdir(root);
|
||||||
const paths = pluginDirs.map(dir => resolve(root, dir, 'index.ts'));
|
const paths = pluginDirs.map((dir) => resolve(root, dir, 'index.ts'));
|
||||||
typedoc.bootstrap({
|
typedoc.bootstrap({
|
||||||
/*
|
/*
|
||||||
mode: 'modules',
|
mode: 'modules',
|
||||||
@ -96,7 +96,7 @@ function processPlugin(pluginModule): Plugin {
|
|||||||
*/
|
*/
|
||||||
const getPluginDecorator = (child: any) => {
|
const getPluginDecorator = (child: any) => {
|
||||||
if (isPlugin(child)) {
|
if (isPlugin(child)) {
|
||||||
const decorator = child.decorators.find(d => d.name === 'Plugin');
|
const decorator = child.decorators.find((d) => d.name === 'Plugin');
|
||||||
|
|
||||||
console.log('Found decorator', decorator.arguments, child);
|
console.log('Found decorator', decorator.arguments, child);
|
||||||
return runInNewContext(`(${decorator.arguments.config})`);
|
return runInNewContext(`(${decorator.arguments.config})`);
|
||||||
@ -105,7 +105,7 @@ const getPluginDecorator = (child: any) => {
|
|||||||
|
|
||||||
const getTag = (child: any, tagName: string): string => {
|
const getTag = (child: any, tagName: string): string => {
|
||||||
if (hasTags(child)) {
|
if (hasTags(child)) {
|
||||||
const tag = child.comment.tags.find(t => t.tag === tagName);
|
const tag = child.comment.tags.find((t) => t.tag === tagName);
|
||||||
if (tag) {
|
if (tag) {
|
||||||
return tag.text;
|
return tag.text;
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ const isPlugin = (child: any): boolean =>
|
|||||||
isClass(child) &&
|
isClass(child) &&
|
||||||
hasTags(child) &&
|
hasTags(child) &&
|
||||||
Array.isArray(child.decorators) &&
|
Array.isArray(child.decorators) &&
|
||||||
child.decorators.some(d => d.name === 'Plugin');
|
child.decorators.some((d) => d.name === 'Plugin');
|
||||||
|
|
||||||
const hasPlugin = (child: any): boolean => child.children.some(isPlugin);
|
const hasPlugin = (child: any): boolean => child.children.some(isPlugin);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ const Package = require('dgeni').Package,
|
|||||||
path = require('path'),
|
path = require('path'),
|
||||||
config = require('../config.json');
|
config = require('../config.json');
|
||||||
|
|
||||||
module.exports = currentVersion => {
|
module.exports = (currentVersion) => {
|
||||||
return (
|
return (
|
||||||
new Package('ionic-native-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage])
|
new Package('ionic-native-docs', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage])
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ module.exports = currentVersion => {
|
|||||||
computePathsProcessor.pathTemplates = [
|
computePathsProcessor.pathTemplates = [
|
||||||
{
|
{
|
||||||
docTypes: ['class'],
|
docTypes: ['class'],
|
||||||
getOutputPath: doc => 'content/' + config.v2DocsDir + '/' + doc.name + '/index.md',
|
getOutputPath: (doc) => 'content/' + config.v2DocsDir + '/' + doc.name + '/index.md',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
@ -7,7 +7,7 @@ const Package = require('dgeni').Package,
|
|||||||
path = require('path'),
|
path = require('path'),
|
||||||
config = require('../config.json');
|
config = require('../config.json');
|
||||||
|
|
||||||
module.exports = currentVersion => {
|
module.exports = (currentVersion) => {
|
||||||
return (
|
return (
|
||||||
new Package('ionic-native-readmes', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage])
|
new Package('ionic-native-readmes', [jsdocPackage, nunjucksPackage, typescriptPackage, linksPackage])
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ module.exports = currentVersion => {
|
|||||||
computePathsProcessor.pathTemplates = [
|
computePathsProcessor.pathTemplates = [
|
||||||
{
|
{
|
||||||
docTypes: ['class'],
|
docTypes: ['class'],
|
||||||
getOutputPath: doc =>
|
getOutputPath: (doc) =>
|
||||||
doc.originalModule.replace(config.pluginDir + '/', '').replace(/\/index$/, '/README.md'),
|
doc.originalModule.replace(config.pluginDir + '/', '').replace(/\/index$/, '/README.md'),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'capital',
|
name: 'capital',
|
||||||
process: str => (str ? str.charAt(0).toUpperCase() + str.substring(1) : ''),
|
process: (str) => (str ? str.charAt(0).toUpperCase() + str.substring(1) : ''),
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'dashify',
|
name: 'dashify',
|
||||||
process: str => (str ? str.replace(/\s/g, '-') : ''),
|
process: (str) => (str ? str.replace(/\s/g, '-') : ''),
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'dump',
|
name: 'dump',
|
||||||
process: obj => console.log(obj),
|
process: (obj) => console.log(obj),
|
||||||
};
|
};
|
||||||
|
@ -4,6 +4,6 @@ module.exports = function removePrivateApi() {
|
|||||||
name: 'remove-private-api',
|
name: 'remove-private-api',
|
||||||
description: 'Prevent the private apis from being rendered',
|
description: 'Prevent the private apis from being rendered',
|
||||||
$runBefore: ['rendering-docs'],
|
$runBefore: ['rendering-docs'],
|
||||||
$process: docs => docs.filter(doc => !doc.private && (!doc.tags || !doc.tags.tagsByName.get('hidden'))),
|
$process: (docs) => docs.filter((doc) => !doc.private && (!doc.tags || !doc.tags.tagsByName.get('hidden'))),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -5,9 +5,9 @@ module.exports = function jekyll(renderDocsProcessor) {
|
|||||||
description: 'Create jekyll includes',
|
description: 'Create jekyll includes',
|
||||||
$runAfter: ['paths-computed'],
|
$runAfter: ['paths-computed'],
|
||||||
$runBefore: ['rendering-docs'],
|
$runBefore: ['rendering-docs'],
|
||||||
$process: docs => {
|
$process: (docs) => {
|
||||||
// pretty up and sort the docs object for menu generation
|
// pretty up and sort the docs object for menu generation
|
||||||
docs = docs.filter(doc => (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page');
|
docs = docs.filter((doc) => (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page');
|
||||||
|
|
||||||
docs.push({
|
docs.push({
|
||||||
docType: 'class',
|
docType: 'class',
|
||||||
@ -22,7 +22,7 @@ module.exports = function jekyll(renderDocsProcessor) {
|
|||||||
return textA < textB ? -1 : textA > textB ? 1 : 0;
|
return textA < textB ? -1 : textA > textB ? 1 : 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
docs.forEach(doc => {
|
docs.forEach((doc) => {
|
||||||
if (!doc.outputPath) {
|
if (!doc.outputPath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ module.exports = function jekyll(renderDocsProcessor) {
|
|||||||
|
|
||||||
const betaDocs = [];
|
const betaDocs = [];
|
||||||
|
|
||||||
docs = docs.filter(doc => {
|
docs = docs.filter((doc) => {
|
||||||
if (doc.beta === true) {
|
if (doc.beta === true) {
|
||||||
betaDocs.push(doc);
|
betaDocs.push(doc);
|
||||||
return false;
|
return false;
|
||||||
|
@ -3,8 +3,8 @@ module.exports = function markProperties() {
|
|||||||
return {
|
return {
|
||||||
name: 'mark-properties',
|
name: 'mark-properties',
|
||||||
$runBefore: ['rendering-docs'],
|
$runBefore: ['rendering-docs'],
|
||||||
$process: docs =>
|
$process: (docs) =>
|
||||||
docs.map(doc => {
|
docs.map((doc) => {
|
||||||
for (let i in doc.members) {
|
for (let i in doc.members) {
|
||||||
if (doc.members.hasOwnProperty(i) && typeof doc.members[i].parameters === 'undefined') {
|
if (doc.members.hasOwnProperty(i) && typeof doc.members[i].parameters === 'undefined') {
|
||||||
doc.members[i].isProperty = true;
|
doc.members[i].isProperty = true;
|
||||||
|
@ -4,13 +4,13 @@ module.exports = function npmId(renderDocsProcessor) {
|
|||||||
name: 'npm-id',
|
name: 'npm-id',
|
||||||
$runAfter: ['paths-computed'],
|
$runAfter: ['paths-computed'],
|
||||||
$runBefore: ['rendering-docs'],
|
$runBefore: ['rendering-docs'],
|
||||||
$process: docs => {
|
$process: (docs) => {
|
||||||
// pretty up and sort the docs object for menu generation
|
// pretty up and sort the docs object for menu generation
|
||||||
docs = docs.filter(function (doc) {
|
docs = docs.filter(function (doc) {
|
||||||
return (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page';
|
return (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page';
|
||||||
});
|
});
|
||||||
|
|
||||||
docs.forEach(doc => {
|
docs.forEach((doc) => {
|
||||||
doc.npmId = doc.id.match(/plugins\/(.*)\/index/)[1];
|
doc.npmId = doc.id.match(/plugins\/(.*)\/index/)[1];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
module.exports = function parseOptional() {
|
module.exports = function parseOptional() {
|
||||||
return {
|
return {
|
||||||
$runBefore: ['rendering-docs'],
|
$runBefore: ['rendering-docs'],
|
||||||
$process: docs => {
|
$process: (docs) => {
|
||||||
docs.forEach(doc => {
|
docs.forEach((doc) => {
|
||||||
if (doc.members && doc.members.length) {
|
if (doc.members && doc.members.length) {
|
||||||
for (let i in doc.members) {
|
for (let i in doc.members) {
|
||||||
if (doc.members[i].params && doc.members[i].params.length) {
|
if (doc.members[i].params && doc.members[i].params.length) {
|
||||||
|
@ -5,11 +5,11 @@ module.exports = function readmes(renderDocsProcessor) {
|
|||||||
description: 'Create jekyll includes',
|
description: 'Create jekyll includes',
|
||||||
$runAfter: ['paths-computed'],
|
$runAfter: ['paths-computed'],
|
||||||
$runBefore: ['rendering-docs'],
|
$runBefore: ['rendering-docs'],
|
||||||
$process: docs => {
|
$process: (docs) => {
|
||||||
// pretty up and sort the docs object for menu generation
|
// pretty up and sort the docs object for menu generation
|
||||||
docs = docs.filter(doc => (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page');
|
docs = docs.filter((doc) => (!!doc.name && !!doc.outputPath) || doc.docType === 'index-page');
|
||||||
|
|
||||||
docs.forEach(doc => {
|
docs.forEach((doc) => {
|
||||||
doc.outputPath = doc.outputPath.replace('src/@awesome-cordova-plugins/', '');
|
doc.outputPath = doc.outputPath.replace('src/@awesome-cordova-plugins/', '');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -5,14 +5,14 @@ module.exports = function removePrivateMembers() {
|
|||||||
description: 'Remove member docs with @private tags',
|
description: 'Remove member docs with @private tags',
|
||||||
$runAfter: ['tags-parsed'],
|
$runAfter: ['tags-parsed'],
|
||||||
$runBefore: ['rendering-docs'],
|
$runBefore: ['rendering-docs'],
|
||||||
$process: docs => {
|
$process: (docs) => {
|
||||||
docs.forEach(doc => {
|
docs.forEach((doc) => {
|
||||||
if (doc.members) {
|
if (doc.members) {
|
||||||
doc.members = doc.members.filter(member => !member.tags.tagsByName.get('hidden'));
|
doc.members = doc.members.filter((member) => !member.tags.tagsByName.get('hidden'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doc.statics) {
|
if (doc.statics) {
|
||||||
doc.statics = doc.statics.filter(staticMethod => !staticMethod.tags.tagsByName.get('hidden'));
|
doc.statics = doc.statics.filter((staticMethod) => !staticMethod.tags.tagsByName.get('hidden'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@ const config = require('./config.json'),
|
|||||||
fs = require('fs-extra'),
|
fs = require('fs-extra'),
|
||||||
Dgeni = require('dgeni');
|
Dgeni = require('dgeni');
|
||||||
|
|
||||||
module.exports = gulp => {
|
module.exports = (gulp) => {
|
||||||
gulp.task('docs', () => {
|
gulp.task('docs', () => {
|
||||||
try {
|
try {
|
||||||
const ionicPackage = require('./dgeni/dgeni-config')(projectPackage.version),
|
const ionicPackage = require('./dgeni/dgeni-config')(projectPackage.version),
|
||||||
dgeni = new Dgeni([ionicPackage]);
|
dgeni = new Dgeni([ionicPackage]);
|
||||||
|
|
||||||
return dgeni.generate().then(docs => console.log(docs.length + ' docs generated'));
|
return dgeni.generate().then((docs) => console.log(docs.length + ' docs generated'));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err.stack);
|
console.log(err.stack);
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ module.exports = gulp => {
|
|||||||
try {
|
try {
|
||||||
const ionicPackage = require('./dgeni/dgeni-readmes-config')(projectPackage.version),
|
const ionicPackage = require('./dgeni/dgeni-readmes-config')(projectPackage.version),
|
||||||
dgeni = new Dgeni([ionicPackage]);
|
dgeni = new Dgeni([ionicPackage]);
|
||||||
return dgeni.generate().then(docs => console.log(docs.length + ' README files generated'));
|
return dgeni.generate().then((docs) => console.log(docs.length + ' README files generated'));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err.stack);
|
console.log(err.stack);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ function createIndexFile() {
|
|||||||
let fileContent = '';
|
let fileContent = '';
|
||||||
fileContent += INJECTABLE_CLASSES.map(getPluginImport).join('\n');
|
fileContent += INJECTABLE_CLASSES.map(getPluginImport).join('\n');
|
||||||
fileContent += `\nwindow.IonicNative = {\n`;
|
fileContent += `\nwindow.IonicNative = {\n`;
|
||||||
fileContent += INJECTABLE_CLASSES.map(e => e.className).join(',\n');
|
fileContent += INJECTABLE_CLASSES.map((e) => e.className).join(',\n');
|
||||||
fileContent += '\n};\n';
|
fileContent += '\n};\n';
|
||||||
fileContent += `require('./@awesome-cordova-plugins/core/bootstrap').checkReady();\n`;
|
fileContent += `require('./@awesome-cordova-plugins/core/bootstrap').checkReady();\n`;
|
||||||
fileContent += `require('./@awesome-cordova-plugins/core/ng1').initAngular1(window.IonicNative);`;
|
fileContent += `require('./@awesome-cordova-plugins/core/ng1').initAngular1(window.IonicNative);`;
|
||||||
|
@ -8,16 +8,16 @@ import { generateDeclarations, transpile } from '../build/transpile';
|
|||||||
generateDeclarations();
|
generateDeclarations();
|
||||||
transpile();
|
transpile();
|
||||||
|
|
||||||
const outDirs = PLUGIN_PATHS.map(p => p.replace(join(ROOT, 'src'), join(ROOT, 'dist')).replace(/[\\/]index.ts/, ''));
|
const outDirs = PLUGIN_PATHS.map((p) => p.replace(join(ROOT, 'src'), join(ROOT, 'dist')).replace(/[\\/]index.ts/, ''));
|
||||||
const injectableClasses = readJSONSync(EMIT_PATH);
|
const injectableClasses = readJSONSync(EMIT_PATH);
|
||||||
|
|
||||||
outDirs.forEach(dir => {
|
outDirs.forEach((dir) => {
|
||||||
const classes = injectableClasses.filter(entry => entry.dirName === dir.split(/[\\/]+/).pop());
|
const classes = injectableClasses.filter((entry) => entry.dirName === dir.split(/[\\/]+/).pop());
|
||||||
|
|
||||||
let jsFile: string = readFileSync(join(dir, 'index.js'), 'utf-8'),
|
let jsFile: string = readFileSync(join(dir, 'index.js'), 'utf-8'),
|
||||||
dtsFile: string = readFileSync(join(dir, 'index.d.ts'), 'utf-8');
|
dtsFile: string = readFileSync(join(dir, 'index.d.ts'), 'utf-8');
|
||||||
|
|
||||||
classes.forEach(entry => {
|
classes.forEach((entry) => {
|
||||||
dtsFile = dtsFile.replace(`class ${entry.className} `, 'class ' + entry.className + 'Original ');
|
dtsFile = dtsFile.replace(`class ${entry.className} `, 'class ' + entry.className + 'Original ');
|
||||||
dtsFile += `\nexport declare const ${entry.className}: ${entry.className}Original;`;
|
dtsFile += `\nexport declare const ${entry.className}: ${entry.className}Original;`;
|
||||||
jsFile = jsFile.replace(
|
jsFile = jsFile.replace(
|
||||||
|
@ -80,7 +80,7 @@ function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts:
|
|||||||
}
|
}
|
||||||
|
|
||||||
function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: any = {}) {
|
||||||
return new Observable(observer => {
|
return new Observable((observer) => {
|
||||||
let pluginResult;
|
let pluginResult;
|
||||||
|
|
||||||
if (opts.destruct) {
|
if (opts.destruct) {
|
||||||
@ -384,7 +384,7 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
|
|||||||
if (opts.sync) {
|
if (opts.sync) {
|
||||||
return callInstance(pluginObj, methodName, args, opts);
|
return callInstance(pluginObj, methodName, args, opts);
|
||||||
} else if (opts.observable) {
|
} else if (opts.observable) {
|
||||||
return new Observable(observer => {
|
return new Observable((observer) => {
|
||||||
let pluginResult;
|
let pluginResult;
|
||||||
|
|
||||||
if (opts.destruct) {
|
if (opts.destruct) {
|
||||||
|
@ -162,7 +162,7 @@ export class EmailComposer extends AwesomeCordovaNativePlugin {
|
|||||||
*/
|
*/
|
||||||
@CordovaCheck()
|
@CordovaCheck()
|
||||||
hasAccount(): Promise<any> {
|
hasAccount(): Promise<any> {
|
||||||
return getPromise<boolean>(resolve => {
|
return getPromise<boolean>((resolve) => {
|
||||||
EmailComposer.getPlugin().hasAccount((result: boolean) => {
|
EmailComposer.getPlugin().hasAccount((result: boolean) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
resolve(true);
|
resolve(true);
|
||||||
@ -182,7 +182,7 @@ export class EmailComposer extends AwesomeCordovaNativePlugin {
|
|||||||
|
|
||||||
@CordovaCheck()
|
@CordovaCheck()
|
||||||
hasClient(app?: string): Promise<any> {
|
hasClient(app?: string): Promise<any> {
|
||||||
return getPromise<boolean>(resolve => {
|
return getPromise<boolean>((resolve) => {
|
||||||
if (app) {
|
if (app) {
|
||||||
EmailComposer.getPlugin().hasClient(app, (result: boolean) => {
|
EmailComposer.getPlugin().hasClient(app, (result: boolean) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
@ -207,7 +207,7 @@ export class EmailComposer extends AwesomeCordovaNativePlugin {
|
|||||||
@CordovaCheck()
|
@CordovaCheck()
|
||||||
@Cordova({ platforms: ['Android'] })
|
@Cordova({ platforms: ['Android'] })
|
||||||
getClients(): Promise<string[]> {
|
getClients(): Promise<string[]> {
|
||||||
return getPromise<string[]>(resolve => {
|
return getPromise<string[]>((resolve) => {
|
||||||
EmailComposer.getPlugin().getClients((apps: any) => {
|
EmailComposer.getPlugin().getClients((apps: any) => {
|
||||||
if (Object.prototype.toString.call(apps) === '[object String]') {
|
if (Object.prototype.toString.call(apps) === '[object String]') {
|
||||||
apps = [apps];
|
apps = [apps];
|
||||||
@ -225,8 +225,8 @@ export class EmailComposer extends AwesomeCordovaNativePlugin {
|
|||||||
*/
|
*/
|
||||||
@CordovaCheck()
|
@CordovaCheck()
|
||||||
isAvailable(app?: string): Promise<any> {
|
isAvailable(app?: string): Promise<any> {
|
||||||
return getPromise<boolean>(resolve => {
|
return getPromise<boolean>((resolve) => {
|
||||||
Promise.all([this.hasAccount, this.hasClient(app)]).then(results => {
|
Promise.all([this.hasAccount, this.hasClient(app)]).then((results) => {
|
||||||
return resolve(results.length === 2 && results[0] && results[1]);
|
return resolve(results.length === 2 && results[0] && results[1]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -819,7 +819,7 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
options.exclusive = true;
|
options.exclusive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.resolveDirectoryUrl(path).then(fse => {
|
return this.resolveDirectoryUrl(path).then((fse) => {
|
||||||
return this.getDirectory(fse, dirName, options);
|
return this.getDirectory(fse, dirName, options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -840,10 +840,10 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.resolveDirectoryUrl(path)
|
return this.resolveDirectoryUrl(path)
|
||||||
.then(fse => {
|
.then((fse) => {
|
||||||
return this.getDirectory(fse, dirName, { create: false });
|
return this.getDirectory(fse, dirName, { create: false });
|
||||||
})
|
})
|
||||||
.then(de => {
|
.then((de) => {
|
||||||
return this.remove(de);
|
return this.remove(de);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -869,11 +869,11 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.resolveDirectoryUrl(path)
|
return this.resolveDirectoryUrl(path)
|
||||||
.then(fse => {
|
.then((fse) => {
|
||||||
return this.getDirectory(fse, dirName, { create: false });
|
return this.getDirectory(fse, dirName, { create: false });
|
||||||
})
|
})
|
||||||
.then(srcde => {
|
.then((srcde) => {
|
||||||
return this.resolveDirectoryUrl(newPath).then(destenation => {
|
return this.resolveDirectoryUrl(newPath).then((destenation) => {
|
||||||
return this.move(srcde, destenation, newDirName);
|
return this.move(srcde, destenation, newDirName);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -897,11 +897,11 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.resolveDirectoryUrl(path)
|
return this.resolveDirectoryUrl(path)
|
||||||
.then(fse => {
|
.then((fse) => {
|
||||||
return this.getDirectory(fse, dirName, { create: false });
|
return this.getDirectory(fse, dirName, { create: false });
|
||||||
})
|
})
|
||||||
.then(srcde => {
|
.then((srcde) => {
|
||||||
return this.resolveDirectoryUrl(newPath).then(deste => {
|
return this.resolveDirectoryUrl(newPath).then((deste) => {
|
||||||
return this.copy(srcde, deste, newDirName);
|
return this.copy(srcde, deste, newDirName);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -923,13 +923,13 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.resolveDirectoryUrl(path)
|
return this.resolveDirectoryUrl(path)
|
||||||
.then(fse => {
|
.then((fse) => {
|
||||||
return this.getDirectory(fse, dirName, {
|
return this.getDirectory(fse, dirName, {
|
||||||
create: false,
|
create: false,
|
||||||
exclusive: false,
|
exclusive: false,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(de => {
|
.then((de) => {
|
||||||
const reader = de.createReader();
|
const reader = de.createReader();
|
||||||
return this.readEntries(reader);
|
return this.readEntries(reader);
|
||||||
});
|
});
|
||||||
@ -951,10 +951,10 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.resolveDirectoryUrl(path)
|
return this.resolveDirectoryUrl(path)
|
||||||
.then(fse => {
|
.then((fse) => {
|
||||||
return this.getDirectory(fse, dirName, { create: false });
|
return this.getDirectory(fse, dirName, { create: false });
|
||||||
})
|
})
|
||||||
.then(de => {
|
.then((de) => {
|
||||||
return this.rimraf(de);
|
return this.rimraf(de);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -974,7 +974,7 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
return Promise.reject<any>(err);
|
return Promise.reject<any>(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.resolveLocalFilesystemUrl(path + file).then(fse => {
|
return this.resolveLocalFilesystemUrl(path + file).then((fse) => {
|
||||||
if (fse.isFile) {
|
if (fse.isFile) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -1011,7 +1011,7 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
options.exclusive = true;
|
options.exclusive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.resolveDirectoryUrl(path).then(fse => {
|
return this.resolveDirectoryUrl(path).then((fse) => {
|
||||||
return this.getFile(fse, fileName, options);
|
return this.getFile(fse, fileName, options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1032,10 +1032,10 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.resolveDirectoryUrl(path)
|
return this.resolveDirectoryUrl(path)
|
||||||
.then(fse => {
|
.then((fse) => {
|
||||||
return this.getFile(fse, fileName, { create: false });
|
return this.getFile(fse, fileName, { create: false });
|
||||||
})
|
})
|
||||||
.then(fe => {
|
.then((fe) => {
|
||||||
return this.remove(fe);
|
return this.remove(fe);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1086,7 +1086,7 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
*/
|
*/
|
||||||
private writeFileEntry(fe: FileEntry, text: string | Blob | ArrayBuffer, options: IWriteOptions) {
|
private writeFileEntry(fe: FileEntry, text: string | Blob | ArrayBuffer, options: IWriteOptions) {
|
||||||
return this.createWriter(fe)
|
return this.createWriter(fe)
|
||||||
.then(writer => {
|
.then((writer) => {
|
||||||
if (options.append) {
|
if (options.append) {
|
||||||
writer.seek(writer.length);
|
writer.seek(writer.length);
|
||||||
}
|
}
|
||||||
@ -1183,11 +1183,11 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.resolveDirectoryUrl(path)
|
return this.resolveDirectoryUrl(path)
|
||||||
.then(fse => {
|
.then((fse) => {
|
||||||
return this.getFile(fse, fileName, { create: false });
|
return this.getFile(fse, fileName, { create: false });
|
||||||
})
|
})
|
||||||
.then(srcfe => {
|
.then((srcfe) => {
|
||||||
return this.resolveDirectoryUrl(newPath).then(deste => {
|
return this.resolveDirectoryUrl(newPath).then((deste) => {
|
||||||
return this.move(srcfe, deste, newFileName);
|
return this.move(srcfe, deste, newFileName);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1213,11 +1213,11 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.resolveDirectoryUrl(path)
|
return this.resolveDirectoryUrl(path)
|
||||||
.then(fse => {
|
.then((fse) => {
|
||||||
return this.getFile(fse, fileName, { create: false });
|
return this.getFile(fse, fileName, { create: false });
|
||||||
})
|
})
|
||||||
.then(srcfe => {
|
.then((srcfe) => {
|
||||||
return this.resolveDirectoryUrl(newPath).then(deste => {
|
return this.resolveDirectoryUrl(newPath).then((deste) => {
|
||||||
return this.copy(srcfe, deste, newFileName);
|
return this.copy(srcfe, deste, newFileName);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1246,7 +1246,7 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
(entry: Entry) => {
|
(entry: Entry) => {
|
||||||
resolve(entry);
|
resolve(entry);
|
||||||
},
|
},
|
||||||
err => {
|
(err) => {
|
||||||
this.fillErrorMessage(err);
|
this.fillErrorMessage(err);
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
@ -1265,7 +1265,7 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
*/
|
*/
|
||||||
@CordovaCheck()
|
@CordovaCheck()
|
||||||
resolveDirectoryUrl(directoryUrl: string): Promise<DirectoryEntry> {
|
resolveDirectoryUrl(directoryUrl: string): Promise<DirectoryEntry> {
|
||||||
return this.resolveLocalFilesystemUrl(directoryUrl).then(de => {
|
return this.resolveLocalFilesystemUrl(directoryUrl).then((de) => {
|
||||||
if (de.isDirectory) {
|
if (de.isDirectory) {
|
||||||
return de as DirectoryEntry;
|
return de as DirectoryEntry;
|
||||||
} else {
|
} else {
|
||||||
@ -1290,10 +1290,10 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
directoryEntry.getDirectory(
|
directoryEntry.getDirectory(
|
||||||
directoryName,
|
directoryName,
|
||||||
flags,
|
flags,
|
||||||
de => {
|
(de) => {
|
||||||
resolve(de);
|
resolve(de);
|
||||||
},
|
},
|
||||||
err => {
|
(err) => {
|
||||||
this.fillErrorMessage(err);
|
this.fillErrorMessage(err);
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
@ -1316,7 +1316,7 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise<FileEntry> {
|
getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise<FileEntry> {
|
||||||
return new Promise<FileEntry>((resolve, reject) => {
|
return new Promise<FileEntry>((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
directoryEntry.getFile(fileName, flags, resolve, err => {
|
directoryEntry.getFile(fileName, flags, resolve, (err) => {
|
||||||
this.fillErrorMessage(err);
|
this.fillErrorMessage(err);
|
||||||
reject(err);
|
reject(err);
|
||||||
});
|
});
|
||||||
@ -1356,10 +1356,10 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fileEntry.file(
|
fileEntry.file(
|
||||||
file => {
|
(file) => {
|
||||||
reader[`readAs${readAs}`].call(reader, file);
|
reader[`readAs${readAs}`].call(reader, file);
|
||||||
},
|
},
|
||||||
error => {
|
(error) => {
|
||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -1376,7 +1376,7 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
() => {
|
() => {
|
||||||
resolve({ success: true, fileRemoved: fe });
|
resolve({ success: true, fileRemoved: fe });
|
||||||
},
|
},
|
||||||
err => {
|
(err) => {
|
||||||
this.fillErrorMessage(err);
|
this.fillErrorMessage(err);
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
@ -1392,10 +1392,10 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
srce.moveTo(
|
srce.moveTo(
|
||||||
destdir,
|
destdir,
|
||||||
newName,
|
newName,
|
||||||
deste => {
|
(deste) => {
|
||||||
resolve(deste);
|
resolve(deste);
|
||||||
},
|
},
|
||||||
err => {
|
(err) => {
|
||||||
this.fillErrorMessage(err);
|
this.fillErrorMessage(err);
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
@ -1411,10 +1411,10 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
srce.copyTo(
|
srce.copyTo(
|
||||||
destdir,
|
destdir,
|
||||||
newName,
|
newName,
|
||||||
deste => {
|
(deste) => {
|
||||||
resolve(deste);
|
resolve(deste);
|
||||||
},
|
},
|
||||||
err => {
|
(err) => {
|
||||||
this.fillErrorMessage(err);
|
this.fillErrorMessage(err);
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
@ -1428,10 +1428,10 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
private readEntries(dr: DirectoryReader): Promise<Entry[]> {
|
private readEntries(dr: DirectoryReader): Promise<Entry[]> {
|
||||||
return new Promise<Entry[]>((resolve, reject) => {
|
return new Promise<Entry[]>((resolve, reject) => {
|
||||||
dr.readEntries(
|
dr.readEntries(
|
||||||
entries => {
|
(entries) => {
|
||||||
resolve(entries);
|
resolve(entries);
|
||||||
},
|
},
|
||||||
err => {
|
(err) => {
|
||||||
this.fillErrorMessage(err);
|
this.fillErrorMessage(err);
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
@ -1448,7 +1448,7 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
() => {
|
() => {
|
||||||
resolve({ success: true, fileRemoved: de });
|
resolve({ success: true, fileRemoved: de });
|
||||||
},
|
},
|
||||||
err => {
|
(err) => {
|
||||||
this.fillErrorMessage(err);
|
this.fillErrorMessage(err);
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
@ -1462,10 +1462,10 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
private createWriter(fe: FileEntry): Promise<FileWriter> {
|
private createWriter(fe: FileEntry): Promise<FileWriter> {
|
||||||
return new Promise<FileWriter>((resolve, reject) => {
|
return new Promise<FileWriter>((resolve, reject) => {
|
||||||
fe.createWriter(
|
fe.createWriter(
|
||||||
writer => {
|
(writer) => {
|
||||||
resolve(writer);
|
resolve(writer);
|
||||||
},
|
},
|
||||||
err => {
|
(err) => {
|
||||||
this.fillErrorMessage(err);
|
this.fillErrorMessage(err);
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
@ -1482,7 +1482,7 @@ export class File extends AwesomeCordovaNativePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new Promise<any>((resolve, reject) => {
|
return new Promise<any>((resolve, reject) => {
|
||||||
writer.onwriteend = evt => {
|
writer.onwriteend = (evt) => {
|
||||||
if (writer.error) {
|
if (writer.error) {
|
||||||
reject(writer.error);
|
reject(writer.error);
|
||||||
} else {
|
} else {
|
||||||
|
@ -165,8 +165,8 @@ export class HyperTrack {
|
|||||||
getDeviceId(): Promise<string> {
|
getDeviceId(): Promise<string> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.cordovaInstanceHandle.getDeviceId(
|
this.cordovaInstanceHandle.getDeviceId(
|
||||||
deviceId => resolve(deviceId),
|
(deviceId) => resolve(deviceId),
|
||||||
err => reject(err)
|
(err) => reject(err)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -175,8 +175,8 @@ export class HyperTrack {
|
|||||||
isRunning(): Promise<boolean> {
|
isRunning(): Promise<boolean> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.cordovaInstanceHandle.isRunning(
|
this.cordovaInstanceHandle.isRunning(
|
||||||
isRunning => resolve(isRunning),
|
(isRunning) => resolve(isRunning),
|
||||||
err => reject(err)
|
(err) => reject(err)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -187,7 +187,7 @@ export class HyperTrack {
|
|||||||
this.cordovaInstanceHandle.setDeviceName(
|
this.cordovaInstanceHandle.setDeviceName(
|
||||||
name,
|
name,
|
||||||
() => resolve(),
|
() => resolve(),
|
||||||
err => reject(err)
|
(err) => reject(err)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ export class HyperTrack {
|
|||||||
this.cordovaInstanceHandle.setDeviceMetadata(
|
this.cordovaInstanceHandle.setDeviceMetadata(
|
||||||
metadata,
|
metadata,
|
||||||
() => resolve(),
|
() => resolve(),
|
||||||
err => reject(err)
|
(err) => reject(err)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ export class HyperTrack {
|
|||||||
title,
|
title,
|
||||||
message,
|
message,
|
||||||
() => resolve(),
|
() => resolve(),
|
||||||
err => reject(err)
|
(err) => reject(err)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ export class HyperTrack {
|
|||||||
geotagData,
|
geotagData,
|
||||||
expectedLocation,
|
expectedLocation,
|
||||||
() => resolve(),
|
() => resolve(),
|
||||||
err => reject(err)
|
(err) => reject(err)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -235,7 +235,7 @@ export class HyperTrack {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.cordovaInstanceHandle.requestPermissionsIfNecessary(
|
this.cordovaInstanceHandle.requestPermissionsIfNecessary(
|
||||||
() => resolve(),
|
() => resolve(),
|
||||||
err => reject(err)
|
(err) => reject(err)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ export class HyperTrack {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.cordovaInstanceHandle.allowMockLocations(
|
this.cordovaInstanceHandle.allowMockLocations(
|
||||||
() => resolve(),
|
() => resolve(),
|
||||||
err => reject(err)
|
(err) => reject(err)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -258,7 +258,7 @@ export class HyperTrack {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.cordovaInstanceHandle.syncDeviceSettings(
|
this.cordovaInstanceHandle.syncDeviceSettings(
|
||||||
() => resolve(),
|
() => resolve(),
|
||||||
err => reject(err)
|
(err) => reject(err)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ export class HyperTrack {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.cordovaInstanceHandle.start(
|
this.cordovaInstanceHandle.start(
|
||||||
() => resolve(),
|
() => resolve(),
|
||||||
err => reject(err)
|
(err) => reject(err)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -278,7 +278,7 @@ export class HyperTrack {
|
|||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
this.cordovaInstanceHandle.stop(
|
this.cordovaInstanceHandle.stop(
|
||||||
() => resolve(),
|
() => resolve(),
|
||||||
err => reject(err)
|
(err) => reject(err)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ export class SmartlookEventTrackingModes {
|
|||||||
private eventTrackingModes: string[];
|
private eventTrackingModes: string[];
|
||||||
|
|
||||||
constructor(eventTrackingModes: SmartlookEventTrackingMode[]) {
|
constructor(eventTrackingModes: SmartlookEventTrackingMode[]) {
|
||||||
this.eventTrackingModes = eventTrackingModes.map(eventTrackingMode =>
|
this.eventTrackingModes = eventTrackingModes.map((eventTrackingMode) =>
|
||||||
eventTrackingMode.getEventTrackingModeString()
|
eventTrackingMode.getEventTrackingModeString()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ export class WebSocketServer extends AwesomeCordovaNativePlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private onFunctionToObservable<T>(fnName: string) {
|
private onFunctionToObservable<T>(fnName: string) {
|
||||||
return new Observable<T>(observer => {
|
return new Observable<T>((observer) => {
|
||||||
const id = window.cordova.plugins.wsserver[fnName](observer.next.bind(observer), observer.error.bind(observer));
|
const id = window.cordova.plugins.wsserver[fnName](observer.next.bind(observer), observer.error.bind(observer));
|
||||||
|
|
||||||
return () => window.cordova.plugins.wsserver.removeCallback(id);
|
return () => window.cordova.plugins.wsserver.removeCallback(id);
|
||||||
|
Loading…
Reference in New Issue
Block a user