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