mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-22 19:53:43 +08:00
feat: networkGameChannels Support
This commit is contained in:
parent
33f8866bb9
commit
43d0d8454c
@ -10,7 +10,7 @@ import 'package:hexcolor/hexcolor.dart';
|
|||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||||
import 'package:starcitizen_doctor/ui/guide/guide_ui.dart';
|
import 'package:starcitizen_doctor/ui/guide/guide_ui.dart';
|
||||||
import 'package:starcitizen_doctor/ui/home/performance/performance_ui.dart';
|
import 'package:starcitizen_doctor/ui/home/performance/performance_ui.dart';
|
||||||
@ -214,6 +214,8 @@ class AppGlobalModel extends _$AppGlobalModel {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
final networkVersionData = await Api.getAppVersion();
|
final networkVersionData = await Api.getAppVersion();
|
||||||
|
dPrint("networkVersionData == ${networkVersionData.toJson()}");
|
||||||
|
AppConf.setNetworkChannels(networkVersionData.gameChannels);
|
||||||
checkActivityThemeColor(networkVersionData);
|
checkActivityThemeColor(networkVersionData);
|
||||||
if (ConstConf.isMSE) {
|
if (ConstConf.isMSE) {
|
||||||
dPrint(
|
dPrint(
|
||||||
|
28
lib/common/conf/conf.dart
Normal file
28
lib/common/conf/conf.dart
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
class ConstConf {
|
||||||
|
static const String appVersion = "2.13.3";
|
||||||
|
static const int appVersionCode = 61;
|
||||||
|
static const String appVersionDate = "2024-11-23";
|
||||||
|
static const _gameChannels = [
|
||||||
|
"LIVE",
|
||||||
|
"4.0_PREVIEW",
|
||||||
|
"PTU",
|
||||||
|
"EPTU",
|
||||||
|
"TECH-PREVIEW",
|
||||||
|
"HOTFIX"
|
||||||
|
];
|
||||||
|
static const isMSE =
|
||||||
|
String.fromEnvironment("MSE", defaultValue: "false") == "true";
|
||||||
|
static const dohAddress = "https://223.6.6.6/resolve";
|
||||||
|
static const inputMethodServerPort = 59399;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AppConf {
|
||||||
|
static List<String>? _networkGameChannels;
|
||||||
|
|
||||||
|
static setNetworkChannels(List<String>? channels) {
|
||||||
|
_networkGameChannels = channels;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<String> get gameChannels =>
|
||||||
|
_networkGameChannels ?? ConstConf._gameChannels;
|
||||||
|
}
|
@ -1,10 +0,0 @@
|
|||||||
class ConstConf {
|
|
||||||
static const String appVersion = "2.13.3";
|
|
||||||
static const int appVersionCode = 61;
|
|
||||||
static const String appVersionDate = "2024-11-23";
|
|
||||||
static const gameChannels = ["LIVE", "4.0_PREVIEW","PTU", "EPTU", "TECH-PREVIEW", "HOTFIX"];
|
|
||||||
static const isMSE =
|
|
||||||
String.fromEnvironment("MSE", defaultValue: "false") == "true";
|
|
||||||
static const dohAddress = "https://223.6.6.6/resolve";
|
|
||||||
static const inputMethodServerPort = 59399;
|
|
||||||
}
|
|
@ -2,7 +2,7 @@ import 'dart:convert';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||||
|
|
||||||
class SCLoggerHelper {
|
class SCLoggerHelper {
|
||||||
@ -108,7 +108,7 @@ class SCLoggerHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static String getGameChannelID(String installPath) {
|
static String getGameChannelID(String installPath) {
|
||||||
for (var value in ConstConf.gameChannels) {
|
for (var value in AppConf.gameChannels) {
|
||||||
if (installPath.endsWith("\\$value")) {
|
if (installPath.endsWith("\\$value")) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/io/rs_http.dart';
|
import 'package:starcitizen_doctor/common/io/rs_http.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||||
import 'package:starcitizen_doctor/data/doh_client_response_data.dart';
|
import 'package:starcitizen_doctor/data/doh_client_response_data.dart';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/rust/api/http_api.dart' as rust_http;
|
import 'package:starcitizen_doctor/common/rust/api/http_api.dart' as rust_http;
|
||||||
import 'package:starcitizen_doctor/common/rust/api/http_api.dart';
|
import 'package:starcitizen_doctor/common/rust/api/http_api.dart';
|
||||||
import 'package:starcitizen_doctor/common/rust/http_package.dart';
|
import 'package:starcitizen_doctor/common/rust/http_package.dart';
|
||||||
|
@ -30,6 +30,7 @@ class AppVersionData {
|
|||||||
activityColors = json['activityColors'] != null
|
activityColors = json['activityColors'] != null
|
||||||
? ActivityColors.fromJson(json['activityColors'])
|
? ActivityColors.fromJson(json['activityColors'])
|
||||||
: null;
|
: null;
|
||||||
|
gameChannels = List.from(json["game_channels"]).cast<String>();
|
||||||
webMirrors = json["web_mirrors"];
|
webMirrors = json["web_mirrors"];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,6 +42,7 @@ class AppVersionData {
|
|||||||
num? mSEMinVersionCode;
|
num? mSEMinVersionCode;
|
||||||
String? p4kDownloadUrl;
|
String? p4kDownloadUrl;
|
||||||
ActivityColors? activityColors;
|
ActivityColors? activityColors;
|
||||||
|
List<String>? gameChannels;
|
||||||
Map? webMirrors;
|
Map? webMirrors;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -56,6 +58,7 @@ class AppVersionData {
|
|||||||
map['activityColors'] = activityColors?.toJson();
|
map['activityColors'] = activityColors?.toJson();
|
||||||
}
|
}
|
||||||
map["web_mirrors"] = webMirrors;
|
map["web_mirrors"] = webMirrors;
|
||||||
|
map["game_channels"] = gameChannels;
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:starcitizen_doctor/api/analytics.dart';
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||||
import 'package:starcitizen_doctor/app.dart';
|
import 'package:starcitizen_doctor/app.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||||
import 'package:starcitizen_doctor/widgets/src/flow_number_text.dart';
|
import 'package:starcitizen_doctor/widgets/src/flow_number_text.dart';
|
||||||
import 'package:starcitizen_doctor/widgets/widgets.dart';
|
import 'package:starcitizen_doctor/widgets/widgets.dart';
|
||||||
|
@ -3,7 +3,7 @@ import 'package:flutter_hooks/flutter_hooks.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||||
import 'package:starcitizen_doctor/ui/settings/settings_ui_model.dart';
|
import 'package:starcitizen_doctor/ui/settings/settings_ui_model.dart';
|
||||||
import 'package:starcitizen_doctor/ui/tools/tools_ui_model.dart';
|
import 'package:starcitizen_doctor/ui/tools/tools_ui_model.dart';
|
||||||
|
@ -11,7 +11,7 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|||||||
import 'package:starcitizen_doctor/api/analytics.dart';
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||||
import 'package:starcitizen_doctor/api/api.dart';
|
import 'package:starcitizen_doctor/api/api.dart';
|
||||||
import 'package:starcitizen_doctor/api/rss.dart';
|
import 'package:starcitizen_doctor/api/rss.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/url_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/log_helper.dart';
|
||||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||||
|
@ -8,7 +8,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';
|
|||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:shelf/shelf.dart';
|
import 'package:shelf/shelf.dart';
|
||||||
import 'package:shelf/shelf_io.dart' as shelf_io;
|
import 'package:shelf/shelf_io.dart' as shelf_io;
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||||
import 'package:starcitizen_doctor/ui/home/input_method/server_qr_dialog_ui.dart';
|
import 'package:starcitizen_doctor/ui/home/input_method/server_qr_dialog_ui.dart';
|
||||||
import 'package:starcitizen_doctor/ui/home/localization/localization_ui_model.dart';
|
import 'package:starcitizen_doctor/ui/home/localization/localization_ui_model.dart';
|
||||||
|
@ -11,7 +11,7 @@ import 'package:hive/hive.dart';
|
|||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:starcitizen_doctor/api/analytics.dart';
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||||
import 'package:starcitizen_doctor/api/api.dart';
|
import 'package:starcitizen_doctor/api/api.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/io/rs_http.dart';
|
import 'package:starcitizen_doctor/common/io/rs_http.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||||
@ -578,7 +578,7 @@ class LocalizationUIModel extends _$LocalizationUIModel {
|
|||||||
dPrint("check Localization update $scInstallPath");
|
dPrint("check Localization update $scInstallPath");
|
||||||
if (!(curData?.keys.contains(installedVersion) ?? false)) {
|
if (!(curData?.keys.contains(installedVersion) ?? false)) {
|
||||||
// has update
|
// has update
|
||||||
for (var channel in ConstConf.gameChannels) {
|
for (var channel in AppConf.gameChannels) {
|
||||||
if (scInstallPath.contains(channel)) {
|
if (scInstallPath.contains(channel)) {
|
||||||
dPrint("check Localization update: has update -> $channel");
|
dPrint("check Localization update: has update -> $channel");
|
||||||
updates.add(channel);
|
updates.add(channel);
|
||||||
|
@ -3,7 +3,7 @@ import 'package:flutter_hooks/flutter_hooks.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:starcitizen_doctor/app.dart';
|
import 'package:starcitizen_doctor/app.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/provider/aria2c.dart';
|
import 'package:starcitizen_doctor/provider/aria2c.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/settings/settings_ui_model.dart';
|
import 'package:starcitizen_doctor/ui/settings/settings_ui_model.dart';
|
||||||
|
@ -7,7 +7,7 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/provider.dart';
|
import 'package:starcitizen_doctor/common/utils/provider.dart';
|
||||||
|
@ -8,7 +8,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|||||||
import 'package:markdown/markdown.dart' as markdown;
|
import 'package:markdown/markdown.dart' as markdown;
|
||||||
import 'package:starcitizen_doctor/api/api.dart';
|
import 'package:starcitizen_doctor/api/api.dart';
|
||||||
import 'package:starcitizen_doctor/app.dart';
|
import 'package:starcitizen_doctor/app.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/url_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/helper/system_helper.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||||
|
@ -8,7 +8,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|||||||
import 'package:markdown_widget/widget/markdown.dart';
|
import 'package:markdown_widget/widget/markdown.dart';
|
||||||
import 'package:starcitizen_doctor/api/analytics.dart';
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||||
import 'package:starcitizen_doctor/app.dart';
|
import 'package:starcitizen_doctor/app.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/url_conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/utils/log.dart';
|
import 'package:starcitizen_doctor/common/utils/log.dart';
|
||||||
import 'package:starcitizen_doctor/provider/aria2c.dart';
|
import 'package:starcitizen_doctor/provider/aria2c.dart';
|
||||||
|
@ -11,7 +11,7 @@ import 'package:go_router/go_router.dart';
|
|||||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||||
import 'package:starcitizen_doctor/api/analytics.dart';
|
import 'package:starcitizen_doctor/api/analytics.dart';
|
||||||
import 'package:starcitizen_doctor/api/api.dart';
|
import 'package:starcitizen_doctor/api/api.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/const_conf.dart';
|
import 'package:starcitizen_doctor/common/conf/conf.dart';
|
||||||
import 'package:starcitizen_doctor/common/conf/url_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/log_helper.dart';
|
||||||
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
import 'package:starcitizen_doctor/common/helper/system_helper.dart';
|
||||||
@ -268,7 +268,7 @@ class ToolsUIModel extends _$ToolsUIModel {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
scInstallPaths = await SCLoggerHelper.getGameInstallPath(listData,
|
scInstallPaths = await SCLoggerHelper.getGameInstallPath(listData,
|
||||||
checkExists: checkActive, withVersion: ConstConf.gameChannels);
|
checkExists: checkActive, withVersion: AppConf.gameChannels);
|
||||||
if (scInstallPaths.isNotEmpty) {
|
if (scInstallPaths.isNotEmpty) {
|
||||||
scInstalledPath = scInstallPaths.first;
|
scInstalledPath = scInstallPaths.first;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user