Skip to content

Commit

Permalink
Feat/0.8.0 (jhomlala#261)
Browse files Browse the repository at this point in the history
* feat: updated android SDK versions, updated dependencies

* feat: added very_good_analysis, fixed lints

* fix: fixed screenshots not being created

* fix: updated changelog, pubspec and readme

* feat: updated screenshot manager

* fix: fixed missing lints

* refactor: general refactor

* fix: updated CI config for Github Actions

* fix: format
  • Loading branch information
jhomlala authored Nov 9, 2023
1 parent 1f0d78b commit 9075b47
Show file tree
Hide file tree
Showing 61 changed files with 1,619 additions and 1,314 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,30 @@ on:

jobs:
check-format:
name: Check format using flutter format
runs-on: ubuntu-latest
container: cirrusci/flutter:stable
name: Check format using dart format.
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check format
run: flutter format -n --set-exit-if-changed .
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Flutter Action
uses: subosito/flutter-action@v2
- name: Check format
run: dart format . --set-exit-if-changed

lint:
name: Lint
runs-on: ubuntu-latest
container: cirrusci/flutter:stable

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v2
- name: Flutter Action
uses: subosito/flutter-action@v2
- name: Install Package Dependencies
run: flutter packages get
- name: Get dependencies for example
run: flutter pub get
working-directory: example
- name: Lint using flutter analyze
run: flutter analyze
run: flutter analyze .
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.8.0
* [BREAKING_CHANGE] Updated min android version to 22 and target/compile version to 34.
* Updated dependencies version.
* Replaced lint with very_good_analysis package.
* Fixed screenshot manger not creating screenshots.
* Update pub.dev metadata.

## 0.7.0
* [BREAKING_CHANGE] Update to Flutter 3 by Nico Mexis (https://github.com/ThexXTURBOXx).
* [BREAKING_CHANGE] Update device_info_plus and added android_id plugin by Nico Mexis (https://github.com/ThexXTURBOXx).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Catcher supports Android, iOS, Web, Linux, Windows and MacOS platforms.
Add this line to your **pubspec.yaml**:
```yaml
dependencies:
catcher: ^0.7.0
catcher: ^0.8.0
```
Then run this command:
Expand Down
26 changes: 10 additions & 16 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
#include: package:lint/analysis_options_package.yaml

analyzer:
strong-mode:
implicit-dynamic: false
include: package:very_good_analysis/analysis_options.yaml

linter:
rules:
close_sinks: true
public_member_api_docs: false
flutter_style_todos: false
avoid_final_parameters: false
sort_constructors_first: false
avoid_classes_with_only_static_members: false
avoid_void_async: false
avoid_positional_boolean_parameters: false
avoid_function_literals_in_foreach_calls: false
prefer_constructors_over_static_methods: false
sort_unnamed_constructors_first: false
sized_box_for_whitespace: false
invalid_dependency: false
sort_pub_dependencies: false
import_of_legacy_library_into_null_safe: false
avoid_positional_boolean_parameters: false
use_if_null_to_convert_nulls_to_bools: false
use_build_context_synchronously: false
use_setters_to_change_properties: false
prefer_constructors_over_static_methods: false
use_setters_to_change_properties: false
avoid_print: false
sort_pub_dependencies: false
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 33
compileSdkVersion 34

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
minSdkVersion 16
minSdkVersion 22
}
}

Expand Down
9 changes: 3 additions & 6 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,22 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
compileSdkVersion 34

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.jhomlala.catcher_example"
minSdkVersion 16
targetSdkVersion 33
minSdkVersion 22
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
Expand Down
9 changes: 9 additions & 0 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,13 @@
android:name="flutterEmbedding"
android:value="2" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<queries>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
</intent>
</queries>


</manifest>
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
44 changes: 25 additions & 19 deletions example/lib/basic_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@ import 'package:catcher/catcher.dart';
import 'package:flutter/material.dart';

void main() {
CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [
final debugOptions = CatcherOptions(DialogReportMode(), [
ConsoleHandler(),
]);
CatcherOptions releaseOptions = CatcherOptions(PageReportMode(), [
EmailManualHandler(["recipient@email.com"])
final releaseOptions = CatcherOptions(PageReportMode(), [
EmailManualHandler(['recipient@e mail.com']),
]);

Catcher(
runAppFunction: () {
runApp(MyApp());
},
debugConfig: debugOptions,
releaseConfig: releaseOptions);
runAppFunction: () {
runApp(const MyApp());
},
debugConfig: debugOptions,
releaseConfig: releaseOptions,
);
}

class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);

@override
_MyAppState createState() => _MyAppState();
State<StatefulWidget> createState() {
return _MyAppState();
}
}

class _MyAppState extends State<MyApp> {
Expand All @@ -33,26 +38,27 @@ class _MyAppState extends State<MyApp> {
return MaterialApp(
navigatorKey: Catcher.navigatorKey,
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: ChildWidget()),
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: const ChildWidget(),
),
);
}
}

