Bug Reporting Callbacks
Covered here are event handlers that you can use to have a block of code executed when a certain action is triggered for your iOS apps.
Before Invoking Luciq
This block is executed on the UI thread. You can use it to perform any UI changes before the SDK's UI is shown.
BugReporting.willInvokeHandler = {
someObject.setSomeState()
}LCQBugReporting.willInvokeHandler = ^{
[someObject setSomeState];
};Before Sending a Report
By default, no pre-sending handler is registered. In Luciq iOS SDK 19.12.0 and later, use onBeforeSendingEventHandler to add tags, user attributes, user data, and file attachments before a report is sent. Changes to the event apply only to that report.
Register the handler after starting Luciq. It runs in the background; keep your work brief. Call completion(event) once when you finish modifying the event. Do not dispatch the completion block to the main queue.
Luciq.onBeforeSendingEventHandler = { event, completion in
event.append(tags: ["checkout"])
event.append(userAttributes: ["subscription": "premium"])
event.set(userData: "Checkout context")
let data = Data("Report context".utf8)
event.addFileAttachment(data: data, fileName: "context.txt")
completion(event)
}Luciq.onBeforeSendingEventHandler = ^(LCQEvent *event, void (^completion)(LCQEvent * _Nullable)) {
[event appendTags:@[@"checkout"]];
[event appendUserAttributes:@{@"subscription": @"premium"}];
[event setUserData:@"Checkout context"];
NSData *data = [@"Report context" dataUsingEncoding:NSUTF8StringEncoding];
[event addFileAttachmentWithData:data fileName:@"context.txt"];
completion(event);
};The new handler receives an Event in Swift (LCQEvent in Objective-C). Use the event methods shown above for report data; the legacy report logging methods are not available on the event.
Use only one pre-sending API. Setting either onBeforeSendingEventHandler or willSendReportHandler replaces the other handler; setting either property to nil clears the registered handler.
After Dismissing Luciq
This block is executed on the UI thread. You can use it to perform any UI changes after the SDK's UI has been dismissed.
The didDismissHandler block has the following parameters:
LCQDismissType
Returns how the SDK was dismissed. It can be set to one of the three following possibilities:
LCQReportCategory
The type of report that was sent. If the SDK was dismissed without selecting a report type, it will be set to LCQReportCategoryBug, so you might need to check issueState before LCQReportCategory. The possible different types are below:
Last updated