diff --git a/.flutter-plugins b/.flutter-plugins new file mode 100644 index 00000000..f245cd0b --- /dev/null +++ b/.flutter-plugins @@ -0,0 +1,5 @@ +# This is a generated file; do not edit or check into version control. +device_info_plus=C:\\Users\\nicom\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\device_info_plus-9.0.3\\ +flutter_mailer=C:\\Users\\nicom\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\flutter_mailer-2.1.1\\ +fluttertoast=C:\\Users\\nicom\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\fluttertoast-8.2.2\\ +package_info_plus=C:\\Users\\nicom\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dev\\package_info_plus-4.1.0\\ diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies new file mode 100644 index 00000000..5814c82e --- /dev/null +++ b/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"device_info_plus","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-9.0.3\\\\","native_build":true,"dependencies":[]},{"name":"flutter_mailer","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_mailer-2.1.1\\\\","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\fluttertoast-8.2.2\\\\","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\package_info_plus-4.1.0\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"device_info_plus","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-9.0.3\\\\","native_build":true,"dependencies":[]},{"name":"flutter_mailer","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_mailer-2.1.1\\\\","native_build":true,"dependencies":[]},{"name":"fluttertoast","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\fluttertoast-8.2.2\\\\","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\package_info_plus-4.1.0\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"device_info_plus","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-9.0.3\\\\","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\package_info_plus-4.1.0\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"device_info_plus","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-9.0.3\\\\","native_build":false,"dependencies":[]},{"name":"package_info_plus","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\package_info_plus-4.1.0\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"device_info_plus","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-9.0.3\\\\","native_build":false,"dependencies":[]},{"name":"package_info_plus","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\package_info_plus-4.1.0\\\\","native_build":false,"dependencies":[]}],"web":[{"name":"device_info_plus","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\device_info_plus-9.0.3\\\\","dependencies":[]},{"name":"fluttertoast","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\fluttertoast-8.2.2\\\\","dependencies":[]},{"name":"package_info_plus","path":"C:\\\\Users\\\\nicom\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\package_info_plus-4.1.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"device_info_plus","dependencies":[]},{"name":"flutter_mailer","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"package_info_plus","dependencies":[]}],"date_created":"2023-09-26 20:30:03.646144","version":"3.13.5"} \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 85b082f2..7f3caf68 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -3,7 +3,7 @@ name: Bug report about: Create a report to help us improve title: "[BUG]" labels: New issue -assignees: jhomlala +assignees: ThexXTURBOXx --- @@ -26,7 +26,7 @@ If applicable, add screenshots to help explain your problem. **Flutter doctor** Please add flutter doctor output here. -**Catcher version** +**Catcher 2 version** - Version: **Smartphone (please complete the following information):** diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 7cf0bce3..d71f7196 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -3,7 +3,7 @@ name: Feature request about: Suggest an idea for this project title: "[FEATURE]" labels: New issue, enhancement -assignees: jhomlala +assignees: ThexXTURBOXx --- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e439f6c..f22499fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check format run: dart format --output=none --set-exit-if-changed . @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get dependencies for example run: flutter pub get working-directory: example diff --git a/.gitignore b/.gitignore index a07e487e..96486fd9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,30 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp .DS_Store -.dart_tool/ -.idea +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ -.packages -.pub/ +# IntelliJ related +*.iml +*.ipr +*.iws .idea/ -build/ -ios/.generated/ -ios/Flutter/Generated.xcconfig -ios/Runner/GeneratedPluginRegistrant.* -example/macos/Flutter/ -example/linux/flutter/ - -*.txt -android/.gradle +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ -.flutter-plugins -.flutter-plugins-dependencies -flutter_export_environment.sh -*.lock -.vscode +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +.packages +build/ diff --git a/README.md b/README.md index 5381e79b..69ead887 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,18 @@

- +

-# Catcher +# Catcher 2 [![pub package](https://img.shields.io/pub/v/catcher.svg)](https://pub.dartlang.org/packages/catcher) -[![pub package](https://img.shields.io/github/license/jhomlala/catcher.svg?style=flat)](https://github.com/jhomlala/catcher) -[![pub package](https://img.shields.io/badge/platform-flutter-blue.svg)](https://github.com/jhomlala/catcher) +[![pub package](https://img.shields.io/github/license/ThexXTURBOXx/catcher_2.svg?style=flat)](https://github.com/ThexXTURBOXx/catcher_2) +[![pub package](https://img.shields.io/badge/platform-flutter-blue.svg)](https://github.com/ThexXTURBOXx/catcher_2) [![pub package](https://img.shields.io/badge/Awesome-Flutter-blue.svg?longCache=true&style=flat-square)](https://github.com/Solido/awesome-flutter) -Catcher is Flutter plugin which automatically catches error/exceptions and handle them. Catcher offers multiple way to handle errors. -Catcher is heavily inspired from ACRA: https://github.com/ACRA/acra. -Catcher supports Android, iOS, Web, Linux, Windows and MacOS platforms. +Catcher 2 is Flutter plugin which automatically catches error/exceptions and handle them. Catcher 2 offers multiple way to handle errors. +Catcher 2 is heavily inspired from ACRA: https://github.com/ACRA/acra. +Catcher 2 supports Android, iOS, Web, Linux, Windows and MacOS platforms. ## Install @@ -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.8.0 + catcher_2: ^1.0.0 ``` Then run this command: @@ -30,15 +30,15 @@ $ flutter packages get Then add this import: ```dart -import 'package:catcher/catcher.dart'; +import 'package:catcher_2/catcher_2.dart'; ``` ## Table of contents [Platform support](#platform-support) [Basic example](#basic-example) -[Catcher usage](#catcher-usage) +[Catcher 2 usage](#catcher-2-usage) [Adding navigator key](#adding-navigator-key) -[Catcher configuration](#catcher-configuration) +[Catcher 2 configuration](#catcher-2-configuration) [Report caught exception](#report-caught-exception) [Localization](#localization) @@ -70,35 +70,35 @@ import 'package:catcher/catcher.dart'; [Screenshots](#screenshots) ## Platform support -To check which features of Catcher are available in given platform visit this page: [Platform support](https://github.com/jhomlala/catcher/blob/master/platform_support.md) +To check which features of Catcher 2 are available in given platform visit this page: [Platform support](https://github.com/ThexXTURBOXx/catcher_2/blob/master/platform_support.md) ## Basic example Basic example utilizes debug config with Dialog Report Mode and Console Handler and release config with Dialog Report Mode and Email Manual Handler. -To start using Catcher, you have to: -1. Create Catcher configuration (you can use only debug config at start) -2. Create Catcher instance and pass your root widget along with catcher configuration +To start using Catcher 2, you have to: +1. Create Catcher 2 configuration (you can use only debug config at start) +2. Create Catcher 2 instance and pass your root widget along with its configuration 3. Add navigator key to MaterialApp or CupertinoApp Here is complete example: ```dart import 'package:flutter/material.dart'; -import 'package:catcher/catcher.dart'; +import 'package:catcher_2/catcher_2.dart'; main() { - /// STEP 1. Create catcher configuration. + /// STEP 1. Create Catcher 2 configuration. /// Debug configuration with dialog report mode and console handler. It will show dialog and once user accepts it, error will be shown /// in console. - CatcherOptions debugOptions = - CatcherOptions(DialogReportMode(), [ConsoleHandler()]); + Catcher2Options debugOptions = + Catcher2Options(DialogReportMode(), [ConsoleHandler()]); /// Release configuration. Same as above, but once user accepts dialog, user will be prompted to send email with crash to support. - CatcherOptions releaseOptions = CatcherOptions(DialogReportMode(), [ + Catcher2Options releaseOptions = Catcher2Options(DialogReportMode(), [ EmailManualHandler(["support@email.com"]) ]); - /// STEP 2. Pass your root widget (MyApp) along with Catcher configuration: - Catcher(rootWidget: MyApp(), debugConfig: debugOptions, releaseConfig: releaseOptions); + /// STEP 2. Pass your root widget (MyApp) along with Catcher 2 configuration: + Catcher2(rootWidget: MyApp(), debugConfig: debugOptions, releaseConfig: releaseOptions); } class MyApp extends StatefulWidget { @@ -115,8 +115,8 @@ class _MyAppState extends State { @override Widget build(BuildContext context) { return MaterialApp( - /// STEP 3. Add navigator key from Catcher. It will be used to navigate user to report page or to show dialog. - navigatorKey: Catcher.navigatorKey, + /// STEP 3. Add navigator key from Catcher 2. It will be used to navigate user to report page or to show dialog. + navigatorKey: Catcher2.navigatorKey, home: Scaffold( appBar: AppBar( title: const Text('Plugin example app'), @@ -142,95 +142,97 @@ class ChildWidget extends StatelessWidget { ``` If you run this code you will see screen with "Generate error" button on the screen. -After clicking on it, it will generate test exception, which will be handled by Catcher. Before Catcher process exception to handler, it will +After clicking on it, it will generate test exception, which will be handled by Catcher 2. Before Catcher 2 process exception to handler, it will show dialog with information for user. This dialog is shown because we have used DialogReportHandler. Once user confirms action in this dialog, report will be send to console handler which will log to console error information.

