mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 08:53:43 +08:00
feat:riverpod 迁移 SettingsUIModel
This commit is contained in:
parent
c4637a8063
commit
46e5dcf01b
@ -20,3 +20,7 @@ void dPrint(src) async {
|
|||||||
void setDPrintFile(File file) {
|
void setDPrintFile(File file) {
|
||||||
_logFile = file;
|
_logFile = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File? getDPrintFile() {
|
||||||
|
return _logFile;
|
||||||
|
}
|
||||||
|
@ -7,10 +7,13 @@ import 'package:starcitizen_doctor/provider/aria2c.dart';
|
|||||||
import 'package:starcitizen_doctor/ui/home/home_ui.dart';
|
import 'package:starcitizen_doctor/ui/home/home_ui.dart';
|
||||||
import 'package:starcitizen_doctor/ui/home/home_ui_model.dart';
|
import 'package:starcitizen_doctor/ui/home/home_ui_model.dart';
|
||||||
import 'package:starcitizen_doctor/ui/party_room/party_room_ui.dart';
|
import 'package:starcitizen_doctor/ui/party_room/party_room_ui.dart';
|
||||||
|
import 'package:starcitizen_doctor/ui/settings/settings_ui_model.dart';
|
||||||
import 'package:starcitizen_doctor/ui/tools/tools_ui.dart';
|
import 'package:starcitizen_doctor/ui/tools/tools_ui.dart';
|
||||||
import 'package:starcitizen_doctor/widgets/widgets.dart';
|
import 'package:starcitizen_doctor/widgets/widgets.dart';
|
||||||
import 'package:window_manager/window_manager.dart';
|
import 'package:window_manager/window_manager.dart';
|
||||||
|
|
||||||
|
import 'settings/settings_ui.dart';
|
||||||
|
|
||||||
class IndexUI extends HookConsumerWidget {
|
class IndexUI extends HookConsumerWidget {
|
||||||
const IndexUI({super.key});
|
const IndexUI({super.key});
|
||||||
|
|
||||||
@ -18,6 +21,7 @@ class IndexUI extends HookConsumerWidget {
|
|||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
// pre init child
|
// pre init child
|
||||||
ref.watch(homeUIModelProvider.select((value) => null));
|
ref.watch(homeUIModelProvider.select((value) => null));
|
||||||
|
ref.watch(settingsUIModelProvider.select((value) => null));
|
||||||
|
|
||||||
final curIndex = useState(0);
|
final curIndex = useState(0);
|
||||||
return NavigationView(
|
return NavigationView(
|
||||||
@ -122,6 +126,8 @@ class IndexUI extends HookConsumerWidget {
|
|||||||
return const PartyRoomUI();
|
return const PartyRoomUI();
|
||||||
case 2:
|
case 2:
|
||||||
return const ToolsUI();
|
return const ToolsUI();
|
||||||
|
case 3:
|
||||||
|
return const SettingsUI();
|
||||||
default:
|
default:
|
||||||
return Center(
|
return Center(
|
||||||
child: Text("UnimplPage $value"),
|
child: Text("UnimplPage $value"),
|
||||||
|
131
lib/ui/settings/settings_ui.dart
Normal file
131
lib/ui/settings/settings_ui.dart
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
||||||
|
import 'package:starcitizen_doctor/ui/settings/settings_ui_model.dart';
|
||||||
|
|
||||||
|
class SettingsUI extends HookConsumerWidget {
|
||||||
|
const SettingsUI({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final sate = ref.watch(settingsUIModelProvider);
|
||||||
|
final model = ref.read(settingsUIModelProvider.notifier);
|
||||||
|
return Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
height: MediaQuery.of(context).size.height,
|
||||||
|
margin: const EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
makeSettingsItem(const Icon(FluentIcons.link, size: 20), "创建设置快捷方式",
|
||||||
|
subTitle: "在桌面创建《SC汉化盒子》快捷方式", onTap: ()=> model.addShortCut(context)),
|
||||||
|
if (ConstConf.isMSE) ...[
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
makeSettingsItem(
|
||||||
|
const Icon(FluentIcons.reset_device, size: 20), "重置自动密码填充",
|
||||||
|
subTitle:
|
||||||
|
"启用:${sate.isEnableAutoLogin ? "已启用" : "已禁用"} 设备支持:${sate.isDeviceSupportWinHello ? "支持" : "不支持"} 邮箱:${sate.autoLoginEmail} 密码:${sate.isEnableAutoLoginPwd ? "已加密保存" : "未保存"}",
|
||||||
|
onTap: ()=> model.onResetAutoLogin(context)),
|
||||||
|
],
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
makeSettingsItem(const Icon(FontAwesomeIcons.microchip, size: 20),
|
||||||
|
"启动游戏时忽略能效核心( 适用于Intel 12th+ 处理器 ) [实验性功能,请随时反馈]",
|
||||||
|
subTitle:
|
||||||
|
"已设置的核心数量:${sate.inputGameLaunchECore} (此功能适用于首页的盒子一键启动 或 工具中的RSI启动器管理员模式,当为 0 时不启用此功能 )",
|
||||||
|
onTap:()=> model.setGameLaunchECore(context)),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
makeSettingsItem(const Icon(FluentIcons.folder_open, size: 20),
|
||||||
|
"设置启动器文件(RSI Launcher.exe)",
|
||||||
|
subTitle: sate.customLauncherPath != null
|
||||||
|
? "${sate.customLauncherPath}"
|
||||||
|
: "手动设置启动器位置,建议仅在无法自动扫描安装位置时使用",
|
||||||
|
onTap: ()=> model.setLauncherPath(context), onDel: () {
|
||||||
|
model.delName("custom_launcher_path");
|
||||||
|
}),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
makeSettingsItem(const Icon(FluentIcons.game, size: 20),
|
||||||
|
"设置游戏文件 (StarCitizen.exe)",
|
||||||
|
subTitle: sate.customGamePath != null
|
||||||
|
? "${sate.customGamePath}"
|
||||||
|
: "手动设置游戏安装位置,建议仅在无法自动扫描安装位置时使用",
|
||||||
|
onTap: ()=> model.setGamePath(context), onDel: () {
|
||||||
|
model.delName("custom_game_path");
|
||||||
|
}),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
makeSettingsItem(const Icon(FluentIcons.delete, size: 20), "清理汉化文件缓存",
|
||||||
|
subTitle:
|
||||||
|
"缓存大小 ${(sate.locationCacheSize / 1024 / 1024).toStringAsFixed(2)}MB,清理盒子下载的汉化文件缓存,不会影响已安装的汉化",
|
||||||
|
onTap: ()=> model.cleanLocationCache(context)),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
makeSettingsItem(
|
||||||
|
const Icon(FluentIcons.speed_high, size: 20), "工具站访问加速",
|
||||||
|
onTap: () =>
|
||||||
|
model.onChangeToolSiteMirror(!sate.isEnableToolSiteMirrors),
|
||||||
|
subTitle:
|
||||||
|
"使用镜像服务器加速访问 Dps Uex 等工具网站,若访问异常请关闭该功能。 为保护账户安全,任何情况下都不会加速RSI官网。",
|
||||||
|
onSwitch: model.onChangeToolSiteMirror,
|
||||||
|
switchStatus: sate.isEnableToolSiteMirrors),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
makeSettingsItem(
|
||||||
|
const Icon(FluentIcons.document_set, size: 20), "查看log",
|
||||||
|
onTap: () => model.showLogs(),
|
||||||
|
subTitle: "查看汉化盒子的 log 文件,以定位盒子的 bug"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget makeSettingsItem(Widget icon, String title,
|
||||||
|
{String? subTitle,
|
||||||
|
VoidCallback? onTap,
|
||||||
|
VoidCallback? onDel,
|
||||||
|
void Function(bool? b)? onSwitch,
|
||||||
|
bool switchStatus = false}) {
|
||||||
|
return Button(
|
||||||
|
onPressed: onTap,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 12, bottom: 12),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
icon,
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(title),
|
||||||
|
const Spacer(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (subTitle != null) ...[
|
||||||
|
const SizedBox(height: 3),
|
||||||
|
Text(
|
||||||
|
subTitle,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12, color: Colors.white.withOpacity(.6)),
|
||||||
|
)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (onDel != null) ...[
|
||||||
|
Button(
|
||||||
|
onPressed: onDel,
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(6),
|
||||||
|
child: Icon(FluentIcons.delete),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
if (onSwitch != null) ...[
|
||||||
|
ToggleSwitch(checked: switchStatus, onChanged: onSwitch),
|
||||||
|
],
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
const Icon(FluentIcons.chevron_right),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
231
lib/ui/settings/settings_ui_model.dart
Normal file
231
lib/ui/settings/settings_ui_model.dart
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
// ignore_for_file: avoid_build_context_in_providers
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:file_picker/file_picker.dart';
|
||||||
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
|
import 'package:local_auth/local_auth.dart';
|
||||||
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
|
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
||||||
|
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||||
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||||
|
import 'package:starcitizen_doctor/common/utils/provider.dart';
|
||||||
|
import 'package:starcitizen_doctor/common/win32/credentials.dart';
|
||||||
|
import 'package:starcitizen_doctor/widgets/widgets.dart';
|
||||||
|
|
||||||
|
part 'settings_ui_model.g.dart';
|
||||||
|
|
||||||
|
part 'settings_ui_model.freezed.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
class SettingsUIState with _$SettingsUIState {
|
||||||
|
const factory SettingsUIState({
|
||||||
|
@Default(false) isDeviceSupportWinHello,
|
||||||
|
@Default("-") String autoLoginEmail,
|
||||||
|
@Default(false) bool isEnableAutoLogin,
|
||||||
|
@Default(false) bool isEnableAutoLoginPwd,
|
||||||
|
@Default(false) bool isEnableToolSiteMirrors,
|
||||||
|
@Default("0") String inputGameLaunchECore,
|
||||||
|
String? customLauncherPath,
|
||||||
|
String? customGamePath,
|
||||||
|
@Default(0) int locationCacheSize,
|
||||||
|
}) = _SettingsUIState;
|
||||||
|
}
|
||||||
|
|
||||||
|
@riverpod
|
||||||
|
class SettingsUIModel extends _$SettingsUIModel {
|
||||||
|
@override
|
||||||
|
SettingsUIState build() {
|
||||||
|
state = const SettingsUIState();
|
||||||
|
_initState();
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _initState() async {
|
||||||
|
final LocalAuthentication localAuth = LocalAuthentication();
|
||||||
|
final isDeviceSupportWinHello = await localAuth.isDeviceSupported();
|
||||||
|
state = state.copyWith(isDeviceSupportWinHello: isDeviceSupportWinHello);
|
||||||
|
_updateGameLaunchECore();
|
||||||
|
if (ConstConf.isMSE) {
|
||||||
|
_updateAutoLoginAccount();
|
||||||
|
}
|
||||||
|
_loadCustomPath();
|
||||||
|
_loadLocationCacheSize();
|
||||||
|
_loadToolSiteMirrorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> onResetAutoLogin(BuildContext context) async {
|
||||||
|
final ok = await showConfirmDialogs(context, "确认重置自动填充?",
|
||||||
|
const Text("这将会删除本地的账号记录,或在下次启动游戏时将自动填充选择 ‘否’ 以禁用自动填充。"));
|
||||||
|
if (ok) {
|
||||||
|
final userBox = await Hive.openBox("rsi_account_data");
|
||||||
|
await userBox.deleteFromDisk();
|
||||||
|
Win32Credentials.delete("SCToolbox_RSI_Account_secret");
|
||||||
|
if (!context.mounted) return;
|
||||||
|
|
||||||
|
showToast(context, "已清理自动填充数据");
|
||||||
|
_initState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future _updateAutoLoginAccount() async {
|
||||||
|
final userBox = await Hive.openBox("rsi_account_data");
|
||||||
|
final autoLoginEmail = userBox.get("account_email", defaultValue: "-");
|
||||||
|
final isEnableAutoLogin = userBox.get("enable", defaultValue: true);
|
||||||
|
final isEnableAutoLoginPwd =
|
||||||
|
userBox.get("account_pwd_encrypted", defaultValue: "") != "";
|
||||||
|
|
||||||
|
state = state.copyWith(
|
||||||
|
autoLoginEmail: autoLoginEmail,
|
||||||
|
isEnableAutoLogin: isEnableAutoLogin,
|
||||||
|
isEnableAutoLoginPwd: isEnableAutoLoginPwd);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> setGameLaunchECore(BuildContext context) async {
|
||||||
|
final userBox = await Hive.openBox("app_conf");
|
||||||
|
final defaultInput =
|
||||||
|
userBox.get("gameLaunch_eCore_count", defaultValue: "0");
|
||||||
|
if (!context.mounted) return;
|
||||||
|
final input = await showInputDialogs(context,
|
||||||
|
title: "请输入要忽略的 CPU 核心数",
|
||||||
|
content:
|
||||||
|
"Tip:您的设备拥有几个能效核心就输入几,非大小核设备请保持 0\n\n此功能适用于首页的盒子一键启动 或 工具中的 RSI启动器管理员模式,当为 0 时不启用此功能。",
|
||||||
|
initialValue: defaultInput,
|
||||||
|
inputFormatters: [FilteringTextInputFormatter.digitsOnly]);
|
||||||
|
if (input == null) return;
|
||||||
|
userBox.put("gameLaunch_eCore_count", input);
|
||||||
|
_initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future _updateGameLaunchECore() async {
|
||||||
|
final userBox = await Hive.openBox("app_conf");
|
||||||
|
final inputGameLaunchECore =
|
||||||
|
userBox.get("gameLaunch_eCore_count", defaultValue: "0");
|
||||||
|
state = state.copyWith(inputGameLaunchECore: inputGameLaunchECore);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> setLauncherPath(BuildContext context) async {
|
||||||
|
final r = await FilePicker.platform.pickFiles(
|
||||||
|
dialogTitle: "请选择RSI启动器位置(RSI Launcher.exe)",
|
||||||
|
type: FileType.custom,
|
||||||
|
allowedExtensions: ["exe"]);
|
||||||
|
if (r == null || r.files.firstOrNull?.path == null) return;
|
||||||
|
final fileName = r.files.first.path!;
|
||||||
|
if (fileName.endsWith("\\RSI Launcher.exe")) {
|
||||||
|
await _saveCustomPath("custom_launcher_path", fileName);
|
||||||
|
if (!context.mounted) return;
|
||||||
|
showToast(context, "设置成功,在对应页面点击刷新即可扫描出新路径");
|
||||||
|
_initState();
|
||||||
|
} else {
|
||||||
|
if (!context.mounted) return;
|
||||||
|
showToast(context, "文件有误!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> setGamePath(BuildContext context) async {
|
||||||
|
final r = await FilePicker.platform.pickFiles(
|
||||||
|
dialogTitle: "请选择游戏安装位置(StarCitizen.exe)",
|
||||||
|
type: FileType.custom,
|
||||||
|
allowedExtensions: ["exe"]);
|
||||||
|
if (r == null || r.files.firstOrNull?.path == null) return;
|
||||||
|
final fileName = r.files.first.path!;
|
||||||
|
dPrint(fileName);
|
||||||
|
final fileNameRegExp =
|
||||||
|
RegExp(r"^(.*\\StarCitizen\\.*\\)Bin64\\StarCitizen\.exe$");
|
||||||
|
if (fileNameRegExp.hasMatch(fileName)) {
|
||||||
|
RegExp pathRegex = RegExp(r"\\[^\\]+\\Bin64\\StarCitizen\.exe$");
|
||||||
|
String extractedPath = fileName.replaceFirst(pathRegex, '');
|
||||||
|
await _saveCustomPath("custom_game_path", extractedPath);
|
||||||
|
if (!context.mounted) return;
|
||||||
|
showToast(context, "设置成功,在对应页面点击刷新即可扫描出新路径");
|
||||||
|
_initState();
|
||||||
|
} else {
|
||||||
|
if (!context.mounted) return;
|
||||||
|
showToast(context, "文件有误!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_saveCustomPath(String pathKey, String dir) async {
|
||||||
|
final confBox = await Hive.openBox("app_conf");
|
||||||
|
await confBox.put(pathKey, dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
_loadCustomPath() async {
|
||||||
|
final confBox = await Hive.openBox("app_conf");
|
||||||
|
final customLauncherPath = confBox.get("custom_launcher_path");
|
||||||
|
final customGamePath = confBox.get("custom_game_path");
|
||||||
|
state = state.copyWith(
|
||||||
|
customLauncherPath: customLauncherPath, customGamePath: customGamePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> delName(String key) async {
|
||||||
|
final confBox = await Hive.openBox("app_conf");
|
||||||
|
await confBox.delete(key);
|
||||||
|
_initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
_loadLocationCacheSize() async {
|
||||||
|
final len = await SystemHelper.getDirLen(
|
||||||
|
"${appGlobalState.applicationSupportDir}/Localizations");
|
||||||
|
final locationCacheSize = len;
|
||||||
|
state = state.copyWith(locationCacheSize: locationCacheSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> cleanLocationCache(BuildContext context) async {
|
||||||
|
final ok = await showConfirmDialogs(
|
||||||
|
context, "确认清理汉化缓存?", const Text("这不会影响已安装的汉化。"));
|
||||||
|
if (ok == true) {
|
||||||
|
final dir =
|
||||||
|
Directory("${appGlobalState.applicationSupportDir}/Localizations");
|
||||||
|
if (!context.mounted) return;
|
||||||
|
await dir.delete(recursive: true).unwrap(context: context);
|
||||||
|
_initState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> addShortCut(BuildContext context) async {
|
||||||
|
if (ConstConf.isMSE) {
|
||||||
|
showToast(context, "因微软版功能限制,请在接下来打开的窗口中 手动将《SC汉化盒子》拖动到桌面,即可创建快捷方式。");
|
||||||
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
|
Process.run("explorer.exe", ["shell:AppsFolder"]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dPrint(Platform.resolvedExecutable);
|
||||||
|
final script = """
|
||||||
|
\$targetPath = "${Platform.resolvedExecutable}";
|
||||||
|
\$shortcutPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::DesktopDirectory), "SC汉化盒子DEV.lnk");
|
||||||
|
\$shell = New-Object -ComObject WScript.Shell
|
||||||
|
\$shortcut = \$shell.CreateShortcut(\$shortcutPath)
|
||||||
|
if (\$shortcut -eq \$null) {
|
||||||
|
Write-Host "Failed to create shortcut."
|
||||||
|
} else {
|
||||||
|
\$shortcut.TargetPath = \$targetPath
|
||||||
|
\$shortcut.Save()
|
||||||
|
Write-Host "Shortcut created successfully."
|
||||||
|
}
|
||||||
|
""";
|
||||||
|
await Process.run(SystemHelper.powershellPath, [script]);
|
||||||
|
if (!context.mounted) return;
|
||||||
|
showToast(context, "创建完毕,请返回桌面查看");
|
||||||
|
}
|
||||||
|
|
||||||
|
_loadToolSiteMirrorState() async {
|
||||||
|
final userBox = await Hive.openBox("app_conf");
|
||||||
|
final isEnableToolSiteMirrors =
|
||||||
|
userBox.get("isEnableToolSiteMirrors", defaultValue: false);
|
||||||
|
state = state.copyWith(isEnableToolSiteMirrors: isEnableToolSiteMirrors);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangeToolSiteMirror(bool? b) async {
|
||||||
|
final userBox = await Hive.openBox("app_conf");
|
||||||
|
final isEnableToolSiteMirrors = b == true;
|
||||||
|
await userBox.put("isEnableToolSiteMirrors", isEnableToolSiteMirrors);
|
||||||
|
_initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
showLogs() async {
|
||||||
|
SystemHelper.openDir(getDPrintFile()?.absolute.path.replaceAll("/", "\\"));
|
||||||
|
}
|
||||||
|
}
|
323
lib/ui/settings/settings_ui_model.freezed.dart
Normal file
323
lib/ui/settings/settings_ui_model.freezed.dart
Normal file
@ -0,0 +1,323 @@
|
|||||||
|
// coverage:ignore-file
|
||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||||
|
|
||||||
|
part of 'settings_ui_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
final _privateConstructorUsedError = UnsupportedError(
|
||||||
|
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$SettingsUIState {
|
||||||
|
dynamic get isDeviceSupportWinHello => throw _privateConstructorUsedError;
|
||||||
|
String get autoLoginEmail => throw _privateConstructorUsedError;
|
||||||
|
bool get isEnableAutoLogin => throw _privateConstructorUsedError;
|
||||||
|
bool get isEnableAutoLoginPwd => throw _privateConstructorUsedError;
|
||||||
|
bool get isEnableToolSiteMirrors => throw _privateConstructorUsedError;
|
||||||
|
String get inputGameLaunchECore => throw _privateConstructorUsedError;
|
||||||
|
String? get customLauncherPath => throw _privateConstructorUsedError;
|
||||||
|
String? get customGamePath => throw _privateConstructorUsedError;
|
||||||
|
int get locationCacheSize => throw _privateConstructorUsedError;
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
$SettingsUIStateCopyWith<SettingsUIState> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class $SettingsUIStateCopyWith<$Res> {
|
||||||
|
factory $SettingsUIStateCopyWith(
|
||||||
|
SettingsUIState value, $Res Function(SettingsUIState) then) =
|
||||||
|
_$SettingsUIStateCopyWithImpl<$Res, SettingsUIState>;
|
||||||
|
@useResult
|
||||||
|
$Res call(
|
||||||
|
{dynamic isDeviceSupportWinHello,
|
||||||
|
String autoLoginEmail,
|
||||||
|
bool isEnableAutoLogin,
|
||||||
|
bool isEnableAutoLoginPwd,
|
||||||
|
bool isEnableToolSiteMirrors,
|
||||||
|
String inputGameLaunchECore,
|
||||||
|
String? customLauncherPath,
|
||||||
|
String? customGamePath,
|
||||||
|
int locationCacheSize});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class _$SettingsUIStateCopyWithImpl<$Res, $Val extends SettingsUIState>
|
||||||
|
implements $SettingsUIStateCopyWith<$Res> {
|
||||||
|
_$SettingsUIStateCopyWithImpl(this._value, this._then);
|
||||||
|
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Val _value;
|
||||||
|
// ignore: unused_field
|
||||||
|
final $Res Function($Val) _then;
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? isDeviceSupportWinHello = freezed,
|
||||||
|
Object? autoLoginEmail = null,
|
||||||
|
Object? isEnableAutoLogin = null,
|
||||||
|
Object? isEnableAutoLoginPwd = null,
|
||||||
|
Object? isEnableToolSiteMirrors = null,
|
||||||
|
Object? inputGameLaunchECore = null,
|
||||||
|
Object? customLauncherPath = freezed,
|
||||||
|
Object? customGamePath = freezed,
|
||||||
|
Object? locationCacheSize = null,
|
||||||
|
}) {
|
||||||
|
return _then(_value.copyWith(
|
||||||
|
isDeviceSupportWinHello: freezed == isDeviceSupportWinHello
|
||||||
|
? _value.isDeviceSupportWinHello
|
||||||
|
: isDeviceSupportWinHello // ignore: cast_nullable_to_non_nullable
|
||||||
|
as dynamic,
|
||||||
|
autoLoginEmail: null == autoLoginEmail
|
||||||
|
? _value.autoLoginEmail
|
||||||
|
: autoLoginEmail // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
isEnableAutoLogin: null == isEnableAutoLogin
|
||||||
|
? _value.isEnableAutoLogin
|
||||||
|
: isEnableAutoLogin // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
isEnableAutoLoginPwd: null == isEnableAutoLoginPwd
|
||||||
|
? _value.isEnableAutoLoginPwd
|
||||||
|
: isEnableAutoLoginPwd // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
isEnableToolSiteMirrors: null == isEnableToolSiteMirrors
|
||||||
|
? _value.isEnableToolSiteMirrors
|
||||||
|
: isEnableToolSiteMirrors // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
inputGameLaunchECore: null == inputGameLaunchECore
|
||||||
|
? _value.inputGameLaunchECore
|
||||||
|
: inputGameLaunchECore // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
customLauncherPath: freezed == customLauncherPath
|
||||||
|
? _value.customLauncherPath
|
||||||
|
: customLauncherPath // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
customGamePath: freezed == customGamePath
|
||||||
|
? _value.customGamePath
|
||||||
|
: customGamePath // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
locationCacheSize: null == locationCacheSize
|
||||||
|
? _value.locationCacheSize
|
||||||
|
: locationCacheSize // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
) as $Val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract class _$$SettingsUIStateImplCopyWith<$Res>
|
||||||
|
implements $SettingsUIStateCopyWith<$Res> {
|
||||||
|
factory _$$SettingsUIStateImplCopyWith(_$SettingsUIStateImpl value,
|
||||||
|
$Res Function(_$SettingsUIStateImpl) then) =
|
||||||
|
__$$SettingsUIStateImplCopyWithImpl<$Res>;
|
||||||
|
@override
|
||||||
|
@useResult
|
||||||
|
$Res call(
|
||||||
|
{dynamic isDeviceSupportWinHello,
|
||||||
|
String autoLoginEmail,
|
||||||
|
bool isEnableAutoLogin,
|
||||||
|
bool isEnableAutoLoginPwd,
|
||||||
|
bool isEnableToolSiteMirrors,
|
||||||
|
String inputGameLaunchECore,
|
||||||
|
String? customLauncherPath,
|
||||||
|
String? customGamePath,
|
||||||
|
int locationCacheSize});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
class __$$SettingsUIStateImplCopyWithImpl<$Res>
|
||||||
|
extends _$SettingsUIStateCopyWithImpl<$Res, _$SettingsUIStateImpl>
|
||||||
|
implements _$$SettingsUIStateImplCopyWith<$Res> {
|
||||||
|
__$$SettingsUIStateImplCopyWithImpl(
|
||||||
|
_$SettingsUIStateImpl _value, $Res Function(_$SettingsUIStateImpl) _then)
|
||||||
|
: super(_value, _then);
|
||||||
|
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
@override
|
||||||
|
$Res call({
|
||||||
|
Object? isDeviceSupportWinHello = freezed,
|
||||||
|
Object? autoLoginEmail = null,
|
||||||
|
Object? isEnableAutoLogin = null,
|
||||||
|
Object? isEnableAutoLoginPwd = null,
|
||||||
|
Object? isEnableToolSiteMirrors = null,
|
||||||
|
Object? inputGameLaunchECore = null,
|
||||||
|
Object? customLauncherPath = freezed,
|
||||||
|
Object? customGamePath = freezed,
|
||||||
|
Object? locationCacheSize = null,
|
||||||
|
}) {
|
||||||
|
return _then(_$SettingsUIStateImpl(
|
||||||
|
isDeviceSupportWinHello: freezed == isDeviceSupportWinHello
|
||||||
|
? _value.isDeviceSupportWinHello!
|
||||||
|
: isDeviceSupportWinHello,
|
||||||
|
autoLoginEmail: null == autoLoginEmail
|
||||||
|
? _value.autoLoginEmail
|
||||||
|
: autoLoginEmail // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
isEnableAutoLogin: null == isEnableAutoLogin
|
||||||
|
? _value.isEnableAutoLogin
|
||||||
|
: isEnableAutoLogin // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
isEnableAutoLoginPwd: null == isEnableAutoLoginPwd
|
||||||
|
? _value.isEnableAutoLoginPwd
|
||||||
|
: isEnableAutoLoginPwd // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
isEnableToolSiteMirrors: null == isEnableToolSiteMirrors
|
||||||
|
? _value.isEnableToolSiteMirrors
|
||||||
|
: isEnableToolSiteMirrors // ignore: cast_nullable_to_non_nullable
|
||||||
|
as bool,
|
||||||
|
inputGameLaunchECore: null == inputGameLaunchECore
|
||||||
|
? _value.inputGameLaunchECore
|
||||||
|
: inputGameLaunchECore // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
customLauncherPath: freezed == customLauncherPath
|
||||||
|
? _value.customLauncherPath
|
||||||
|
: customLauncherPath // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
customGamePath: freezed == customGamePath
|
||||||
|
? _value.customGamePath
|
||||||
|
: customGamePath // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String?,
|
||||||
|
locationCacheSize: null == locationCacheSize
|
||||||
|
? _value.locationCacheSize
|
||||||
|
: locationCacheSize // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
class _$SettingsUIStateImpl implements _SettingsUIState {
|
||||||
|
const _$SettingsUIStateImpl(
|
||||||
|
{this.isDeviceSupportWinHello = false,
|
||||||
|
this.autoLoginEmail = "-",
|
||||||
|
this.isEnableAutoLogin = false,
|
||||||
|
this.isEnableAutoLoginPwd = false,
|
||||||
|
this.isEnableToolSiteMirrors = false,
|
||||||
|
this.inputGameLaunchECore = "0",
|
||||||
|
this.customLauncherPath,
|
||||||
|
this.customGamePath,
|
||||||
|
this.locationCacheSize = 0});
|
||||||
|
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final dynamic isDeviceSupportWinHello;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final String autoLoginEmail;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isEnableAutoLogin;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isEnableAutoLoginPwd;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final bool isEnableToolSiteMirrors;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final String inputGameLaunchECore;
|
||||||
|
@override
|
||||||
|
final String? customLauncherPath;
|
||||||
|
@override
|
||||||
|
final String? customGamePath;
|
||||||
|
@override
|
||||||
|
@JsonKey()
|
||||||
|
final int locationCacheSize;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SettingsUIState(isDeviceSupportWinHello: $isDeviceSupportWinHello, autoLoginEmail: $autoLoginEmail, isEnableAutoLogin: $isEnableAutoLogin, isEnableAutoLoginPwd: $isEnableAutoLoginPwd, isEnableToolSiteMirrors: $isEnableToolSiteMirrors, inputGameLaunchECore: $inputGameLaunchECore, customLauncherPath: $customLauncherPath, customGamePath: $customGamePath, locationCacheSize: $locationCacheSize)';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) ||
|
||||||
|
(other.runtimeType == runtimeType &&
|
||||||
|
other is _$SettingsUIStateImpl &&
|
||||||
|
const DeepCollectionEquality().equals(
|
||||||
|
other.isDeviceSupportWinHello, isDeviceSupportWinHello) &&
|
||||||
|
(identical(other.autoLoginEmail, autoLoginEmail) ||
|
||||||
|
other.autoLoginEmail == autoLoginEmail) &&
|
||||||
|
(identical(other.isEnableAutoLogin, isEnableAutoLogin) ||
|
||||||
|
other.isEnableAutoLogin == isEnableAutoLogin) &&
|
||||||
|
(identical(other.isEnableAutoLoginPwd, isEnableAutoLoginPwd) ||
|
||||||
|
other.isEnableAutoLoginPwd == isEnableAutoLoginPwd) &&
|
||||||
|
(identical(
|
||||||
|
other.isEnableToolSiteMirrors, isEnableToolSiteMirrors) ||
|
||||||
|
other.isEnableToolSiteMirrors == isEnableToolSiteMirrors) &&
|
||||||
|
(identical(other.inputGameLaunchECore, inputGameLaunchECore) ||
|
||||||
|
other.inputGameLaunchECore == inputGameLaunchECore) &&
|
||||||
|
(identical(other.customLauncherPath, customLauncherPath) ||
|
||||||
|
other.customLauncherPath == customLauncherPath) &&
|
||||||
|
(identical(other.customGamePath, customGamePath) ||
|
||||||
|
other.customGamePath == customGamePath) &&
|
||||||
|
(identical(other.locationCacheSize, locationCacheSize) ||
|
||||||
|
other.locationCacheSize == locationCacheSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(
|
||||||
|
runtimeType,
|
||||||
|
const DeepCollectionEquality().hash(isDeviceSupportWinHello),
|
||||||
|
autoLoginEmail,
|
||||||
|
isEnableAutoLogin,
|
||||||
|
isEnableAutoLoginPwd,
|
||||||
|
isEnableToolSiteMirrors,
|
||||||
|
inputGameLaunchECore,
|
||||||
|
customLauncherPath,
|
||||||
|
customGamePath,
|
||||||
|
locationCacheSize);
|
||||||
|
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
@override
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$$SettingsUIStateImplCopyWith<_$SettingsUIStateImpl> get copyWith =>
|
||||||
|
__$$SettingsUIStateImplCopyWithImpl<_$SettingsUIStateImpl>(
|
||||||
|
this, _$identity);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class _SettingsUIState implements SettingsUIState {
|
||||||
|
const factory _SettingsUIState(
|
||||||
|
{final dynamic isDeviceSupportWinHello,
|
||||||
|
final String autoLoginEmail,
|
||||||
|
final bool isEnableAutoLogin,
|
||||||
|
final bool isEnableAutoLoginPwd,
|
||||||
|
final bool isEnableToolSiteMirrors,
|
||||||
|
final String inputGameLaunchECore,
|
||||||
|
final String? customLauncherPath,
|
||||||
|
final String? customGamePath,
|
||||||
|
final int locationCacheSize}) = _$SettingsUIStateImpl;
|
||||||
|
|
||||||
|
@override
|
||||||
|
dynamic get isDeviceSupportWinHello;
|
||||||
|
@override
|
||||||
|
String get autoLoginEmail;
|
||||||
|
@override
|
||||||
|
bool get isEnableAutoLogin;
|
||||||
|
@override
|
||||||
|
bool get isEnableAutoLoginPwd;
|
||||||
|
@override
|
||||||
|
bool get isEnableToolSiteMirrors;
|
||||||
|
@override
|
||||||
|
String get inputGameLaunchECore;
|
||||||
|
@override
|
||||||
|
String? get customLauncherPath;
|
||||||
|
@override
|
||||||
|
String? get customGamePath;
|
||||||
|
@override
|
||||||
|
int get locationCacheSize;
|
||||||
|
@override
|
||||||
|
@JsonKey(ignore: true)
|
||||||
|
_$$SettingsUIStateImplCopyWith<_$SettingsUIStateImpl> get copyWith =>
|
||||||
|
throw _privateConstructorUsedError;
|
||||||
|
}
|
26
lib/ui/settings/settings_ui_model.g.dart
Normal file
26
lib/ui/settings/settings_ui_model.g.dart
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'settings_ui_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// RiverpodGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
String _$settingsUIModelHash() => r'34ac24f658a081350be7d2b3bda810d101b888a1';
|
||||||
|
|
||||||
|
/// See also [SettingsUIModel].
|
||||||
|
@ProviderFor(SettingsUIModel)
|
||||||
|
final settingsUIModelProvider =
|
||||||
|
AutoDisposeNotifierProvider<SettingsUIModel, SettingsUIState>.internal(
|
||||||
|
SettingsUIModel.new,
|
||||||
|
name: r'settingsUIModelProvider',
|
||||||
|
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||||
|
? null
|
||||||
|
: _$settingsUIModelHash,
|
||||||
|
dependencies: null,
|
||||||
|
allTransitiveDependencies: null,
|
||||||
|
);
|
||||||
|
|
||||||
|
typedef _$SettingsUIModel = AutoDisposeNotifier<SettingsUIState>;
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member
|
Loading…
Reference in New Issue
Block a user