fix: 将账号切换输出文本中的目标账号由输入文本改为OCR结果,尝试修复账号切换出错 (#6353)

尝试修复#6346
This commit is contained in:
MistEO
2023-09-14 14:29:42 +08:00
committed by GitHub
3 changed files with 13 additions and 10 deletions

View File

@@ -2920,11 +2920,11 @@
"algorithm": "JustReturn",
"action": "DoNothing",
"next": [
"LoginOther#next",
"SwitchAccount@StartUpThemes#next",
"SwitchAccount@LoadingIcon",
"SwitchAccount@ReturnTo",
"Settings",
"LoginOther"
"Settings"
]
},
"SwitchAccount": {

View File

@@ -48,28 +48,28 @@ bool asst::AccountSwitchTask::_run()
current_account = get_current_account_b();
}
json::value info = basic_info_with_what("AccountSwitch");
info["details"]["current_account"] = current_account;
info["details"]["account_name"] = m_account;
callback(AsstMsg::SubTaskExtraInfo, info);
if (current_account == m_account) {
return click_manager_login_button();
}
// 展开列表
show_account_list();
if (swipe_and_select()) {
if (swipe_and_select() || swipe_and_select(true)) {
json::value info = basic_info_with_what("AccountSwitch");
info["details"]["current_account"] = current_account;
info["details"]["account_name"] = m_target_account;
callback(AsstMsg::SubTaskExtraInfo, info);
return true;
}
else {
return swipe_and_select(true);
return false;
}
}
bool asst::AccountSwitchTask::navigate_to_start_page()
{
auto task = ProcessTask(*this, { "AccountManagerOfficial", "AccountManagerBili", "SwitchAccount@StartUpBegin" });
auto task = ProcessTask(*this, { "SwitchAccount@StartUpBegin" });
task.set_retry_times(30);
task.run();
std::string last_name = task.get_last_task_name();
@@ -198,6 +198,7 @@ bool asst::AccountSwitchTask::select_account(std::vector<std::string>& account_l
}
std::string text = ocr.get_result().text;
if (text.find(m_account) != std::string::npos) {
m_target_account = std::move(text);
ctrler()->click(roi);
return true;
}
@@ -227,6 +228,7 @@ bool asst::AccountSwitchTask::select_account_b(std::vector<std::string>& account
}
std::string text = ocr.get_result().text;
if (text.find(m_account) != std::string::npos) {
m_target_account = std::move(text);
ctrler()->click(roi);
return true;
}

View File

@@ -33,5 +33,6 @@ namespace asst
bool is_official = false, is_bili = false;
std::string m_account;
std::string m_target_account;
};
}