-
+
Dialog with default confirmation message

```dart -I/flutter ( 7457): [2019-02-09 12:40:21.527271 | ConsoleHandler | INFO] ============================== CATCHER LOG ============================== -I/flutter ( 7457): [2019-02-09 12:40:21.527742 | ConsoleHandler | INFO] Crash occurred on 2019-02-09 12:40:20.424286 -I/flutter ( 7457): [2019-02-09 12:40:21.527827 | ConsoleHandler | INFO] -I/flutter ( 7457): [2019-02-09 12:40:21.527908 | ConsoleHandler | INFO] ------- DEVICE INFO ------- -I/flutter ( 7457): [2019-02-09 12:40:21.528233 | ConsoleHandler | INFO] id: PSR1.180720.061 -I/flutter ( 7457): [2019-02-09 12:40:21.528337 | ConsoleHandler | INFO] androidId: 726e4abc58dde277 -I/flutter ( 7457): [2019-02-09 12:40:21.528431 | ConsoleHandler | INFO] board: goldfish_x86 -I/flutter ( 7457): [2019-02-09 12:40:21.528512 | ConsoleHandler | INFO] bootloader: unknown -I/flutter ( 7457): [2019-02-09 12:40:21.528595 | ConsoleHandler | INFO] brand: google -I/flutter ( 7457): [2019-02-09 12:40:21.528694 | ConsoleHandler | INFO] device: generic_x86 -I/flutter ( 7457): [2019-02-09 12:40:21.528774 | ConsoleHandler | INFO] display: sdk_gphone_x86-userdebug 9 PSR1.180720.061 5075414 dev-keys -I/flutter ( 7457): [2019-02-09 12:40:21.528855 | ConsoleHandler | INFO] fingerprint: google/sdk_gphone_x86/generic_x86:9/PSR1.180720.061/5075414:userdebug/dev-keys -I/flutter ( 7457): [2019-02-09 12:40:21.528939 | ConsoleHandler | INFO] hardware: ranchu -I/flutter ( 7457): [2019-02-09 12:40:21.529023 | ConsoleHandler | INFO] host: vped9.mtv.corp.google.com -I/flutter ( 7457): [2019-02-09 12:40:21.529813 | ConsoleHandler | INFO] isPsychicalDevice: false -I/flutter ( 7457): [2019-02-09 12:40:21.530178 | ConsoleHandler | INFO] manufacturer: Google -I/flutter ( 7457): [2019-02-09 12:40:21.530345 | ConsoleHandler | INFO] model: Android SDK built for x86 -I/flutter ( 7457): [2019-02-09 12:40:21.530443 | ConsoleHandler | INFO] product: sdk_gphone_x86 -I/flutter ( 7457): [2019-02-09 12:40:21.530610 | ConsoleHandler | INFO] tags: dev-keys -I/flutter ( 7457): [2019-02-09 12:40:21.530713 | ConsoleHandler | INFO] type: userdebug -I/flutter ( 7457): [2019-02-09 12:40:21.530825 | ConsoleHandler | INFO] versionBaseOs: -I/flutter ( 7457): [2019-02-09 12:40:21.530922 | ConsoleHandler | INFO] versionCodename: REL -I/flutter ( 7457): [2019-02-09 12:40:21.531074 | ConsoleHandler | INFO] versionIncremental: 5075414 -I/flutter ( 7457): [2019-02-09 12:40:21.531573 | ConsoleHandler | INFO] versionPreviewSdk: 0 -I/flutter ( 7457): [2019-02-09 12:40:21.531659 | ConsoleHandler | INFO] versionRelase: 9 -I/flutter ( 7457): [2019-02-09 12:40:21.531740 | ConsoleHandler | INFO] versionSdk: 28 -I/flutter ( 7457): [2019-02-09 12:40:21.531870 | ConsoleHandler | INFO] versionSecurityPatch: 2018-08-05 -I/flutter ( 7457): [2019-02-09 12:40:21.532002 | ConsoleHandler | INFO] -I/flutter ( 7457): [2019-02-09 12:40:21.532078 | ConsoleHandler | INFO] ------- APP INFO ------- -I/flutter ( 7457): [2019-02-09 12:40:21.532167 | ConsoleHandler | INFO] version: 1.0 -I/flutter ( 7457): [2019-02-09 12:40:21.532250 | ConsoleHandler | INFO] appName: catcher_example -I/flutter ( 7457): [2019-02-09 12:40:21.532345 | ConsoleHandler | INFO] buildNumber: 1 -I/flutter ( 7457): [2019-02-09 12:40:21.532426 | ConsoleHandler | INFO] packageName: com.jhomlala.catcherexample -I/flutter ( 7457): [2019-02-09 12:40:21.532667 | ConsoleHandler | INFO] -I/flutter ( 7457): [2019-02-09 12:40:21.532944 | ConsoleHandler | INFO] ---------- ERROR ---------- -I/flutter ( 7457): [2019-02-09 12:40:21.533096 | ConsoleHandler | INFO] Test exception -I/flutter ( 7457): [2019-02-09 12:40:21.533179 | ConsoleHandler | INFO] -I/flutter ( 7457): [2019-02-09 12:40:21.533257 | ConsoleHandler | INFO] ------- STACK TRACE ------- -I/flutter ( 7457): [2019-02-09 12:40:21.533695 | ConsoleHandler | INFO] #0 ChildWidget.generateError (package:catcher_example/file_example.dart:62:5) -I/flutter ( 7457): [2019-02-09 12:40:21.533799 | ConsoleHandler | INFO] -I/flutter ( 7457): [2019-02-09 12:40:21.533879 | ConsoleHandler | INFO] #1 ChildWidget.build. (package:catcher_example/file_example.dart:53:61) -I/flutter ( 7457): [2019-02-09 12:40:21.534149 | ConsoleHandler | INFO] #2 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:507:14) -I/flutter ( 7457): [2019-02-09 12:40:21.534230 | ConsoleHandler | INFO] #3 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:562:30) -I/flutter ( 7457): [2019-02-09 12:40:21.534321 | ConsoleHandler | INFO] #4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24) -I/flutter ( 7457): [2019-02-09 12:40:21.534419 | ConsoleHandler | INFO] #5 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9) -I/flutter ( 7457): [2019-02-09 12:40:21.534524 | ConsoleHandler | INFO] #6 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7) -I/flutter ( 7457): [2019-02-09 12:40:21.534608 | ConsoleHandler | INFO] #7 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9) -I/flutter ( 7457): [2019-02-09 12:40:21.534686 | ConsoleHandler | INFO] #8 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12) -I/flutter ( 7457): [2019-02-09 12:40:21.534765 | ConsoleHandler | INFO] #9 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11) -I/flutter ( 7457): [2019-02-09 12:40:21.534843 | ConsoleHandler | INFO] #10 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:180:19) -I/flutter ( 7457): [2019-02-09 12:40:21.534973 | ConsoleHandler | INFO] #11 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:158:22) -I/flutter ( 7457): [2019-02-09 12:40:21.535052 | ConsoleHandler | INFO] #12 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:138:7) -I/flutter ( 7457): [2019-02-09 12:40:21.535136 | ConsoleHandler | INFO] #13 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7) -I/flutter ( 7457): [2019-02-09 12:40:21.535216 | ConsoleHandler | INFO] #14 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7) -I/flutter ( 7457): [2019-02-09 12:40:21.535600 | ConsoleHandler | INFO] #15 _rootRunUnary (dart:async/zone.dart:1136:13) -I/flutter ( 7457): [2019-02-09 12:40:21.535753 | ConsoleHandler | INFO] #16 _CustomZone.runUnary (dart:async/zone.dart:1029:19) -I/flutter ( 7457): [2019-02-09 12:40:21.536008 | ConsoleHandler | INFO] #17 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7) -I/flutter ( 7457): [2019-02-09 12:40:21.536138 | ConsoleHandler | INFO] #18 _invoke1 (dart:ui/hooks.dart:170:10) -I/flutter ( 7457): [2019-02-09 12:40:21.536271 | ConsoleHandler | INFO] #19 _dispatchPointerDataPacket (dart:ui/hooks.dart:122:5) -I/flutter ( 7457): [2019-02-09 12:40:21.536375 | ConsoleHandler | INFO] -I/flutter ( 7457): [2019-02-09 12:40:21.536539 | ConsoleHandler | INFO] ====================================================================== +I/flutter ( 1792): [2023-09-26 20:40:59.075029 | Catcher 2 | INFO] ============================== CATCHER 2 LOG ============================== +I/flutter ( 1792): [2023-09-26 20:40:59.075175 | Catcher 2 | INFO] Crash occurred on 2023-09-26 20:40:57.818695 +I/flutter ( 1792): [2023-09-26 20:40:59.075220 | Catcher 2 | INFO] +I/flutter ( 1792): [2023-09-26 20:40:59.075378 | Catcher 2 | INFO] ------- DEVICE INFO ------- +I/flutter ( 1792): [2023-09-26 20:40:59.075755 | Catcher 2 | INFO] id: TQ3A.230705.001.B4 +I/flutter ( 1792): [2023-09-26 20:40:59.075830 | Catcher 2 | INFO] board: windows +I/flutter ( 1792): [2023-09-26 20:40:59.075874 | Catcher 2 | INFO] bootloader: unknown +I/flutter ( 1792): [2023-09-26 20:40:59.075901 | Catcher 2 | INFO] brand: Windows +I/flutter ( 1792): [2023-09-26 20:40:59.075940 | Catcher 2 | INFO] device: windows_x86_64 +I/flutter ( 1792): [2023-09-26 20:40:59.075966 | Catcher 2 | INFO] display: TQ3A.230705.001.B4 +I/flutter ( 1792): [2023-09-26 20:40:59.076003 | Catcher 2 | INFO] fingerprint: Windows/windows_x86_64/windows_x86_64:13/TQ3A.230705.001.B4/2307.40000.6.0:user/release-keys +I/flutter ( 1792): [2023-09-26 20:40:59.076047 | Catcher 2 | INFO] hardware: windows_x86_64 +I/flutter ( 1792): [2023-09-26 20:40:59.076089 | Catcher 2 | INFO] host: bba7b442c000000 +I/flutter ( 1792): [2023-09-26 20:40:59.076169 | Catcher 2 | INFO] isPhysicalDevice: true +I/flutter ( 1792): [2023-09-26 20:40:59.076224 | Catcher 2 | INFO] manufacturer: Microsoft Corporation +I/flutter ( 1792): [2023-09-26 20:40:59.076269 | Catcher 2 | INFO] model: Subsystem for Android(TM) +I/flutter ( 1792): [2023-09-26 20:40:59.076310 | Catcher 2 | INFO] product: windows_x86_64 +I/flutter ( 1792): [2023-09-26 20:40:59.076346 | Catcher 2 | INFO] tags: release-keys +I/flutter ( 1792): [2023-09-26 20:40:59.076371 | Catcher 2 | INFO] type: user +I/flutter ( 1792): [2023-09-26 20:40:59.076404 | Catcher 2 | INFO] versionBaseOs: +I/flutter ( 1792): [2023-09-26 20:40:59.076430 | Catcher 2 | INFO] versionCodename: REL +I/flutter ( 1792): [2023-09-26 20:40:59.076462 | Catcher 2 | INFO] versionIncremental: 2307.40000.6.0 +I/flutter ( 1792): [2023-09-26 20:40:59.076487 | Catcher 2 | INFO] versionPreviewSdk: 0 +I/flutter ( 1792): [2023-09-26 20:40:59.076521 | Catcher 2 | INFO] versionRelease: 13 +I/flutter ( 1792): [2023-09-26 20:40:59.076573 | Catcher 2 | INFO] versionSdk: 33 +I/flutter ( 1792): [2023-09-26 20:40:59.076611 | Catcher 2 | INFO] versionSecurityPatch: 2023-07-05 +I/flutter ( 1792): [2023-09-26 20:40:59.076640 | Catcher 2 | INFO] +I/flutter ( 1792): [2023-09-26 20:40:59.076759 | Catcher 2 | INFO] ------- APP INFO ------- +I/flutter ( 1792): [2023-09-26 20:40:59.076829 | Catcher 2 | INFO] environment: debug +I/flutter ( 1792): [2023-09-26 20:40:59.076867 | Catcher 2 | INFO] version: 1.0.0 +I/flutter ( 1792): [2023-09-26 20:40:59.076903 | Catcher 2 | INFO] appName: catcher_2_example +I/flutter ( 1792): [2023-09-26 20:40:59.076941 | Catcher 2 | INFO] buildNumber: 1 +I/flutter ( 1792): [2023-09-26 20:40:59.076978 | Catcher 2 | INFO] packageName: com.jhomlala.catcher_2_example +I/flutter ( 1792): [2023-09-26 20:40:59.077006 | Catcher 2 | INFO] +I/flutter ( 1792): [2023-09-26 20:40:59.077040 | Catcher 2 | INFO] ---------- ERROR ---------- +I/flutter ( 1792): [2023-09-26 20:40:59.077079 | Catcher 2 | INFO] FormatException: Test exception generated by Catcher 2 +I/flutter ( 1792): [2023-09-26 20:40:59.077125 | Catcher 2 | INFO] +I/flutter ( 1792): [2023-09-26 20:40:59.077267 | Catcher 2 | INFO] ------- STACK TRACE ------- +I/flutter ( 1792): [2023-09-26 20:40:59.077461 | Catcher 2 | INFO] #0 Catcher2.sendTestException (package:catcher_2/core/catcher_2.dart:706:5) +I/flutter ( 1792): [2023-09-26 20:40:59.077523 | Catcher 2 | INFO] #1 ChildWidget.generateError (package:catcher_2_example/main.dart:89:14) +I/flutter ( 1792): [2023-09-26 20:40:59.077562 | Catcher 2 | INFO] #2 _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1154:21) +I/flutter ( 1792): [2023-09-26 20:40:59.077588 | Catcher 2 | INFO] #3 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:275:24) +I/flutter ( 1792): [2023-09-26 20:40:59.077611 | Catcher 2 | INFO] #4 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:654:11) +I/flutter ( 1792): [2023-09-26 20:40:59.077643 | Catcher 2 | INFO] #5 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:311:5) +I/flutter ( 1792): [2023-09-26 20:40:59.077690 | Catcher 2 | INFO] #6 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:244:7) +I/flutter ( 1792): [2023-09-26 20:40:59.077719 | Catcher 2 | INFO] #7 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:630:9) +I/flutter ( 1792): [2023-09-26 20:40:59.077761 | Catcher 2 | INFO] #8 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:98:12) +I/flutter ( 1792): [2023-09-26 20:40:59.077811 | Catcher 2 | INFO] #9 PointerRouter._dispatchEventToRoutes. (package:flutter/src/gestures/pointer_router.dart:143:9) +I/flutter ( 1792): [2023-09-26 20:40:59.077869 | Catcher 2 | INFO] #10 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625:13) +I/flutter ( 1792): [2023-09-26 20:40:59.077908 | Catcher 2 | INFO] #11 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:141:18) +I/flutter ( 1792): [2023-09-26 20:40:59.077945 | Catcher 2 | INFO] #12 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:127:7) +I/flutter ( 1792): [2023-09-26 20:40:59.077969 | Catcher 2 | INFO] #13 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:488:19) +I/flutter ( 1792): [2023-09-26 20:40:59.078002 | Catcher 2 | INFO] #14 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:468:22) +I/flutter ( 1792): [2023-09-26 20:40:59.078036 | Catcher 2 | INFO] #15 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:333:11) +I/flutter ( 1792): [2023-09-26 20:40:59.078077 | Catcher 2 | INFO] #16 GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:413:7) +I/flutter ( 1792): [2023-09-26 20:40:59.078123 | Catcher 2 | INFO] #17 GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:376:5) +I/flutter ( 1792): [2023-09-26 20:40:59.078174 | Catcher 2 | INFO] #18 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:323:7) +I/flutter ( 1792): [2023-09-26 20:40:59.078209 | Catcher 2 | INFO] #19 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:292:9) +I/flutter ( 1792): [2023-09-26 20:40:59.078250 | Catcher 2 | INFO] #20 _invoke1 (dart:ui/hooks.dart:186:13) +I/flutter ( 1792): [2023-09-26 20:40:59.078286 | Catcher 2 | INFO] #21 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:424:7) +I/flutter ( 1792): [2023-09-26 20:40:59.078310 | Catcher 2 | INFO] #22 _dispatchPointerDataPacket (dart:ui/hooks.dart:119:31) +I/flutter ( 1792): [2023-09-26 20:40:59.078340 | Catcher 2 | INFO] +I/flutter ( 1792): [2023-09-26 20:40:59.078397 | Catcher 2 | INFO] ====================================================================== ```

