Add silent start for desktop
This commit is contained in:
@@ -2,7 +2,6 @@ import 'package:hiddify/services/clash/clash.dart';
|
||||
import 'package:hiddify/services/connectivity/connectivity.dart';
|
||||
import 'package:hiddify/services/files_editor_service.dart';
|
||||
import 'package:hiddify/services/notification/notification.dart';
|
||||
import 'package:hiddify/services/window_manager_service.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'service_providers.g.dart';
|
||||
@@ -15,10 +14,6 @@ NotificationService notificationService(NotificationServiceRef ref) =>
|
||||
FilesEditorService filesEditorService(FilesEditorServiceRef ref) =>
|
||||
FilesEditorService();
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
WindowManagerService windowManagerService(WindowManagerServiceRef ref) =>
|
||||
WindowManagerService();
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
ConnectivityService connectivityService(ConnectivityServiceRef ref) =>
|
||||
ConnectivityService(
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
// TODO: rewrite
|
||||
class WindowManagerService with WindowListener {
|
||||
Future<void> init() async {
|
||||
await windowManager.ensureInitialized();
|
||||
const windowOptions = WindowOptions(
|
||||
size: Size(868, 768),
|
||||
minimumSize: Size(868, 648),
|
||||
center: true,
|
||||
);
|
||||
await windowManager.waitUntilReadyToShow(windowOptions);
|
||||
await windowManager.setPreventClose(true);
|
||||
windowManager.addListener(this);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> onWindowClose() async {
|
||||
await windowManager.hide();
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
windowManager.removeListener(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user