p4k 下载地址动态下发

This commit is contained in:
xkeyC 2023-10-12 21:00:58 +08:00
parent 4b2461bd9a
commit 889e1f8e19
2 changed files with 22 additions and 8 deletions

View File

@ -1,9 +1,10 @@
/// lastVersion : "V2.5" /// lastVersion : "V2.9"
/// lastVersionCode : 8 /// lastVersionCode : 13
/// lastBetaVersion : "V2.5" /// lastBetaVersion : "V2.9"
/// lastBetaVersionCode : 8 /// lastBetaVersionCode : 13
/// minVersionCode : 7 /// minVersionCode : 13
/// minBetaVersionCode : 7 /// minBetaVersionCode : 13
/// p4kDownloadUrl : "https://p4k.42kit.com/Data.p4k"
class AppVersionData { class AppVersionData {
AppVersionData({ AppVersionData({
@ -12,7 +13,8 @@ class AppVersionData {
this.lastBetaVersion, this.lastBetaVersion,
this.lastBetaVersionCode, this.lastBetaVersionCode,
this.minVersionCode, this.minVersionCode,
this.minBetaVersionCode,}); this.minBetaVersionCode,
this.p4kDownloadUrl,});
AppVersionData.fromJson(dynamic json) { AppVersionData.fromJson(dynamic json) {
lastVersion = json['lastVersion']; lastVersion = json['lastVersion'];
@ -21,6 +23,7 @@ class AppVersionData {
lastBetaVersionCode = json['lastBetaVersionCode']; lastBetaVersionCode = json['lastBetaVersionCode'];
minVersionCode = json['minVersionCode']; minVersionCode = json['minVersionCode'];
minBetaVersionCode = json['minBetaVersionCode']; minBetaVersionCode = json['minBetaVersionCode'];
p4kDownloadUrl = json['p4kDownloadUrl'];
} }
String? lastVersion; String? lastVersion;
num? lastVersionCode; num? lastVersionCode;
@ -28,6 +31,7 @@ class AppVersionData {
num? lastBetaVersionCode; num? lastBetaVersionCode;
num? minVersionCode; num? minVersionCode;
num? minBetaVersionCode; num? minBetaVersionCode;
String? p4kDownloadUrl;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final map = <String, dynamic>{}; final map = <String, dynamic>{};
@ -37,6 +41,7 @@ class AppVersionData {
map['lastBetaVersionCode'] = lastBetaVersionCode; map['lastBetaVersionCode'] = lastBetaVersionCode;
map['minVersionCode'] = minVersionCode; map['minVersionCode'] = minVersionCode;
map['minBetaVersionCode'] = minBetaVersionCode; map['minBetaVersionCode'] = minBetaVersionCode;
map['p4kDownloadUrl'] = p4kDownloadUrl;
return map; return map;
} }

View File

@ -4,6 +4,7 @@ import 'dart:io';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:starcitizen_doctor/base/ui_model.dart'; import 'package:starcitizen_doctor/base/ui_model.dart';
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/ui/tools/downloader/downloader_dialog_ui_model.dart'; import 'package:starcitizen_doctor/ui/tools/downloader/downloader_dialog_ui_model.dart';
@ -302,7 +303,15 @@ class ToolsUIModel extends BaseUIModel {
} }
Future<void> _downloadP4k() async { Future<void> _downloadP4k() async {
const downloadUrl = "https://r2test.citizenwiki.cn/Data.p4k"; final downloadUrl = AppConf.networkVersionData?.p4kDownloadUrl;
if (downloadUrl == null || downloadUrl.isEmpty) {
showToast(context!, "该功能维护中,请稍后再试!");
return;
}
await showToast(
context!,
"P4k 是星际公民的核心游戏文件,高达近 100GB盒子提供的离线下载是为了帮助一些p4k文件下载超级慢的用户。"
"\n\n接下来会弹窗询问您保存位置(可以选择星际公民文件夹也可以选择别处),下载完成后请确保 P4K 文件夹位于 LIVE 文件夹内,之后使用星际公民启动器校验更新即可。");
final r = await showDialog( final r = await showDialog(
context: context!, context: context!,
dismissWithEsc: false, dismissWithEsc: false,