From bbff6fcc8024b86a5ffd53f173d917febc11e606 Mon Sep 17 00:00:00 2001 From: Justin Unterreiner Date: Fri, 19 Feb 2016 13:51:36 -0800 Subject: [PATCH] Added run-time tests and bug fixes --- CONTRIBUTING.md | 25 ++++ LICENSE | 7 ++ LICENSE.md | 20 --- README.md | 20 ++- package.json | 3 - src/android/FabricPlugin.java | 4 +- src/ios/FabricPlugin.m | 30 ++++- tests/runtime-tests.js | 143 ++++++++++++++++++++++ typings/cordova-fabric-plugin-tests.ts | 8 +- www/FabricPlugin.Answers.es6 | 162 ++++++++++++------------- www/FabricPlugin.Answers.js | 98 +++------------ www/FabricPlugin.Crashlytics.es6 | 49 +++++--- www/FabricPlugin.Crashlytics.js | 26 ++-- 13 files changed, 356 insertions(+), 239 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100755 LICENSE delete mode 100755 LICENSE.md create mode 100644 tests/runtime-tests.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..95c0bfb --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,25 @@ +# Contributing + +If you wish to contribute please keep the following in mind. + +## Modification of JavaScript APIs + +If you want to modify the JavaScript APIs in `www` you'll need to edit the corresponding `*.es6` files. Once complete, execute `npm run-script transpile` which will transpile the ES6 code into ES5 JavaScript. + +If you do not have Babel installed globally, you'll first need to run `npm install bower@5.8.35` before executing the transpile script. + +Note that you only need to do this if you are making modifications to the ES6 source files. Also, please do not modify the `*.js` files directly--they should always be generated from the ES6 source files. + +## Run-time/Functional Tests + +The `tests` directory contains a JavaScript file of functional tests. These are different from unit tests in that they should be executed at runtime from within Cordova. + +These tests call every plugin method with and without parameters to ensure all APIs work as expected. + +Before running these tests you should change your application's bundle ID in `config.xml` so that the test data sent to Crashlytics/Answers does not pollute your application's data. + +## TypeScript Definitions and Tests + +If you are editing the JavaScript interfaces, be sure to also update the TypeScript definition files in the `typings` directory. + +This directory also includes a test file which should compile with `tsc` without any errors (it is a test of the validity of the definition file and not a runnable unit test file). diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..5523c36 --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +The MIT License (MIT) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100755 index 66c7de2..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,20 +0,0 @@ -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 23d036b..f098d8b 100755 --- a/README.md +++ b/README.md @@ -37,14 +37,14 @@ See `typings/cordova-fabric-plugin.d.ts` for documentation of the JavaScript API Below are a few examples; see the API documentation for a complete list. -## Simulate a native crash +## Simulate a Native Crash ```javascript window.fabric.Crashlytics.addLog("about to send a crash for testing!"); window.fabric.Crashlytics.sendCrash(); ``` -## Set information for crash reports +## Set Information for Crash Reports ```javascript window.fabric.Crashlytics.setUserIdentifier("123"); window.fabric.Crashlytics.setUserName("Some Guy"); @@ -52,12 +52,12 @@ window.fabric.Crashlytics.setUserEmail("some.guy@email.com"); window.fabric.Crashlytics.setStringValueForKey("bar", "foo"); ``` -## Send a Sign Up event +## Send a Sign Up Event ```javascript window.fabric.Answers.sendSignUp("Facebook", true); ``` -## Send a Sign Up event (with custom attributes) +## Send a Sign Up Event (with custom attributes) ```javascript var attributes = { foo: "data", @@ -67,7 +67,7 @@ var attributes = { window.fabric.Answers.sendSignUp("Facebook", true, attributes); ``` -## Send a Add To Cart event +## Send a Add To Cart Event ```javascript window.fabric.Answers.sendAddToCart(29.95, "USD", "Foo Bar Shirt", "apparel", "123"); ``` @@ -80,7 +80,7 @@ A normal installation for the Fabric SDKs involves downloading the Fabric tool a This plugin instead performs these steps via two build hooks located in the `hooks` directory: `after_plugin_install` and `before_plugin_uninstall`. -This allows you to avoid using the Fabric tool as well as omit your `platforms` directory to source control. +This allows you to avoid using the Fabric tool as well as omit your `platforms` directory from source control. ## Automatic Debug Symbol Upload on Build @@ -90,13 +90,9 @@ For iOS, our build hook adds a build script phase block to execute Fabric's uplo For Android, our build hook modifies the `build.gradle` file to delegate to Fabric's uploader Gradle task. -## Modification of JavaScript APIs +# Contributing -If you want to modify the JavaScript APIs in `www` you'll need to edit the corresponding `*.es6` files. Once complete, execute `npm transpile` which will transpile the ES6 code into ES5 JavaScript. - -If you do not have Babel installed globally, you'll first need to run `npm install` to install the development dependencies. - -Note that you only need to do this if you are making modifications to the `*.es6` source files in your own fork of the plugin. +If you wish to contribute please see `CONTRIBUTING.md`. # Authors diff --git a/package.json b/package.json index c33cc13..5596ea7 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,5 @@ "license": "MIT", "scripts": { "transpile": "node_modules/.bin/babel www/*.es6 --out-dir ." - }, - "devDependencies": { - "babel": "^5.8.35" } } diff --git a/src/android/FabricPlugin.java b/src/android/FabricPlugin.java index 6069550..f8ff70a 100755 --- a/src/android/FabricPlugin.java +++ b/src/android/FabricPlugin.java @@ -187,10 +187,10 @@ private void setBoolValueForKey(final JSONArray data, private void setFloatValueForKey(final JSONArray data, final CallbackContext callbackContext) { - float value = data.optLong(0); + double value = data.optDouble(0); String key = data.optString(1); - Crashlytics.setFloat(key, value); + Crashlytics.setDouble(key, value); callbackContext.success(); } diff --git a/src/ios/FabricPlugin.m b/src/ios/FabricPlugin.m index 31c1c71..e691ac9 100755 --- a/src/ios/FabricPlugin.m +++ b/src/ios/FabricPlugin.m @@ -51,9 +51,17 @@ - (void)pluginInitialize #pragma mark - Answers -(void) sendPurchase:(CDVInvokedUrlCommand *)command { - + [self.commandDelegate runInBackground:^{ - [Answers logPurchaseWithPrice:[command argumentAtIndex:0 withDefault: nil] + + NSNumber *priceNumber = [command argumentAtIndex:0 withDefault: nil andClass: [NSNumber class]]; + NSDecimalNumber *price = nil; + + if (priceNumber) { + price = [NSDecimalNumber decimalNumberWithDecimal:[priceNumber decimalValue]]; + } + + [Answers logPurchaseWithPrice:price currency:[command argumentAtIndex:1 withDefault: nil] success:[command argumentAtIndex:2 withDefault: nil] itemName:[command argumentAtIndex:3 withDefault: nil] @@ -64,9 +72,16 @@ -(void) sendPurchase:(CDVInvokedUrlCommand *)command { } -(void) sendAddToCart:(CDVInvokedUrlCommand *)command { + + NSNumber *priceNumber = [command argumentAtIndex:0 withDefault: nil andClass: [NSNumber class]]; + NSDecimalNumber *price = nil; + + if (priceNumber) { + price = [NSDecimalNumber decimalNumberWithDecimal:[priceNumber decimalValue]]; + } [self.commandDelegate runInBackground:^{ - [Answers logAddToCartWithPrice:[command argumentAtIndex:0 withDefault: nil] + [Answers logAddToCartWithPrice:price currency:[command argumentAtIndex:1 withDefault: nil] itemName:[command argumentAtIndex:2 withDefault: nil] itemType:[command argumentAtIndex:3 withDefault: nil] @@ -76,9 +91,16 @@ -(void) sendAddToCart:(CDVInvokedUrlCommand *)command { } -(void) sendStartCheckout:(CDVInvokedUrlCommand *)command { + + NSNumber *priceNumber = [command argumentAtIndex:0 withDefault: nil andClass: [NSNumber class]]; + NSDecimalNumber *price = nil; + + if (priceNumber) { + price = [NSDecimalNumber decimalNumberWithDecimal:[priceNumber decimalValue]]; + } [self.commandDelegate runInBackground:^{ - [Answers logStartCheckoutWithPrice:[command argumentAtIndex:0 withDefault: nil] + [Answers logStartCheckoutWithPrice:price currency:[command argumentAtIndex:1 withDefault: nil] itemCount:[command argumentAtIndex:2 withDefault: nil] customAttributes:[command argumentAtIndex:3 withDefault: nil]]; diff --git a/tests/runtime-tests.js b/tests/runtime-tests.js new file mode 100644 index 0000000..965e526 --- /dev/null +++ b/tests/runtime-tests.js @@ -0,0 +1,143 @@ + +var FabricPluginTests = (function (module) { + + var executeStatements = function (statements) { + + var index = 0; + + var interval = setInterval(function () { + + if (index >= statements.length) { + clearInterval(interval); + return; + } + + var statement = statements[index]; + + console.debug("Executing: " + statement); + eval(statement); + + index++; + + }, 500); + } + + module.testCrashWithParameters = function () { + + var statements = [ + "fabric.Crashlytics.sendNonFatalCrash('Non-fatal Crash Message 1');", + "fabric.Crashlytics.sendNonFatalCrash('Non-fatal Crash Message 2');", + "fabric.Crashlytics.addLog('Custom Log Message 1');", + "fabric.Crashlytics.addLog('Custom Log Message 2');", + "fabric.Crashlytics.addLog('Custom Log Message 3');", + "fabric.Crashlytics.setUserIdentifier('123');", + "fabric.Crashlytics.setUserName('bob');", + "fabric.Crashlytics.setUserEmail('bob@email.com');", + "fabric.Crashlytics.setStringValueForKey('value', 'string-property');", + "fabric.Crashlytics.setIntValueForKey(1, 'integer-property');", + "fabric.Crashlytics.setBoolValueForKey(true, 'boolean-property');", + "fabric.Crashlytics.setFloatValueForKey(1.1, 'float-property');", + "fabric.Crashlytics.sendCrash();" + ]; + + executeStatements(statements); + }; + + module.testCrashWithNullParameters = function () { + + var statements = [ + "fabric.Crashlytics.sendNonFatalCrash();", + "fabric.Crashlytics.addLog();", + "fabric.Crashlytics.setUserIdentifier();", + "fabric.Crashlytics.setUserName();", + "fabric.Crashlytics.setUserEmail();", + "fabric.Crashlytics.setStringValueForKey();", + "fabric.Crashlytics.setIntValueForKey();", + "fabric.Crashlytics.setBoolValueForKey();", + "fabric.Crashlytics.setFloatValueForKey();", + "fabric.Crashlytics.sendCrash();" + ]; + + executeStatements(statements); + }; + + module.testAnswersApi = function () { + + var statements = [ + "fabric.Answers.sendPurchase();", + "fabric.Answers.sendPurchase(24.95);", + "fabric.Answers.sendPurchase(24.95, 'USD');", + "fabric.Answers.sendPurchase(24.95, 'USD', true);", + "fabric.Answers.sendPurchase(24.95, 'USD', true, 'Foo Bar Shirt');", + "fabric.Answers.sendPurchase(24.95, 'USD', true, 'Foo Bar Shirt', 'apparel');", + "fabric.Answers.sendPurchase(24.95, 'USD', true, 'Foo Bar Shirt', 'apparel', '123');", + "fabric.Answers.sendPurchase(24.95, 'USD', true, 'Foo Bar Shirt', 'apparel', '123', { 'key': 'value' });", + + "fabric.Answers.sendAddToCart();", + "fabric.Answers.sendAddToCart(24.95);", + "fabric.Answers.sendAddToCart(24.95, 'USD');", + "fabric.Answers.sendAddToCart(24.95, 'USD', 'Foo Bar Shirt');", + "fabric.Answers.sendAddToCart(24.95, 'USD', 'Foo Bar Shirt', 'apparel');", + "fabric.Answers.sendAddToCart(24.95, 'USD', 'Foo Bar Shirt', 'apparel', '123');", + "fabric.Answers.sendAddToCart(24.95, 'USD', 'Foo Bar Shirt', 'apparel', '123', { 'key': 'value' });", + + "fabric.Answers.sendStartCheckout();", + "fabric.Answers.sendStartCheckout(24.95);", + "fabric.Answers.sendStartCheckout(24.95, 'USD', 2);", + "fabric.Answers.sendStartCheckout(24.95, 'USD', 2, { 'key': 'value' });", + + "fabric.Answers.sendSearch('query');", + "fabric.Answers.sendSearch('query', { 'key': 'value' });", + + "fabric.Answers.sendShare();", + "fabric.Answers.sendShare('Facebook');", + "fabric.Answers.sendShare('Facebook', 'Foo Bar Shirt');", + "fabric.Answers.sendShare('Facebook', 'Foo Bar Shirt', 'apparel');", + "fabric.Answers.sendShare('Facebook', 'Foo Bar Shirt', 'apparel', '123');", + "fabric.Answers.sendShare('Facebook', 'Foo Bar Shirt', 'apparel', '123', { 'key': 'value' });", + + "fabric.Answers.sendRatedContent();", + "fabric.Answers.sendRatedContent(5);", + "fabric.Answers.sendRatedContent(5, 'Foo Bar Shirt');", + "fabric.Answers.sendRatedContent(5, 'Foo Bar Shirt', 'apparel');", + "fabric.Answers.sendRatedContent(5, 'Foo Bar Shirt', 'apparel', '123', { 'key': 'value' });", + + "fabric.Answers.sendSignUp();", + "fabric.Answers.sendSignUp('Facebook');", + "fabric.Answers.sendSignUp('Facebook', true);", + "fabric.Answers.sendSignUp('Facebook', true, { 'key': 'value' });", + + "fabric.Answers.sendLogIn();", + "fabric.Answers.sendLogIn('Facebook');", + "fabric.Answers.sendLogIn('Facebook', true);", + "fabric.Answers.sendLogIn('Facebook', true, { 'key': 'value' });", + + "fabric.Answers.sendInvite();", + "fabric.Answers.sendInvite('Facebook');", + "fabric.Answers.sendInvite('Facebook', { 'key': 'value' });", + + "fabric.Answers.sendLevelStart();", + "fabric.Answers.sendLevelStart('Chemical Plant Zone - Act 1');", + "fabric.Answers.sendLevelStart('Chemical Plant Zone - Act 1', { 'key': 'value' });", + + "fabric.Answers.sendLevelEnd();", + "fabric.Answers.sendLevelEnd('Brinstar');", + "fabric.Answers.sendLevelEnd('Brinstar', 9000);", + "fabric.Answers.sendLevelEnd('Brinstar', 9000, true);", + "fabric.Answers.sendLevelEnd('Brinstar', 9000, true, { 'key': 'value' });", + + "fabric.Answers.sendContentView('Home');", + "fabric.Answers.sendContentView('Home', 'Page');", + "fabric.Answers.sendContentView('Home', 'Page', '123');", + "fabric.Answers.sendContentView('Home', 'Page', '123', { 'key': 'value' });", + + "fabric.Answers.sendCustomEvent('My Event');", + "fabric.Answers.sendCustomEvent('My Event', { 'key': 'value' });", + ]; + + executeStatements(statements); + }; + + return module; + +}(FabricPluginTests || {})); diff --git a/typings/cordova-fabric-plugin-tests.ts b/typings/cordova-fabric-plugin-tests.ts index 1a4aed5..54b79ec 100644 --- a/typings/cordova-fabric-plugin-tests.ts +++ b/typings/cordova-fabric-plugin-tests.ts @@ -81,10 +81,10 @@ fabric.Answers.sendLevelStart("Chemical Plant Zone - Act 1"); fabric.Answers.sendLevelStart("Chemical Plant Zone - Act 1", { "key": "value" }); fabric.Answers.sendLevelEnd(); -fabric.Answers.sendLevelEnd(""); -fabric.Answers.sendLevelEnd("", 9000); -fabric.Answers.sendLevelEnd("", 9000, true); -fabric.Answers.sendLevelEnd("", 9000, true, { "key": "value" }); +fabric.Answers.sendLevelEnd("Brinstar"); +fabric.Answers.sendLevelEnd("Brinstar", 9000); +fabric.Answers.sendLevelEnd("Brinstar", 9000, true); +fabric.Answers.sendLevelEnd("Brinstar", 9000, true, { "key": "value" }); fabric.Answers.sendContentView("Home"); fabric.Answers.sendContentView("Home", "Page"); diff --git a/www/FabricPlugin.Answers.es6 b/www/FabricPlugin.Answers.es6 index 912f413..c4e6718 100644 --- a/www/FabricPlugin.Answers.es6 +++ b/www/FabricPlugin.Answers.es6 @@ -3,126 +3,126 @@ class FabricAnswers { constructor() {} sendPurchase(itemPrice, currency, success, itemName, itemType, itemId, attributes) { - window.fabric.core.execPlugin('sendPurchase', { - itemPrice: itemPrice, - currency: currency, - success: success, - itemName: itemName, - itemType: itemType, - itemId: itemId, - attributes: attributes - }); + window.fabric.core.execPlugin('sendPurchase', [ + itemPrice, + currency, + success, + itemName, + itemType, + itemId, + attributes + ]); } sendAddToCart(itemPrice, currency, itemName, itemType, itemId, attributes) { - window.fabric.core.execPlugin('sendAddToCart', { - itemPrice: itemPrice, - currency: currency, - itemName: itemName, - itemType: itemType, - itemId: itemId, - attributes: attributes - }); + window.fabric.core.execPlugin('sendAddToCart', [ + itemPrice, + currency, + itemName, + itemType, + itemId, + attributes + ]); } sendStartCheckout(totalPrice, currency, itemCount, attributes) { - window.fabric.core.execPlugin('sendStartCheckout', { - totalPrice: totalPrice, - currency: currency, - itemCount: itemCount, - attributes: attributes - }); + window.fabric.core.execPlugin('sendStartCheckout', [ + totalPrice, + currency, + itemCount, + attributes + ]); } sendSearch(query, attributes) { - window.fabric.core.execPlugin('sendSearch', { - query: query, - attributes: attributes - }); + window.fabric.core.execPlugin('sendSearch', [ + query, + attributes + ]); } sendShare(method, contentName, contentType, contentId, attributes) { - window.fabric.core.execPlugin('sendShare', { - method: method, - contentName: contentName, - contentType: contentType, - contentId: contentId, - attributes: attributes - }); + window.fabric.core.execPlugin('sendShare', [ + method, + contentName, + contentType, + contentId, + attributes + ]); } sendRatedContent(rating, contentName, contentType, contentId, attributes) { - window.fabric.core.execPlugin('sendRatedContent', { - rating: rating, - contentName: contentName, - contentType: contentType, - contentId: contentId, - attributes: attributes - }); + window.fabric.core.execPlugin('sendRatedContent', [ + rating, + contentName, + contentType, + contentId, + attributes + ]); } sendSignUp(method, success, attributes) { - window.fabric.core.execPlugin('sendSignUp', { - method: method, - success: success, - attributes: attributes - }); + window.fabric.core.execPlugin('sendSignUp', [ + method, + success, + attributes + ]); } sendLogIn(method, success, attributes) { - window.fabric.core.execPlugin('sendLogIn', { - method: method, - success: success, - attributes: attributes - }); + window.fabric.core.execPlugin('sendLogIn', [ + method, + success, + attributes + ]); } sendInvite(method, attributes) { - window.fabric.core.execPlugin('sendInvite', { - method: method, - attributes: attributes - }); + window.fabric.core.execPlugin('sendInvite', [ + method, + attributes + ]); } sendLevelStart(levelName, attributes) { - window.fabric.core.execPlugin('sendLevelStart', { - levelName: levelName, - attributes: attributes - }); + window.fabric.core.execPlugin('sendLevelStart', [ + levelName, + attributes + ]); } sendLevelEnd(levelName, score, success, attributes) { - window.fabric.core.execPlugin('sendLevelEnd', { - levelName: levelName, - score: score, - success: success, - attributes: attributes - }); + window.fabric.core.execPlugin('sendLevelEnd', [ + levelName, + score, + success, + attributes + ]); } sendContentView(name, type, id, attributes) { - window.fabric.core.execPlugin('sendContentView', { - name: name, - type: type, - id: id, - attributes: attributes - }); + window.fabric.core.execPlugin('sendContentView', [ + name, + type, + id, + attributes + ]); } sendScreenView(name, id, attributes) { - window.fabric.core.execPlugin('sendContentView', { - name: name, - type: "Screen", - id: id, - attributes: attributes - }); + window.fabric.core.execPlugin('sendContentView', [ + name, + "Screen", + id, + attributes + ]); } sendCustomEvent(name, attributes) { - window.fabric.core.execPlugin('sendCustomEvent', { - name: name, - attributes: attributes - }); + window.fabric.core.execPlugin('sendCustomEvent', [ + name, + attributes + ]); } } diff --git a/www/FabricPlugin.Answers.js b/www/FabricPlugin.Answers.js index ae13137..d58cf6d 100644 --- a/www/FabricPlugin.Answers.js +++ b/www/FabricPlugin.Answers.js @@ -12,140 +12,72 @@ var FabricAnswers = (function () { _createClass(FabricAnswers, [{ key: 'sendPurchase', value: function sendPurchase(itemPrice, currency, success, itemName, itemType, itemId, attributes) { - window.fabric.core.execPlugin('sendPurchase', { - itemPrice: itemPrice, - currency: currency, - success: success, - itemName: itemName, - itemType: itemType, - itemId: itemId, - attributes: attributes - }); + window.fabric.core.execPlugin('sendPurchase', [itemPrice, currency, success, itemName, itemType, itemId, attributes]); } }, { key: 'sendAddToCart', value: function sendAddToCart(itemPrice, currency, itemName, itemType, itemId, attributes) { - window.fabric.core.execPlugin('sendAddToCart', { - itemPrice: itemPrice, - currency: currency, - itemName: itemName, - itemType: itemType, - itemId: itemId, - attributes: attributes - }); + window.fabric.core.execPlugin('sendAddToCart', [itemPrice, currency, itemName, itemType, itemId, attributes]); } }, { key: 'sendStartCheckout', value: function sendStartCheckout(totalPrice, currency, itemCount, attributes) { - window.fabric.core.execPlugin('sendStartCheckout', { - totalPrice: totalPrice, - currency: currency, - itemCount: itemCount, - attributes: attributes - }); + window.fabric.core.execPlugin('sendStartCheckout', [totalPrice, currency, itemCount, attributes]); } }, { key: 'sendSearch', value: function sendSearch(query, attributes) { - window.fabric.core.execPlugin('sendSearch', { - query: query, - attributes: attributes - }); + window.fabric.core.execPlugin('sendSearch', [query, attributes]); } }, { key: 'sendShare', value: function sendShare(method, contentName, contentType, contentId, attributes) { - window.fabric.core.execPlugin('sendShare', { - method: method, - contentName: contentName, - contentType: contentType, - contentId: contentId, - attributes: attributes - }); + window.fabric.core.execPlugin('sendShare', [method, contentName, contentType, contentId, attributes]); } }, { key: 'sendRatedContent', value: function sendRatedContent(rating, contentName, contentType, contentId, attributes) { - window.fabric.core.execPlugin('sendRatedContent', { - rating: rating, - contentName: contentName, - contentType: contentType, - contentId: contentId, - attributes: attributes - }); + window.fabric.core.execPlugin('sendRatedContent', [rating, contentName, contentType, contentId, attributes]); } }, { key: 'sendSignUp', value: function sendSignUp(method, success, attributes) { - window.fabric.core.execPlugin('sendSignUp', { - method: method, - success: success, - attributes: attributes - }); + window.fabric.core.execPlugin('sendSignUp', [method, success, attributes]); } }, { key: 'sendLogIn', value: function sendLogIn(method, success, attributes) { - window.fabric.core.execPlugin('sendLogIn', { - method: method, - success: success, - attributes: attributes - }); + window.fabric.core.execPlugin('sendLogIn', [method, success, attributes]); } }, { key: 'sendInvite', - value: function sendInvite(method, success, attributes) { - window.fabric.core.execPlugin('sendInvite', { - method: method, - success: success, - attributes: attributes - }); + value: function sendInvite(method, attributes) { + window.fabric.core.execPlugin('sendInvite', [method, attributes]); } }, { key: 'sendLevelStart', value: function sendLevelStart(levelName, attributes) { - window.fabric.core.execPlugin('sendLevelStart', { - levelName: levelName, - attributes: attributes - }); + window.fabric.core.execPlugin('sendLevelStart', [levelName, attributes]); } }, { key: 'sendLevelEnd', value: function sendLevelEnd(levelName, score, success, attributes) { - window.fabric.core.execPlugin('sendLevelEnd', { - levelName: levelName, - score: score, - success: success, - attributes: attributes - }); + window.fabric.core.execPlugin('sendLevelEnd', [levelName, score, success, attributes]); } }, { key: 'sendContentView', value: function sendContentView(name, type, id, attributes) { - window.fabric.core.execPlugin('sendContentView', { - name: name, - type: type, - id: id, - attributes: attributes - }); + window.fabric.core.execPlugin('sendContentView', [name, type, id, attributes]); } }, { key: 'sendScreenView', value: function sendScreenView(name, id, attributes) { - window.fabric.core.execPlugin('sendContentView', { - name: name, - type: "Screen", - id: id, - attributes: attributes - }); + window.fabric.core.execPlugin('sendContentView', [name, "Screen", id, attributes]); } }, { key: 'sendCustomEvent', value: function sendCustomEvent(name, attributes) { - window.fabric.core.execPlugin('sendCustomEvent', { - name: name, - attributes: attributes - }); + window.fabric.core.execPlugin('sendCustomEvent', [name, attributes]); } }]); diff --git a/www/FabricPlugin.Crashlytics.es6 b/www/FabricPlugin.Crashlytics.es6 index 20d0ec9..d23ba89 100644 --- a/www/FabricPlugin.Crashlytics.es6 +++ b/www/FabricPlugin.Crashlytics.es6 @@ -3,47 +3,66 @@ class FabricCrashlytics { constructor() {} addLog(message) { - const defaults = { - message: message - }; - - window.fabric.core.execPlugin('addLog', defaults); + window.fabric.core.execPlugin('addLog', [ + message + ]); } sendCrash() { - window.fabric.core.execPlugin('sendCrash'); + window.fabric.core.execPlugin('sendCrash', [ + ]); } - sendNonFatalCrash() { - window.fabric.core.execPlugin('sendNonFatalCrash'); + sendNonFatalCrash(message) { + window.fabric.core.execPlugin('sendNonFatalCrash', [ + message + ]); } setUserIdentifier(userIdentifier) { - window.fabric.core.execPlugin('setUserIdentifier', userIdentifier); + window.fabric.core.execPlugin('setUserIdentifier', [ + userIdentifier + ]); } setUserName(userName) { - window.fabric.core.execPlugin('setUserName', userName); + window.fabric.core.execPlugin('setUserName', [ + userName + ]); } setUserEmail(userEmail) { - window.fabric.core.execPlugin('setUserEmail', userEmail); + window.fabric.core.execPlugin('setUserEmail', [ + userEmail + ]); } setStringValueForKey(value, key) { - window.fabric.core.execPlugin('setStringValueForKey', value, key); + window.fabric.core.execPlugin('setStringValueForKey', [ + value, + key + ]); } setIntValueForKey(value, key) { - window.fabric.core.execPlugin('setIntValueForKey', value, key); + window.fabric.core.execPlugin('setIntValueForKey', [ + value, + key + ]); } setBoolValueForKey(value, key) { - window.fabric.core.execPlugin('setBoolValueForKey', value, key); + window.fabric.core.execPlugin('setBoolValueForKey', [ + value, + key + ]); } setFloatValueForKey(value, key) { - window.fabric.core.execPlugin('setFloatValueForKey', value, key); + window.fabric.core.execPlugin('setFloatValueForKey', [ + value, + key + ]); } } diff --git a/www/FabricPlugin.Crashlytics.js b/www/FabricPlugin.Crashlytics.js index 20b792a..04b6f20 100644 --- a/www/FabricPlugin.Crashlytics.js +++ b/www/FabricPlugin.Crashlytics.js @@ -12,56 +12,52 @@ var FabricCrashlytics = (function () { _createClass(FabricCrashlytics, [{ key: 'addLog', value: function addLog(message) { - var defaults = { - message: message - }; - - window.fabric.core.execPlugin('addLog', defaults); + window.fabric.core.execPlugin('addLog', [message]); } }, { key: 'sendCrash', value: function sendCrash() { - window.fabric.core.execPlugin('sendCrash'); + window.fabric.core.execPlugin('sendCrash', []); } }, { key: 'sendNonFatalCrash', - value: function sendNonFatalCrash() { - window.fabric.core.execPlugin('sendNonFatalCrash'); + value: function sendNonFatalCrash(message) { + window.fabric.core.execPlugin('sendNonFatalCrash', [message]); } }, { key: 'setUserIdentifier', value: function setUserIdentifier(userIdentifier) { - window.fabric.core.execPlugin('setUserIdentifier', userIdentifier); + window.fabric.core.execPlugin('setUserIdentifier', [userIdentifier]); } }, { key: 'setUserName', value: function setUserName(userName) { - window.fabric.core.execPlugin('setUserName', userName); + window.fabric.core.execPlugin('setUserName', [userName]); } }, { key: 'setUserEmail', value: function setUserEmail(userEmail) { - window.fabric.core.execPlugin('setUserEmail', userEmail); + window.fabric.core.execPlugin('setUserEmail', [userEmail]); } }, { key: 'setStringValueForKey', value: function setStringValueForKey(value, key) { - window.fabric.core.execPlugin('setStringValueForKey', value, key); + window.fabric.core.execPlugin('setStringValueForKey', [value, key]); } }, { key: 'setIntValueForKey', value: function setIntValueForKey(value, key) { - window.fabric.core.execPlugin('setIntValueForKey', value, key); + window.fabric.core.execPlugin('setIntValueForKey', [value, key]); } }, { key: 'setBoolValueForKey', value: function setBoolValueForKey(value, key) { - window.fabric.core.execPlugin('setBoolValueForKey', value, key); + window.fabric.core.execPlugin('setBoolValueForKey', [value, key]); } }, { key: 'setFloatValueForKey', value: function setFloatValueForKey(value, key) { - window.fabric.core.execPlugin('setFloatValueForKey', value, key); + window.fabric.core.execPlugin('setFloatValueForKey', [value, key]); } }]);