Skip to content

Commit fbdfe4b

Browse files
feat: add proactive bug reporting
1 parent dffe0fb commit fbdfe4b

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

lib/src/models/proactive_reporting_config.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class ProactiveReportingConfigsBuilder {
2929
/// Controls the time gap between showing 2 proactive reporting dialogs in seconds
3030
ProactiveReportingConfigsBuilder setGapBetweenModals(int gap) {
3131
if (gap <= 0) {
32-
_logWarning('gapBetweenModals must be a positive number. Using default value of 30 seconds.');
32+
_logWarning(
33+
'gapBetweenModals must be a positive number. Using default value of 30 seconds.');
3334
return this;
3435
}
3536
gapBetweenModals = gap;
@@ -39,7 +40,8 @@ class ProactiveReportingConfigsBuilder {
3940
/// Controls the time gap between detecting a frustrating experience
4041
ProactiveReportingConfigsBuilder setModalDelayAfterDetection(int delay) {
4142
if (delay <= 0) {
42-
_logWarning('modalDelayAfterDetection must be a positive number. Using default value of 15 seconds.');
43+
_logWarning(
44+
'modalDelayAfterDetection must be a positive number. Using default value of 15 seconds.');
4345
return this;
4446
}
4547
modalDelayAfterDetection = delay;

lib/src/modules/bug_reporting.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ class BugReporting implements BugReportingFlutterApi {
260260
/// prompts end users to submit their feedback after our SDK automatically detects a frustrating experience.
261261
/// [config] configuration of proActive bug report.
262262
static Future<void> setProactiveReportingConfigurations(
263-
ProactiveReportingConfigs config,) async {
263+
ProactiveReportingConfigs config,
264+
) async {
264265
_host.setProactiveReportingConfigurations(config.enabled,
265266
config.gapBetweenModals, config.modalDelayAfterDetection);
266267
}

pigeons/bug_reporting.api.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ abstract class BugReportingHostApi {
2828
void bindOnInvokeCallback();
2929
void bindOnDismissCallback();
3030
void setDisclaimerText(String text);
31-
void setCommentMinimumCharacterCount(int limit,
32-
List<String>? reportTypes,);
33-
void setProactiveReportingConfigurations(bool enabled, int gapBetweenModals,
34-
int modalDelayAfterDetection);
31+
void setCommentMinimumCharacterCount(
32+
int limit,
33+
List<String>? reportTypes,
34+
);
35+
void setProactiveReportingConfigurations(
36+
bool enabled, int gapBetweenModals, int modalDelayAfterDetection);
3537
}

test/bug_reporting_test.dart

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void main() {
100100

101101
test(
102102
'[setVideoRecordingFloatingButtonPosition] should call host method',
103-
() async {
103+
() async {
104104
const position = Position.topLeft;
105105

106106
await BugReporting.setVideoRecordingFloatingButtonPosition(position);
@@ -202,17 +202,14 @@ void main() {
202202
});
203203

204204
test('[setProactiveReportingConfigurations] should call host method',
205-
() async {
206-
await BugReporting.setProactiveReportingConfigurations(
207-
ProactiveReportingConfigsBuilder()
208-
.setGapBetweenModals(1)
209-
.setModalDelayAfterDetection(1)
210-
.isEnabled(true)
211-
.build());
212-
213-
verify(
214-
mHost.setProactiveReportingConfigurations(
215-
true, 1, 1
216-
)).called(1);
217-
});
205+
() async {
206+
await BugReporting.setProactiveReportingConfigurations(
207+
ProactiveReportingConfigsBuilder()
208+
.setGapBetweenModals(1)
209+
.setModalDelayAfterDetection(1)
210+
.isEnabled(true)
211+
.build());
212+
213+
verify(mHost.setProactiveReportingConfigurations(true, 1, 1)).called(1);
214+
});
218215
}

0 commit comments

Comments
 (0)