new: add some more checks

This commit is contained in:
hiddify
2024-12-21 18:25:09 +01:00
parent 93a556f41f
commit a0cf2a640e
9 changed files with 26 additions and 15 deletions
+2
View File
@@ -122,5 +122,7 @@ dependencies {
implementation 'androidx.core:core-ktx:1.15.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.7'
implementation "androidx.compose.ui:ui:1.7.6"
}
+1
View File
@@ -167,6 +167,7 @@ Future<void> lazyBootstrap(
if (!kIsWeb) {
FlutterNativeSplash.remove();
}
SentryFlutter.setAppStartEnd(DateTime.now().toUtc());
}
Future<T> _init<T>(
@@ -47,6 +47,7 @@ class AnalyticsController extends _$AnalyticsController with AppLogger {
options.debug = kDebugMode;
options.enableNativeCrashHandling = true;
options.enableNdkScopeSync = true;
options.autoAppStart = false;
// options.attachScreenshot = true;
options.serverName = "";
options.attachThreads = true;
@@ -31,8 +31,8 @@ class AdaptiveRootScaffold extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final t = ref.watch(translationsProvider).requireValue;
final t = ref.watch(translationsProvider).valueOrNull;
if (t == null) return const SizedBox.shrink();
// final selectedIndex = getCurrentIndex(context);
var allnavigationItems = [
NavigationItem(
@@ -80,12 +80,13 @@ class ConnectionNotifier extends _$ConnectionNotifier with AppLogger {
await haptic.lightImpact();
await ref.read(Preferences.startedByUser.notifier).update(true);
await _connect();
case Connected():
// case Connected():
default:
await haptic.mediumImpact();
await ref.read(Preferences.startedByUser.notifier).update(false);
await _disconnect();
default:
loggy.warning("switching status, debounce");
// default:
// loggy.warning("switching status, debounce");
}
}
}
@@ -125,8 +125,8 @@ class ConnectionButton extends HookConsumerWidget {
final activeProfile = await ref.read(activeProfileProvider.future);
return await ref.read(connectionNotifierProvider.notifier).reconnect(activeProfile);
},
AsyncData(value: Disconnected()) || AsyncError() => () async {
if (ref.read(activeProfileProvider).value == null) {
AsyncData(value: Disconnected()) || AsyncData(value: Connecting()) || AsyncError() => () async {
if (ref.read(activeProfileProvider).valueOrNull == null) {
await showDialog<bool>(
context: context,
builder: (context) => PlatformAlertDialog(
@@ -8,9 +8,10 @@ import 'package:hiddify/features/proxy/active/active_proxy_notifier.dart';
import 'package:hiddify/features/proxy/active/ip_widget.dart';
import 'package:hiddify/features/proxy/widget/proxy_tile.dart';
import 'package:hiddify/hiddifycore/generated/v2/hcore/hcore.pb.dart';
import 'package:hiddify/utils/custom_loggers.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
class ActiveProxyFooter extends ConsumerWidget {
class ActiveProxyFooter extends ConsumerWidget with InfraLogger {
const ActiveProxyFooter({super.key});
@override
@@ -29,8 +30,13 @@ class ActiveProxyFooter extends ConsumerWidget {
// Handle URL test in a way that won't trigger during build
Future<void> handleUrlTest() async {
if (!context.mounted) return;
await ref.read(activeProxyNotifierProvider.notifier).urlTest(activeProxy.tag);
try {
if (!context.mounted) return;
await ref.read(activeProxyNotifierProvider.notifier).urlTest(activeProxy.tag);
} catch (e) {
// Handle error here
loggy.error("Error during URL test: $e");
}
}
// Handle showing proxy info
+4 -4
View File
@@ -1577,10 +1577,10 @@ packages:
dependency: transitive
description:
name: sentry
sha256: "27088acf02728692f1067d6cc5b4ced37894080dc1b6147357f9e2961c6a5c9b"
sha256: b1ead7ca4da0949aed9482c4962f172021a4417f0a126fa974878c2301c16df7
url: "https://pub.dev"
source: hosted
version: "8.11.1"
version: "8.11.2"
sentry_dart_plugin:
dependency: "direct main"
description:
@@ -1593,10 +1593,10 @@ packages:
dependency: "direct main"
description:
name: sentry_flutter
sha256: "8e416b8549322c643ad4ee5956185d7a429417b68f9ddeb646aa08e319f01201"
sha256: d978861bc413ef98b663b065a65e780b255bfcdc0e2fa307884f7f6df0f1a406
url: "https://pub.dev"
source: hosted
version: "8.11.1"
version: "8.11.2"
share_plus:
dependency: "direct main"
description:
+1 -1
View File
@@ -51,7 +51,7 @@ dependencies:
url_launcher: ^6.2.5
vclibs: ^0.1.2
launch_at_startup: ^0.3.1
sentry_flutter: ^8.9.0
sentry_flutter: ^8.11.2
sentry_dart_plugin: ^2.1.0
sqlite3_flutter_libs: ^0.5.25
combine: ^0.5.7