From ac78a1540ce0152675592e608b9f1690a93f091d Mon Sep 17 00:00:00 2001 From: Perry Govier Date: Thu, 27 Sep 2018 01:05:08 -0500 Subject: [PATCH] chore(tidy up): getting rid of redundant code to make TSDoc happy (#2747) --- src/@ionic-native/plugins/file/index.ts | 40 ---------------- src/@ionic-native/plugins/paypal/index.ts | 46 ------------------- .../plugins/photo-library/index.ts | 2 +- 3 files changed, 1 insertion(+), 87 deletions(-) diff --git a/src/@ionic-native/plugins/file/index.ts b/src/@ionic-native/plugins/file/index.ts index aac1362b9..4eb57501f 100644 --- a/src/@ionic-native/plugins/file/index.ts +++ b/src/@ionic-native/plugins/file/index.ts @@ -1217,46 +1217,6 @@ export class File extends IonicNativePlugin { return this.readFile(path, file, 'ArrayBuffer'); } - private readFile( - path: string, - file: string, - readAs: 'ArrayBuffer' | 'BinaryString' | 'DataURL' | 'Text' - ): Promise { - if (/^\//.test(file)) { - const err = new FileError(5); - err.message = 'file-name cannot start with /'; - return Promise.reject(err); - } - - return this.resolveDirectoryUrl(path) - .then((directoryEntry: DirectoryEntry) => { - return this.getFile(directoryEntry, file, { create: false }); - }) - .then((fileEntry: FileEntry) => { - const reader = new FileReader(); - return new Promise((resolve, reject) => { - reader.onloadend = () => { - if (reader.result !== undefined || reader.result !== null) { - resolve((reader.result as any) as T); - } else if (reader.error !== undefined || reader.error !== null) { - reject(reader.error); - } else { - reject({ code: null, message: 'READER_ONLOADEND_ERR' }); - } - }; - - fileEntry.file( - file => { - reader[`readAs${readAs}`].call(reader, file); - }, - error => { - reject(error); - } - ); - }); - }); - } - /** * Move a file to a given path. * diff --git a/src/@ionic-native/plugins/paypal/index.ts b/src/@ionic-native/plugins/paypal/index.ts index ec6b832cb..8cbbba8d7 100644 --- a/src/@ionic-native/plugins/paypal/index.ts +++ b/src/@ionic-native/plugins/paypal/index.ts @@ -237,14 +237,6 @@ export class PayPalPayment { * Optional PayPalPaymentDetails object */ details: PayPalPaymentDetails; - - constructor(amount: string, currency: string, shortDescription: string, intent: string, details?: PayPalPaymentDetails) { - this.amount = amount; - this.currency = currency; - this.shortDescription = shortDescription; - this.intent = intent; - this.details = details; - } } /** @@ -294,24 +286,6 @@ export class PayPalItem { * The stock keeping unit for this item. 50 characters max (optional) */ sku?: string; - - /** - * The PayPalItem class defines an optional itemization for a payment. - * @see https://developer.paypal.com/docs/api/#item-object for more details. - * @param {String} name: Name of the item. 127 characters max - * @param {Number} quantity: Number of units. 10 characters max. - * @param {String} price: Unit price for this item 10 characters max. - * May be negative for "coupon" etc - * @param {String} currency: ISO standard currency code. - * @param {String} sku: The stock keeping unit for this item. 50 characters max (optional) - */ - constructor(name: string, quantity: number, price: string, currency: string, sku?: string) { - this.name = name; - this.quantity = quantity; - this.price = price; - this.currency = currency; - this.sku = sku; - } } /** @@ -546,24 +520,4 @@ export class PayPalShippingAddress { * 2-letter country code. 2 characters max. */ countryCode: string; - - /** - * See the documentation of the individual properties for more detail. - * @param {String} recipientName: Name of the recipient at this address. 50 characters max. - * @param {String} line1: Line 1 of the address (e.g., Number, street, etc). 100 characters max. - * @param {String} line2: Line 2 of the address (e.g., Suite, apt #, etc). 100 characters max. Optional. - * @param {String} city: City name. 50 characters max. - * @param {String} state: 2-letter code for US states, and the equivalent for other countries. 100 characters max. Required in certain countries. - * @param {String} postalCode: ZIP code or equivalent is usually required for countries that have them. 20 characters max. Required in certain countries. - * @param {String} countryCode: 2-letter country code. 2 characters max. - */ - constructor(recipientName: string, line1: string, line2: string, city: string, state: string, postalCode: string, countryCode: string) { - this.recipientName = recipientName; - this.line1 = line1; - this.line2 = line2; - this.city = city; - this.state = state; - this.postalCode = postalCode; - this.countryCode = countryCode; - } } diff --git a/src/@ionic-native/plugins/photo-library/index.ts b/src/@ionic-native/plugins/photo-library/index.ts index 7a7f1a111..802abec86 100644 --- a/src/@ionic-native/plugins/photo-library/index.ts +++ b/src/@ionic-native/plugins/photo-library/index.ts @@ -122,7 +122,7 @@ export class PhotoLibrary extends IonicNativePlugin { * @param options {GetLibraryOptions} Optional, like thumbnail size and chunks settings. * @return {Observable} Returns library items. If appropriate option was set, will be returned by chunks. */ - @CordovaCheck({ + @Cordova({ observable: true }) getLibrary(options?: GetLibraryOptions): Observable {