From 82f7fd9e0a5a4c5aabfccd07112c4c567682ae61 Mon Sep 17 00:00:00 2001 From: ndesai-newrelic <89222514+ndesai-newrelic@users.noreply.github.com> Date: Sat, 31 Dec 2022 02:04:42 -0600 Subject: [PATCH] docs(newrelic): update docs (#4420) * Adding Newrelic support for Awesome plugins * Adding more static methods for newrelic cordova plugin * adding documentation for newrelic plugin * Updating newrelic cordova plugin repo * Update index.ts * fix:updating correct cordova plugin repo * docs: added Documentation for NewRelic Plugin * ADDED Record Error and Updated set Attribute Method Co-authored-by: Daniel Sogl --- docs/plugins/newrelic/README.md | 20 +++++++++++++ .../plugins/newrelic/index.ts | 29 +++++++++---------- 2 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 docs/plugins/newrelic/README.md diff --git a/docs/plugins/newrelic/README.md b/docs/plugins/newrelic/README.md new file mode 100644 index 00000000..fc7c0dde --- /dev/null +++ b/docs/plugins/newrelic/README.md @@ -0,0 +1,20 @@ +# newrelic mobile + +``` +$ ionic cordova plugin add https://github.com/newrelic/newrelic-cordova-plugin.git --variable IOS_APP_TOKEN="{ios-app-token}" --variable ANDROID_APP_TOKEN="{android-app-token}" +$ npm install @awesome-cordova-plugins/newrelic +``` + +## [Usage Documentation](https://danielsogl.gitbook.io/awesome-cordova-plugins/plugins/newrelic/) + +Plugin Repo: [https://github.com/newrelic/newrelic-cordova-plugin](https://github.com/newrelic/newrelic-cordova-plugin) + +This NewRelic plugin collect crashes, network traffic, and other information for hybrid apps using native components. + +## Supported platforms + +- Android + - iOS + + + diff --git a/src/@awesome-cordova-plugins/plugins/newrelic/index.ts b/src/@awesome-cordova-plugins/plugins/newrelic/index.ts index 11dd4fef..ce89fbc8 100644 --- a/src/@awesome-cordova-plugins/plugins/newrelic/index.ts +++ b/src/@awesome-cordova-plugins/plugins/newrelic/index.ts @@ -29,7 +29,7 @@ import { Observable } from 'rxjs'; pluginRef: 'NewRelic', // the variable reference to call the plugin, example: navigator.geolocation repo: 'https://github.com/newrelic/newrelic-cordova-plugin', // the github repository URL for the plugin install: - 'ionic cordova plugin add https://github.com/ndesai-newrelic/newrelic-cordova-plugin.git --variable IOS_APP_TOKEN="{ios-app-token}" --variable ANDROID_APP_TOKEN="{android-app-token}"', // OPTIONAL install command, in case the plugin requires variables + 'ionic cordova plugin add https://github.com/newrelic/newrelic-cordova-plugin.git --variable IOS_APP_TOKEN="{ios-app-token}" --variable ANDROID_APP_TOKEN="{android-app-token}"', // OPTIONAL install command, in case the plugin requires variables installVariables: ['IOS_APP_TOKEN', 'ANDROID_APP_TOKEN'], // OPTIONAL the plugin requires variables platforms: ['Android', 'iOS'], // Array of platforms supported, example: ['Android', 'iOS'] }) @@ -56,7 +56,7 @@ export class NewRelic extends AwesomeCordovaNativePlugin { @Cordova({ sync: true, }) - setAttribute(name: string, value: string): void { + setAttribute(name: string, value: any): void { return; // We add return; here to avoid any IDE / Compiler errors } @@ -124,19 +124,6 @@ export class NewRelic extends AwesomeCordovaNativePlugin { return; // We add return; here to avoid any IDE / Compiler errors } - /** - * Records JavaScript errors for ionic. - * @param {string} name The name of the error. - * @param {string} message The message of the error. - * @param {string} stack The error stack of the error. - * @param {boolean} isFatal The flag for whether the error is fatal. - */ - @Cordova({ - sync: true, - }) - recordError(name: string, message: string, stack: string, isFatal: boolean): void { - return; // We add return; here to avoid any IDE / Compiler errors - } /** * Throws a demo run-time exception to test New Relic crash reporting. @@ -317,4 +304,16 @@ export class NewRelic extends AwesomeCordovaNativePlugin { noticeNetworkFailure(url: string, method: string, startTime: Number, endTime: Number, failure: string): void { return; // We add return; here to avoid any IDE / Compiler errors } + + /** + * Records JavaScript errors for ionic. + * @param {Error} err The error to report. + */ + @Cordova({ + sync: true, + }) + recordError(err: Error): void { + return; // We add return; here to avoid any IDE / Compiler errors + } + }