Skip to content

Commit

Permalink
Merge pull request #2212 from acterglobal/ben-minor-ensure-bug-report…
Browse files Browse the repository at this point in the history
…er-only-open-once

Ensure bug reporter only open once
  • Loading branch information
gnunicorn authored Oct 2, 2024
2 parents 5bb00be + 3e72f15 commit 333c0e9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
44 changes: 24 additions & 20 deletions app/lib/features/bug_report/actions/open_bug_report.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,29 @@ Future<void> openBugReport(
if (_bugReportOpen) {
return;
}
queryParams = queryParams ?? {};
final cacheDir = await appCacheDir();
// rage shake disallows dot in filename
final timestamp = DateTime.now().timestamp;
final imagePath = await screenshotController.captureAndSave(
cacheDir,
fileName: 'screenshot_$timestamp.png',
);
if (imagePath != null) {
queryParams['screenshot'] = imagePath;
}
if (!context.mounted) {
_log.warning('Trying to open the bugreport without being mounted');
return;
}
_bugReportOpen = true;
await context.pushNamed(
Routes.bugReport.name,
queryParameters: queryParams,
);
_bugReportOpen = false;
try {
queryParams = queryParams ?? {};
final cacheDir = await appCacheDir();
// rage shake disallows dot in filename
final timestamp = DateTime.now().timestamp;
final imagePath = await screenshotController.captureAndSave(
cacheDir,
fileName: 'screenshot_$timestamp.png',
);
if (imagePath != null) {
queryParams['screenshot'] = imagePath;
}
if (!context.mounted) {
_log.warning('Trying to open the bugreport without being mounted');
return;
}
_bugReportOpen = true;
await context.pushNamed(
Routes.bugReport.name,
queryParameters: queryParams,
);
} finally {
_bugReportOpen = false;
}
}
4 changes: 2 additions & 2 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2658,10 +2658,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev"
source: hosted
version: "14.2.4"
version: "14.2.5"
volume_controller:
dependency: transitive
description:
Expand Down

0 comments on commit 333c0e9

Please sign in to comment.