为账户安全,游戏登入功能将只支持微软商店版

This commit is contained in:
xkeyC 2023-11-07 22:49:09 +08:00
parent 7257e34653
commit 8d79c1bce2
7 changed files with 78 additions and 43 deletions

View File

@ -44,7 +44,7 @@ class AppConf {
static late final WindowsDeviceInfo windowsDeviceInfo;
static const isMSE =
String.fromEnvironment("MSE", defaultValue: "false") == "true";
String.fromEnvironment("MSE", defaultValue: "true") == "true";
static final launchHelperPath =
"${AppConf.applicationSupportDir}\\launch_helper.vbs";

View File

@ -1,7 +1,6 @@
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:starcitizen_doctor/base/ui.dart';
import 'package:starcitizen_doctor/common/conf.dart';
import 'package:starcitizen_doctor/global_ui_model.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'about_ui_model.dart';
@ -25,16 +24,11 @@ class AboutUI extends BaseUI<AboutUIModel> {
),
const SizedBox(height: 12),
Button(
onPressed: model.checkUpdate,
child: const Padding(
padding: EdgeInsets.all(4),
child: Text("检查更新"),
),
onPressed: () async {
final hasUpdate = await globalUIModel.checkUpdate(context);
if (!hasUpdate) {
if (mounted) showToast(context, "已是最新版本");
}
}),
)),
const SizedBox(height: 32),
Container(
decoration: BoxDecoration(

View File

@ -1,5 +1,17 @@
import 'package:starcitizen_doctor/base/ui_model.dart';
import 'package:starcitizen_doctor/common/conf.dart';
import 'package:starcitizen_doctor/global_ui_model.dart';
import 'package:url_launcher/url_launcher_string.dart';
class AboutUIModel extends BaseUIModel {
}
Future<void> checkUpdate() async {
if (AppConf.isMSE) {
launchUrlString("ms-windows-store://pdp/?productid=9NF3SWFWNKL1");
return;
}
final hasUpdate = await globalUIModel.checkUpdate(context!);
if (!hasUpdate) {
if (mounted) showToast(context!, "已是最新版本");
}
}
}

View File

@ -415,21 +415,23 @@ class HomeUI extends BaseUI<HomeUIModel> {
const SizedBox(width: 12),
AnimatedSize(
duration: const Duration(milliseconds: 130),
child: Button(
onPressed: model.appWebLocalizationVersionsData == null
? null
: () => model.launchRSI(),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
model.isCurGameRunning
? FluentIcons.stop_solid
: FluentIcons.play,
color: model.isCurGameRunning
? Colors.red.withOpacity(.8)
: null,
),
)),
child: model.isRsiLauncherStarting
? const ProgressRing()
: Button(
onPressed: model.appWebLocalizationVersionsData == null
? null
: () => model.launchRSI(),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
model.isCurGameRunning
? FluentIcons.stop_solid
: FluentIcons.play,
color: model.isCurGameRunning
? Colors.red.withOpacity(.8)
: null,
),
)),
),
const SizedBox(width: 12),
Button(

View File

@ -74,6 +74,8 @@ class HomeUIModel extends BaseUIModel {
"Arena Commander": "竞技场指挥官"
};
bool isRsiLauncherStarting = false;
@override
Future loadData() async {
if (AppConf.networkVersionData == null) return;
@ -488,19 +490,37 @@ class HomeUIModel extends BaseUIModel {
showToast(context!, "该功能需要一个有效的安装位置");
return;
}
if (isCurGameRunning) {
await Process.run(SystemHelper.powershellPath, ["ps \"StarCitizen\" | kill"]);
return;
if (AppConf.isMSE) {
if (isCurGameRunning) {
await Process.run(
SystemHelper.powershellPath, ["ps \"StarCitizen\" | kill"]);
return;
}
AnalyticsApi.touch("gameLaunch");
showDialog(
context: context!,
dismissWithEsc: false,
builder: (context) {
return BaseUIContainer(
uiCreate: () => LoginDialog(),
modelCreate: () => LoginDialogModel(scInstalledPath, this));
});
} else {
isRsiLauncherStarting = true;
notifyListeners();
final rsiLauncherInstalledPath = await SystemHelper.getRSILauncherPath();
if (rsiLauncherInstalledPath.isEmpty) {
isRsiLauncherStarting = false;
notifyListeners();
showToast(context!, "未找到 RSI 启动器目录");
return;
}
SystemHelper.checkAndLaunchRSILauncher(rsiLauncherInstalledPath);
await Future.delayed(const Duration(seconds: 3));
isRsiLauncherStarting = false;
notifyListeners();
}
AnalyticsApi.touch("gameLaunch");
showDialog(
context: context!,
dismissWithEsc: false,
builder: (context) {
return BaseUIContainer(
uiCreate: () => LoginDialog(),
modelCreate: () => LoginDialogModel(scInstalledPath, this));
});
}
bool isRSIServerStatusOK(Map map) {

View File

@ -1,4 +1,5 @@
import 'package:starcitizen_doctor/base/ui.dart';
import 'package:starcitizen_doctor/common/conf.dart';
import 'package:starcitizen_doctor/ui/settings/settings_ui_model.dart';
class SettingUI extends BaseUI<SettingUIModel> {
@ -10,10 +11,13 @@ class SettingUI extends BaseUI<SettingUIModel> {
margin: const EdgeInsets.all(16),
child: Column(
children: [
makeSettingsItem(const Icon(FluentIcons.reset_device), "重置自动密码填充",
subTitle:
"启用:${model.isEnableAutoLogin ? "已启用" : "已禁用"} 设备支持:${model.isDeviceSupportWinHello ? "支持" : "不支持"} 邮箱:${model.autoLoginEmail} 密码:${model.isEnableAutoLoginPwd ? "已加密保存" : "未保存"}",
onTap: model.onResetAutoLogin),
if (AppConf.isMSE)
makeSettingsItem(const Icon(FluentIcons.reset_device), "重置自动密码填充",
subTitle:
"启用:${model.isEnableAutoLogin ? "已启用" : "已禁用"} 设备支持:${model.isDeviceSupportWinHello ? "支持" : "不支持"} 邮箱:${model.autoLoginEmail} 密码:${model.isEnableAutoLoginPwd ? "已加密保存" : "未保存"}",
onTap: model.onResetAutoLogin)
else
const Text("暂无设置项"),
],
),
);

View File

@ -1,6 +1,7 @@
import 'package:hive/hive.dart';
import 'package:local_auth/local_auth.dart';
import 'package:starcitizen_doctor/base/ui_model.dart';
import 'package:starcitizen_doctor/common/conf.dart';
import 'package:starcitizen_doctor/common/win32/credentials.dart';
class SettingUIModel extends BaseUIModel {
@ -15,7 +16,9 @@ class SettingUIModel extends BaseUIModel {
final LocalAuthentication localAuth = LocalAuthentication();
isDeviceSupportWinHello = await localAuth.isDeviceSupported();
notifyListeners();
_updateAutoLoginAccount();
if (AppConf.isMSE) {
_updateAutoLoginAccount();
}
}
Future<void> onResetAutoLogin() async {