mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 11:24:46 +08:00
fix: 因 RSI 官网变更,移除自动填充功能 (不再支持)
This commit is contained in:
@ -2,7 +2,6 @@ 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/app.dart';
|
||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
||||
import 'package:starcitizen_doctor/generated/l10n.dart';
|
||||
import 'package:starcitizen_doctor/ui/settings/settings_ui_model.dart';
|
||||
|
||||
@ -31,23 +30,6 @@ class SettingsUI extends HookConsumerWidget {
|
||||
S.current.setting_action_create_settings_shortcut,
|
||||
subTitle: S.current.setting_action_create_desktop_shortcut,
|
||||
onTap: () => model.addShortCut(context)),
|
||||
if (ConstConf.isMSE) ...[
|
||||
const SizedBox(height: 12),
|
||||
makeSettingsItem(const Icon(FluentIcons.reset_device, size: 20),
|
||||
S.current.setting_action_reset_auto_password_fill,
|
||||
subTitle: S.current.setting_action_info_device_support_info(
|
||||
sate.isEnableAutoLogin
|
||||
? S.current.setting_action_info_enabled
|
||||
: S.current.setting_action_info_disabled,
|
||||
sate.isDeviceSupportWinHello
|
||||
? S.current.setting_action_info_support
|
||||
: S.current.setting_action_info_not_support,
|
||||
sate.autoLoginEmail,
|
||||
sate.isEnableAutoLoginPwd
|
||||
? S.current.setting_action_info_encrypted_saved
|
||||
: S.current.setting_action_info_not_saved),
|
||||
onTap: () => model.onResetAutoLogin(context)),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
makeSettingsItem(const Icon(FontAwesomeIcons.microchip, size: 20),
|
||||
S.current.setting_action_ignore_efficiency_cores_on_launch,
|
||||
@ -176,4 +158,4 @@ class SettingsUI extends HookConsumerWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,13 +6,11 @@ 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';
|
||||
@ -22,10 +20,6 @@ part 'settings_ui_model.freezed.dart';
|
||||
@freezed
|
||||
class SettingsUIState with _$SettingsUIState {
|
||||
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,
|
||||
@ -44,47 +38,12 @@ class SettingsUIModel extends _$SettingsUIModel {
|
||||
}
|
||||
|
||||
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,
|
||||
S.current.setting_action_info_confirm_reset_autofill,
|
||||
Text(S.current.setting_action_info_delete_local_account_warning));
|
||||
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, S.current.setting_action_info_autofill_data_cleared);
|
||||
_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 =
|
||||
|
@ -17,9 +17,6 @@ final _privateConstructorUsedError = UnsupportedError(
|
||||
/// @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;
|
||||
@ -39,9 +36,6 @@ abstract class $SettingsUIStateCopyWith<$Res> {
|
||||
@useResult
|
||||
$Res call(
|
||||
{dynamic isDeviceSupportWinHello,
|
||||
String autoLoginEmail,
|
||||
bool isEnableAutoLogin,
|
||||
bool isEnableAutoLoginPwd,
|
||||
bool isEnableToolSiteMirrors,
|
||||
String inputGameLaunchECore,
|
||||
String? customLauncherPath,
|
||||
@ -63,9 +57,6 @@ class _$SettingsUIStateCopyWithImpl<$Res, $Val extends SettingsUIState>
|
||||
@override
|
||||
$Res call({
|
||||
Object? isDeviceSupportWinHello = freezed,
|
||||
Object? autoLoginEmail = null,
|
||||
Object? isEnableAutoLogin = null,
|
||||
Object? isEnableAutoLoginPwd = null,
|
||||
Object? isEnableToolSiteMirrors = null,
|
||||
Object? inputGameLaunchECore = null,
|
||||
Object? customLauncherPath = freezed,
|
||||
@ -77,18 +68,6 @@ class _$SettingsUIStateCopyWithImpl<$Res, $Val extends SettingsUIState>
|
||||
? _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
|
||||
@ -123,9 +102,6 @@ abstract class _$$SettingsUIStateImplCopyWith<$Res>
|
||||
@useResult
|
||||
$Res call(
|
||||
{dynamic isDeviceSupportWinHello,
|
||||
String autoLoginEmail,
|
||||
bool isEnableAutoLogin,
|
||||
bool isEnableAutoLoginPwd,
|
||||
bool isEnableToolSiteMirrors,
|
||||
String inputGameLaunchECore,
|
||||
String? customLauncherPath,
|
||||
@ -145,9 +121,6 @@ class __$$SettingsUIStateImplCopyWithImpl<$Res>
|
||||
@override
|
||||
$Res call({
|
||||
Object? isDeviceSupportWinHello = freezed,
|
||||
Object? autoLoginEmail = null,
|
||||
Object? isEnableAutoLogin = null,
|
||||
Object? isEnableAutoLoginPwd = null,
|
||||
Object? isEnableToolSiteMirrors = null,
|
||||
Object? inputGameLaunchECore = null,
|
||||
Object? customLauncherPath = freezed,
|
||||
@ -158,18 +131,6 @@ class __$$SettingsUIStateImplCopyWithImpl<$Res>
|
||||
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
|
||||
@ -199,9 +160,6 @@ class __$$SettingsUIStateImplCopyWithImpl<$Res>
|
||||
class _$SettingsUIStateImpl implements _SettingsUIState {
|
||||
_$SettingsUIStateImpl(
|
||||
{this.isDeviceSupportWinHello = false,
|
||||
this.autoLoginEmail = "-",
|
||||
this.isEnableAutoLogin = false,
|
||||
this.isEnableAutoLoginPwd = false,
|
||||
this.isEnableToolSiteMirrors = false,
|
||||
this.inputGameLaunchECore = "0",
|
||||
this.customLauncherPath,
|
||||
@ -213,15 +171,6 @@ class _$SettingsUIStateImpl implements _SettingsUIState {
|
||||
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()
|
||||
@ -236,7 +185,7 @@ class _$SettingsUIStateImpl implements _SettingsUIState {
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingsUIState(isDeviceSupportWinHello: $isDeviceSupportWinHello, autoLoginEmail: $autoLoginEmail, isEnableAutoLogin: $isEnableAutoLogin, isEnableAutoLoginPwd: $isEnableAutoLoginPwd, isEnableToolSiteMirrors: $isEnableToolSiteMirrors, inputGameLaunchECore: $inputGameLaunchECore, customLauncherPath: $customLauncherPath, customGamePath: $customGamePath, locationCacheSize: $locationCacheSize)';
|
||||
return 'SettingsUIState(isDeviceSupportWinHello: $isDeviceSupportWinHello, isEnableToolSiteMirrors: $isEnableToolSiteMirrors, inputGameLaunchECore: $inputGameLaunchECore, customLauncherPath: $customLauncherPath, customGamePath: $customGamePath, locationCacheSize: $locationCacheSize)';
|
||||
}
|
||||
|
||||
@override
|
||||
@ -246,12 +195,6 @@ class _$SettingsUIStateImpl implements _SettingsUIState {
|
||||
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) &&
|
||||
@ -269,9 +212,6 @@ class _$SettingsUIStateImpl implements _SettingsUIState {
|
||||
int get hashCode => Object.hash(
|
||||
runtimeType,
|
||||
const DeepCollectionEquality().hash(isDeviceSupportWinHello),
|
||||
autoLoginEmail,
|
||||
isEnableAutoLogin,
|
||||
isEnableAutoLoginPwd,
|
||||
isEnableToolSiteMirrors,
|
||||
inputGameLaunchECore,
|
||||
customLauncherPath,
|
||||
@ -289,9 +229,6 @@ class _$SettingsUIStateImpl implements _SettingsUIState {
|
||||
abstract class _SettingsUIState implements SettingsUIState {
|
||||
factory _SettingsUIState(
|
||||
{final dynamic isDeviceSupportWinHello,
|
||||
final String autoLoginEmail,
|
||||
final bool isEnableAutoLogin,
|
||||
final bool isEnableAutoLoginPwd,
|
||||
final bool isEnableToolSiteMirrors,
|
||||
final String inputGameLaunchECore,
|
||||
final String? customLauncherPath,
|
||||
@ -301,12 +238,6 @@ abstract class _SettingsUIState implements SettingsUIState {
|
||||
@override
|
||||
dynamic get isDeviceSupportWinHello;
|
||||
@override
|
||||
String get autoLoginEmail;
|
||||
@override
|
||||
bool get isEnableAutoLogin;
|
||||
@override
|
||||
bool get isEnableAutoLoginPwd;
|
||||
@override
|
||||
bool get isEnableToolSiteMirrors;
|
||||
@override
|
||||
String get inputGameLaunchECore;
|
||||
|
@ -6,7 +6,7 @@ part of 'settings_ui_model.dart';
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$settingsUIModelHash() => r'aab08176293b380f09c89e006f373fbfd7a7ba16';
|
||||
String _$settingsUIModelHash() => r'897176bc24ec5397cce0dd1ceea58338ac7841e0';
|
||||
|
||||
/// See also [SettingsUIModel].
|
||||
@ProviderFor(SettingsUIModel)
|
||||
|
Reference in New Issue
Block a user