Skip to content

Commit

Permalink
Update feedback_sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
ueman committed Nov 13, 2024
1 parent f0962a6 commit 7893889
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
5 changes: 5 additions & 0 deletions feedback_sentry/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.1.0

* Require `sentry ^8.10.0`
* Start using Sentry's user feedback feature

## 3.0.1

* Add compatibility with Sentry v8
Expand Down
35 changes: 21 additions & 14 deletions feedback_sentry/lib/feedback_sentry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export 'package:feedback/feedback.dart';

/// Extension on [FeedbackController] in order to make
/// it easier to call [showAndUploadToSentry].
extension SentryFeedback on FeedbackController {
extension SentryFeedbackX on FeedbackController {
/// This method opens the feedback ui and the users feedback
/// is uploaded to Sentry after the user submitted his feedback.
/// [name] and [email] are optional. They are shown in the Sentry.io ui.s
Expand All @@ -26,6 +26,10 @@ extension SentryFeedback on FeedbackController {
/// This method opens the feedback ui and the users feedback
/// is uploaded to Sentry after the user submitted his feedback.
/// [name] and [email] are optional. They are shown in the Sentry.io ui.s
@Deprecated(
'Sentry marked the underlying APIs for this method as deprecated. '
'Unfortunately, there is no replacement.',
)
void showAndUploadToSentryWithException({
Hub? hub,
String? name,
Expand Down Expand Up @@ -54,19 +58,21 @@ OnFeedbackCallback sendToSentry({
final realHub = hub ?? HubAdapter();

return (UserFeedback feedback) async {
final id = await realHub.captureMessage(feedback.text, withScope: (scope) {
scope.addAttachment(SentryAttachment.fromUint8List(
feedback.screenshot,
'screenshot.png',
contentType: 'image/png',
));
});
await realHub.captureUserFeedback(SentryUserFeedback(
eventId: id,
email: email,
name: name,
comments: feedback.text + '\n${feedback.extra.toString()}',
));
await realHub.captureFeedback(
SentryFeedback(
contactEmail: email,
name: name,
message: feedback.text,
unknown: feedback.extra,
),
hint: Hint.withScreenshot(
SentryAttachment.fromUint8List(
feedback.screenshot,
'screenshot.png',
contentType: 'image/png',
),
),
);
};
}

Expand Down Expand Up @@ -94,6 +100,7 @@ OnFeedbackCallback sendToSentryWithException({
));
},
);
// ignore: deprecated_member_use
await realHub.captureUserFeedback(SentryUserFeedback(
eventId: id,
email: email,
Expand Down
4 changes: 2 additions & 2 deletions feedback_sentry/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: feedback_sentry
description: A Flutter package for getting better feedback. It allows the user to give interactive feedback directly in the app and upload it to Sentry.io
version: 3.0.1
version: 3.1.0
homepage: https://uekoetter.dev
repository: https://github.com/ueman/feedback
issue_tracker: https://github.com/ueman/feedback/issues
Expand All @@ -16,7 +16,7 @@ dependencies:
flutter:
sdk: flutter
feedback: ^3.0.0
sentry: '>=7.0.0 <9.0.0'
sentry: ^8.10.0

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 7893889

Please sign in to comment.