feat: Guide UI

This commit is contained in:
2024-11-03 18:32:12 +08:00
parent 0577b54f9c
commit 8a58719908
21 changed files with 555 additions and 37 deletions

View File

@ -208,8 +208,8 @@ class ToolsUI extends HookConsumerWidget {
)
],
onChanged: (v) {
model.loadToolsCard(context, skipPathScan: true);
model.onChangeGamePath(v!);
model.loadToolsCard(context, skipPathScan: true);
},
),
),
@ -253,8 +253,8 @@ class ToolsUI extends HookConsumerWidget {
)
],
onChanged: (v) {
model.loadToolsCard(context, skipPathScan: true);
model.onChangeLauncherPath(v!);
model.loadToolsCard(context, skipPathScan: true);
},
),
),

View File

@ -11,6 +11,7 @@ import 'package:go_router/go_router.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:starcitizen_doctor/api/analytics.dart';
import 'package:starcitizen_doctor/api/api.dart';
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
import 'package:starcitizen_doctor/common/helper/log_helper.dart';
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
@ -245,7 +246,8 @@ class ToolsUIModel extends _$ToolsUIModel {
/// -----------------------------------------------------------------------------------------
/// -----------------------------------------------------------------------------------------
Future<void> reScanPath(BuildContext context) async {
Future<void> reScanPath(BuildContext context,
{bool checkActive = false, bool skipToast = false}) async {
var scInstallPaths = <String>[];
var rsiLauncherInstallPaths = <String>[];
var scInstalledPath = "";
@ -266,7 +268,7 @@ class ToolsUIModel extends _$ToolsUIModel {
return;
}
scInstallPaths = await SCLoggerHelper.getGameInstallPath(listData,
checkExists: false, withVersion: ["LIVE", "PTU", "EPTU"]);
checkExists: checkActive, withVersion: ConstConf.gameChannels);
if (scInstallPaths.isNotEmpty) {
scInstalledPath = scInstallPaths.first;
}
@ -282,13 +284,15 @@ class ToolsUIModel extends _$ToolsUIModel {
showToast(context, S.current.tools_action_info_log_file_parse_failed);
}
if (rsiLauncherInstalledPath == "") {
if (!context.mounted) return;
showToast(context, S.current.tools_action_info_rsi_launcher_not_found);
}
if (scInstalledPath == "") {
if (!context.mounted) return;
showToast(context, S.current.tools_action_info_star_citizen_not_found);
if (!skipToast) {
if (rsiLauncherInstalledPath == "") {
if (!context.mounted) return;
showToast(context, S.current.tools_action_info_rsi_launcher_not_found);
}
if (scInstalledPath == "") {
if (!context.mounted) return;
showToast(context, S.current.tools_action_info_star_citizen_not_found);
}
}
}

View File

@ -6,7 +6,7 @@ part of 'tools_ui_model.dart';
// RiverpodGenerator
// **************************************************************************
String _$toolsUIModelHash() => r'cc75badc7ad810d2a8cef3d2a5188b1b68079aa3';
String _$toolsUIModelHash() => r'b0f314abe69c56d4e5e1ac0e89d848b55daabb4f';
/// See also [ToolsUIModel].
@ProviderFor(ToolsUIModel)