From acfaee78bf84ef7e15a5d7a2d754c787337cd794 Mon Sep 17 00:00:00 2001 From: LiJianying Date: Sun, 14 Nov 2021 15:04:59 +0800 Subject: [PATCH] Update tray menu (Add website & discussion) --- lib/main.dart | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 9c251d1c..658235ac 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,14 @@ +import 'dart:io'; + +import 'package:anyinspect/anyinspect.dart'; +import 'package:anyinspect_plugin_network/anyinspect_plugin_network.dart'; +import 'package:anyinspect_plugin_shared_preferences/anyinspect_plugin_shared_preferences.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization_loader/easy_localization_loader.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:launch_at_startup/launch_at_startup.dart'; +import 'package:package_info_plus/package_info_plus.dart'; import 'package:window_manager/window_manager.dart'; import './includes.dart'; @@ -11,15 +19,31 @@ void main() async { await EasyLocalization.ensureInitialized(); await AudioPlayer.ensureInitialized(); - await ProAccount.instance.ensureInitialized(); if (kIsLinux || kIsMacOS || kIsWindows) { await WindowManager.instance.ensureInitialized(); } + if (kIsMacOS || kIsWindows) { + PackageInfo packageInfo = await PackageInfo.fromPlatform(); + LaunchAtStartup.instance.setup( + appName: packageInfo.appName, + appPath: Platform.resolvedExecutable, + ); + } + + await ProAccount.instance.ensureInitialized(); + await initEnv('dev'); await initLocalDb(); await initConfig(); + if (!kReleaseMode) { + AnyInspect anyInspect = AnyInspect.instance; + anyInspect.addPlugin(AnyInspectPluginNetwork()); + anyInspect.addPlugin(AnyInspectPluginSharedPreferences()); + anyInspect.start(); + } + runApp( EasyLocalization( supportedLocales: [