Skip to content

Commit e3be01e

Browse files
Fix getUnreadMessagesCount API params
1 parent a31d649 commit e3be01e

File tree

1 file changed

+86
-82
lines changed

1 file changed

+86
-82
lines changed

index.js

Lines changed: 86 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,11 @@ module.exports = {
237237
* Notifications count, or -1 incase the SDK has not been initialized.
238238
*/
239239
getUnreadMessagesCount: function (messageCountCallback) {
240-
Instabug.getUnreadMessagesCount(messageCountCallback);
240+
if (Platform.OS === 'ios') {
241+
Instabug.getUnreadMessagesCount(messageCountCallback);
242+
} else if (Platform.OS === 'android') {
243+
Instabug.getUnreadMessagesCount();
244+
}
241245
},
242246

243247
/**
@@ -517,123 +521,123 @@ module.exports = {
517521
},
518522

519523
/**
520-
* Add file to attached files with each report being sent.
521-
* A new copy of the file at fileURL will be attached with each bug report being sent. The file is only copied
522-
* at the time of sending the report, so you could safely call this API whenever the file is available on disk, and the copy
523-
* attached to your bug reports will always contain that latest changes at the time of sending the report.
524-
*
525-
* Each call to this method adds the file to the files attached, until a maximum of 3 then it overrides the first file.
526-
* The file has to be available locally at the provided path when the report is being sent.
527-
* @param {string} stringURL Path to a file that's going to be attached to each report.
528-
*/
524+
* Add file to attached files with each report being sent.
525+
* A new copy of the file at fileURL will be attached with each bug report being sent. The file is only copied
526+
* at the time of sending the report, so you could safely call this API whenever the file is available on disk, and the copy
527+
* attached to your bug reports will always contain that latest changes at the time of sending the report.
528+
*
529+
* Each call to this method adds the file to the files attached, until a maximum of 3 then it overrides the first file.
530+
* The file has to be available locally at the provided path when the report is being sent.
531+
* @param {string} stringURL Path to a file that's going to be attached to each report.
532+
*/
529533

530534
// addFileAttachment: function(stringURL) {
531535
// if (Platform.OS == 'ios') {
532-
// Instabug.addFileAttachment(stringURL);
536+
// Instabug.addFileAttachment(stringURL);
533537
// }
534538
// },
535539

536540
/**
537-
* Clear list of files to be attached with each report.
538-
* This method doesn't delete any files from the file system. It will just removes them for the list of files
539-
* to be attached with each report.
540-
*/
541-
541+
* Clear list of files to be attached with each report.
542+
* This method doesn't delete any files from the file system. It will just removes them for the list of files
543+
* to be attached with each report.
544+
*/
545+
542546
// clearFileAttachments: function() {
543547
// if (Platform.OS == 'ios') {
544-
// Instabug.clearFileAttachments();
548+
// Instabug.clearFileAttachments();
545549
// }
546550
// },
547551

548552
/**
549-
* Shows/Hides email field.
550-
* Defaults to show email field.
551-
* @param {boolean} shouldShowEmailField true to show the email field, false to hide it.
552-
*/
553-
setShowEmailField: function(shouldShowEmailField) {
553+
* Shows/Hides email field.
554+
* Defaults to show email field.
555+
* @param {boolean} shouldShowEmailField true to show the email field, false to hide it.
556+
*/
557+
setShowEmailField: function (shouldShowEmailField) {
554558
if (Platform.OS == 'ios') {
555-
Instabug.setShowEmailField();
559+
Instabug.setShowEmailField();
556560
}
557561
},
558562

559563
/**
560-
* Sets the default value of the user's email and hides the email field from the reporting UI
561-
* and set the user's name to be included with all reports.
562-
* It also reset the chats on device to that email and removes user attributes, user data and completed surveys.
563-
* @param {string} email Email address to be set as the user's email.
564-
* @param {string} name Name of the user to be set.
565-
*/
566-
identifyUserWithEmail: function(email, name) {
564+
* Sets the default value of the user's email and hides the email field from the reporting UI
565+
* and set the user's name to be included with all reports.
566+
* It also reset the chats on device to that email and removes user attributes, user data and completed surveys.
567+
* @param {string} email Email address to be set as the user's email.
568+
* @param {string} name Name of the user to be set.
569+
*/
570+
identifyUserWithEmail: function (email, name) {
567571
if (Platform.OS == 'ios') {
568-
Instabug.identifyUserWithEmail(email, name);
572+
Instabug.identifyUserWithEmail(email, name);
569573
}
570574
},
571575

572576
/**
573-
* Sets the default value of the user's email to nil and show email field and remove user name from all reports
574-
* It also reset the chats on device and removes user attributes, user data and completed surveys.
575-
*/
576-
logOut: function() {
577+
* Sets the default value of the user's email to nil and show email field and remove user name from all reports
578+
* It also reset the chats on device and removes user attributes, user data and completed surveys.
579+
*/
580+
logOut: function () {
577581
if (Platform.OS == 'ios') {
578-
Instabug.logOut();
582+
Instabug.logOut();
579583
}
580584
},
581585

582586
/**
583-
* Sets whether to show a "Thank You" dialog after a bug report is sent or not.
584-
* Defaults to YES.
585-
* @param {boolean} isPostSendingDialogEnabled A boolean to indicate whether the dialog is enabled or not.
586-
*/
587-
setPostSendingDialogEnabled: function(isPostSendingDialogEnabled) {
587+
* Sets whether to show a "Thank You" dialog after a bug report is sent or not.
588+
* Defaults to YES.
589+
* @param {boolean} isPostSendingDialogEnabled A boolean to indicate whether the dialog is enabled or not.
590+
*/
591+
setPostSendingDialogEnabled: function (isPostSendingDialogEnabled) {
588592
if (Platform.OS == 'ios') {
589-
Instabug.setPostSendingDialogEnabled(isPostSendingDialogEnabled);
593+
Instabug.setPostSendingDialogEnabled(isPostSendingDialogEnabled);
590594
}
591595
},
592596

593597
/**
594-
* Sets an array of report categories to be shown for users to select from before reporting a bug or sending
595-
* feedback.
596-
* Use this method to give users a list of choices of categories their bug report or feedback might be related
597-
* to. Selected category will be shown as a tag on your dashboard.
598-
* @param {array} titles titles to be shown in the list.
599-
* @param {array} name names of icons to be shown along with titles. Use the same names you would use
600-
*/
601-
setReportCategories: function(titles, names) {
598+
* Sets an array of report categories to be shown for users to select from before reporting a bug or sending
599+
* feedback.
600+
* Use this method to give users a list of choices of categories their bug report or feedback might be related
601+
* to. Selected category will be shown as a tag on your dashboard.
602+
* @param {array} titles titles to be shown in the list.
603+
* @param {array} name names of icons to be shown along with titles. Use the same names you would use
604+
*/
605+
setReportCategories: function (titles, names) {
602606
if (Platform.OS == 'ios') {
603-
Instabug.setReportCategories(titles, names);
607+
Instabug.setReportCategories(titles, names);
604608
}
605609
},
606610

607611
/**
608-
* Enables/disables inspect view hierarchy when reporting a bug/feedback.
609-
* @param {boolean} viewHierarchyEnabled A boolean to set whether view hierarchy are enabled or disabled.
610-
*/
611-
setViewHierarchyEnabled: function(viewHierarchyEnabled) {
612+
* Enables/disables inspect view hierarchy when reporting a bug/feedback.
613+
* @param {boolean} viewHierarchyEnabled A boolean to set whether view hierarchy are enabled or disabled.
614+
*/
615+
setViewHierarchyEnabled: function (viewHierarchyEnabled) {
612616
if (Platform.OS == 'ios') {
613-
Instabug.setViewHierarchyEnabled(viewHierarchyEnabled);
617+
Instabug.setViewHierarchyEnabled(viewHierarchyEnabled);
614618
}
615619
},
616620

617621
/**
618-
* Logs a user event that happens through the lifecycle of the application.
619-
* Logged user events are going to be sent with each report, as well as at the end of a session.
620-
* @param {string} name Event name.
621-
*/
622-
logUserEventWithName: function(name) {
622+
* Logs a user event that happens through the lifecycle of the application.
623+
* Logged user events are going to be sent with each report, as well as at the end of a session.
624+
* @param {string} name Event name.
625+
*/
626+
logUserEventWithName: function (name) {
623627
if (Platform.OS == 'ios') {
624-
Instabug.logUserEventWithName(name);
628+
Instabug.logUserEventWithName(name);
625629
}
626630
},
627631

628632
/**
629-
* Logs a user event that happens through the lifecycle of the application.
630-
* Logged user events are going to be sent with each report, as well as at the end of a session.
631-
* @param {string} name Event name.
632-
* @param {Object} params An optional dictionary or parameters to be associated with the event.
633-
*/
634-
logUserEventWithNameAndParams: function(name, params) {
633+
* Logs a user event that happens through the lifecycle of the application.
634+
* Logged user events are going to be sent with each report, as well as at the end of a session.
635+
* @param {string} name Event name.
636+
* @param {Object} params An optional dictionary or parameters to be associated with the event.
637+
*/
638+
logUserEventWithNameAndParams: function (name, params) {
635639
if (Platform.OS == 'ios') {
636-
Instabug.logUserEventWithNameAndParams(name, params);
640+
Instabug.logUserEventWithNameAndParams(name, params);
637641
}
638642
},
639643

@@ -650,7 +654,7 @@ module.exports = {
650654
*
651655
* @param message the message
652656
*/
653-
logVerbose: function(message){
657+
logVerbose: function (message) {
654658
if (!message)return;
655659
if (Platform.OS === 'android') {
656660
Instabug.log("v", message);
@@ -672,7 +676,7 @@ module.exports = {
672676
*
673677
* @param message the message
674678
*/
675-
logInfo: function(message){
679+
logInfo: function (message) {
676680
if (!message)return;
677681
if (Platform.OS === 'android') {
678682
Instabug.log("i", message);
@@ -694,7 +698,7 @@ module.exports = {
694698
*
695699
* @param message the message
696700
*/
697-
logDebug: function(message){
701+
logDebug: function (message) {
698702
if (!message)return;
699703
if (Platform.OS === 'android') {
700704
Instabug.log("d", message);
@@ -716,7 +720,7 @@ module.exports = {
716720
*
717721
* @param message the message
718722
*/
719-
logError: function(message){
723+
logError: function (message) {
720724
if (!message)return;
721725
if (Platform.OS === 'android') {
722726
Instabug.log("e", message);
@@ -738,7 +742,7 @@ module.exports = {
738742
*
739743
* @param message the message
740744
*/
741-
logWarn: function(message){
745+
logWarn: function (message) {
742746
if (!message)return;
743747
if (Platform.OS === 'android') {
744748
Instabug.log("w", message);
@@ -771,7 +775,7 @@ module.exports = {
771775
* Clears Instabug internal log
772776
*
773777
*/
774-
clearLogs: function(){
778+
clearLogs: function () {
775779
if (Platform.OS === 'android') {
776780
Instabug.clearLogs();
777781
}
@@ -783,7 +787,7 @@ module.exports = {
783787
* @param key the attribute
784788
* @param value the value
785789
*/
786-
setUserAttribute: function(key, value){
790+
setUserAttribute: function (key, value) {
787791
if (!key || !value || typeof key !== "string" || typeof value !== "string")
788792
throw new TypeError("Invalid param, Expected String");
789793
if (Platform.OS === 'android') {
@@ -799,11 +803,11 @@ module.exports = {
799803

800804
/**
801805
* Returns the user attribute associated with a given key.
802-
aKey
806+
aKey
803807
* @param {string} key The attribute key as string
804-
* @param {userAttributeCallback} userAttributeCallback callback with argument as the desired user attribute value
808+
* @param {userAttributeCallback} userAttributeCallback callback with argument as the desired user attribute value
805809
*/
806-
getUserAttribute: function(key, userAttributeCallback){
810+
getUserAttribute: function (key, userAttributeCallback) {
807811
if (Platform.OS === 'ios') {
808812
return Instabug.getUserAttribute(key, userAttributeCallback);
809813
}
@@ -815,7 +819,7 @@ module.exports = {
815819
* @param key the attribute key as string
816820
* @see #setUserAttribute(String, String)
817821
*/
818-
removeUserAttribute: function(key){
822+
removeUserAttribute: function (key) {
819823
if (!key || typeof key !== "string")
820824
throw new TypeError("Invalid param, Expected String");
821825
if (Platform.OS === 'android') {
@@ -834,7 +838,7 @@ module.exports = {
834838
* @param {userAttributesCallback} userAttributesCallback callback with argument A new dictionary containing all the currently set user attributes,
835839
* or an empty dictionary if no user attributes have been set.
836840
*/
837-
getAllUserAttributes: function(userAttributesCallback){
841+
getAllUserAttributes: function (userAttributesCallback) {
838842
if (Platform.OS === 'ios') {
839843
return Instabug.getAllUserAttributes(userAttributesCallback);
840844
}
@@ -843,7 +847,7 @@ module.exports = {
843847
/**
844848
* Clears all user attributes if exists.
845849
*/
846-
clearAllUserAttributes: function(){
850+
clearAllUserAttributes: function () {
847851
if (Platform.OS === 'android') {
848852
Instabug.clearAllUserAttributes();
849853
}

0 commit comments

Comments
 (0)