Change proxies lifecycle

This commit is contained in:
problematicconsumer
2023-09-10 20:27:07 +03:30
parent dedccdd772
commit cd37f5124a
6 changed files with 37 additions and 16 deletions

View File

@@ -24,11 +24,11 @@ class StatsOverview extends HookConsumerWidget {
_StatCard(
title: t.home.stats.traffic,
firstStat: (
label: t.home.stats.uplink,
label: "",
data: stats.uplink.speed(),
),
secondStat: (
label: t.home.stats.downlink,
label: "",
data: stats.downlink.speed(),
),
),
@@ -36,11 +36,11 @@ class StatsOverview extends HookConsumerWidget {
_StatCard(
title: t.home.stats.trafficTotal,
firstStat: (
label: t.home.stats.uplink,
label: "",
data: stats.uplinkTotal.size(),
),
secondStat: (
label: t.home.stats.downlink,
label: "",
data: stats.downlinkTotal.size(),
),
),
@@ -80,7 +80,7 @@ class _StatCard extends HookConsumerWidget {
children: [
Text(
firstStat.label,
style: TextStyle(color: Colors.green),
style: const TextStyle(color: Colors.green),
),
Text(
firstStat.data,
@@ -93,7 +93,7 @@ class _StatCard extends HookConsumerWidget {
children: [
Text(
secondStat.label,
style: TextStyle(color: Colors.red),
style: TextStyle(color: theme.colorScheme.error),
),
Text(
secondStat.data,

View File

@@ -8,6 +8,7 @@ import 'package:hiddify/domain/core_service_failure.dart';
import 'package:hiddify/domain/singbox/singbox.dart';
import 'package:hiddify/features/common/connectivity/connectivity_controller.dart';
import 'package:hiddify/utils/pref_notifier.dart';
import 'package:hiddify/utils/riverpod_utils.dart';
import 'package:hiddify/utils/utils.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
@@ -36,6 +37,7 @@ final proxiesSortProvider = AlwaysAlivePrefNotifier.provider(
class ProxiesNotifier extends _$ProxiesNotifier with AppLogger {
@override
Stream<List<OutboundGroup>> build() async* {
ref.disposeDelay(const Duration(seconds: 15));
final serviceRunning = await ref.watch(serviceRunningProvider.future);
if (!serviceRunning) {
throw const CoreServiceNotRunning();