mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 05:34:45 +08:00
feat: Remove custom localization
This commit is contained in:
@ -180,89 +180,6 @@ class LocalizationDialogUI extends HookConsumerWidget {
|
||||
],
|
||||
context),
|
||||
const SizedBox(height: 12),
|
||||
IconButton(
|
||||
icon: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(state.enableCustomize
|
||||
? FluentIcons.chevron_up
|
||||
: FluentIcons.chevron_down),
|
||||
const SizedBox(width: 12),
|
||||
Text(S.current.localization_action_advanced_features),
|
||||
],
|
||||
),
|
||||
onPressed: model.toggleCustomize),
|
||||
AnimatedSize(
|
||||
duration: const Duration(milliseconds: 130),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 12),
|
||||
state.enableCustomize
|
||||
? makeListContainer(
|
||||
S.current.localization_info_custom_text,
|
||||
[
|
||||
if (state.customizeList == null)
|
||||
makeLoading(context)
|
||||
else if (state.customizeList!.isEmpty)
|
||||
Center(
|
||||
child: Text(
|
||||
S.current.localization_info_no_custom_text,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.white.withOpacity(.8)),
|
||||
),
|
||||
)
|
||||
else ...[
|
||||
for (final file in state.customizeList!)
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
model.getCustomizeFileName(file),
|
||||
),
|
||||
const Spacer(),
|
||||
if (state.workingVersion == file)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(right: 12),
|
||||
child: ProgressRing(),
|
||||
)
|
||||
else
|
||||
Button(
|
||||
onPressed:
|
||||
model.doLocalInstall(file),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 8,
|
||||
right: 8,
|
||||
top: 4,
|
||||
bottom: 4),
|
||||
child: Text(S.current
|
||||
.localization_action_install),
|
||||
))
|
||||
],
|
||||
)
|
||||
],
|
||||
],
|
||||
context,
|
||||
actions: [
|
||||
Button(
|
||||
onPressed: () => model.openDir(context),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(FluentIcons.folder_open),
|
||||
const SizedBox(width: 6),
|
||||
Text(S.current.action_open_folder),
|
||||
],
|
||||
),
|
||||
)),
|
||||
])
|
||||
: SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -12,7 +12,6 @@ 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/system_helper.dart';
|
||||
import 'package:starcitizen_doctor/common/io/rs_http.dart';
|
||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||
import 'package:starcitizen_doctor/common/utils/provider.dart';
|
||||
@ -49,9 +48,6 @@ class LocalizationUIModel extends _$LocalizationUIModel {
|
||||
Directory get _downloadDir =>
|
||||
Directory("${appGlobalState.applicationSupportDir}\\Localizations");
|
||||
|
||||
Directory get _customizeDir =>
|
||||
Directory("${_downloadDir.absolute.path}\\Customize_ini");
|
||||
|
||||
Directory get _scDataDir =>
|
||||
Directory("${ref.read(homeUIModelProvider).scInstalledPath}\\data");
|
||||
|
||||
@ -72,12 +68,6 @@ class LocalizationUIModel extends _$LocalizationUIModel {
|
||||
if (_scInstallPath == "not_install") {
|
||||
return;
|
||||
}
|
||||
if (!_customizeDir.existsSync()) {
|
||||
await _customizeDir.create(recursive: true);
|
||||
}
|
||||
_customizeDirListenSub = _customizeDir.watch().listen((event) {
|
||||
_scanCustomizeDir();
|
||||
});
|
||||
ref.onDispose(() {
|
||||
_customizeDirListenSub?.cancel();
|
||||
_customizeDirListenSub = null;
|
||||
@ -106,7 +96,6 @@ class LocalizationUIModel extends _$LocalizationUIModel {
|
||||
Future<void> _loadData() async {
|
||||
_allVersionLocalizationData.clear();
|
||||
await _updateStatus();
|
||||
_scanCustomizeDir();
|
||||
for (var lang in languageSupport.keys) {
|
||||
final l = await Api.getScLocalizationData(lang).unwrap();
|
||||
if (l != null) {
|
||||
@ -275,11 +264,6 @@ class LocalizationUIModel extends _$LocalizationUIModel {
|
||||
await _updateStatus();
|
||||
}
|
||||
|
||||
openDir(BuildContext context) async {
|
||||
showToast(context, S.current.localization_info_custom_file_instructions);
|
||||
SystemHelper.openDir(_customizeDir.absolute.path);
|
||||
}
|
||||
|
||||
VoidCallback? doRemoteInstall(
|
||||
BuildContext context, ScLocalizationData value) {
|
||||
return () async {
|
||||
@ -363,17 +347,6 @@ class LocalizationUIModel extends _$LocalizationUIModel {
|
||||
};
|
||||
}
|
||||
|
||||
void _scanCustomizeDir() {
|
||||
final fileList = _customizeDir.listSync();
|
||||
final customizeList = <String>[];
|
||||
for (var value in fileList) {
|
||||
if (value is File && value.path.endsWith(".ini")) {
|
||||
customizeList.add(value.absolute.path);
|
||||
}
|
||||
}
|
||||
state = state.copyWith(customizeList: customizeList);
|
||||
}
|
||||
|
||||
_updateStatus() async {
|
||||
final patchStatus = MapEntry(
|
||||
await _getLangCfgEnableLang(lang: state.selectedLanguage!),
|
||||
|
Reference in New Issue
Block a user