service: Do not restart the timer on regaining network connectivity
This commit is contained in:
parent
38cb61102a
commit
822e0ff565
@ -4,7 +4,6 @@ import 'package:connectivity_plus/connectivity_plus.dart';
|
|||||||
import 'package:get_it/get_it.dart';
|
import 'package:get_it/get_it.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:moxxyv2/service/connectivity_watcher.dart';
|
|
||||||
import 'package:moxxyv2/service/httpfiletransfer/httpfiletransfer.dart';
|
import 'package:moxxyv2/service/httpfiletransfer/httpfiletransfer.dart';
|
||||||
import 'package:moxxyv2/service/moxxmpp/reconnect.dart';
|
import 'package:moxxyv2/service/moxxmpp/reconnect.dart';
|
||||||
import 'package:moxxyv2/xmpp/connection.dart';
|
import 'package:moxxyv2/xmpp/connection.dart';
|
||||||
@ -42,8 +41,6 @@ class ConnectivityService {
|
|||||||
.onConnectivityChanged(regained, lost);
|
.onConnectivityChanged(regained, lost);
|
||||||
|
|
||||||
GetIt.I.get<HttpFileTransferService>().onConnectivityChanged(regained);
|
GetIt.I.get<HttpFileTransferService>().onConnectivityChanged(regained);
|
||||||
|
|
||||||
GetIt.I.get<ConnectivityWatcherService>().onConnectivityChanged(regained);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,14 +37,6 @@ class ConnectivityWatcherService {
|
|||||||
_timer = Timer(const Duration(minutes: 30), _onTimerElapsed);
|
_timer = Timer(const Duration(minutes: 30), _onTimerElapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called when the network state changed
|
|
||||||
Future<void> onConnectivityChanged(bool regained) async {
|
|
||||||
if (regained) {
|
|
||||||
_log.finest('Regained network connection. Starting warning timer...');
|
|
||||||
_startTimer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Called when the XMPP connection state changed
|
/// Called when the XMPP connection state changed
|
||||||
Future<void> onConnectionStateChanged(XmppConnectionState before, XmppConnectionState current) async {
|
Future<void> onConnectionStateChanged(XmppConnectionState before, XmppConnectionState current) async {
|
||||||
if (before == XmppConnectionState.connected && current != XmppConnectionState.connected) {
|
if (before == XmppConnectionState.connected && current != XmppConnectionState.connected) {
|
||||||
|
Loading…
Reference in New Issue
Block a user