Skip to content

Commit aea6b2f

Browse files
committed
Update network detection
1 parent 96eca03 commit aea6b2f

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

lib/fragments/dashboard/network_detection.dart

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'dart:async';
2-
31
import 'package:dio/dio.dart';
42
import 'package:fl_clash/common/common.dart';
53
import 'package:fl_clash/enum/enum.dart';
@@ -25,7 +23,6 @@ class _NetworkDetectionState extends State<NetworkDetection> {
2523
);
2624
bool? _preIsStart;
2725
Function? _checkIpDebounce;
28-
Timer? _setTimeoutTimer;
2926
CancelToken? cancelToken;
3027

3128
_checkIp() async {
@@ -35,7 +32,6 @@ class _NetworkDetectionState extends State<NetworkDetection> {
3532
if (!isInit) return;
3633
final isStart = appFlowingState.isStart;
3734
if (_preIsStart == false && _preIsStart == isStart) return;
38-
_clearSetTimeoutTimer();
3935
networkDetectionState.value = networkDetectionState.value.copyWith(
4036
isTesting: true,
4137
ipInfo: null,
@@ -55,12 +51,6 @@ class _NetworkDetectionState extends State<NetworkDetection> {
5551
);
5652
return;
5753
}
58-
_setTimeoutTimer = Timer(const Duration(milliseconds: 2000), () {
59-
networkDetectionState.value = networkDetectionState.value.copyWith(
60-
isTesting: false,
61-
ipInfo: null,
62-
);
63-
});
6454
} catch (_) {
6555
networkDetectionState.value = networkDetectionState.value.copyWith(
6656
isTesting: true,
@@ -69,13 +59,6 @@ class _NetworkDetectionState extends State<NetworkDetection> {
6959
}
7060
}
7161

72-
_clearSetTimeoutTimer() {
73-
if (_setTimeoutTimer != null) {
74-
_setTimeoutTimer?.cancel();
75-
_setTimeoutTimer = null;
76-
}
77-
}
78-
7962
_checkIpContainer(Widget child) {
8063
return Selector<AppState, num>(
8164
selector: (_, appState) {
@@ -156,7 +139,8 @@ class _NetworkDetectionState extends State<NetworkDetection> {
156139
.textTheme
157140
.titleLarge
158141
?.copyWith(
159-
fontFamily: FontFamily.twEmoji.value,
142+
fontFamily:
143+
FontFamily.twEmoji.value,
160144
),
161145
),
162146
)

0 commit comments

Comments
 (0)