From e3be01e4b8d8e9d972f1a05049e30cb47a2c6db0 Mon Sep 17 00:00:00 2001 From: Hossam Hassan Date: Thu, 16 Feb 2017 01:55:09 +0200 Subject: [PATCH] Fix getUnreadMessagesCount API params --- index.js | 168 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 86 insertions(+), 82 deletions(-) diff --git a/index.js b/index.js index 6f33be7..45d1d91 100644 --- a/index.js +++ b/index.js @@ -237,7 +237,11 @@ module.exports = { * Notifications count, or -1 incase the SDK has not been initialized. */ getUnreadMessagesCount: function (messageCountCallback) { - Instabug.getUnreadMessagesCount(messageCountCallback); + if (Platform.OS === 'ios') { + Instabug.getUnreadMessagesCount(messageCountCallback); + } else if (Platform.OS === 'android') { + Instabug.getUnreadMessagesCount(); + } }, /** @@ -517,123 +521,123 @@ module.exports = { }, /** - * Add file to attached files with each report being sent. - * A new copy of the file at fileURL will be attached with each bug report being sent. The file is only copied - * at the time of sending the report, so you could safely call this API whenever the file is available on disk, and the copy - * attached to your bug reports will always contain that latest changes at the time of sending the report. - * - * Each call to this method adds the file to the files attached, until a maximum of 3 then it overrides the first file. - * The file has to be available locally at the provided path when the report is being sent. - * @param {string} stringURL Path to a file that's going to be attached to each report. - */ + * Add file to attached files with each report being sent. + * A new copy of the file at fileURL will be attached with each bug report being sent. The file is only copied + * at the time of sending the report, so you could safely call this API whenever the file is available on disk, and the copy + * attached to your bug reports will always contain that latest changes at the time of sending the report. + * + * Each call to this method adds the file to the files attached, until a maximum of 3 then it overrides the first file. + * The file has to be available locally at the provided path when the report is being sent. + * @param {string} stringURL Path to a file that's going to be attached to each report. + */ // addFileAttachment: function(stringURL) { // if (Platform.OS == 'ios') { - // Instabug.addFileAttachment(stringURL); + // Instabug.addFileAttachment(stringURL); // } // }, /** - * Clear list of files to be attached with each report. - * This method doesn't delete any files from the file system. It will just removes them for the list of files - * to be attached with each report. - */ - + * Clear list of files to be attached with each report. + * This method doesn't delete any files from the file system. It will just removes them for the list of files + * to be attached with each report. + */ + // clearFileAttachments: function() { // if (Platform.OS == 'ios') { - // Instabug.clearFileAttachments(); + // Instabug.clearFileAttachments(); // } // }, /** - * Shows/Hides email field. - * Defaults to show email field. - * @param {boolean} shouldShowEmailField true to show the email field, false to hide it. - */ - setShowEmailField: function(shouldShowEmailField) { + * Shows/Hides email field. + * Defaults to show email field. + * @param {boolean} shouldShowEmailField true to show the email field, false to hide it. + */ + setShowEmailField: function (shouldShowEmailField) { if (Platform.OS == 'ios') { - Instabug.setShowEmailField(); + Instabug.setShowEmailField(); } }, /** - * Sets the default value of the user's email and hides the email field from the reporting UI - * and set the user's name to be included with all reports. - * It also reset the chats on device to that email and removes user attributes, user data and completed surveys. - * @param {string} email Email address to be set as the user's email. - * @param {string} name Name of the user to be set. - */ - identifyUserWithEmail: function(email, name) { + * Sets the default value of the user's email and hides the email field from the reporting UI + * and set the user's name to be included with all reports. + * It also reset the chats on device to that email and removes user attributes, user data and completed surveys. + * @param {string} email Email address to be set as the user's email. + * @param {string} name Name of the user to be set. + */ + identifyUserWithEmail: function (email, name) { if (Platform.OS == 'ios') { - Instabug.identifyUserWithEmail(email, name); + Instabug.identifyUserWithEmail(email, name); } }, /** - * Sets the default value of the user's email to nil and show email field and remove user name from all reports - * It also reset the chats on device and removes user attributes, user data and completed surveys. - */ - logOut: function() { + * Sets the default value of the user's email to nil and show email field and remove user name from all reports + * It also reset the chats on device and removes user attributes, user data and completed surveys. + */ + logOut: function () { if (Platform.OS == 'ios') { - Instabug.logOut(); + Instabug.logOut(); } }, /** - * Sets whether to show a "Thank You" dialog after a bug report is sent or not. - * Defaults to YES. - * @param {boolean} isPostSendingDialogEnabled A boolean to indicate whether the dialog is enabled or not. - */ - setPostSendingDialogEnabled: function(isPostSendingDialogEnabled) { + * Sets whether to show a "Thank You" dialog after a bug report is sent or not. + * Defaults to YES. + * @param {boolean} isPostSendingDialogEnabled A boolean to indicate whether the dialog is enabled or not. + */ + setPostSendingDialogEnabled: function (isPostSendingDialogEnabled) { if (Platform.OS == 'ios') { - Instabug.setPostSendingDialogEnabled(isPostSendingDialogEnabled); + Instabug.setPostSendingDialogEnabled(isPostSendingDialogEnabled); } }, /** - * Sets an array of report categories to be shown for users to select from before reporting a bug or sending - * feedback. - * Use this method to give users a list of choices of categories their bug report or feedback might be related - * to. Selected category will be shown as a tag on your dashboard. - * @param {array} titles titles to be shown in the list. - * @param {array} name names of icons to be shown along with titles. Use the same names you would use - */ - setReportCategories: function(titles, names) { + * Sets an array of report categories to be shown for users to select from before reporting a bug or sending + * feedback. + * Use this method to give users a list of choices of categories their bug report or feedback might be related + * to. Selected category will be shown as a tag on your dashboard. + * @param {array} titles titles to be shown in the list. + * @param {array} name names of icons to be shown along with titles. Use the same names you would use + */ + setReportCategories: function (titles, names) { if (Platform.OS == 'ios') { - Instabug.setReportCategories(titles, names); + Instabug.setReportCategories(titles, names); } }, /** - * Enables/disables inspect view hierarchy when reporting a bug/feedback. - * @param {boolean} viewHierarchyEnabled A boolean to set whether view hierarchy are enabled or disabled. - */ - setViewHierarchyEnabled: function(viewHierarchyEnabled) { + * Enables/disables inspect view hierarchy when reporting a bug/feedback. + * @param {boolean} viewHierarchyEnabled A boolean to set whether view hierarchy are enabled or disabled. + */ + setViewHierarchyEnabled: function (viewHierarchyEnabled) { if (Platform.OS == 'ios') { - Instabug.setViewHierarchyEnabled(viewHierarchyEnabled); + Instabug.setViewHierarchyEnabled(viewHierarchyEnabled); } }, /** - * Logs a user event that happens through the lifecycle of the application. - * Logged user events are going to be sent with each report, as well as at the end of a session. - * @param {string} name Event name. - */ - logUserEventWithName: function(name) { + * Logs a user event that happens through the lifecycle of the application. + * Logged user events are going to be sent with each report, as well as at the end of a session. + * @param {string} name Event name. + */ + logUserEventWithName: function (name) { if (Platform.OS == 'ios') { - Instabug.logUserEventWithName(name); + Instabug.logUserEventWithName(name); } }, /** - * Logs a user event that happens through the lifecycle of the application. - * Logged user events are going to be sent with each report, as well as at the end of a session. - * @param {string} name Event name. - * @param {Object} params An optional dictionary or parameters to be associated with the event. - */ - logUserEventWithNameAndParams: function(name, params) { + * Logs a user event that happens through the lifecycle of the application. + * Logged user events are going to be sent with each report, as well as at the end of a session. + * @param {string} name Event name. + * @param {Object} params An optional dictionary or parameters to be associated with the event. + */ + logUserEventWithNameAndParams: function (name, params) { if (Platform.OS == 'ios') { - Instabug.logUserEventWithNameAndParams(name, params); + Instabug.logUserEventWithNameAndParams(name, params); } }, @@ -650,7 +654,7 @@ module.exports = { * * @param message the message */ - logVerbose: function(message){ + logVerbose: function (message) { if (!message)return; if (Platform.OS === 'android') { Instabug.log("v", message); @@ -672,7 +676,7 @@ module.exports = { * * @param message the message */ - logInfo: function(message){ + logInfo: function (message) { if (!message)return; if (Platform.OS === 'android') { Instabug.log("i", message); @@ -694,7 +698,7 @@ module.exports = { * * @param message the message */ - logDebug: function(message){ + logDebug: function (message) { if (!message)return; if (Platform.OS === 'android') { Instabug.log("d", message); @@ -716,7 +720,7 @@ module.exports = { * * @param message the message */ - logError: function(message){ + logError: function (message) { if (!message)return; if (Platform.OS === 'android') { Instabug.log("e", message); @@ -738,7 +742,7 @@ module.exports = { * * @param message the message */ - logWarn: function(message){ + logWarn: function (message) { if (!message)return; if (Platform.OS === 'android') { Instabug.log("w", message); @@ -771,7 +775,7 @@ module.exports = { * Clears Instabug internal log * */ - clearLogs: function(){ + clearLogs: function () { if (Platform.OS === 'android') { Instabug.clearLogs(); } @@ -783,7 +787,7 @@ module.exports = { * @param key the attribute * @param value the value */ - setUserAttribute: function(key, value){ + setUserAttribute: function (key, value) { if (!key || !value || typeof key !== "string" || typeof value !== "string") throw new TypeError("Invalid param, Expected String"); if (Platform.OS === 'android') { @@ -799,11 +803,11 @@ module.exports = { /** * Returns the user attribute associated with a given key. - aKey + aKey * @param {string} key The attribute key as string - * @param {userAttributeCallback} userAttributeCallback callback with argument as the desired user attribute value + * @param {userAttributeCallback} userAttributeCallback callback with argument as the desired user attribute value */ - getUserAttribute: function(key, userAttributeCallback){ + getUserAttribute: function (key, userAttributeCallback) { if (Platform.OS === 'ios') { return Instabug.getUserAttribute(key, userAttributeCallback); } @@ -815,7 +819,7 @@ module.exports = { * @param key the attribute key as string * @see #setUserAttribute(String, String) */ - removeUserAttribute: function(key){ + removeUserAttribute: function (key) { if (!key || typeof key !== "string") throw new TypeError("Invalid param, Expected String"); if (Platform.OS === 'android') { @@ -834,7 +838,7 @@ module.exports = { * @param {userAttributesCallback} userAttributesCallback callback with argument A new dictionary containing all the currently set user attributes, * or an empty dictionary if no user attributes have been set. */ - getAllUserAttributes: function(userAttributesCallback){ + getAllUserAttributes: function (userAttributesCallback) { if (Platform.OS === 'ios') { return Instabug.getAllUserAttributes(userAttributesCallback); } @@ -843,7 +847,7 @@ module.exports = { /** * Clears all user attributes if exists. */ - clearAllUserAttributes: function(){ + clearAllUserAttributes: function () { if (Platform.OS === 'android') { Instabug.clearAllUserAttributes(); }