Files
umbrix/lib/features/auto_start/notifier/auto_start_notifier.dart
Umbrix Developer 76a374950f feat: mobile-like window size and always-visible stats
- Changed window size to mobile phone format (400x800)
- Removed width condition for ActiveProxyFooter - now always visible
- Added run-umbrix.sh launch script with icon copying
- Stats cards now display on all screen sizes
2026-01-17 13:09:20 +03:00

38 lines
1.1 KiB
Dart

import 'dart:io';
import 'package:umbrix/core/app_info/app_info_provider.dart';
import 'package:umbrix/utils/utils.dart';
import 'package:launch_at_startup/launch_at_startup.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'auto_start_notifier.g.dart';
@Riverpod(keepAlive: true)
class AutoStartNotifier extends _$AutoStartNotifier with InfraLogger {
@override
Future<bool> build() async {
if (!PlatformUtils.isDesktop) return false;
final appInfo = ref.watch(appInfoProvider).requireValue;
launchAtStartup.setup(
appName: appInfo.name,
appPath: Platform.resolvedExecutable,
);
final isEnabled = await launchAtStartup.isEnabled();
loggy.info("auto start is [${isEnabled ? "Enabled" : "Disabled"}]");
return isEnabled;
}
Future<void> enable() async {
loggy.debug("enabling auto start");
await launchAtStartup.enable();
state = const AsyncValue.data(true);
}
Future<void> disable() async {
loggy.debug("disabling auto start");
await launchAtStartup.disable();
state = const AsyncValue.data(false);
}
}