Skip to content

Commit

Permalink
Merge branch 'main' into feat/js-sdk-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor committed Dec 23, 2024
2 parents d2a808c + 02661eb commit 7017668
Show file tree
Hide file tree
Showing 46 changed files with 942 additions and 663 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @krystofwoldrich @stefanosiano @buenaflor @martinhaintz
* @krystofwoldrich @stefanosiano @buenaflor
2 changes: 1 addition & 1 deletion .github/workflows/testflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # pin@v2.18.0
- run: xcodes select 15.0.1
- uses: ruby/setup-ruby@2a18b06812b0e15bb916e1df298d3e740422c47e # pin@v1.203.0
- uses: ruby/setup-ruby@401c19e14f474b54450cd3905bb8b86e2c8509cf # pin@v1.204.0
with:
ruby-version: '2.7.5'
bundler-cache: true
Expand Down
84 changes: 79 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,98 @@
# Changelog

## Unreleased
## 8.12.0

### Deprecate
### Deprecations

- Manual TTID ([#2477](https://github.com/getsentry/sentry-dart/pull/2477))

### Fixes

- Missing replay gestures on Android ([#2515](https://github.com/getsentry/sentry-dart/pull/2515))
- Replay mask sizing on scaling transform widget children ([#2520](https://github.com/getsentry/sentry-dart/pull/2520))
- Masking semi-transparent widgets ([#2472](https://github.com/getsentry/sentry-dart/pull/2472))
- Check `SentryTracer` type in TTFD tracker ([#2508](https://github.com/getsentry/sentry-dart/pull/2508))

### Features

- Replay: device orientation change support & improve video size fit on Android ([#2462](https://github.com/getsentry/sentry-dart/pull/2462))
- Support custom `Sentry.runZoneGuarded` zone creation ([#2088](https://github.com/getsentry/sentry-dart/pull/2088))
- Sentry will not create a custom zone anymore if it is started within a custom one.
- This fixes Zone miss-match errors when trying to initialize WidgetsBinding before Sentry on Flutter Web
- `Sentry.runZonedGuarded` creates a zone and also captures exceptions & breadcrumbs automatically.

```dart
Sentry.runZonedGuarded(() {
WidgetsBinding.ensureInitialized();
// Errors before init will not be handled by Sentry
SentryFlutter.init(
(options) {
...
},
appRunner: () => runApp(MyApp()),
);
} (error, stackTrace) {
// Automatically sends errors to Sentry, no need to do any
// captureException calls on your part.
// On top of that, you can do your own custom stuff in this callback.
});
```

- Warning (in a debug build) if a potentially sensitive widget is not masked or unmasked explicitly ([#2375](https://github.com/getsentry/sentry-dart/pull/2375))
- Replay: ensure visual update before capturing screenshots ([#2527](https://github.com/getsentry/sentry-dart/pull/2527))

### Dependencies

- Bump Native SDK from v0.7.15 to v0.7.17 ([#2465](https://github.com/getsentry/sentry-dart/pull/2465), [#2516](https://github.com/getsentry/sentry-dart/pull/2516))
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0717)
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.15...0.7.17)
- Bump Android SDK from v7.18.1 to v7.19.0 ([#2488](https://github.com/getsentry/sentry-dart/pull/2488))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7190)
- [diff](https://github.com/getsentry/sentry-java/compare/7.18.1...7.19.0)

## 8.12.0-beta.2

### Deprecations

- Manual TTID ([#2477](https://github.com/getsentry/sentry-dart/pull/2477))

### Fixes

- Missing replay gestures on Android ([#2515](https://github.com/getsentry/sentry-dart/pull/2515))
- Replay mask sizing on scaling transform widget children ([#2520](https://github.com/getsentry/sentry-dart/pull/2520))

### Enhancements

- Check `SentryTracer` type in TTFD tracker ([#2508](https://github.com/getsentry/sentry-dart/pull/2508))
- Warning (in a debug build) if a potentially sensitive widget is not masked or unmasked explicitly ([#2375](https://github.com/getsentry/sentry-dart/pull/2375))
- Replay: ensure visual update before capturing screenshots ([#2527](https://github.com/getsentry/sentry-dart/pull/2527))

### Dependencies

- Bump Native SDK from v0.7.15 to v0.7.16 ([#2465](https://github.com/getsentry/sentry-dart/pull/2465))
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0716)
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.15...0.7.16)
- Bump Native SDK from v0.7.15 to v0.7.17 ([#2465](https://github.com/getsentry/sentry-dart/pull/2465), [#2516](https://github.com/getsentry/sentry-dart/pull/2516))
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0717)
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.15...0.7.17)
- Bump Android SDK from v7.18.1 to v7.19.0 ([#2488](https://github.com/getsentry/sentry-dart/pull/2488))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7190)
- [diff](https://github.com/getsentry/sentry-java/compare/7.18.1...7.19.0)

## 8.11.2

### Changes

- Windows & Linux native crash handlers: add `SENTRY_NATIVE_BACKEND` env var with default setting of `none`. ([#2522](https://github.com/getsentry/sentry-dart/pull/2522))
Native crash reporting support with `sentry-native`'s `crashpad` was added in v8.11.0 and has caused build-time issues
for some users, because it required newer build tools (newer versions of MSVC/Clang/GCC) than base Flutter SDK.
This broke the ability to build the app for some users compiling Windows and Linux apps with older toolchains.

To avoid this issue, we're disabling the native crash handling by default for Linux and Windows for now.
You can enable it manually by setting the `SENTRY_NATIVE_BACKEND=crashpad` environment variable before running `flutter build`.
You can read more about available backends that fit your use-case in [sentry-native docs](https://docs.sentry.io/platforms/native/configuration/backends/).

We plan to change the default back to `crashpad` in the next major SDK release.

## 8.11.1

### Improvements
Expand Down
2 changes: 1 addition & 1 deletion dart/lib/src/version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
library version;

/// The SDK version reported to Sentry.io in the submitted events.
const String sdkVersion = '8.12.0-beta.1';
const String sdkVersion = '8.12.0-beta.2';

String sdkName(bool isWeb) => isWeb ? _browserSdkName : _ioSdkName;

Expand Down
2 changes: 1 addition & 1 deletion dart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sentry
version: 8.12.0-beta.1
version: 8.12.0-beta.2
description: >
A crash reporting library for Dart that sends crash reports to Sentry.io.
This library supports Dart VM and Web. For Flutter consider sentry_flutter instead.
Expand Down
2 changes: 1 addition & 1 deletion dio/lib/src/version.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// The SDK version reported to Sentry.io in the submitted events.
const String sdkVersion = '8.12.0-beta.1';
const String sdkVersion = '8.12.0-beta.2';

/// The package name reported to Sentry.io in the submitted events.
const String packageName = 'pub:sentry_dio';
4 changes: 2 additions & 2 deletions dio/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sentry_dio
description: An integration which adds support for performance tracing for the Dio package.
version: 8.12.0-beta.1
version: 8.12.0-beta.2
homepage: https://docs.sentry.io/platforms/dart/
repository: https://github.com/getsentry/sentry-dart
issue_tracker: https://github.com/getsentry/sentry-dart/issues
Expand All @@ -19,7 +19,7 @@ platforms:

dependencies:
dio: ^5.0.0
sentry: 8.12.0-beta.1
sentry: 8.12.0-beta.2

dev_dependencies:
meta: ^1.3.0
Expand Down
2 changes: 1 addition & 1 deletion drift/lib/src/version.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// The SDK version reported to Sentry.io in the submitted events.
const String sdkVersion = '8.12.0-beta.1';
const String sdkVersion = '8.12.0-beta.2';

/// The package name reported to Sentry.io in the submitted events.
const String packageName = 'pub:sentry_drift';
4 changes: 2 additions & 2 deletions drift/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sentry_drift
description: An integration which adds support for performance tracing for the drift package.
version: 8.12.0-beta.1
version: 8.12.0-beta.2
homepage: https://docs.sentry.io/platforms/flutter/
repository: https://github.com/getsentry/sentry-dart
issue_tracker: https://github.com/getsentry/sentry-dart/issues
Expand All @@ -17,7 +17,7 @@ platforms:
web:

dependencies:
sentry: 8.12.0-beta.1
sentry: 8.12.0-beta.2
meta: ^1.3.0
drift: ^2.13.0

Expand Down
2 changes: 1 addition & 1 deletion file/lib/src/version.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// The SDK version reported to Sentry.io in the submitted events.
const String sdkVersion = '8.12.0-beta.1';
const String sdkVersion = '8.12.0-beta.2';

/// The package name reported to Sentry.io in the submitted events.
const String packageName = 'pub:sentry_file';
4 changes: 2 additions & 2 deletions file/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sentry_file
description: An integration which adds support for performance tracing for dart.io.File.
version: 8.12.0-beta.1
version: 8.12.0-beta.2
homepage: https://docs.sentry.io/platforms/dart/
repository: https://github.com/getsentry/sentry-dart
issue_tracker: https://github.com/getsentry/sentry-dart/issues
Expand All @@ -17,7 +17,7 @@ platforms:
windows:

dependencies:
sentry: 8.12.0-beta.1
sentry: 8.12.0-beta.2
meta: ^1.3.0

dev_dependencies:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ package io.sentry.flutter
import android.app.Activity
import android.content.Context
import android.content.res.Configuration
import android.graphics.Point
import android.graphics.Rect
import android.os.Build
import android.os.Build.VERSION
import android.os.Build.VERSION_CODES
import android.os.Looper
import android.util.Log
import android.view.WindowManager
import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.embedding.engine.plugins.activity.ActivityAware
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding
Expand Down Expand Up @@ -638,12 +643,23 @@ class SentryFlutterPlugin :
height = newHeight
}

val wm = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
val screenBounds =
if (VERSION.SDK_INT >= VERSION_CODES.R) {
wm.currentWindowMetrics.bounds
} else {
val screenBounds = Point()
@Suppress("DEPRECATION")
wm.defaultDisplay.getRealSize(screenBounds)
Rect(0, 0, screenBounds.x, screenBounds.y)
}

replayConfig =
ScreenshotRecorderConfig(
recordingWidth = width.roundToInt(),
recordingHeight = height.roundToInt(),
scaleFactorX = 1.0f,
scaleFactorY = 1.0f,
scaleFactorX = width.toFloat() / screenBounds.width().toFloat(),
scaleFactorY = height.toFloat() / screenBounds.height().toFloat(),
frameRate = call.argument("frameRate") as? Int ?: 0,
bitRate = call.argument("bitRate") as? Int ?: 0,
)
Expand Down
2 changes: 1 addition & 1 deletion flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: sentry_flutter_example
description: Demonstrates how to use the sentry_flutter plugin.
version: 8.12.0-beta.1
version: 8.12.0-beta.2

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

Expand Down
2 changes: 1 addition & 1 deletion flutter/ios/sentry_flutter.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Sentry SDK for Flutter with support to native through sentry-cocoa.
:tag => s.version.to_s }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Sentry/HybridSDK', '8.41.0'
s.dependency 'Sentry/HybridSDK', '8.42.0'
s.ios.dependency 'Flutter'
s.osx.dependency 'FlutterMacOS'
s.ios.deployment_target = '12.0'
Expand Down
17 changes: 5 additions & 12 deletions flutter/lib/src/event_processor/screenshot_event_processor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class ScreenshotEventProcessor implements EventProcessor {
height: targetResolution,
),
_options,
isReplayRecorder: false,
);
_debouncer = Debouncer(
// ignore: invalid_use_of_internal_member
Expand Down Expand Up @@ -126,18 +125,12 @@ class ScreenshotEventProcessor implements EventProcessor {
}

@internal
Future<Uint8List?> createScreenshot() async {
Uint8List? screenshotData;
Future<Uint8List?> createScreenshot() =>
_recorder.capture(_convertImageToUint8List);

await _recorder.capture((Image image) async {
screenshotData = await _convertImageToUint8List(image);
});

return screenshotData;
}

Future<Uint8List?> _convertImageToUint8List(Image image) async {
final byteData = await image.toByteData(format: ImageByteFormat.png);
Future<Uint8List?> _convertImageToUint8List(Screenshot screenshot) async {
final byteData =
await screenshot.image.toByteData(format: ImageByteFormat.png);

final bytes = byteData?.buffer.asUint8List();
if (bytes?.isNotEmpty == true) {
Expand Down
Loading

0 comments on commit 7017668

Please sign in to comment.