Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid dependency conflict with package_info_plus v4 #1440

Merged
merged 17 commits into from
May 15, 2023
2 changes: 1 addition & 1 deletion .github/workflows/flutter_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
profile: Nexus 6
script: flutter test integration_test/integration_test.dart --verbose
test-ios:
runs-on: macos-12
runs-on: macos-latest
timeout-minutes: 30
defaults:
run:
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

### Fixes

- Fix battery level convertion for iOS 16.4 ([#1433](https://github.com/getsentry/sentry-dart/pull/1433))
- Fix battery level conversion for iOS 16.4 ([#1433](https://github.com/getsentry/sentry-dart/pull/1433))
- Adds a namespace for compatibility with AGP 8.0. ([#1427](https://github.com/getsentry/sentry-dart/pull/1427))
- Avoid dependency conflict with package_info_plus v4 ([#1440](https://github.com/getsentry/sentry-dart/pull/1440))

### Breaking Changes

- Android `minSdkVersion` is now 19 (Flutter already defines 19-20 as best effort)

## 7.5.2

Expand Down
6 changes: 3 additions & 3 deletions dart/example_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
path: ../../dart

dev_dependencies:
build_runner: ^2.1.8
build_web_compilers: ^3.2.2
build_runner: ^2.4.2
build_web_compilers: ^4.0.3
lints: ^2.0.0
webdev: ^2.7.6
webdev: ^3.0.4
6 changes: 3 additions & 3 deletions dart/lib/src/run_zoned_guarded_integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ class RunZonedGuardedIntegration extends Integration<SentryOptions> {

// marks the span status if none to `internal_error` in case there's an
// unhandled error
hub.configureScope((scope) => {
scope.span?.status ??= const SpanStatus.internalError(),
});
hub.configureScope(
(scope) => scope.span?.status ??= const SpanStatus.internalError(),
);

await hub.captureEvent(event, stackTrace: stackTrace);
}
Expand Down
6 changes: 3 additions & 3 deletions dart/lib/src/sentry_isolate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ class SentryIsolate {

// marks the span status if none to `internal_error` in case there's an
// unhandled error
hub.configureScope((scope) => {
scope.span?.status ??= const SpanStatus.internalError(),
});
hub.configureScope(
(scope) => scope.span?.status ??= const SpanStatus.internalError(),
);

await hub.captureEvent(event, stackTrace: stackTrace);
}
Expand Down
2 changes: 1 addition & 1 deletion flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ android {
}

defaultConfig {
minSdkVersion 16
minSdkVersion 19
targetSdkVersion 33

ndk {
Expand Down
2 changes: 1 addition & 1 deletion flutter/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ android {

defaultConfig {
applicationId "io.sentry.samples.flutter"
minSdkVersion 16
minSdkVersion 19
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
2 changes: 1 addition & 1 deletion flutter/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:
dio: any # This gets constrained by `sentry_dio`
sqflite: any # This gets constrained by `sentry_sqflite`
logging: any # This gets constrained by `sentry_logging`
package_info_plus: ^3.0.0
package_info_plus: ^4.0.0
path_provider: ^2.0.0
#sqflite_common_ffi: ^2.0.0
#sqflite_common_ffi_web: ^0.3.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class FlutterEnricherEventProcessor implements EventProcessor {
// Thus we call it on demand after all the initialization happened.
WidgetsBinding? get _widgetsBinding => _options.bindingUtils.instance;

// ignore: deprecated_member_use
SingletonFlutterWindow? get _window => _widgetsBinding?.window;
Map<String, String> _packages = {};

Expand Down Expand Up @@ -120,6 +121,7 @@ class FlutterEnricherEventProcessor implements EventProcessor {
final defaultRouteName = _window?.defaultRouteName;
// A FlutterEngine has no renderViewElement if it was started or is
// accessed from an isolate different to the main isolate.
// ignore: deprecated_member_use
final hasRenderView = _widgetsBinding?.renderViewElement != null;

return <String, String>{
Expand Down Expand Up @@ -180,6 +182,7 @@ class FlutterEnricherEventProcessor implements EventProcessor {

SentryOperatingSystem _getOperatingSystem(SentryOperatingSystem? os) {
return (os ?? SentryOperatingSystem()).copyWith(
// ignore: deprecated_member_use
theme: os?.theme ?? describeEnum(window.platformBrightness),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class ScreenshotEventProcessor implements EventProcessor {
final renderObject =
sentryScreenshotWidgetGlobalKey.currentContext?.findRenderObject();
if (renderObject is RenderRepaintBoundary) {
// ignore: deprecated_member_use
final pixelRatio = window.devicePixelRatio;
var imageResult = _getImage(renderObject, pixelRatio);
Image image;
Expand Down
6 changes: 3 additions & 3 deletions flutter/lib/src/integrations/flutter_error_integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class FlutterErrorIntegration implements Integration<SentryFlutterOptions> {

// marks the span status if none to `internal_error` in case there's an
// unhandled error
hub.configureScope((scope) => {
scope.span?.status ??= const SpanStatus.internalError(),
});
hub.configureScope(
(scope) => scope.span?.status ??= const SpanStatus.internalError(),
);

await hub.captureEvent(event,
stackTrace: errorDetails.stack,
Expand Down
6 changes: 3 additions & 3 deletions flutter/lib/src/integrations/on_error_integration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ class OnErrorIntegration implements Integration<SentryFlutterOptions> {

// marks the span status if none to `internal_error` in case there's an
// unhandled error
hub.configureScope((scope) => {
scope.span?.status ??= const SpanStatus.internalError(),
});
hub.configureScope(
(scope) => scope.span?.status ??= const SpanStatus.internalError(),
);

// unawaited future
hub.captureEvent(event, stackTrace: stackTrace);
Expand Down
1 change: 1 addition & 0 deletions flutter/lib/src/view_hierarchy/sentry_tree_walker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ class _TreeWalker {
}

SentryViewHierarchy? walkWidgetTree(WidgetsBinding instance) {
// ignore: deprecated_member_use
final rootElement = instance.renderViewElement;
if (rootElement == null) {
return null;
Expand Down
5 changes: 5 additions & 0 deletions flutter/lib/src/widgets_binding_observer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class SentryWidgetsBindingObserver with WidgetsBindingObserver {
.skip(1) // Skip initial event added below in constructor
.listen(_onScreenSizeChanged);

// ignore: deprecated_member_use
final window = _options.bindingUtils.instance?.window;
_screenSizeStreamController.add(window);
}
Expand All @@ -46,6 +47,7 @@ class SentryWidgetsBindingObserver with WidgetsBindingObserver {
final Hub _hub;
final SentryFlutterOptions _options;

// ignore: deprecated_member_use
final StreamController<SingletonFlutterWindow?> _screenSizeStreamController;

/// This method records lifecycle events.
Expand Down Expand Up @@ -86,6 +88,7 @@ class SentryWidgetsBindingObserver with WidgetsBindingObserver {
if (!_options.enableWindowMetricBreadcrumbs) {
return;
}
// ignore: deprecated_member_use
final window = _options.bindingUtils.instance?.window;
_screenSizeStreamController.add(window);
}
Expand All @@ -109,6 +112,7 @@ class SentryWidgetsBindingObserver with WidgetsBindingObserver {
return;
}
final brightness =
// ignore: deprecated_member_use
_options.bindingUtils.instance?.window.platformBrightness;
final brightnessDescription =
brightness == Brightness.dark ? 'dark' : 'light';
Expand All @@ -133,6 +137,7 @@ class SentryWidgetsBindingObserver with WidgetsBindingObserver {
return;
}
final newTextScaleFactor =
// ignore: deprecated_member_use
_options.bindingUtils.instance?.window.textScaleFactor;

_hub.addBreadcrumb(Breadcrumb(
Expand Down
4 changes: 2 additions & 2 deletions flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ dependencies:
flutter_web_plugins:
sdk: flutter
sentry: 7.5.2
package_info_plus: '>=1.0.0 <4.0.0'
package_info_plus: '>=1.0.0 <5.0.0'
meta: ^1.3.0

dev_dependencies:
build_runner: ^2.1.8
build_runner: ^2.4.2
flutter_test:
sdk: flutter
mockito: ^5.1.0
Expand Down
4 changes: 4 additions & 0 deletions flutter/test/file_system_transport_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ void main() {
});

tearDown(() {
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler(null);
});

test('FileSystemTransport wont throw', () async {
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler((MethodCall methodCall) async {});

final transport = fixture.getSut(_channel);
Expand All @@ -46,6 +48,7 @@ void main() {
});

test('FileSystemTransport returns emptyId if channel throws', () async {
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler((MethodCall methodCall) async {
throw Exception();
});
Expand All @@ -67,6 +70,7 @@ void main() {

test('FileSystemTransport asserts the event', () async {
dynamic arguments;
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler((MethodCall methodCall) async {
arguments = methodCall.arguments;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ MethodChannel createChannelWithCallback(
Future<dynamic>? Function(MethodCall call)? handler,
) {
final channel = MethodChannel('initNativeSdk');
// ignore: deprecated_member_use
channel.setMockMethodCallHandler(handler);
return channel;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ void main() {
});

tearDown(() {
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler(null);
});

test('loadContextsIntegration adds integration', () {
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler((MethodCall methodCall) async {});

final integration = LoadContextsIntegration(_channel);
Expand All @@ -51,6 +53,7 @@ void main() {
final future = Future.value(loadContexts);
when(fixture.methodChannel.invokeMethod<dynamic>('loadContexts'))
.thenAnswer((_) => future);
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler((MethodCall methodCall) async {});

final integration = LoadContextsIntegration(fixture.methodChannel);
Expand All @@ -75,6 +78,7 @@ void main() {
final future = Future.value(loadContexts);
when(fixture.methodChannel.invokeMethod<dynamic>('loadContexts'))
.thenAnswer((_) => future);
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler((MethodCall methodCall) async {});

final integration = LoadContextsIntegration(fixture.methodChannel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ void main() {
);

test('should not throw on loadContextsIntegration exception', () async {
// ignore: deprecated_member_use
fixture.channel.setMockMethodCallHandler((MethodCall methodCall) async {
throw Exception();
});
Expand Down Expand Up @@ -453,6 +454,7 @@ class Fixture {
}
]
}}) {
// ignore: deprecated_member_use
channel.setMockMethodCallHandler((MethodCall methodCall) async {
called = true;
return contexts;
Expand Down
6 changes: 6 additions & 0 deletions flutter/test/integrations/load_image_list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ void main() {
late Fixture fixture;

tearDown(() {
// ignore: deprecated_member_use
fixture.channel.setMockMethodCallHandler(null);
});

Expand All @@ -38,6 +39,7 @@ void main() {
setUp(() {
fixture = Fixture(platform);
fixture.channel
// ignore: deprecated_member_use
.setMockMethodCallHandler((MethodCall methodCall) async {
return imageList;
});
Expand All @@ -62,6 +64,7 @@ void main() {

final sut = fixture.getSut();
fixture.channel
// ignore: deprecated_member_use
.setMockMethodCallHandler((MethodCall methodCall) async {
called = true;
return imageList;
Expand All @@ -83,6 +86,7 @@ void main() {

final sut = fixture.getSut();
fixture.channel
// ignore: deprecated_member_use
.setMockMethodCallHandler((MethodCall methodCall) async {
called = true;
return imageList;
Expand All @@ -101,6 +105,7 @@ void main() {

final sut = fixture.getSut();
fixture.channel
// ignore: deprecated_member_use
.setMockMethodCallHandler((MethodCall methodCall) async {
called = true;
return imageList;
Expand Down Expand Up @@ -160,6 +165,7 @@ void main() {

final sut = fixture.getSut();
fixture.channel
// ignore: deprecated_member_use
.setMockMethodCallHandler((MethodCall methodCall) async {
called = true;
return imageList;
Expand Down
6 changes: 6 additions & 0 deletions flutter/test/integrations/native_sdk_integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ void main() {
});

tearDown(() {
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler(null);
});

test('nativeSdkIntegration adds integration', () async {
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler((MethodCall methodCall) async {});

final integration = NativeSdkIntegration(_channel);
Expand All @@ -35,6 +37,7 @@ void main() {
});

test('nativeSdkIntegration do not throw', () async {
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler((MethodCall methodCall) async {
throw Exception();
});
Expand All @@ -49,6 +52,7 @@ void main() {

test('nativeSdkIntegration closes native SDK', () async {
var closeCalled = false;
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler((MethodCall methodCall) async {
expect(methodCall.method, 'closeNativeSdk');
closeCalled = true;
Expand All @@ -64,6 +68,7 @@ void main() {
test('nativeSdkIntegration does not call native sdk when auto init disabled',
() async {
var methodChannelCalled = false;
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler((MethodCall methodCall) async {
methodChannelCalled = true;
});
Expand All @@ -79,6 +84,7 @@ void main() {
test('nativeSdkIntegration does not close native when auto init disabled',
() async {
var methodChannelCalled = false;
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler((MethodCall methodCall) async {
methodChannelCalled = true;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ void main() {
});

tearDown(() {
// ignore: deprecated_member_use
_channel.setMockMethodCallHandler(null);
});

Expand Down
Loading