Terminate the application when the UI thread is dead. Close #343

This commit is contained in:
2025-04-24 16:44:51 +08:00
parent 17e2696ca4
commit f38129133a
2 changed files with 43 additions and 0 deletions

View File

@@ -1,4 +1,7 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter_saf/flutter_saf.dart';
import 'package:rhttp/rhttp.dart';
import 'package:venera/foundation/app.dart';
@@ -51,6 +54,14 @@ Future<void> init() async {
FlutterError.onError = (details) {
Log.error("Unhandled Exception", "${details.exception}\n${details.stack}");
};
if (App.isWindows) {
// Report to the monitor thread that the app is running
// https://github.com/venera-app/venera/issues/343
Timer.periodic(const Duration(seconds: 1), (_) {
const methodChannel = MethodChannel('venera/method_channel');
methodChannel.invokeMethod("heartBeat");
});
}
}
void _checkOldConfigs() {