improved error logging

This commit is contained in:
Fabian Freund
2025-06-23 22:19:50 +02:00
parent 66ac66cbd2
commit 9351dc3852
21 changed files with 410 additions and 199 deletions
@@ -4,6 +4,7 @@ import 'dart:ui';
import 'package:flutter_background_service/flutter_background_service.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:rxdart/rxdart.dart';
import 'package:weblibre/core/logger.dart';
import 'package:weblibre/features/geckoview/features/browser/domain/providers/lifecycle.dart';
import 'package:weblibre/features/tor/utils/tor_entrypoint.dart';
@@ -108,26 +109,34 @@ class TorProxyService extends _$TorProxyService {
await _tor.initializeService();
ref.listen(fireImmediately: true, browserViewLifecycleProvider, (
previous,
next,
) {
switch (next) {
case AppLifecycleState.resumed:
if (_timerPaused) {
_enableHeartbeatTimer();
}
case AppLifecycleState.detached:
case AppLifecycleState.inactive:
case AppLifecycleState.hidden:
case AppLifecycleState.paused:
case null:
if (_heartbeatUpdate?.isActive == true) {
_heartbeatUpdate?.cancel();
_timerPaused = true;
}
}
});
ref.listen(
fireImmediately: true,
browserViewLifecycleProvider,
(previous, next) {
switch (next) {
case AppLifecycleState.resumed:
if (_timerPaused) {
_enableHeartbeatTimer();
}
case AppLifecycleState.detached:
case AppLifecycleState.inactive:
case AppLifecycleState.hidden:
case AppLifecycleState.paused:
case null:
if (_heartbeatUpdate?.isActive == true) {
_heartbeatUpdate?.cancel();
_timerPaused = true;
}
}
},
onError: (error, stackTrace) {
logger.e(
'Error listening to browserViewLifecycleProvider',
error: error,
stackTrace: stackTrace,
);
},
);
ref.onDispose(() async {
_heartbeatUpdate?.cancel();
@@ -6,7 +6,7 @@ part of 'tor_proxy.dart';
// RiverpodGenerator
// **************************************************************************
String _$torProxyServiceHash() => r'95cabaa03ea777a2a6cfb46629be334cde3f7a7e';
String _$torProxyServiceHash() => r'f991652e4e228d3e7fdc09a6088b6c5427d6231c';
/// See also [TorProxyService].
@ProviderFor(TorProxyService)