Skip to content

Commit 36e99be

Browse files
Update setReportCategories API params
To accept one or more category as an array
1 parent 135b621 commit 36e99be

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -636,12 +636,13 @@ public void clearAllUserAttributes() {
636636
* @param reportCategories the report categories list which is a list of ReportCategory model
637637
*/
638638
@ReactMethod
639-
public void setReportCategories(String... categoriesTitles) {
639+
public void setReportCategories(ReadableArray categoriesTitles) {
640640
try {
641641
ArrayList<ReportCategory> bugCategories = new ArrayList<>();
642-
643-
for (String category : categoriesTitles) {
644-
bugCategories.add(ReportCategory.getInstance().withLabel(category));
642+
int size = categoriesTitles != null ? categoriesTitles.size() : 0;
643+
if (size == 0) return;
644+
for (int i = 0; i < size; i++) {
645+
bugCategories.add(ReportCategory.getInstance().withLabel(categoriesTitles.getString(i)));
645646
}
646647

647648
Instabug.setReportCategories(bugCategories);

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ module.exports = {
497497
* to. Selected category will be shown as a tag on your dashboard.
498498
* @param {array} titles titles to be shown in the list.
499499
*/
500-
setReportCategories: function (titles) {
500+
setReportCategories: function (... titles) {
501501
if (Platform.OS == 'ios') {
502502
Instabug.setReportCategories(titles, null);
503503
} else if (Platform.OS == 'android') {

0 commit comments

Comments
 (0)