BuglifeDelegate

@protocol BuglifeDelegate <NSObject>

The BuglifeDelegate protocol provides a mechanism for your application to configure certain aspects of the Buglife reporter UI.

  • Buglife calls this method when the bug reporter is ready to accept attachments.

    You should use this method to add attachments. Within your method implementation, use Buglife.addAttachmentWithData(_:type:filename:) to add attachments, then call the completionHandler. You may both add attachments & call the completionHandler on any thread.

    Warning

    You only have a few seconds to add attachments & call the completionHandler. If the completionHandler isn’t called, the bug report submission process will continue regardless.

    Declaration

    Objective-C

    - (void)buglife:(nonnull Buglife *)buglife
        handleAttachmentRequestWithCompletionHandler:
            (nonnull void (^)(void))completionHandler;

    Swift

    optional func buglife(_ buglife: Buglife, handleAttachmentRequestWithCompletionHandler completionHandler: @escaping () -> Void)
  • Called when a user attempts to invoke the bug reporter UI. To prevent accidental invocations, the user is presented with a prompt before showing the full bug reporter UI. If this method is implemented by your application, the returned result is used as the title for the prompt. If the returned result is nil, the prompt does not display a title. If this method is not implemented, a default title is used.

    Declaration

    Objective-C

    - (nullable NSString *)buglife:(nonnull Buglife *)buglife
        titleForPromptWithInvocation:(LIFEInvocationOptions)invocation;

    Swift

    optional func buglife(_ buglife: Buglife, titleForPromptWithInvocation invocation: LIFEInvocationOptions = []) -> String?

    Parameters

    buglife

    The Buglife instance requesting the title.

    invocation

    The invocation type used to present the bug reporter UI.

  • Called when the bug report form has been completed by the user.

    If your application uses custom input fields, then this method gives your app an opportunity to examine values submitted for these fields by the user by inspecting the attributes parameter.

    Declaration

    Objective-C

    - (void)buglifeDidCompleteReportWithAttributes:
        (nonnull NSDictionary<NSString *, NSString *> *)attributes;

    Swift

    optional func buglifeDidCompleteReport(attributes: [String : String] = [:])

    Parameters

    attributes

    A dictionary of attributes submitted for a bug report, where the key is an attribute name (e.g. specified by your custom input field), and the dictionary value is the attribute’s corresponding value, as inputted by the user (or its default value). Custom attributes set programmatically may neeed to be cleared here.

  • Asks the delegate whether the Thank you dialog should be presented after a bug report is completed. Returning YES from this method will result in the default dialog being presented after report completion. Returning NO from this method will omit presenting any dialog. You can also use this to present your own custom completion dialog.

    Declaration

    Objective-C

    - (BOOL)buglifeWillPresentReportCompletedDialog:(nonnull Buglife *)buglife;

    Swift

    optional func buglifeWillPresentReportCompletedDialog(_ buglife: Buglife) -> Bool
  • Alert the delegate that the report was dismissed without sending the report.

    Declaration

    Objective-C

    - (void)buglife:(nonnull Buglife *)buglife
        userCanceledReportWithAttributes:
            (nonnull NSDictionary<NSString *, NSString *> *)attributes;

    Swift

    optional func buglife(_ buglife: Buglife, userCanceledReportWithAttributes attributes: [String : String] = [:])

    Parameters

    attributes

    A dictionary of attributes that would have been submitted for a bug report, where the key is an attribute name (e.g. spcified by your custom input field), and the dictionary value is the attribute’s corresponding value, as inputted by the user (or its default value). Custom attributes set programmatically may need to be cleared here.