From d0ec66685ba386d1f353af0edc73d99ce9234491 Mon Sep 17 00:00:00 2001 From: akz92 Date: Mon, 28 Nov 2016 14:03:03 -0200 Subject: [PATCH 1/4] Add Rollbar plugin --- src/index.ts | 2 ++ src/plugins/rollbar.ts | 50 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/plugins/rollbar.ts diff --git a/src/index.ts b/src/index.ts index 8b8d55f6c2..aaf0002929 100644 --- a/src/index.ts +++ b/src/index.ts @@ -86,6 +86,7 @@ import { PinDialog } from './plugins/pin-dialog'; import { PowerManagement } from './plugins/power-management'; import { Printer } from './plugins/printer'; import { Push } from './plugins/push'; +import { Rollbar } from './plugins/rollbar'; import { SafariViewController } from './plugins/safari-view-controller'; import { Screenshot } from './plugins/screenshot'; import { SecureStorage } from './plugins/securestorage'; @@ -305,6 +306,7 @@ window['IonicNative'] = { ScreenOrientation, PinDialog, PowerManagement, + Rollbar, SafariViewController, Screenshot, SecureStorage, diff --git a/src/plugins/rollbar.ts b/src/plugins/rollbar.ts new file mode 100644 index 0000000000..03c23f6e60 --- /dev/null +++ b/src/plugins/rollbar.ts @@ -0,0 +1,50 @@ +/** + * This is a template for new plugin wrappers + * + * TODO: + * - Add/Change information below + * - Document usage (importing, executing main functionality) + * - Remove any imports that you are not using + * - Add this file to /src/index.ts (follow style of other plugins) + * - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs. + * - Remove this note + * + */ +import { Plugin, Cordova } from './plugin'; + +/** + * @name Rollbar + * @description + * This plugin does something + * + * @usage + * ``` + * import { Rollbar } from 'ionic-native'; + * + * Rollbar.functionName('Hello', 123) + * .then((something: any) => doSomething(something)) + * .catch((error: any) => console.log(error)); + * + * ``` + */ +@Plugin({ + pluginName: 'Rollbar', + plugin: 'resgrid-cordova-plugins-rollbar', + pluginRef: 'plugins.Rollbar', + repo: 'https://github.com/Resgrid/cordova-plugins-rollbar', + install: 'ionic plugin add resgrid-cordova-plugins-rollbar --variable ROLLBAR_ACCESS_TOKEN=rollbar_access_token --variable ROLLBAR_ENVIRONMENT=rollbar_environment' +}) +export class Rollbar { + + /** + * This function does something + * @param arg1 {string} Some param to configure something + * @param arg2 {number} Another param to configure something + * @return {Promise} Returns a promise that resolves when something happens + */ + @Cordova() + static init(successCallback: Function, errorCallback: Function) { + return; + } + +} From 7201b91a6992486010b88bca9b10b58963785db5 Mon Sep 17 00:00:00 2001 From: akz92 Date: Mon, 28 Nov 2016 16:23:14 -0200 Subject: [PATCH 2/4] Add documentation --- src/index.ts | 1 + src/plugins/rollbar.ts | 33 ++++++++++----------------------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/index.ts b/src/index.ts index aaf0002929..0f8234a4e7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -196,6 +196,7 @@ export * from './plugins/plugin'; export * from './plugins/power-management'; export * from './plugins/printer'; export * from './plugins/push'; +export * from './plugins/rollbar'; export * from './plugins/safari-view-controller'; export * from './plugins/screen-orientation'; export * from './plugins/screenshot'; diff --git a/src/plugins/rollbar.ts b/src/plugins/rollbar.ts index 03c23f6e60..873e83d28a 100644 --- a/src/plugins/rollbar.ts +++ b/src/plugins/rollbar.ts @@ -1,49 +1,36 @@ -/** - * This is a template for new plugin wrappers - * - * TODO: - * - Add/Change information below - * - Document usage (importing, executing main functionality) - * - Remove any imports that you are not using - * - Add this file to /src/index.ts (follow style of other plugins) - * - Remove all the comments included in this template, EXCEPT the @Plugin wrapper docs. - * - Remove this note - * - */ import { Plugin, Cordova } from './plugin'; /** * @name Rollbar * @description - * This plugin does something + * This plugin adds Rollbar App monitoring to your application * * @usage * ``` * import { Rollbar } from 'ionic-native'; * - * Rollbar.functionName('Hello', 123) - * .then((something: any) => doSomething(something)) - * .catch((error: any) => console.log(error)); + * Rollbar.init(); * * ``` */ @Plugin({ pluginName: 'Rollbar', plugin: 'resgrid-cordova-plugins-rollbar', - pluginRef: 'plugins.Rollbar', + pluginRef: 'Rollbar', repo: 'https://github.com/Resgrid/cordova-plugins-rollbar', - install: 'ionic plugin add resgrid-cordova-plugins-rollbar --variable ROLLBAR_ACCESS_TOKEN=rollbar_access_token --variable ROLLBAR_ENVIRONMENT=rollbar_environment' + platforms: ['Android', 'iOS'], + install: 'ionic plugin add resgrid-cordova-plugins-rollbar --variable ROLLBAR_ACCESS_TOKEN="YOUR_ROLLBAR_ACCEESS_TOKEN" --variable ROLLBAR_ENVIRONMENT="ROLLBAR_ENVIRONMENT"' }) export class Rollbar { /** - * This function does something - * @param arg1 {string} Some param to configure something - * @param arg2 {number} Another param to configure something - * @return {Promise} Returns a promise that resolves when something happens + * This function initializes the monitoring of your application + * @param successCallback {Function} A function to be executed when the plugin successfully initializes + * @param errorCallback {Function} A function to be executed when an error happens while initializing the plugin + * @return {Promise} Returns a promise that resolves when the plugin successfully initializes */ @Cordova() - static init(successCallback: Function, errorCallback: Function) { + static init(successCallback?: Function, errorCallback?: Function) { return; } From 919c7980d58b3c9613703491910c91a0647d4955 Mon Sep 17 00:00:00 2001 From: akz92 Date: Tue, 29 Nov 2016 16:30:05 -0200 Subject: [PATCH 3/4] Add return type to init function --- src/plugins/rollbar.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/rollbar.ts b/src/plugins/rollbar.ts index 873e83d28a..0b3566625e 100644 --- a/src/plugins/rollbar.ts +++ b/src/plugins/rollbar.ts @@ -30,8 +30,6 @@ export class Rollbar { * @return {Promise} Returns a promise that resolves when the plugin successfully initializes */ @Cordova() - static init(successCallback?: Function, errorCallback?: Function) { - return; - } + static init(successCallback?: Function, errorCallback?: Function): Promise { return; } } From 326f794cffffbb91c1237db8a59a26f61c319171 Mon Sep 17 00:00:00 2001 From: akz92 Date: Wed, 30 Nov 2016 08:25:14 -0200 Subject: [PATCH 4/4] Remove init params --- src/plugins/rollbar.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/rollbar.ts b/src/plugins/rollbar.ts index 0b3566625e..8d13c6ba72 100644 --- a/src/plugins/rollbar.ts +++ b/src/plugins/rollbar.ts @@ -25,11 +25,9 @@ export class Rollbar { /** * This function initializes the monitoring of your application - * @param successCallback {Function} A function to be executed when the plugin successfully initializes - * @param errorCallback {Function} A function to be executed when an error happens while initializing the plugin * @return {Promise} Returns a promise that resolves when the plugin successfully initializes */ @Cordova() - static init(successCallback?: Function, errorCallback?: Function): Promise { return; } + static init(): Promise { return; } }