mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-23 01:53:41 +08:00
update
This commit is contained in:
parent
d63d07a1a9
commit
5606dd0b87
@ -23,6 +23,8 @@ class AppConf {
|
|||||||
"https://jihulab.com/StarCitizenCN_Community/api/-/raw/main/";
|
"https://jihulab.com/StarCitizenCN_Community/api/-/raw/main/";
|
||||||
static const String gitlabApiPath = "https://jihulab.com/api/v4/";
|
static const String gitlabApiPath = "https://jihulab.com/api/v4/";
|
||||||
|
|
||||||
|
static const String webTranslateHomeUrl= "https://ch.citizenwiki.cn/json-files/locales";
|
||||||
|
|
||||||
static late final String applicationSupportDir;
|
static late final String applicationSupportDir;
|
||||||
|
|
||||||
static AppVersionData? networkVersionData;
|
static AppVersionData? networkVersionData;
|
||||||
|
@ -83,107 +83,123 @@ class HomeUI extends BaseUI<HomeUIModel> {
|
|||||||
Positioned(
|
Positioned(
|
||||||
top: 0,
|
top: 0,
|
||||||
right: 24,
|
right: 24,
|
||||||
child: Container(
|
child: Stack(
|
||||||
decoration: BoxDecoration(
|
children: [
|
||||||
borderRadius: BorderRadius.circular(12),
|
Container(
|
||||||
color: FluentTheme.of(context).cardColor.withOpacity(.03),
|
decoration: BoxDecoration(
|
||||||
),
|
borderRadius: BorderRadius.circular(12),
|
||||||
child: Padding(
|
color: FluentTheme.of(context).cardColor.withOpacity(.03),
|
||||||
padding: const EdgeInsets.all(12),
|
),
|
||||||
child: Column(
|
child: Padding(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
padding: const EdgeInsets.all(12),
|
||||||
children: [
|
child: Column(
|
||||||
makeWebViewButton(model,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
icon: SvgPicture.asset(
|
children: [
|
||||||
"assets/rsi.svg",
|
makeWebViewButton(model,
|
||||||
colorFilter: makeSvgColor(Colors.white),
|
icon: SvgPicture.asset(
|
||||||
height: 18,
|
"assets/rsi.svg",
|
||||||
),
|
colorFilter: makeSvgColor(Colors.white),
|
||||||
name: "星际公民官网汉化",
|
|
||||||
webTitle: "星际公民官网汉化",
|
|
||||||
webURL: "https://robertsspaceindustries.com",
|
|
||||||
info: "罗伯茨航天工业公司,万物的起源",
|
|
||||||
useLocalization: true,
|
|
||||||
width: width),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
makeWebViewButton(model,
|
|
||||||
icon: Row(
|
|
||||||
children: [
|
|
||||||
SvgPicture.asset(
|
|
||||||
"assets/uex.svg",
|
|
||||||
height: 18,
|
height: 18,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
name: "星际公民官网汉化",
|
||||||
],
|
webTitle: "星际公民官网汉化",
|
||||||
),
|
webURL: "https://robertsspaceindustries.com",
|
||||||
name: "UEX 汉化",
|
info: "罗伯茨航天工业公司,万物的起源",
|
||||||
webTitle: "UEX 汉化",
|
useLocalization: true,
|
||||||
webURL: "https://uexcorp.space",
|
width: width),
|
||||||
info: "采矿、精炼、贸易计算器、价格、船信息",
|
const SizedBox(height: 12),
|
||||||
useLocalization: true,
|
makeWebViewButton(model,
|
||||||
width: width),
|
icon: Row(
|
||||||
const SizedBox(height: 12),
|
children: [
|
||||||
makeWebViewButton(model,
|
SvgPicture.asset(
|
||||||
icon: Row(
|
"assets/uex.svg",
|
||||||
|
height: 18,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
name: "UEX 汉化",
|
||||||
|
webTitle: "UEX 汉化",
|
||||||
|
webURL: "https://uexcorp.space",
|
||||||
|
info: "采矿、精炼、贸易计算器、价格、船信息",
|
||||||
|
useLocalization: true,
|
||||||
|
width: width),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
makeWebViewButton(model,
|
||||||
|
icon: Row(
|
||||||
|
children: [
|
||||||
|
ExtendedImage.network(
|
||||||
|
"https://www.erkul.games/assets/icons/icon-512x512.png",
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
name: "DPS计算器汉化",
|
||||||
|
webTitle: "DPS计算器汉化",
|
||||||
|
webURL: "https://www.erkul.games/live/calculator",
|
||||||
|
info: "在线改船,查询伤害数值和配件购买地点",
|
||||||
|
useLocalization: true,
|
||||||
|
width: width),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
const Text("外部浏览器拓展:"),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Row(
|
||||||
children: [
|
children: [
|
||||||
ExtendedImage.network(
|
Button(
|
||||||
"https://www.erkul.games/assets/icons/icon-512x512.png",
|
child: const FaIcon(FontAwesomeIcons.chrome,
|
||||||
height: 20,
|
size: 18),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString(
|
||||||
|
"https://chrome.google.com/webstore/detail/gocnjckojmledijgmadmacoikibcggja?authuser=0&hl=zh-CN");
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
|
Button(
|
||||||
|
child:
|
||||||
|
const FaIcon(FontAwesomeIcons.edge, size: 18),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString(
|
||||||
|
"https://microsoftedge.microsoft.com/addons/detail/lipbbcckldklpdcpfagicipecaacikgi");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Button(
|
||||||
|
child: const FaIcon(
|
||||||
|
FontAwesomeIcons.firefoxBrowser,
|
||||||
|
size: 18),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString(
|
||||||
|
"https://addons.mozilla.org/zh-CN/firefox/"
|
||||||
|
"addon/%E6%98%9F%E9%99%85%E5%85%AC%E6%B0%91%E7%9B%92%E5%AD%90%E6%B5%8F%E8%A7%88%E5%99%A8%E6%8B%93%E5%B1%95/");
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Button(
|
||||||
|
child: const FaIcon(FontAwesomeIcons.github,
|
||||||
|
size: 18),
|
||||||
|
onPressed: () {
|
||||||
|
launchUrlString(
|
||||||
|
"https://github.com/xkeyC/StarCitizenBoxBrowserEx");
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
name: "DPS计算器汉化",
|
|
||||||
webTitle: "DPS计算器汉化",
|
|
||||||
webURL: "https://www.erkul.games/live/calculator",
|
|
||||||
info: "在线改船,查询伤害数值和配件购买地点",
|
|
||||||
useLocalization: true,
|
|
||||||
width: width),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
const Text("外部浏览器拓展:"),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Button(
|
|
||||||
child:
|
|
||||||
const FaIcon(FontAwesomeIcons.chrome, size: 18),
|
|
||||||
onPressed: () {
|
|
||||||
launchUrlString(
|
|
||||||
"https://chrome.google.com/webstore/detail/gocnjckojmledijgmadmacoikibcggja?authuser=0&hl=zh-CN");
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
Button(
|
|
||||||
child: const FaIcon(FontAwesomeIcons.edge, size: 18),
|
|
||||||
onPressed: () {
|
|
||||||
launchUrlString(
|
|
||||||
"https://microsoftedge.microsoft.com/addons/detail/lipbbcckldklpdcpfagicipecaacikgi");
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
Button(
|
|
||||||
child: const FaIcon(FontAwesomeIcons.firefoxBrowser,
|
|
||||||
size: 18),
|
|
||||||
onPressed: () {
|
|
||||||
launchUrlString(
|
|
||||||
"https://addons.mozilla.org/zh-CN/firefox/"
|
|
||||||
"addon/%E6%98%9F%E9%99%85%E5%85%AC%E6%B0%91%E7%9B%92%E5%AD%90%E6%B5%8F%E8%A7%88%E5%99%A8%E6%8B%93%E5%B1%95/");
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
Button(
|
|
||||||
child:
|
|
||||||
const FaIcon(FontAwesomeIcons.github, size: 18),
|
|
||||||
onPressed: () {
|
|
||||||
launchUrlString(
|
|
||||||
"https://github.com/xkeyC/StarCitizenBoxBrowserEx");
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
if (model.appWebLocalizationVersionsData == null)
|
||||||
|
Positioned.fill(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.black.withOpacity(.3),
|
||||||
|
borderRadius: BorderRadius.circular(12)),
|
||||||
|
child: const Center(
|
||||||
|
child: ProgressRing(),
|
||||||
|
),
|
||||||
|
))
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
@ -297,13 +313,20 @@ class HomeUI extends BaseUI<HomeUIModel> {
|
|||||||
AnimatedSize(
|
AnimatedSize(
|
||||||
duration: const Duration(milliseconds: 130),
|
duration: const Duration(milliseconds: 130),
|
||||||
child: Button(
|
child: Button(
|
||||||
|
onPressed: model.appWebLocalizationVersionsData == null
|
||||||
|
? null
|
||||||
|
: () => model.launchRSI(),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Icon(model.isCurGameRunning
|
child: Icon(
|
||||||
? FluentIcons.stop_solid
|
model.isCurGameRunning
|
||||||
: FluentIcons.play),
|
? FluentIcons.stop_solid
|
||||||
),
|
: FluentIcons.play,
|
||||||
onPressed: () => model.launchRSI()),
|
color: model.isCurGameRunning
|
||||||
|
? Colors.red.withOpacity(.8)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
)),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Button(
|
Button(
|
||||||
|
@ -3,6 +3,7 @@ import 'dart:convert';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:desktop_webview_window/desktop_webview_window.dart';
|
import 'package:desktop_webview_window/desktop_webview_window.dart';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:starcitizen_doctor/api/api.dart';
|
import 'package:starcitizen_doctor/api/api.dart';
|
||||||
import 'package:starcitizen_doctor/base/ui_model.dart';
|
import 'package:starcitizen_doctor/base/ui_model.dart';
|
||||||
@ -10,6 +11,7 @@ import 'package:starcitizen_doctor/common/conf.dart';
|
|||||||
import 'package:starcitizen_doctor/common/helper/log_helper.dart';
|
import 'package:starcitizen_doctor/common/helper/log_helper.dart';
|
||||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||||
import 'package:starcitizen_doctor/data/app_placard_data.dart';
|
import 'package:starcitizen_doctor/data/app_placard_data.dart';
|
||||||
|
import 'package:starcitizen_doctor/data/app_web_localization_versions_data.dart';
|
||||||
import 'package:starcitizen_doctor/ui/home/dialogs/md_content_dialog_ui.dart';
|
import 'package:starcitizen_doctor/ui/home/dialogs/md_content_dialog_ui.dart';
|
||||||
import 'package:starcitizen_doctor/ui/home/dialogs/md_content_dialog_ui_model.dart';
|
import 'package:starcitizen_doctor/ui/home/dialogs/md_content_dialog_ui_model.dart';
|
||||||
import 'package:starcitizen_doctor/ui/home/localization/localization_ui_model.dart';
|
import 'package:starcitizen_doctor/ui/home/localization/localization_ui_model.dart';
|
||||||
@ -49,6 +51,8 @@ class HomeUIModel extends BaseUIModel {
|
|||||||
|
|
||||||
List<MapEntry<String, String>>? checkResult;
|
List<MapEntry<String, String>>? checkResult;
|
||||||
|
|
||||||
|
AppWebLocalizationVersionsData? appWebLocalizationVersionsData;
|
||||||
|
|
||||||
final cnExp = RegExp(r"[^\x00-\xff]");
|
final cnExp = RegExp(r"[^\x00-\xff]");
|
||||||
|
|
||||||
AppPlacardData? appPlacardData;
|
AppPlacardData? appPlacardData;
|
||||||
@ -77,6 +81,10 @@ class HomeUIModel extends BaseUIModel {
|
|||||||
appPlacardData = r;
|
appPlacardData = r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
appWebLocalizationVersionsData = AppWebLocalizationVersionsData.fromJson(
|
||||||
|
(await Api.dio.get("${AppConf.webTranslateHomeUrl}/versions.json",
|
||||||
|
options: Options(responseType: ResponseType.json)))
|
||||||
|
.data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
dPrint(e);
|
dPrint(e);
|
||||||
}
|
}
|
||||||
@ -434,7 +442,7 @@ class HomeUIModel extends BaseUIModel {
|
|||||||
isFixing = true;
|
isFixing = true;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
try {
|
try {
|
||||||
await webViewModel.initLocalization();
|
await webViewModel.initLocalization(appWebLocalizationVersionsData!);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showToast(context!, "初始化网页汉化资源失败!$e");
|
showToast(context!, "初始化网页汉化资源失败!$e");
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,33 @@ class LoginDialogModel extends BaseUIModel {
|
|||||||
.replaceAll("\")", "");
|
.replaceAll("\")", "");
|
||||||
Map<String, dynamic> payload = Jwt.parseJwt(authToken!);
|
Map<String, dynamic> payload = Jwt.parseJwt(authToken!);
|
||||||
nickname = payload["nickname"] ?? "";
|
nickname = payload["nickname"] ?? "";
|
||||||
|
final buildInfoFile = File("$installPath\\build_manifest.id");
|
||||||
|
if (await buildInfoFile.exists()) {
|
||||||
|
final buildInfo =
|
||||||
|
json.decode(await buildInfoFile.readAsString())["Data"];
|
||||||
|
dPrint("buildInfo ======= $buildInfo");
|
||||||
|
|
||||||
|
if (releaseInfo?["versionLabel"] != null &&
|
||||||
|
buildInfo["RequestedP4ChangeNum"] != null) {
|
||||||
|
if (!(releaseInfo!["versionLabel"]!
|
||||||
|
.toString()
|
||||||
|
.endsWith(buildInfo["RequestedP4ChangeNum"]!.toString()))) {
|
||||||
|
final ok = await showConfirmDialogs(
|
||||||
|
context!,
|
||||||
|
"游戏版本过期",
|
||||||
|
Text(
|
||||||
|
"RSI 服务器报告版本号:${releaseInfo?["versionLabel"]} \n\n本地版本号:${buildInfo["RequestedP4ChangeNum"]} \n\n建议使用 RSI Launcher 更新游戏!"),
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxWidth: MediaQuery.of(context!).size.width * .4),
|
||||||
|
cancel: "忽略");
|
||||||
|
if (ok == true) {
|
||||||
|
Navigator.pop(context!);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_readyForLaunch();
|
_readyForLaunch();
|
||||||
}, useLocalization: true);
|
}, useLocalization: true);
|
||||||
}
|
}
|
||||||
@ -98,7 +125,8 @@ class LoginDialogModel extends BaseUIModel {
|
|||||||
loginChannel: getChannelID());
|
loginChannel: getChannelID());
|
||||||
if (useLocalization) {
|
if (useLocalization) {
|
||||||
try {
|
try {
|
||||||
await webViewModel.initLocalization();
|
await webViewModel
|
||||||
|
.initLocalization(homeUIModel.appWebLocalizationVersionsData!);
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
await webViewModel.initWebView(
|
await webViewModel.initWebView(
|
||||||
|
@ -167,16 +167,12 @@ class WebViewModel {
|
|||||||
webview.launch(url);
|
webview.launch(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
initLocalization() async {
|
initLocalization(AppWebLocalizationVersionsData v) async {
|
||||||
localizationScript = await rootBundle.loadString('assets/web_script.js');
|
localizationScript = await rootBundle.loadString('assets/web_script.js');
|
||||||
|
|
||||||
/// https://github.com/CxJuice/Uex_Chinese_Translate
|
/// https://github.com/CxJuice/Uex_Chinese_Translate
|
||||||
// get versions
|
// get versions
|
||||||
const hostUrl = "https://ch.citizenwiki.cn/json-files/locales";
|
const hostUrl = AppConf.webTranslateHomeUrl;
|
||||||
|
|
||||||
final v = AppWebLocalizationVersionsData.fromJson(
|
|
||||||
await _getJson("$hostUrl/versions.json"));
|
|
||||||
|
|
||||||
dPrint("AppWebLocalizationVersionsData === ${v.toJson()}");
|
dPrint("AppWebLocalizationVersionsData === ${v.toJson()}");
|
||||||
|
|
||||||
localizationResource["zh-CN"] = await _getJson("$hostUrl/zh-CN-rsi.json",
|
localizationResource["zh-CN"] = await _getJson("$hostUrl/zh-CN-rsi.json",
|
||||||
|
Loading…
Reference in New Issue
Block a user