Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* Bumps Instabug Android SDK to `v11.8.0`
* Bumps Instabug iOS SDK to `v11.7.0`
* Adds `BugReporting.setDisclaimerText` API
* Adds `BugReporting.setCommentMinimumCharacterCount` API
* Adds support for more locales:
* czech
* finnish
Expand Down
33 changes: 33 additions & 0 deletions src/android/IBGPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,39 @@ public void setVideoRecordingFloatingButtonPosition(final CallbackContext callba
}
}

/**
* Adds a disclaimer text within the bug reporting form, which can include hyperlinked text.
* @param callbackContext Used when calling back into JavaScript
* @param args [text: String]
*/
public void setDisclaimerText(final CallbackContext callbackContext, JSONArray args) {
final String text = args.optString(0);
try {
BugReporting.setDisclaimerText(text);

callbackContext.success();
} catch (Exception e) {
callbackContext.error(e.getMessage());
}
}

/**
* Sets a minimum number of characters as a requirement for the comments field in the different report types.
* @param callbackContext Used when calling back into JavaScript
* @param args [limit: int, reportTypes: reportTypes[]]
*/
public void setCommentMinimumCharacterCount(final CallbackContext callbackContext, JSONArray args) {
final int limit = args.optInt(0);
final JSONArray reportTypes = args.optJSONArray(1);
final String[] stringArrayOfReportTypes = toStringArray(reportTypes);
try {
int [] parsedReportTypes = stringArrayOfReportTypes == null ? new int[0] : Util.parseReportTypes(stringArrayOfReportTypes);
BugReporting.setCommentMinimumCharacterCount(limit, parsedReportTypes);
} catch (Exception e) {
callbackContext.error(e.getMessage());
}
}

/**
* Customize the attachment options available to users to send with a bug reeport.
*
Expand Down
43 changes: 43 additions & 0 deletions src/ios/IBGPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,49 @@ - (void) setVideoRecordingFloatingButtonPosition:(CDVInvokedUrlCommand*)command
callbackId:[command callbackId]];
}

/**
* Adds a disclaimer text within the bug reporting form, which can include hyperlinked text.
* @param {CDVInvokedUrlCommand*} command
* The command sent from JavaScript
*/
- (void)setDisclaimerText:(CDVInvokedUrlCommand*)command
{
NSString* text = [command argumentAtIndex:0];

[IBGBugReporting setDisclaimerText:text];

[self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK]
callbackId:[command callbackId]];
}

/**
* Sets a minimum number of characters as a requirement for the comments field in the different report types.
* @param {CDVInvokedUrlCommand*} command
* The command sent from JavaScript
*/
- (void)setCommentMinimumCharacterCount:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* result;
NSNumber* limit = [command argumentAtIndex:0];
NSArray* reportTypes = [command argumentAtIndex:1];
IBGBugReportingReportType parsedTypes = 0;

if (![reportTypes count]) {
parsedTypes = ([self parseBugReportingReportType:@"bug"] | [self parseBugReportingReportType:@"feedback"] | [self parseBugReportingReportType:@"question"]);
}
else {
for (NSString* type in reportTypes) {
parsedTypes |= [self parseBugReportingReportType:type];
}
}

[IBGBugReporting setCommentMinimumCharacterCountForReportTypes:parsedTypes withLimit:limit.intValue];
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:result callbackId:[command callbackId]];

}


/**
* Attaches a new copy of this file with each bug report sent
* with a maximum size of 1 MB. Calling this method several
Expand Down
30 changes: 30 additions & 0 deletions src/modules/BugReporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,5 +286,35 @@ namespace BugReporting {
error
);
};

/**
* Adds a disclaimer text within the bug reporting form, which can include hyperlinked text.
* @param text a String of the disclaimer text.
* @param success callback on function success.
* @param error callback on function error.
*/
export const setDisclaimerText = (
text: string,
success?: () => void,
error?: (err: any) => void
) => {
exec("IBGPlugin", "setDisclaimerText", [text], success, error);
};

/**
* Sets a minimum number of characters as a requirement for the comments field in the different report types.
* @param limit an integer number of characters.
* @param reportTypes an optional an array of reportType. If it's not passed, the limit will apply to all report types.
* @param success callback on function success.
* @param error callback on function error.
*/
export const setCommentMinimumCharacterCount = (
limit: number,
reportTypes?: reportType[],
success?: () => void,
error?: (err: any) => void
) => {
exec("IBGPlugin", "setCommentMinimumCharacterCount", [limit, reportTypes], success, error);
};
}
export = BugReporting;