Skip to content

Commit

Permalink
Merge pull request #134 from bugsnag/release-v2.0.2
Browse files Browse the repository at this point in the history
Release v2.0.2
  • Loading branch information
nickdowell committed May 30, 2022
2 parents 086df8b + d535596 commit 9314bf8
Show file tree
Hide file tree
Showing 47 changed files with 242 additions and 198 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.2 (2022-05-30)

- Prefixed all class named with 'Bugsnag' to avoid clashing with application code.

## 2.0.1 (2022-05-25)

- Fixed documentation links in README.md
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ Here’s a bit about our process designing and building the Bugsnag libraries:
## Further development docs

For information on how to build the library and develop changes you should start by
reading [the docs](docs/README.md).
reading [the docs](docs/RELEASING.md).

17 changes: 17 additions & 0 deletions UPGRADING.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Upgrading
=========

## 1.x to 2.x

Flutter is now officially supported by Bugsnag! Many thanks to the community for the [previous library](https://github.com/GetDutchie/bugsnag_flutter) and for allowing us to take the `bugsnag_flutter` package name.

To upgrade:

* `bugsnag_flutter/bugsnag.dart` is now `bugsnag_flutter/bugsnag_flutter.dart`
* we recommend using single Flutter project rather than separate platform projects. To continue using existing separate projects, use ternaries like `Platform.isAndroid ? androidApiKey : iosApiKey` when using `bugsnag.start`
* `.setUser` accepts a named ID instead of an unnamed ID in the first position
* `BugsnagObserver` is now `BugsnagNavigatorObserver`
* `Bugsnag.instance` is now a global `bugsnag`
* `Bugsnag.instance.recordError` is now `bugsnag.notify`
* `Bugsnag.instance.recordFlutterError` should be translated as `bugsnag.notify(error.exception, error.stack)`
* `BugsnagBreadcrumb` is now `BreadcrumbType`
4 changes: 3 additions & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ Demonstrates how to use the bugsnag_flutter package.

* Install the Flutter extension for Visual Studio Code and open the `/example` directory
* Insert your API key into `lib/main.dart`
* Run the app using Visual Studio Code! There are several examples of different kinds of errors which can be thrown.
* With `lib/main.dart` open in Visual Studio Code, click "Run" above the `main` function

There are several examples of different kinds of errors which can be thrown.
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ void main() async => bugsnag.start(
// Find your API key in the settings menu of your Bugsnag dashboard
apiKey: 'add_your_api_key_here',
// Specify in-project packages if you have multiple or are splitting debug info in your build (--split-debug-info)
projectPackages: const ProjectPackages.only({'bugsnag_example'}),
projectPackages: const BugsnagProjectPackages.only({'bugsnag_example'}),
// onError callbacks can be used to modify or reject certain events
onError: [
(event) {
Expand Down
2 changes: 1 addition & 1 deletion features/fixtures/app/lib/channels.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class MazeRunnerChannels {
});
}

static Future<void> startBugsnag(EndpointConfiguration endpoints) {
static Future<void> startBugsnag(BugsnagEndpointConfiguration endpoints) {
return platform.invokeMethod("startBugsnag", {
'notifyEndpoint': endpoints.notify,
'sessionEndpoint': endpoints.sessions,
Expand Down
2 changes: 1 addition & 1 deletion features/fixtures/app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class _HomePageState extends State<MazeRunnerHomePage> {
return scenarios[scenarioIndex].init();
}

EndpointConfiguration _endpoints() => EndpointConfiguration(
BugsnagEndpointConfiguration _endpoints() => BugsnagEndpointConfiguration(
_notifyEndpointController.value.text,
_sessionEndpointController.value.text,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class AttachBugsnagScenario extends Scenario {
bugsnag.setContext('flutter-test-context'),
bugsnag.setUser(id: 'test-user-id', name: 'Old Man Tables'),
bugsnag.addFeatureFlags(const [
FeatureFlag('demo-mode'),
FeatureFlag('sample-group', '123'),
BugsnagFeatureFlag('demo-mode'),
BugsnagFeatureFlag('sample-group', '123'),
]),
]);

Expand Down
6 changes: 3 additions & 3 deletions features/fixtures/app/lib/scenarios/breadcrumbs_scenario.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class BreadcrumbsScenario extends Scenario {
@override
Future<void> run() async {
await bugsnag.start(
enabledBreadcrumbTypes: {EnabledBreadcrumbType.state},
enabledBreadcrumbTypes: {BugsnagEnabledBreadcrumbType.state},
endpoints: endpoints,
);

Expand All @@ -16,9 +16,9 @@ class BreadcrumbsScenario extends Scenario {

final breadcrumbs = await bugsnag.getBreadcrumbs();
expect(breadcrumbs[0].message, 'Bugsnag loaded');
expect(breadcrumbs[0].type, BreadcrumbType.state);
expect(breadcrumbs[0].type, BugsnagBreadcrumbType.state);
expect(breadcrumbs[1].message, 'Manual breadcrumb');
expect(breadcrumbs[1].type, BreadcrumbType.manual);
expect(breadcrumbs[1].type, BugsnagBreadcrumbType.manual);

await bugsnag.notify(Exception('BreadcrumbsScenarioException'), null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class DetectEnabledErrorsScenario extends Scenario {
@override
Future<void> run() async {
await bugsnag.start(
enabledErrorTypes: EnabledErrorTypes(
enabledErrorTypes: BugsnagEnabledErrorTypes(
unhandledDartExceptions:
extraConfig?.contains('detectDartExceptions') == true,
unhandledJvmExceptions:
Expand Down
12 changes: 6 additions & 6 deletions features/fixtures/app/lib/scenarios/feature_flags_scenario.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ class FeatureFlagsScenario extends Scenario {
await bugsnag.start(
endpoints: endpoints,
featureFlags: const [
FeatureFlag('1'),
FeatureFlag('2', 'foo'),
FeatureFlag('3'),
BugsnagFeatureFlag('1'),
BugsnagFeatureFlag('2', 'foo'),
BugsnagFeatureFlag('3'),
],
);

await bugsnag.clearFeatureFlags();

await bugsnag.addFeatureFlags(const [
FeatureFlag('one'),
FeatureFlag('two', 'foo'),
FeatureFlag('three'),
BugsnagFeatureFlag('one'),
BugsnagFeatureFlag('two', 'foo'),
BugsnagFeatureFlag('three'),
]);
await bugsnag.addFeatureFlag('four');
await bugsnag.addFeatureFlag('five', 'six');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class LastRunInfoScenario extends Scenario {
Exception('After launch'),
null,
callback: (event) async {
final lastRunInfo = await bugsnag.getLastRunInfo() as LastRunInfo;
final lastRunInfo =
await bugsnag.getLastRunInfo() as BugsnagLastRunInfo;
event.addMetadata('lastRunInfo', {
'consecutiveLaunchCrashes': lastRunInfo.consecutiveLaunchCrashes,
'crashed': lastRunInfo.crashed,
Expand Down
3 changes: 3 additions & 0 deletions features/fixtures/app/lib/scenarios/on_error_scenario.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ class OnErrorScenario extends Scenario {
onError: [
(event) => event.errors.first.message != 'Ignored',
(event) {
event.app.id = 'app_id';
event.device.id = 'device_id';
event.severity = BugsnagSeverity.info;
event.errors.first.message = 'Not ignored';
return true;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class ProjectPackagesScenario extends Scenario {
Future<void> run() async {
await bugsnag.start(
endpoints: endpoints,
projectPackages: const ProjectPackages.withDefaults({'test_package'}),
projectPackages:
const BugsnagProjectPackages.withDefaults({'test_package'}),
);
await bugsnag.notify(Exception(), null);
}
Expand Down
2 changes: 1 addition & 1 deletion features/fixtures/app/lib/scenarios/scenario.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:flutter/widgets.dart';
import '../channels.dart';

abstract class Scenario {
late EndpointConfiguration endpoints;
late BugsnagEndpointConfiguration endpoints;

String? extraConfig;

Expand Down
10 changes: 5 additions & 5 deletions features/fixtures/app/lib/scenarios/start_bugsnag_scenario.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ class StartBugsnagScenario extends Scenario {
appVersion: '1.2.3',
versionCode: 4321,
context: 'awesome',
user: User(
user: BugsnagUser(
id: '123',
name: 'From Config',
),
redactedKeys: {'secret'},
releaseStage: 'testing',
enabledReleaseStages: {'testing'},
enabledBreadcrumbTypes: {EnabledBreadcrumbType.error},
enabledBreadcrumbTypes: {BugsnagEnabledBreadcrumbType.error},
endpoints: endpoints,
featureFlags: const [
FeatureFlag('demo-mode'),
FeatureFlag('sample-group', '123'),
BugsnagFeatureFlag('demo-mode'),
BugsnagFeatureFlag('sample-group', '123'),
],
metadata: const {
'custom': {
Expand All @@ -31,7 +31,7 @@ class StartBugsnagScenario extends Scenario {
'password': 'not redacted'
}
},
sendThreads: ThreadSendPolicy.never,
sendThreads: BugsnagThreadSendPolicy.never,
runApp: () async {
await bugsnag.notify(
Exception('Exception with attached info'),
Expand Down
3 changes: 3 additions & 0 deletions features/on_error.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ Feature: OnError callbacks
Given I run "OnErrorScenario"
And I wait to receive an error
Then the exception "message" equals "Not ignored"
And the event "app.id" equals "app_id"
And the event "device.id" equals "device_id"
And the event "severity" equals "info"
And on iOS, the event "threads.0.stacktrace.0.symbolAddress" is not null
5 changes: 3 additions & 2 deletions packages/bugsnag_flutter/lib/bugsnag_flutter.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export 'src/breadcrumbs/navigation.dart';
export 'src/callbacks.dart' show OnErrorCallback;
export 'src/client.dart' show bugsnag, Client, Bugsnag, ProjectPackages;
export 'src/callbacks.dart' show BugsnagOnErrorCallback;
export 'src/client.dart'
show bugsnag, BugsnagClient, Bugsnag, BugsnagProjectPackages;
export 'src/config.dart';
export 'src/helpers.dart';
export 'src/last_run_info.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class BugsnagNavigatorObserver extends NavigatorObserver {
if (leaveBreadcrumbs) {
bugsnag.leaveBreadcrumb(
_operationDescription(function),
type: BreadcrumbType.navigation,
type: BugsnagBreadcrumbType.navigation,
metadata: metadata,
);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/bugsnag_flutter/lib/src/bugsnag_stacktrace.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:bugsnag_flutter/bugsnag_flutter.dart';
import 'package:flutter/foundation.dart';

import 'model.dart';

// This file is heavily based on:
// https://github.com/dart-lang/sdk/blob/main/pkg/native_stack_traces/lib/src/convert.dart
// the primary difference is that we're only interested in the virtual address
Expand Down
2 changes: 1 addition & 1 deletion packages/bugsnag_flutter/lib/src/callbacks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'model.dart';
/// "on error" callbacks added in Dart are only triggered for events originating
/// in Dart and will always be triggered before "on error" callbacks added
/// in the native layer (on Android and iOS).
typedef OnErrorCallback = FutureOr<bool> Function(BugsnagEvent event);
typedef BugsnagOnErrorCallback = FutureOr<bool> Function(BugsnagEvent event);

typedef _Callback<E> = FutureOr<bool> Function(E);

Expand Down
Loading

0 comments on commit 9314bf8

Please sign in to comment.