From 226c182039b26372572a4347e8ca1b859747bb35 Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Mon, 30 Nov 2015 10:11:48 -0600 Subject: [PATCH] Toast fix --- demo/package.json | 8 ++++- dist/plugins/actionsheet.js | 2 +- dist/plugins/camera.js | 2 +- dist/plugins/device.js | 2 +- dist/plugins/statusbar.js | 2 +- dist/plugins/toast.js | 16 +++------- dist/src/plugins/toast.js | 14 ++------- package.json | 2 +- src/plugin-config.ts | 58 ------------------------------------- src/plugins/toast.ts | 14 ++------- 10 files changed, 22 insertions(+), 98 deletions(-) delete mode 100644 src/plugin-config.ts diff --git a/demo/package.json b/demo/package.json index e166e758d..db44c2743 100644 --- a/demo/package.json +++ b/demo/package.json @@ -19,7 +19,13 @@ "name": "demo", "description": "demo: An Ionic project", "cordovaPlugins": [ - "cordova-plugin-x-toast" + "cordova-plugin-x-toast", + "cordova-plugin-device", + "cordova-plugin-console", + "cordova-plugin-whitelist", + "cordova-plugin-splashscreen", + "cordova-plugin-statusbar", + "ionic-plugin-keyboard" ], "cordovaPlatforms": [ "ios" diff --git a/dist/plugins/actionsheet.js b/dist/plugins/actionsheet.js index b1548060e..475627b50 100644 --- a/dist/plugins/actionsheet.js +++ b/dist/plugins/actionsheet.js @@ -1,4 +1,4 @@ -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/dist/plugins/camera.js b/dist/plugins/camera.js index 0d6a22a88..9fc8b9052 100644 --- a/dist/plugins/camera.js +++ b/dist/plugins/camera.js @@ -1,4 +1,4 @@ -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/dist/plugins/device.js b/dist/plugins/device.js index 344a31516..6737ae54b 100644 --- a/dist/plugins/device.js +++ b/dist/plugins/device.js @@ -1,4 +1,4 @@ -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/dist/plugins/statusbar.js b/dist/plugins/statusbar.js index a33adc45a..fbbc29059 100644 --- a/dist/plugins/statusbar.js +++ b/dist/plugins/statusbar.js @@ -1,4 +1,4 @@ -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/dist/plugins/toast.js b/dist/plugins/toast.js index ec6d17e4d..1d750fde4 100644 --- a/dist/plugins/toast.js +++ b/dist/plugins/toast.js @@ -1,4 +1,4 @@ -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); @@ -12,23 +12,15 @@ var Toast = (function () { } Toast.hide = function () { }; ; - Toast.showWithOptions = function (options) { - console.log('Show with options'); - }; + Toast.showWithOptions = function (options) { }; ; Object.defineProperty(Toast, "hide", __decorate([ - plugin_1.Cordova({ - successIndex: 0, - errIndex: 1 - }) + plugin_1.Cordova() ], Toast, "hide", Object.getOwnPropertyDescriptor(Toast, "hide"))); Object.defineProperty(Toast, "showWithOptions", __decorate([ - plugin_1.Cordova({ - successIndex: 1, - errIndex: 2 - }) + plugin_1.Cordova() ], Toast, "showWithOptions", Object.getOwnPropertyDescriptor(Toast, "showWithOptions"))); Toast = __decorate([ plugin_1.Plugin({ diff --git a/dist/src/plugins/toast.js b/dist/src/plugins/toast.js index cb5eadc6b..e1924f4b8 100644 --- a/dist/src/plugins/toast.js +++ b/dist/src/plugins/toast.js @@ -13,24 +13,16 @@ var Toast = (function () { } Toast.hide = function () { }; ; - Toast.showWithOptions = function (options) { - console.log('Show with options'); - }; + Toast.showWithOptions = function (options) { }; ; __decorate([ - plugin_1.Cordova({ - successIndex: 0, - errIndex: 1 - }), + plugin_1.Cordova(), __metadata('design:type', Function), __metadata('design:paramtypes', []), __metadata('design:returntype', void 0) ], Toast, "hide", null); __decorate([ - plugin_1.Cordova({ - successIndex: 1, - errIndex: 2 - }), + plugin_1.Cordova(), __metadata('design:type', Function), __metadata('design:paramtypes', [Object]), __metadata('design:returntype', void 0) diff --git a/package.json b/package.json index 6b3d4a9ea..b4c26d4ec 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "build": "rm -rf dist && tsc" + "build": "tsc --experimentalDecorators", }, "repository": { "type": "git", diff --git a/src/plugin-config.ts b/src/plugin-config.ts deleted file mode 100644 index e69191ee8..000000000 --- a/src/plugin-config.ts +++ /dev/null @@ -1,58 +0,0 @@ -export interface CordovaPlugin { - id: string, - className: string; - plugin: string; - pluginRef: string; - promise?: any //should really be Promise -} - - -export var PluginConfig:CordovaPlugin[] = [ - { - id: 'device', - className: 'Device', - plugin: 'cordova-plugin-device', - pluginRef: 'device' - }, - { - id: 'camera', - className: 'Camera', - plugin: 'cordova-plugin-camera', - promise: ['takePicture'], - pluginRef: 'navigator.camera' - }, - { - id: 'statusbar', - className: 'StatusBar', - plugin: 'cordova-plugin-statusbar', - pluginRef: 'StatusBar', - promise: ['show', 'hide', 'styleDefault', 'styleLightContent', 'styleBlackTranslucent', 'styleBlackOpaque'] - }, - { - id: 'applinks', - className: 'AppLinks', - plugin: 'com.lampa.startapp', - pluginRef: 'navigator.startApp', - promise: ['start', 'check'] - }, - { - id: 'barcode', - className: 'Barcode', - plugin: 'phonegap-plugin-barcodescanner', - pluginRef: 'cordova.plugins.barcodeScanner', - promise: ['scan', 'encode'] - }, - { - id: 'camera-roll', - className: 'CameraRoll', - plugin: 'cordova-plugin-camera-roll', - pluginRef: 'CameraRoll', - promise: ['saveToCameraRoll', 'getPhotos'] - }, - { - id: 'contacts', - className: 'Contacts', - plugin: 'cordova-plugin-contacts', - pluginRef: 'navigator.contacts', - }, -] diff --git a/src/plugins/toast.ts b/src/plugins/toast.ts index d67113e1f..8097b8406 100644 --- a/src/plugins/toast.ts +++ b/src/plugins/toast.ts @@ -7,17 +7,9 @@ import {Plugin, Cordova} from './plugin'; repo: 'https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin' }) export class Toast { - @Cordova({ - successIndex: 0, - errIndex: 1 - }) + @Cordova() static hide(){}; - @Cordova({ - successIndex: 1, - errIndex: 2 - }) - static showWithOptions(options:any){ - console.log('Show with options'); - }; + @Cordova() + static showWithOptions(options:any){}; }