mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-11 17:42:05 +00:00
Implemented sentry
This commit is contained in:
parent
6196cd369a
commit
885d01fa1a
12 changed files with 112 additions and 16 deletions
2
.env.sample
Normal file
2
.env.sample
Normal file
|
@ -0,0 +1,2 @@
|
|||
SENTRY_DSN=
|
||||
ENABLE_SENTRY=false
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -10,6 +10,9 @@
|
|||
.svn/
|
||||
migrate_working_dir/
|
||||
|
||||
# Env
|
||||
.env
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
||||
import 'package:window_size/window_size.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
|
@ -34,6 +37,8 @@ void main() async {
|
|||
sqfliteFfiInit();
|
||||
databaseFactory = databaseFactoryFfi;
|
||||
}
|
||||
|
||||
await dotenv.load(fileName: '.env');
|
||||
|
||||
AppConfigProvider appConfigProvider = AppConfigProvider();
|
||||
ServersProvider serversProvider = ServersProvider();
|
||||
|
@ -62,22 +67,56 @@ void main() async {
|
|||
PackageInfo appInfo = await PackageInfo.fromPlatform();
|
||||
appConfigProvider.setAppInfo(appInfo);
|
||||
|
||||
runApp(
|
||||
MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider(
|
||||
create: ((context) => serversProvider)
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: ((context) => appConfigProvider)
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: ((context) => logsProvider)
|
||||
),
|
||||
],
|
||||
child: const Main(),
|
||||
if (
|
||||
(
|
||||
kReleaseMode &&
|
||||
(dotenv.env['SENTRY_DSN'] != null && dotenv.env['SENTRY_DSN'] != "")
|
||||
) || (
|
||||
dotenv.env['ENABLE_SENTRY'] == "true" &&
|
||||
(dotenv.env['SENTRY_DSN'] != null && dotenv.env['SENTRY_DSN'] != "")
|
||||
)
|
||||
);
|
||||
) {
|
||||
SentryFlutter.init(
|
||||
(options) {
|
||||
options.dsn = dotenv.env['SENTRY_DSN'];
|
||||
options.sendDefaultPii = false;
|
||||
},
|
||||
appRunner: () => runApp(
|
||||
MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider(
|
||||
create: ((context) => serversProvider)
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: ((context) => appConfigProvider)
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: ((context) => logsProvider)
|
||||
),
|
||||
],
|
||||
child: const Main(),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
runApp(
|
||||
MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider(
|
||||
create: ((context) => serversProvider)
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: ((context) => appConfigProvider)
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: ((context) => logsProvider)
|
||||
),
|
||||
],
|
||||
child: const Main(),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Main extends StatefulWidget {
|
||||
|
|
|
@ -126,7 +126,6 @@ class _LogsListClientState extends State<LogsListClient> {
|
|||
|
||||
if (widget.ip != previousIp) {
|
||||
setState(() => loadStatus = 0);
|
||||
if (scrollController.hasClients) scrollController.animateTo(0, duration: const Duration(milliseconds: 1), curve: Curves.ease);
|
||||
fetchLogs(inOffset: 0);
|
||||
setState(() => previousIp = widget.ip);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <dynamic_color/dynamic_color_plugin.h>
|
||||
#include <sentry_flutter/sentry_flutter_plugin.h>
|
||||
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
|
||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||
#include <window_size/window_size_plugin.h>
|
||||
|
@ -15,6 +16,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
|
|||
g_autoptr(FlPluginRegistrar) dynamic_color_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "DynamicColorPlugin");
|
||||
dynamic_color_plugin_register_with_registrar(dynamic_color_registrar);
|
||||
g_autoptr(FlPluginRegistrar) sentry_flutter_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "SentryFlutterPlugin");
|
||||
sentry_flutter_plugin_register_with_registrar(sentry_flutter_registrar);
|
||||
g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin");
|
||||
sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
dynamic_color
|
||||
sentry_flutter
|
||||
sqlite3_flutter_libs
|
||||
url_launcher_linux
|
||||
window_size
|
||||
|
|
|
@ -8,6 +8,7 @@ import Foundation
|
|||
import device_info_plus_macos
|
||||
import dynamic_color
|
||||
import package_info_plus
|
||||
import sentry_flutter
|
||||
import sqflite
|
||||
import sqlite3_flutter_libs
|
||||
import url_launcher_macos
|
||||
|
@ -17,6 +18,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
|||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||
DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin"))
|
||||
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
|
||||
SentryFlutterPlugin.register(with: registry.registrar(forPlugin: "SentryFlutterPlugin"))
|
||||
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
||||
Sqlite3FlutterLibsPlugin.register(with: registry.registrar(forPlugin: "Sqlite3FlutterLibsPlugin"))
|
||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||
|
|
|
@ -9,6 +9,13 @@ PODS:
|
|||
- FMDB/standard (2.7.5)
|
||||
- package_info_plus (0.0.1):
|
||||
- FlutterMacOS
|
||||
- Sentry/HybridSDK (8.5.0):
|
||||
- SentryPrivate (= 8.5.0)
|
||||
- sentry_flutter (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- Sentry/HybridSDK (= 8.5.0)
|
||||
- SentryPrivate (8.5.0)
|
||||
- sqflite (0.0.2):
|
||||
- FlutterMacOS
|
||||
- FMDB (>= 2.7.5)
|
||||
|
@ -37,6 +44,7 @@ DEPENDENCIES:
|
|||
- dynamic_color (from `Flutter/ephemeral/.symlinks/plugins/dynamic_color/macos`)
|
||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
|
||||
- sentry_flutter (from `Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos`)
|
||||
- sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`)
|
||||
- sqlite3_flutter_libs (from `Flutter/ephemeral/.symlinks/plugins/sqlite3_flutter_libs/macos`)
|
||||
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
|
||||
|
@ -45,6 +53,8 @@ DEPENDENCIES:
|
|||
SPEC REPOS:
|
||||
trunk:
|
||||
- FMDB
|
||||
- Sentry
|
||||
- SentryPrivate
|
||||
- sqlite3
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
|
@ -56,6 +66,8 @@ EXTERNAL SOURCES:
|
|||
:path: Flutter/ephemeral
|
||||
package_info_plus:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos
|
||||
sentry_flutter:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos
|
||||
sqflite:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos
|
||||
sqlite3_flutter_libs:
|
||||
|
@ -71,6 +83,9 @@ SPEC CHECKSUMS:
|
|||
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
|
||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||
package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce
|
||||
Sentry: 3be3f42e40e5a552935552e115744d5810a216d9
|
||||
sentry_flutter: c75806c304706163b2c129394c4621a786ad84e9
|
||||
SentryPrivate: 8c9463280e282527f938d1a5d1d60f8e10ff279b
|
||||
sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea
|
||||
sqlite3: d31b2b69d59bd1b4ab30e5c92eb18fd8e82fa392
|
||||
sqlite3_flutter_libs: f20746e4a0245afbee4f20d9afc0072ebff7cc26
|
||||
|
|
24
pubspec.lock
24
pubspec.lock
|
@ -246,6 +246,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.4.1"
|
||||
flutter_dotenv:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_dotenv
|
||||
sha256: d9283d92059a22e9834bc0a31336658ffba77089fb6f3cc36751f1fc7c6661a3
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.2"
|
||||
flutter_html:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -518,6 +526,22 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.5"
|
||||
sentry:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: sentry
|
||||
sha256: "8f2ff67c168c640567093f9f80f6cdfa34c009b89fb81732e896b9e95c3b87e8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.5.1"
|
||||
sentry_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: sentry_flutter
|
||||
sha256: "4de19f8b353eac472609f6c42b2bb0dd38d5a128c3e4a6ac6c0a9574b85fde47"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.5.1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
|
|
|
@ -70,6 +70,8 @@ dependencies:
|
|||
url_launcher: ^6.1.10
|
||||
contextmenu: ^3.0.0
|
||||
async: ^2.10.0
|
||||
sentry_flutter: ^7.5.1
|
||||
flutter_dotenv: ^5.0.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
@ -131,6 +133,7 @@ flutter:
|
|||
- assets/other/get_google_play.png
|
||||
- assets/resources/github.svg
|
||||
- assets/resources/google-play.svg
|
||||
- .env
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <dynamic_color/dynamic_color_plugin_c_api.h>
|
||||
#include <sentry_flutter/sentry_flutter_plugin.h>
|
||||
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
#include <window_size/window_size_plugin.h>
|
||||
|
@ -14,6 +15,8 @@
|
|||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
DynamicColorPluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
|
||||
SentryFlutterPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("SentryFlutterPlugin"));
|
||||
Sqlite3FlutterLibsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
|
||||
UrlLauncherWindowsRegisterWithRegistrar(
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
dynamic_color
|
||||
sentry_flutter
|
||||
sqlite3_flutter_libs
|
||||
url_launcher_windows
|
||||
window_size
|
||||
|
|
Loading…
Add table
Reference in a new issue