mirror of
https://mirror.ghproxy.com/https://github.com/StarCitizenToolBox/app.git
synced 2024-12-22 18:43:43 +08:00
优化登录功能
This commit is contained in:
parent
6153bcf9c0
commit
0640761299
@ -229,6 +229,7 @@ async function getRSILauncherToken() {
|
||||
});
|
||||
if (r.status !== 200) {
|
||||
// wait login
|
||||
window.chrome.webview.postMessage({action: 'webview_rsi_login_show_window'});
|
||||
return;
|
||||
}
|
||||
|
||||
@ -268,7 +269,7 @@ async function getRSILauncherToken() {
|
||||
body: releaseFormData
|
||||
});
|
||||
if (releaseR.status !== 200) return;
|
||||
let releaseDataJson = await releaseR.json();
|
||||
let releaseDataJson = (await releaseR.json())['data'];
|
||||
console.log(releaseDataJson);
|
||||
|
||||
// post message
|
||||
|
@ -472,6 +472,7 @@ class HomeUIModel extends BaseUIModel {
|
||||
// SystemHelper.checkAndLaunchRSILauncher(rsiLauncherInstalledPath);
|
||||
goWebView("登录 RSI 账户", "https://robertsspaceindustries.com/connect",
|
||||
loginMode: true, rsiLoginCallback: (data, ok) {
|
||||
dPrint("======rsiLoginCallback=== $ok =====\n$data}");
|
||||
isRsiLauncherStarting = false;
|
||||
notifyListeners();
|
||||
}, useLocalization: true);
|
||||
|
@ -53,6 +53,9 @@ class WebViewModel {
|
||||
userDataFolderWindows:
|
||||
"${AppConf.applicationSupportDir}/webview_data",
|
||||
title: title));
|
||||
if (loginMode) {
|
||||
await webview.setWebviewWindowVisibility(false);
|
||||
}
|
||||
|
||||
// webview.openDevToolsWindow();
|
||||
webview.isNavigating.addListener(() async {
|
||||
@ -141,7 +144,9 @@ class WebViewModel {
|
||||
if (loginMode) {
|
||||
webview.addOnWebMessageReceivedCallback((messageString) {
|
||||
final message = json.decode(messageString);
|
||||
if (message["action"] == "webview_rsi_login_success") {
|
||||
if (message["action"] == "webview_rsi_login_show_window") {
|
||||
webview.setWebviewWindowVisibility(true);
|
||||
} else if (message["action"] == "webview_rsi_login_success") {
|
||||
_loginModeSuccess = true;
|
||||
loginCallback?.call(message, true);
|
||||
webview.close();
|
||||
|
Loading…
Reference in New Issue
Block a user