Console handler output

-## Catcher usage +## Catcher 2 usage ### Adding navigator key -In order to make work Page Report Mode and Dialog Report Mode, you must include navigator key. Catcher plugin exposes key which must be included in your MaterialApp or WidgetApp: +In order to make work Page Report Mode and Dialog Report Mode, you must include navigator key. Catcher 2 plugin exposes key which must be included in your MaterialApp or WidgetApp: ```dart @override Widget build(BuildContext context) { return MaterialApp( //******************************************** - navigatorKey: Catcher.navigatorKey, + navigatorKey: Catcher2.navigatorKey, //******************************************** home: Scaffold( appBar: AppBar( @@ -241,35 +243,35 @@ In order to make work Page Report Mode and Dialog Report Mode, you must include } ``` -You need to provide this key, because Catcher needs context of navigator to show dialogs/pages. There is no need to include this navigator key if you won't use Page/Dialog Report Mode. -You can also provide your own navigator key if need to. You can provide it with Catcher constructor (see below). Please check custom navigator key example to see basic example. +You need to provide this key, because Catcher 2 needs context of navigator to show dialogs/pages. There is no need to include this navigator key if you won't use Page/Dialog Report Mode. +You can also provide your own navigator key if need to. You can provide it with Catcher 2 constructor (see below). Please check custom navigator key example to see basic example. -### Catcher configuration -Catcher instance needs rootWidget or runAppFunction in setup time. Please provide one of it. +### Catcher 2 configuration +Catcher 2 instance needs rootWidget or runAppFunction in setup time. Please provide one of it. * rootWidget (optional) - instance of your root application widget * runAppFunction (optional) - function where runApp() will be called -* debugConfig (optional) - config used when Catcher detects that application runs in debug mode -* releaseConfig (optional) - config used when Catcher detects that application runs in release mode -* profileConfig (optional) - config used when Catcher detects that application runs in profile mode -* enableLogger (optional) - enable/disable internal Catcher logs -* navigatorKey (optional) - provide optional navigator key from outside of Catcher -* ensureInitialized (optional) - should Catcher run WidgetsFlutterBinding.ensureInitialized() during initialization +* debugConfig (optional) - config used when Catcher 2 detects that application runs in debug mode +* releaseConfig (optional) - config used when Catcher 2 detects that application runs in release mode +* profileConfig (optional) - config used when Catcher 2 detects that application runs in profile mode +* enableLogger (optional) - enable/disable internal Catcher 2 logs +* navigatorKey (optional) - provide optional navigator key from outside of Catcher 2 +* ensureInitialized (optional) - should Catcher 2 run WidgetsFlutterBinding.ensureInitialized() during initialization ```dart main() { - CatcherOptions debugOptions = - CatcherOptions(DialogReportMode(), [ConsoleHandler()]); - CatcherOptions releaseOptions = CatcherOptions(DialogReportMode(), [ + Catcher2Options debugOptions = + Catcher2Options(DialogReportMode(), [ConsoleHandler()]); + Catcher2Options releaseOptions = Catcher2Options(DialogReportMode(), [ EmailManualHandler(["recipient@email.com"]) ]); - CatcherOptions profileOptions = CatcherOptions( + Catcher2Options profileOptions = Catcher2Options( NotificationReportMode(), [ConsoleHandler(), ToastHandler()], handlerTimeout: 10000, customParameters: {"example"c: "example_parameter"},); - Catcher(rootWidget: MyApp(), debugConfig: debugOptions, releaseConfig: releaseOptions, profileConfig: profileOptions, enableLogger: false, navigatorKey: navigatorKey); + Catcher2(rootWidget: MyApp(), debugConfig: debugOptions, releaseConfig: releaseOptions, profileConfig: profileOptions, enableLogger: false, navigatorKey: navigatorKey); } ``` -CatcherOptions parameters: +Catcher2Options parameters: handlers - list of handlers, which will process report, see handlers to get more information. handlerTimeout - timeout in milliseconds, this parameter describes max time of handling report by handler. reportMode - describes how error report will be shown to user, see report modes to get more information. @@ -284,23 +286,23 @@ filterFunction - function used to filter errors which shouldn't be handled. ### Report caught exception -Catcher won't process exceptions caught in try/catch block. You can send exception from try catch block to Catcher: +Catcher 2 won't process exceptions caught in try/catch block. You can send exception from try catch block to Catcher 2: ```dart try { ... } catch (error,stackTrace) { - Catcher.reportCheckedError(error, stackTrace); + Catcher2.reportCheckedError(error, stackTrace); } ``` ### Localization -Catcher allows to create localizations for Report modes. To add localization support, you need setup +Catcher 2 allows to create localizations for Report modes. To add localization support, you need setup few things: Add navigatorKey in your `MaterialApp`: ```dart - navigatorKey: Catcher.navigatorKey, + navigatorKey: Catcher2.navigatorKey, ``` Add Flutter localizations delegates and locales in your MaterialApp: @@ -315,9 +317,9 @@ Add Flutter localizations delegates and locales in your MaterialApp: ], ``` -Add localizationOptions in `CatcherOptions`: +Add localizationOptions in `Catcher2Options`: ```dart -CatcherOptions( +Catcher2Options( ... localizationOptions: [ LocalizationOptions("pl", notificationReportModeTitle: "My translation" ...), @@ -399,11 +401,11 @@ LocalizationOptions.buildDefaultDutchOptions(); Complete Example: ```dart import 'package:flutter/material.dart'; -import 'package:catcher/catcher.dart'; +import 'package:catcher_2/catcher_2.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; main() { - CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [ + Catcher2Options debugOptions = Catcher2Options(DialogReportMode(), [ ConsoleHandler(), HttpHandler(HttpRequestType.post, Uri.parse("https://httpstat.us/200"), printLogs: true) @@ -425,11 +427,11 @@ main() { toastHandlerDescription: "Wystąpił błąd:", ) ]); - CatcherOptions releaseOptions = CatcherOptions(NotificationReportMode(), [ + Catcher2Options releaseOptions = Catcher2Options(NotificationReportMode(), [ EmailManualHandler(["recipient@email.com"]) ]); - Catcher(rootWidget: MyApp(), debugConfig: debugOptions, releaseConfig: releaseOptions); + Catcher2(rootWidget: MyApp(), debugConfig: debugOptions, releaseConfig: releaseOptions); } class MyApp extends StatefulWidget { @@ -446,7 +448,7 @@ class _MyAppState extends State { @override Widget build(BuildContext context) { return MaterialApp( - navigatorKey: Catcher.navigatorKey, + navigatorKey: Catcher2.navigatorKey, localizationsDelegates: [ GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, @@ -504,7 +506,7 @@ See localization options to change default texts.