class ChildWidget extends StatelessWidget {
const ChildWidget({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Container(
child: TextButton(
child: Text("Generate error"),
onPressed: () => generateError(),
),
return TextButton(
onPressed: generateError,
child: const Text('Generate error'),
);
}

void generateError() async {
Future<void> generateError() async {
Catcher.sendTestException();
}
}
66 changes: 39 additions & 27 deletions example/lib/change_custom_parameters_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,33 @@ import 'package:flutter/material.dart';
late Catcher catcher;

void main() {
Map<String, dynamic> customParameters = new Map<String, dynamic>();
customParameters["First"] = "First parameter";
CatcherOptions debugOptions = CatcherOptions(
PageReportMode(),
[
ConsoleHandler(enableCustomParameters: true),
],
customParameters: customParameters);
CatcherOptions releaseOptions = CatcherOptions(PageReportMode(), [
EmailManualHandler(["[email protected]"])
final customParameters = <String, dynamic>{};
customParameters['First'] = 'First parameter';
final debugOptions = CatcherOptions(
PageReportMode(),
[
ConsoleHandler(enableCustomParameters: true),
],
customParameters: customParameters,
);
final releaseOptions = CatcherOptions(PageReportMode(), [
EmailManualHandler(['[email protected]']),
]);

catcher = Catcher(
rootWidget: MyApp(),
rootWidget: const MyApp(),
debugConfig: debugOptions,
releaseConfig: releaseOptions,
);
}

class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);

@override
_MyAppState createState() => _MyAppState();
State<StatefulWidget> createState() {
return _MyAppState();
}
}

class _MyAppState extends State<MyApp> {
Expand All @@ -39,33 +44,40 @@ class _MyAppState extends State<MyApp> {
return MaterialApp(
navigatorKey: Catcher.navigatorKey,
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: ChildWidget()),
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: const ChildWidget(),
),
);
}
}

class ChildWidget extends StatelessWidget {
const ChildWidget({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Container(
child: Column(children: [
ElevatedButton(
child: Text("Change custom parameters"),
onPressed: _changeCustomParameters),
ElevatedButton(
child: Text("Generate error"), onPressed: () => generateError())
]));
return Column(
children: [
ElevatedButton(
onPressed: _changeCustomParameters,
child: const Text('Change custom parameters'),
),
ElevatedButton(
onPressed: generateError,
child: const Text('Generate error'),
),
],
);
}

void generateError() async {
Future<void> generateError() async {
Catcher.sendTestException();
}

void _changeCustomParameters() {
CatcherOptions options = catcher.getCurrentConfig()!;
options.customParameters["Second"] = "Second parameter";
final options = catcher.getCurrentConfig()!;
options.customParameters['Second'] = 'Second parameter';
}
}
6 changes: 4 additions & 2 deletions example/lib/crashlytics_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ class CrashlyticsHandler extends ReportHandler {
crashlytics.log(_getLogMessage(report));
if (report.errorDetails != null) {
// ignore: cast_nullable_to_non_nullable
await crashlytics.recordFlutterError(report.errorDetails as FlutterErrorDetails);
await crashlytics.recordFlutterError(report.errorDetails as
FlutterErrorDetails);
} else {
await crashlytics.recordError(report.error, report.stackTrace as StackTrace);
await crashlytics.recordError(report.error, report.stackTrace as
StackTrace);
}
_printLog("Crashlytics report sent");
return true;
Expand Down
Loading

0 comments on commit 9075b47

Please sign in to comment.