Added connectivity Logs

qlline_design_update
Faiz Hashmi 4 weeks ago
parent 510f50fc7f
commit f97fb5c78b

@ -15,6 +15,8 @@ abstract class SignalrRepo {
required Function(dynamic) onHubReconnected,
required Function(dynamic) onHubDisconnected,
});
Future<void> closeConnection();
}
class SignalrRepoImp implements SignalrRepo {
@ -103,6 +105,7 @@ class SignalrRepoImp implements SignalrRepo {
return false;
}
@override
closeConnection() async {
if (connection!.state == HubConnectionState.connected || connection!.state == HubConnectionState.connecting) {
await connection!.stop();

@ -6,7 +6,8 @@ import 'package:restart_app/restart_app.dart';
abstract class NativeMethodChannelService {
void reopenApp();
void restartApp();
Future<void> restartApp();
}
class NativeMethodChannelServiceImp implements NativeMethodChannelService {
@ -26,7 +27,7 @@ class NativeMethodChannelServiceImp implements NativeMethodChannelService {
}
@override
void restartApp() async {
Future<void> restartApp() async {
try {
await Restart.restartApp();
} catch (e) {

@ -49,6 +49,10 @@ class QueuingViewModel extends ChangeNotifier {
);
}
Future<void> stopHubConnection() async {
return await signalrRepo.closeConnection();
}
initializeAudioPlayer() {
audioService.listenAudioPlayerEvents(onToneCompleted: onToneCompleted);
}

@ -333,6 +333,8 @@ class ScreenConfigViewModel extends ChangeNotifier {
// At midnight, update weather and prayer details if required
if (now.day != lastChecked.day) {
if (now.difference(now.copyWith(hour: 0, minute: 0, second: 0, millisecond: 0, microsecond: 0)).inMinutes >= 5) {
QueuingViewModel queuingViewModel = getIt.get<QueuingViewModel>();
await queuingViewModel.stopHubConnection();
nativeMethodChannelService.restartApp();
if (globalConfigurationsModel.isWeatherReq) {
await getWeatherDetailsFromServer();

Loading…
Cancel
Save