Privacy and Report fields

You can use both pre and postprocessing for report fields. This is useful when you want to strip any sensitive data user may enter into it or when you want to apply some specific formatting.

The principle is simple, for every generated report, Bugsee will call the corresponding method from provided ReportFieldsFilter object. You should then perform all the required fields manipulations and call listener.onChanged(reportFields) to pass it back to Bugsee. listener.onChanged(reportFields) can be called in other thread than calling thread.

!Java

Bugsee.setReportFieldsFilter(new ReportFieldsFilter() {
    @Override
    public void addFieldsBeforeReportCreated(ReportFields reportFields, OnChangeReportFieldsListener listener) {
        reportFields.setSummary("Before: " + reportFields.getSummary());
        reportFields.setDescription("Before: " + reportFields.getDescription());
        ArrayList labels = reportFields.getLabels();
        labels.add("before");
        reportFields.setLabels(labels);
        reportFields.setSeverity(IssueSeverity.VeryLow);
        listener.onChanged(reportFields);
    }

    @Override
    public void changeFieldsAfterReportCreated(ReportFields reportFields, OnChangeReportFieldsListener listener) {
        reportFields.setSummary(reportFields.getSummary() + " :After");
        reportFields.setDescription(reportFields.getDescription() + " :After");
        ArrayList labels = reportFields.getLabels();
        labels.add("after");
        reportFields.setLabels(labels);
        reportFields.setSeverity(IssueSeverity.Blocker);
        listener.onChanged(reportFields);
    }
});

!Kotlin

Bugsee.setReportFieldsFilter(object : ReportFieldsFilter {
    override fun addFieldsBeforeReportCreated(
        reportFields: ReportFields,
        listener: OnChangeReportFieldsListener
    ) {
        reportFields.summary = "Begin:" + reportFields.summary
        reportFields.description = "Begin:" + reportFields.description
        val labels: ArrayList<String> = reportFields.labels
        labels.add("begin")
        reportFields.labels = labels
        reportFields.severity = IssueSeverity.VeryLow
        listener.onChanged(reportFields)
    }

    override fun changeFieldsAfterReportCreated(
        reportFields: ReportFields,
        listener: OnChangeReportFieldsListener
    ) {
        reportFields.summary = reportFields.summary + ":After"
        reportFields.description = reportFields.description + ":After"
        val labels: ArrayList<String> = reportFields.labels
        labels.add("after")
        reportFields.labels = labels
        reportFields.severity = IssueSeverity.Blocker
        listener.onChanged(reportFields)
    }
})