-
+
Dialog report mode

@@ -522,7 +524,7 @@ See localization options to change default texts.

-
+
Page report mode

@@ -550,9 +552,9 @@ ConsoleHandler( ```dart I/flutter ( 4820): ------- APP INFO ------- I/flutter ( 4820): version: 1.0 -I/flutter ( 4820): appName: catcher_example +I/flutter ( 4820): appName: catcher_2_example I/flutter ( 4820): buildNumber: 1 -I/flutter ( 4820): packageName: com.jhomlala.catcherexample +I/flutter ( 4820): packageName: com.jhomlala.catcher_2_example I/flutter ( 4820): ``` @@ -585,15 +587,15 @@ I/flutter ( 4820): versionSdk: 28 I/flutter ( 4820): versionSecurityPatch: 2018-08-05 ``` -* enableCustomParameters (optional) - display in log section with custom parameters passed to Catcher constructor +* enableCustomParameters (optional) - display in log section with custom parameters passed to Catcher 2 constructor * enableStackTrace (optional) - display in log section with stack trace: ```dart I/flutter ( 5073): ------- STACK TRACE ------- -I/flutter ( 5073): #0 _MyAppState.generateError (package:catcher_example/main.dart:38:5) +I/flutter ( 5073): #0 _MyAppState.generateError (package:catcher_2_example/main.dart:38:5) I/flutter ( 5073): -I/flutter ( 5073): #1 _MyAppState.build. (package:catcher_example/main.dart:31:69) +I/flutter ( 5073): #1 _MyAppState.build. (package:catcher_2_example/main.dart:31:69) I/flutter ( 5073): #2 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:507:14) I/flutter ( 5073): #3 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:562:30) I/flutter ( 5073): #4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24) @@ -639,7 +641,7 @@ Email Manual Handler parameters: Email handler can be used to send automatically email with error reports. Email handler has multiple configuration parameters. Few of them are required, other are optional. These parameters are required: ```dart - EmailAutoHandler("smtp.gmail.com", 587, "somefakeemail@gmail.com", "Catcher", + EmailAutoHandler("smtp.gmail.com", 587, "somefakeemail@gmail.com", "Catcher 2", "FakePassword", ["myemail@gmail.com"]) ``` We need to setup email smtp server, email account and recipient. Currently, only Gmail was tested and worked. You can try use other email providers, but there can be errors. @@ -648,7 +650,7 @@ List of all parameters: * smtpHost (required) - host address of your email, for example host for gmail is smtp.gmail.com * smtpPort (required) - smtp port of your email, for example port for gmail is 587 -* senderEmail (required) - email from which Catcher will send email (it will be sender of error emails) +* senderEmail (required) - email from which Catcher 2 will send email (it will be sender of error emails) * senderName (required) - name of sender email * senderPassword (required) - password for sender email * recipients (required) - list which contains recipient emails @@ -664,7 +666,7 @@ List of all parameters: Example email:

- +

#### Http Handler @@ -687,10 +689,10 @@ All parameters list: * enableCustomParameters (optional) - please look in console handler description You can try using example backend server which handles logs. It's written in Java 8 and Spring Framework and uses material design. -You can find code of backend server here: https://github.com/jhomlala/catcher/tree/master/backend +You can find code of backend server here: https://github.com/ThexXTURBOXx/catcher_2/tree/master/backend

- +

Note: Remember to add Internet permission in Android Manifest: @@ -704,12 +706,12 @@ File handler allows to store logs in file. Minimal example: ```dart main() { String path = "/storage/emulated/0/log.txt"; - CatcherOptions debugOptions = CatcherOptions( + Catcher2Options debugOptions = Catcher2Options( DialogReportMode(), [FileHandler(File(path), printLogs: true)]); - CatcherOptions releaseOptions = - CatcherOptions(DialogReportMode(), [FileHandler(File(path))]); + Catcher2Options releaseOptions = + Catcher2Options(DialogReportMode(), [FileHandler(File(path))]); - Catcher(rootWidget: MyApp(), debugConfig: debugOptions, releaseConfig: releaseOptions); + Catcher2(rootWidget: MyApp(), debugConfig: debugOptions, releaseConfig: releaseOptions); } ``` @@ -722,13 +724,13 @@ All parameters list: * printLogs (optional) - enable/disable debug logs * handleWhenRejected - please look in console handler description -Example of logging to file in external directory: https://github.com/jhomlala/catcher/blob/master/example/lib/file_example.dart +Example of logging to file in external directory: https://github.com/ThexXTURBOXx/catcher_2/blob/master/example/lib/file_example.dart -If you want to get file path with path_provider lib, you need to call Catcher constructor with -ensureInitialized = true. Then you need to pass your catcher config with updateConfig. +If you want to get file path with path_provider lib, you need to call Catcher 2 constructor with +ensureInitialized = true. Then you need to pass your catcher 2 config with updateConfig. This is required because WidgetBindings ensureInitialized must be called first before accessing path_provider methods. -See example here: https://github.com/jhomlala/catcher/blob/master/example/lib/file_example.dart +See example here: https://github.com/ThexXTURBOXx/catcher_2/blob/master/example/lib/file_example.dart #### Toast Handler Toast handler allows to show short message in toast. Minimal example: @@ -743,7 +745,7 @@ All parameters list: * handleWhenRejected - please look in console handler description

- +

#### Sentry Handler @@ -753,13 +755,13 @@ Sentry.io page and then copy DSN link. Example: ```dart main() { - CatcherOptions debugOptions = CatcherOptions( + Catcher2Options debugOptions = Catcher2Options( DialogReportMode(), [SentryHandler(SentryClient("YOUR_DSN_HERE"))]); - CatcherOptions releaseOptions = CatcherOptions(NotificationReportMode(), [ + Catcher2Options releaseOptions = Catcher2Options(NotificationReportMode(), [ EmailManualHandler(["recipient@email.com"]) ]); - Catcher(rootWidget: MyApp(), debugConfig: debugOptions, releaseConfig: releaseOptions); + Catcher2(rootWidget: MyApp(), debugConfig: debugOptions, releaseConfig: releaseOptions); } ``` @@ -768,8 +770,8 @@ All parameters list: * enableDeviceParameters (optional) - please look in console handler description * enableApplicationParameters (optional) - please look in console handler description * enableCustomParameters (optional) - please look in console handler description -* customEnvironment (optional) - custom environment string, if null, Catcher will generate it -* customRelease (optional) - custom release string , if null, Catcher will generate it +* customEnvironment (optional) - custom environment string, if null, Catcher 2 will generate it +* customRelease (optional) - custom release string , if null, Catcher 2 will generate it * printLogs (optional) - enable/disable debug logs #### Slack Handler @@ -780,11 +782,11 @@ works: https://api.slack.com/incoming-webhooks. ```dart main() { - CatcherOptions debugOptions = CatcherOptions(SilentReportMode(), [ + Catcher2Options debugOptions = Catcher2Options(SilentReportMode(), [ SlackHandler( "", - "#catcher", - username: "CatcherTest", + "#catcher2", + username: "Catcher2Test", iconEmoji: ":thinking_face:", enableDeviceParameters: true, enableApplicationParameters: true, @@ -792,13 +794,13 @@ main() { enableStackTrace: true, printLogs: true), ]); - Catcher(rootWidget: MyApp(), debugConfig: debugOptions); + Catcher2(rootWidget: MyApp(), debugConfig: debugOptions); } ``` All parameters list: * webhookUrl (required) - url of your webhook -* channel (required) - your channel name (i.e. #catcher) +* channel (required) - your channel name (i.e. #catcher2) * username (optional) - name of the integration bot * iconEmoji (optional) - avatar of the integration bot * enableDeviceParameters (optional) - please look in console handler description @@ -814,7 +816,7 @@ works: https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webho ```dart main() { - CatcherOptions debugOptions = CatcherOptions(SilentReportMode(), [ + Catcher2Options debugOptions = Catcher2Options(SilentReportMode(), [ DiscordHandler( "", enableDeviceParameters: true, @@ -824,7 +826,7 @@ main() { printLogs: true), ]); - Catcher(rootWidget: MyApp(), debugConfig: debugOptions); + Catcher2(rootWidget: MyApp(), debugConfig: debugOptions); } ``` @@ -843,7 +845,7 @@ Snackbar handler allows to show customized snackbar message. ```dart void main() { - CatcherOptions debugOptions = CatcherOptions(DialogReportMode(), [ + Catcher2Options debugOptions = Catcher2Options(DialogReportMode(), [ SnackbarHandler( Duration(seconds: 5), backgroundColor: Colors.green, @@ -864,7 +866,7 @@ void main() { ), ]); - Catcher( + Catcher2( runAppFunction: () { runApp(MyApp()); }, @@ -898,7 +900,7 @@ Crashlytics handler has been removed from core package. You can re-enable it in Explicit exception report handler map allows you to setup report handler for specific exception. For example if you want to setup Console Handler for FormatException, you can write: ```dart var explicitMap = {"FormatException": ConsoleHandler()}; -CatcherOptions debugOptions = CatcherOptions( +Catcher2Options debugOptions = Catcher2Options( DialogReportMode(), [ ConsoleHandler(), @@ -914,7 +916,7 @@ Now if `FormatException` will be caught, then Console Handler will be used. Warn Same as explicit report handler map, but it's for report mode. Let's say you want to use specific report mode for some exception: ```dart var explicitReportModesMap = {"FormatException": NotificationReportMode()}; - CatcherOptions debugOptions = CatcherOptions( + Catcher2Options debugOptions = Catcher2Options( DialogReportMode(), [ ConsoleHandler(), @@ -923,7 +925,7 @@ Same as explicit report handler map, but it's for report mode. Let's say you wan ], explicitExceptionReportModesMap: explicitReportModesMap,); ``` -When `FormatException` will be caught, then NotificationReportMode will be used. For other exceptions, Catcher will use DialogReportMode. +When `FormatException` will be caught, then NotificationReportMode will be used. For other exceptions, Catcher 2 will use DialogReportMode. @@ -933,10 +935,10 @@ You can add error widget which will replace red screen of death. To add this int @override Widget build(BuildContext context) { return MaterialApp( - navigatorKey: Catcher.navigatorKey, + navigatorKey: Catcher2.navigatorKey, //******************************************** builder: (BuildContext context, Widget widget) { - Catcher.addDefaultErrorWidget( + Catcher2.addDefaultErrorWidget( showStacktrace: true, title: "Custom error title", description: "Custom error description", @@ -952,7 +954,7 @@ You can add error widget which will replace red screen of death. To add this int ); } ``` -You need to add in your MaterialApp or CupertinoApp builder method with ```Catcher.addDefaultErrorWidget()```. This will add error handler for each widget in your app. +You need to add in your MaterialApp or CupertinoApp builder method with ```Catcher2.addDefaultErrorWidget()```. This will add error handler for each widget in your app. You can provide optional parameters: * showStacktrace - show/hide stacktrace @@ -968,7 +970,7 @@ Error widget will replace your widget if he fails to render. If width of widget With error widgetWithout error widget - +

@@ -976,7 +978,7 @@ Error widget will replace your widget if he fails to render. If width of widget ### Current config You can get currently used config by using: ```dart -CatcherOptions options = catcher.getCurrentConfig(); +Catcher2Options options = catcher2.getCurrentConfig(); ``` This can be used for example to change custom parameters in runtime. @@ -984,16 +986,16 @@ This can be used for example to change custom parameters in runtime. Send test exception: ```dart -Catcher.sendTestException(); +Catcher2.sendTestException(); ``` ### Update config -You can update Catcher config during runtime: +You can update Catcher 2 config during runtime: ```dart -///Catcher instance initialized -Catcher catcher; -catcher.updateConfig( - debugConfig: CatcherOptions( +/// Catcher 2 instance initialized +Catcher2 catcher2; +catcher2.updateConfig( + debugConfig: Catcher2Options( PageReportMode(), [ConsoleHandler()], ), @@ -1001,13 +1003,13 @@ catcher.updateConfig( ``` ### Screenshots -Catcher can create screenshots automatically and include them in report handlers. To add screenshot -support in your app, simply wrap your root widget with CatcherScreenshot widget: +Catcher 2 can create screenshots automatically and include them in report handlers. To add screenshot +support in your app, simply wrap your root widget with Catcher2Screenshot widget: ```dart MaterialApp( - navigatorKey: Catcher.navigatorKey, - home: CatcherScreenshot( - catcher: Catcher.getInstance(), + navigatorKey: Catcher2.navigatorKey, + home: Catcher2Screenshot( + catcher2: Catcher2.getInstance(), child: Scaffold( appBar: AppBar( title: const Text('Plugin example app'), @@ -1017,10 +1019,10 @@ MaterialApp( ), ); ``` -Also you need to provide directory path, where Catcher will store screenshot files: +Also you need to provide directory path, where Catcher 2 will store screenshot files: ```dart - CatcherOptions debugOptions = CatcherOptions( + Catcher2Options debugOptions = Catcher2Options( DialogReportMode(), [ ToastHandler(), diff --git a/analysis_options.yaml b/analysis_options.yaml index 024f2d4b..8a52cd1c 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,16 +1,242 @@ -#include: package:lint/analysis_options_package.yaml +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +analyzer: + errors: + # treat missing required parameters as a warning (not a hint) + missing_required_param: warning + # treat missing returns as a warning (not a hint) + missing_return: warning + # allow having TODOs in the code + todo: ignore + # allow self-reference to deprecated members (we do this because otherwise we have + # to annotate every member in every test, assert, etc, when we deprecate something) + deprecated_member_use_from_same_package: ignore + # Ignore analyzer hints for updating pubspecs when using Future or + # Stream and not importing dart:async + # Please see https://github.com/flutter/flutter/pull/24528 for details. + sdk_version_async_exported_from_core: ignore + # Ignore imports due to f***ed up import hierarchies. + unnecessary_import: ignore + exclude: + - "bin/cache/**" + # the following two are relative to the stocks example and the flutter package respectively + # see https://github.com/dart-lang/sdk/issues/28463 + - "lib/i18n/messages_*.dart" + - "lib/src/http/**" linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. rules: - close_sinks: true - 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 - sort_pub_dependencies: false - use_build_context_synchronously: false - use_setters_to_change_properties: false + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + - always_declare_return_types + - always_put_control_body_on_new_line + # - always_put_required_named_parameters_first + # - always_specify_types + - always_use_package_imports + - annotate_overrides + # - avoid_annotating_with_dynamic + - avoid_bool_literals_in_conditional_expressions + # - avoid_catches_without_on_clauses + - avoid_catching_errors + # - avoid_classes_with_only_static_members + - avoid_double_and_int_checks + # - avoid_dynamic_calls + - avoid_empty_else + - avoid_equals_and_hash_code_on_mutable_classes + - avoid_escaping_inner_quotes + - avoid_field_initializers_in_const_classes + - avoid_function_literals_in_foreach_calls + # - avoid_implementing_value_types + - avoid_init_to_null + - avoid_js_rounded_ints + - avoid_multiple_declarations_per_line + - avoid_null_checks_in_equality_operators + - avoid_positional_boolean_parameters + - avoid_print + - avoid_private_typedef_functions + # - avoid_redundant_argument_values + - avoid_relative_lib_imports + - avoid_renaming_method_parameters + - avoid_return_types_on_setters + - avoid_returning_null_for_void + - avoid_returning_this + - avoid_setters_without_getters + - avoid_shadowing_type_parameters + - avoid_single_cascade_in_expression_statements + - avoid_slow_async_io + - avoid_type_to_string + - avoid_types_as_parameter_names + - avoid_types_on_closure_parameters + - avoid_unnecessary_containers + - avoid_unused_constructor_parameters + - avoid_void_async + - avoid_web_libraries_in_flutter + - await_only_futures + - camel_case_extensions + - camel_case_types + - cancel_subscriptions + # - cascade_invocations + - cast_nullable_to_non_nullable + - close_sinks + - collection_methods_unrelated_type + - comment_references + - constant_identifier_names + - control_flow_in_finally + - curly_braces_in_flow_control_structures + - depend_on_referenced_packages + - deprecated_consistency + # - diagnostic_describe_all_properties + - directives_ordering + - do_not_use_environment + - empty_catches + - empty_constructor_bodies + - empty_statements + - eol_at_end_of_file + - exhaustive_cases + - file_names + - flutter_style_todos + - hash_and_equals + - implementation_imports + - join_return_with_assignment + - leading_newlines_in_multiline_strings + - library_names + - library_prefixes + - library_private_types_in_public_api + - lines_longer_than_80_chars + - literal_only_boolean_expressions + - missing_whitespace_between_adjacent_strings + - no_adjacent_strings_in_list + # - no_default_cases + - no_duplicate_case_values + - no_leading_underscores_for_library_prefixes + - no_leading_underscores_for_local_identifiers + - no_logic_in_create_state + - no_runtimeType_toString + - non_constant_identifier_names + - noop_primitive_operations + - null_check_on_nullable_type_parameter + - null_closures + - omit_local_variable_types + - one_member_abstracts + - only_throw_errors + - overridden_fields + - package_api_docs + - package_names + - package_prefixed_library_names + - parameter_assignments + - prefer_adjacent_string_concatenation + - prefer_asserts_in_initializer_lists + - prefer_asserts_with_message + - prefer_collection_literals + - prefer_conditional_assignment + - prefer_const_constructors + - prefer_const_constructors_in_immutables + - prefer_const_declarations + - prefer_const_literals_to_create_immutables + - prefer_constructors_over_static_methods + - prefer_contains + # - prefer_double_quotes + - prefer_expression_function_bodies + - prefer_final_fields + - prefer_final_in_for_each + - prefer_final_locals + # - prefer_final_parameters + - prefer_for_elements_to_map_fromIterable + - prefer_foreach + - prefer_function_declarations_over_variables + - prefer_generic_function_type_aliases + - prefer_if_elements_to_conditional_expressions + - prefer_if_null_operators + - prefer_initializing_formals + - prefer_inlined_adds + - prefer_int_literals + - prefer_interpolation_to_compose_strings + - prefer_is_empty + - prefer_is_not_empty + - prefer_is_not_operator + - prefer_iterable_whereType + - prefer_mixin + - prefer_null_aware_method_calls + - prefer_null_aware_operators + # - prefer_relative_imports + - prefer_single_quotes + - prefer_spread_collections + - prefer_typing_uninitialized_variables + - prefer_void_to_null + - provide_deprecation_message + # - public_member_api_docs + - recursive_getters + - require_trailing_commas + - sized_box_for_whitespace + - slash_for_doc_comments + - sort_child_properties_last + # - sort_constructors_first + - sort_pub_dependencies + - sort_unnamed_constructors_first + - test_types_in_equals + - throw_in_finally + - tighten_type_of_initializing_formals + - type_annotate_public_apis + - type_init_formals + - unawaited_futures + - unnecessary_await_in_return + - unnecessary_brace_in_string_interps + - unnecessary_const + - unnecessary_constructor_name + # - unnecessary_final + - unnecessary_getters_setters + - unnecessary_lambdas + - unnecessary_late + - unnecessary_new + - unnecessary_null_aware_assignments + - unnecessary_null_checks + - unnecessary_null_in_if_null_operators + - unnecessary_nullable_for_final_variable_declarations + - unnecessary_overrides + - unnecessary_parenthesis + - unnecessary_raw_strings + - unnecessary_statements + - unnecessary_string_escapes + - unnecessary_string_interpolations + - unnecessary_this + - unrelated_type_equality_checks + - unsafe_html + - use_build_context_synchronously + - use_full_hex_values_for_flutter_colors + - use_function_type_syntax_for_parameters + - use_if_null_to_convert_nulls_to_bools + - use_is_even_rather_than_modulo + - use_key_in_widget_constructors + - use_late_for_private_fields_and_variables + - use_named_constants + - use_raw_strings + - use_rethrow_when_possible + - use_setters_to_change_properties + - use_string_buffers + - use_test_throws_matchers + - use_to_and_as_if_applicable + - valid_regexps + - void_checks + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore deleted file mode 100644 index c6cbe562..00000000 --- a/android/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/workspace.xml -/.idea/libraries -.DS_Store -/build -/captures diff --git a/android/build.gradle b/android/build.gradle deleted file mode 100644 index 3d8a84d6..00000000 --- a/android/build.gradle +++ /dev/null @@ -1,43 +0,0 @@ -group 'com.jhomlala.catcher' -version '1.0-SNAPSHOT' - -buildscript { - ext.kotlin_version = '1.7.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -rootProject.allprojects { - repositories { - google() - mavenCentral() - } -} - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' - -android { - compileSdkVersion 34 - if (project.android.hasProperty("namespace")) { - namespace 'com.jhomlala.catcher' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - defaultConfig { - minSdkVersion 19 - } -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/android/gradle.properties b/android/gradle.properties deleted file mode 100644 index 94adc3a3..00000000 --- a/android/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.useAndroidX=true -android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index afba1092..00000000 Binary files a/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 4e86b927..00000000 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip -networkTimeout=10000 -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/android/gradlew b/android/gradlew deleted file mode 100644 index 65dcd68d..00000000 --- a/android/gradlew +++ /dev/null @@ -1,244 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/android/gradlew.bat b/android/gradlew.bat deleted file mode 100644 index 6689b85b..00000000 --- a/android/gradlew.bat +++ /dev/null @@ -1,92 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/android/settings.gradle b/android/settings.gradle deleted file mode 100644 index ca46e998..00000000 --- a/android/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'catcher' diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml deleted file mode 100644 index a8f7aee0..00000000 --- a/android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,3 +0,0 @@ - - diff --git a/android/src/main/kotlin/com/jhomlala/catcher/CatcherPlugin.kt b/android/src/main/kotlin/com/jhomlala/catcher/CatcherPlugin.kt deleted file mode 100644 index f18eb4bf..00000000 --- a/android/src/main/kotlin/com/jhomlala/catcher/CatcherPlugin.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.jhomlala.catcher - -import androidx.annotation.NonNull - -import io.flutter.embedding.engine.plugins.FlutterPlugin -import io.flutter.plugin.common.MethodCall -import io.flutter.plugin.common.MethodChannel -import io.flutter.plugin.common.MethodChannel.MethodCallHandler -import io.flutter.plugin.common.MethodChannel.Result -import io.flutter.plugin.common.PluginRegistry.Registrar - -/** CatcherPlugin */ - -class CatcherPlugin: FlutterPlugin, MethodCallHandler { /// The MethodChannel that will the communication between Flutter and native Android - /// - /// This local reference serves to register the plugin with the Flutter Engine and unregister it - /// when the Flutter Engine is detached from the Activity - private lateinit var channel : MethodChannel - - override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { - channel = MethodChannel(flutterPluginBinding.binaryMessenger, "catcher") - channel.setMethodCallHandler(this) - } - - override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { - if (call.method == "getPlatformVersion") { - result.success("Android ${android.os.Build.VERSION.RELEASE}") - } else { - result.notImplemented() - } - } - - override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { - channel.setMethodCallHandler(null) - } -} diff --git a/backend/.mvn/wrapper/maven-wrapper.jar b/backend/.mvn/wrapper/maven-wrapper.jar index 01e67997..cb28b0e3 100644 Binary files a/backend/.mvn/wrapper/maven-wrapper.jar and b/backend/.mvn/wrapper/maven-wrapper.jar differ diff --git a/backend/.mvn/wrapper/maven-wrapper.properties b/backend/.mvn/wrapper/maven-wrapper.properties index cd0d451c..ac184013 100644 --- a/backend/.mvn/wrapper/maven-wrapper.properties +++ b/backend/.mvn/wrapper/maven-wrapper.properties @@ -1 +1,18 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/backend/mvnw b/backend/mvnw index 5551fde8..8d937f4c 100644 --- a/backend/mvnw +++ b/backend/mvnw @@ -19,7 +19,7 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script +# Apache Maven Wrapper startup batch script, version 3.2.0 # # Required ENV vars: # ------------------ @@ -27,7 +27,6 @@ # # Optional ENV vars # ----------------- -# M2_HOME - location of maven2's installed home dir # MAVEN_OPTS - parameters passed to the Java VM when running Maven # e.g. to debug Maven itself, use # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @@ -36,6 +35,10 @@ if [ -z "$MAVEN_SKIP_RC" ] ; then + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + if [ -f /etc/mavenrc ] ; then . /etc/mavenrc fi @@ -50,7 +53,7 @@ fi cygwin=false; darwin=false; mingw=false -case "`uname`" in +case "$(uname)" in CYGWIN*) cygwin=true ;; MINGW*) mingw=true;; Darwin*) darwin=true @@ -58,9 +61,9 @@ case "`uname`" in # See https://developer.apple.com/library/mac/qa/qa1170/_index.html if [ -z "$JAVA_HOME" ]; then if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" + JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME else - export JAVA_HOME="/Library/Java/Home" + JAVA_HOME="/Library/Java/Home"; export JAVA_HOME fi fi ;; @@ -68,69 +71,38 @@ esac if [ -z "$JAVA_HOME" ] ; then if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` + JAVA_HOME=$(java-config --jre-home) fi fi -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - # For Cygwin, ensure paths are in UNIX format before anything is touched if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + JAVA_HOME=$(cygpath --unix "$JAVA_HOME") [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` + CLASSPATH=$(cygpath --path --unix "$CLASSPATH") fi # For Mingw, ensure paths are in UNIX format before anything is touched if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? + [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] && + JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)" fi if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + readLink=$(which readlink) + if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + javaHome="$(dirname "\"$javaExecutable\"")" + javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac" else - javaExecutable="`readlink -f \"$javaExecutable\"`" + javaExecutable="$(readlink -f "\"$javaExecutable\"")" fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` + javaHome="$(dirname "\"$javaExecutable\"")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') JAVA_HOME="$javaHome" export JAVA_HOME fi @@ -146,7 +118,7 @@ if [ -z "$JAVACMD" ] ; then JAVACMD="$JAVA_HOME/bin/java" fi else - JAVACMD="`which java`" + JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)" fi fi @@ -160,12 +132,9 @@ if [ -z "$JAVA_HOME" ] ; then echo "Warning: JAVA_HOME environment variable is not set." fi -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - # traverses directory structure from process work directory to filesystem root # first directory with .mvn subdirectory is considered project base directory find_maven_basedir() { - if [ -z "$1" ] then echo "Path not specified to find_maven_basedir" @@ -181,76 +150,99 @@ find_maven_basedir() { fi # workaround for JBEAP-8937 (on Solaris 10/Sparc) if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` + wdir=$(cd "$wdir/.." || exit 1; pwd) fi # end of workaround done - echo "${basedir}" + printf '%s' "$(cd "$basedir" || exit 1; pwd)" } # concatenates all lines of a file concat_lines() { if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' < "$1" fi } -BASE_DIR=`find_maven_basedir "$(pwd)"` +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") if [ -z "$BASE_DIR" ]; then exit 1; fi +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR +log "$MAVEN_PROJECTBASEDIR" + ########################################################################################## # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central # This allows using the maven wrapper in projects that prohibit checking in binary data. ########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + log "Couldn't find $wrapperJarPath, downloading it ..." + + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" fi - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + while IFS="=" read -r key value; do + # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' ) + safeValue=$(echo "$value" | tr -d '\r') + case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;; esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" + done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" fi - wget "$jarUrl" -O "$wrapperJarPath" elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" fi - curl -o "$wrapperJarPath" "$jarUrl" else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + log " - Compiling MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/javac" "$javaSource") fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + if [ -e "$javaClass" ]; then + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" fi fi fi @@ -259,28 +251,58 @@ fi # End of extension ########################################################################################## -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;; + esac +done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi fi + MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" # For Cygwin, switch paths to Windows format before running java if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + CLASSPATH=$(cygpath --path --windows "$CLASSPATH") [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` + MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") fi +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" +export MAVEN_CMD_LINE_ARGS + WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain +# shellcheck disable=SC2086 # safe args exec "$JAVACMD" \ $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/backend/mvnw.cmd b/backend/mvnw.cmd index e5cfb0ae..c4586b56 100644 --- a/backend/mvnw.cmd +++ b/backend/mvnw.cmd @@ -18,15 +18,14 @@ @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script +@REM Apache Maven Wrapper startup batch script, version 3.2.0 @REM @REM Required ENV vars: @REM JAVA_HOME - location of a JDK home dir @REM @REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven @REM e.g. to debug Maven itself, use @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 @@ -37,7 +36,7 @@ @echo off @REM set title of command window title %0 -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% @REM set %HOME% to equivalent of $HOME @@ -46,8 +45,8 @@ if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") @REM Execute a user defined script before this one if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre @REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* :skipRcPre @setlocal @@ -120,24 +119,69 @@ SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" -FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B ) @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central @REM This allows using the maven wrapper in projects that prohibit checking in binary data. if exist %WRAPPER_JAR% ( - echo Found %WRAPPER_JAR% + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) ) else ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" - echo Finished downloading %WRAPPER_JAR% + if not "%MVNW_REPOURL%" == "" ( + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %WRAPPER_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) ) @REM End of extension -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* if ERRORLEVEL 1 goto error goto end @@ -147,15 +191,15 @@ set ERROR_CODE=1 :end @endlocal & set ERROR_CODE=%ERROR_CODE% -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost @REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" :skipRcPost @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause +if "%MAVEN_BATCH_PAUSE%"=="on" pause -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% -exit /B %ERROR_CODE% +cmd /C exit /B %ERROR_CODE% diff --git a/backend/pom.xml b/backend/pom.xml index 17f7ec64..fef03929 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -6,17 +6,17 @@ org.springframework.boot spring-boot-starter-parent - 2.1.2.RELEASE + 3.1.4 - com.jhomlala.catcher + com.jhomlala.catcher_2 backend 0.0.1-SNAPSHOT backend - Backend for Catcher plugin + Backend for Catcher 2 plugin - 1.8 + 8 diff --git a/backend/src/main/java/com/jhomlala/catcher/backend/BackendApplication.java b/backend/src/main/java/com/jhomlala/catcher_2/backend/BackendApplication.java similarity index 87% rename from backend/src/main/java/com/jhomlala/catcher/backend/BackendApplication.java rename to backend/src/main/java/com/jhomlala/catcher_2/backend/BackendApplication.java index 3f18a3d1..f4754dba 100644 --- a/backend/src/main/java/com/jhomlala/catcher/backend/BackendApplication.java +++ b/backend/src/main/java/com/jhomlala/catcher_2/backend/BackendApplication.java @@ -1,4 +1,4 @@ -package com.jhomlala.catcher.backend; +package com.jhomlala.catcher_2.backend; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/backend/src/main/java/com/jhomlala/catcher/backend/ReportLog.java b/backend/src/main/java/com/jhomlala/catcher_2/backend/ReportLog.java similarity index 98% rename from backend/src/main/java/com/jhomlala/catcher/backend/ReportLog.java rename to backend/src/main/java/com/jhomlala/catcher_2/backend/ReportLog.java index 65418ab7..fe124701 100644 --- a/backend/src/main/java/com/jhomlala/catcher/backend/ReportLog.java +++ b/backend/src/main/java/com/jhomlala/catcher_2/backend/ReportLog.java @@ -1,4 +1,4 @@ -package com.jhomlala.catcher.backend; +package com.jhomlala.catcher_2.backend; import java.sql.Timestamp; import java.util.Map; diff --git a/backend/src/main/java/com/jhomlala/catcher/backend/ReportLogController.java b/backend/src/main/java/com/jhomlala/catcher_2/backend/ReportLogController.java similarity index 96% rename from backend/src/main/java/com/jhomlala/catcher/backend/ReportLogController.java rename to backend/src/main/java/com/jhomlala/catcher_2/backend/ReportLogController.java index e067625d..1f20b4b9 100644 --- a/backend/src/main/java/com/jhomlala/catcher/backend/ReportLogController.java +++ b/backend/src/main/java/com/jhomlala/catcher_2/backend/ReportLogController.java @@ -1,4 +1,4 @@ -package com.jhomlala.catcher.backend; +package com.jhomlala.catcher_2.backend; import java.util.ArrayList; import java.util.Collections; diff --git a/backend/src/main/java/com/jhomlala/catcher/backend/ReportLogService.java b/backend/src/main/java/com/jhomlala/catcher_2/backend/ReportLogService.java similarity index 89% rename from backend/src/main/java/com/jhomlala/catcher/backend/ReportLogService.java rename to backend/src/main/java/com/jhomlala/catcher_2/backend/ReportLogService.java index 2b2734d8..b9c70f42 100644 --- a/backend/src/main/java/com/jhomlala/catcher/backend/ReportLogService.java +++ b/backend/src/main/java/com/jhomlala/catcher_2/backend/ReportLogService.java @@ -1,4 +1,4 @@ -package com.jhomlala.catcher.backend; +package com.jhomlala.catcher_2.backend; import java.util.ArrayList; import java.util.List; diff --git a/backend/src/main/resources/templates/reports.html b/backend/src/main/resources/templates/reports.html index ea3cb2bb..00a534c9 100644 --- a/backend/src/main/resources/templates/reports.html +++ b/backend/src/main/resources/templates/reports.html @@ -5,9 +5,9 @@ - - + Reports diff --git a/backend/src/test/java/com/jhomlala/catcher/backend/BackendApplicationTests.java b/backend/src/test/java/com/jhomlala/catcher/backend/BackendApplicationTests.java deleted file mode 100644 index 2454f25f..00000000 --- a/backend/src/test/java/com/jhomlala/catcher/backend/BackendApplicationTests.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.jhomlala.catcher.backend; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class BackendApplicationTests { - - @Test - public void contextLoads() { - } - -} - diff --git a/backend/src/test/java/com/jhomlala/catcher_2/backend/BackendApplicationTests.java b/backend/src/test/java/com/jhomlala/catcher_2/backend/BackendApplicationTests.java new file mode 100644 index 00000000..44be30a0 --- /dev/null +++ b/backend/src/test/java/com/jhomlala/catcher_2/backend/BackendApplicationTests.java @@ -0,0 +1,17 @@ +package com.jhomlala.catcher_2.backend; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +@ExtendWith(SpringExtension.class) +@SpringBootTest +public class BackendApplicationTests { + + @Test + public void contextLoads() { + } + +} + diff --git a/example/.gitignore b/example/.gitignore index 0fa6b675..a8e938c0 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -8,6 +8,7 @@ .buildlog/ .history .svn/ +migrate_working_dir/ # IntelliJ related *.iml diff --git a/example/README.md b/example/README.md index 953a7218..f849bfed 100644 --- a/example/README.md +++ b/example/README.md @@ -1,4 +1,4 @@ -# catcher_example +# catcher_2_example A new Flutter application. diff --git a/example/android/.gitignore b/example/android/.gitignore index 26bd9ae3..6f568019 100644 --- a/example/android/.gitignore +++ b/example/android/.gitignore @@ -1,8 +1,13 @@ +gradle-wrapper.jar /.gradle /captures/ +/gradlew +/gradlew.bat /local.properties GeneratedPluginRegistrant.java # Remember to never publicly share your keystore. # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app key.properties +**/*.keystore +**/*.jks diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 77b9c8f9..7a9e1225 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) { } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' @@ -21,14 +22,20 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - compileSdkVersion 34 if (project.android.hasProperty("namespace")) { - namespace 'com.jhomlala.catcher_example' + namespace 'com.jhomlala.catcher_2_example' + } + compileSdkVersion 34 + ndkVersion flutter.ndkVersion + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = '1.8' } sourceSets { @@ -37,7 +44,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.jhomlala.catcher_example" + applicationId "com.jhomlala.catcher_2_example" minSdkVersion 19 targetSdkVersion 34 versionCode flutterVersionCode.toInteger() @@ -57,6 +64,4 @@ flutter { source '../..' } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} +dependencies {} diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index 745e77e7..9c411ddd 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -1,6 +1,7 @@ - diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index e615d99d..c6658cca 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,7 +1,8 @@ - +