refactor(presenter): M114 mock 的「取消登录」搬进 mock/accounts.rs(守 400 行)
This commit is contained in:
1 parent
f3e20b670e
commit
0f69eec64d
2 files changed
+17
-10
No files matched your search
@@ -284,16 +284,8 @@ impl Backend for MockBackend {
|
|||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
AppCommand::RefreshAll => self.seed_accounts(),
|
AppCommand::RefreshAll => self.seed_accounts(),
|
||||||
// 与真 host 同一契约:取消登录把**两条轨**都收回 Idle(M114 r3 / 复审 r2 P2-1 的
|
// 与真 host 同一契约:取消登录把两条轨都收回 Idle(否则 Close 在 mock 下「没反应」)
|
||||||
// 断言与截图都依赖这条;mock 的 `_ => {}` 兜底会让 Close 看起来「没反应」)。
|
AppCommand::CancelDeviceLogin => self.cancel_login(),
|
||||||
AppCommand::CancelDeviceLogin => {
|
|
||||||
self.emit(AppEvent::Core(CoreEvent::DeviceLoginChanged(
|
|
||||||
crate::dto::DeviceLoginView::new(),
|
|
||||||
)));
|
|
||||||
self.emit(AppEvent::Core(CoreEvent::AuthlibLoginChanged(
|
|
||||||
crate::dto::AuthlibLoginView::new(),
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
AppCommand::RefreshLogSessions | AppCommand::StopAgent => {}
|
AppCommand::RefreshLogSessions | AppCommand::StopAgent => {}
|
||||||
// 其余指令(安装向导/账户/Java/设置/通知)由真实 host 承接:mock 不模拟
|
// 其余指令(安装向导/账户/Java/设置/通知)由真实 host 承接:mock 不模拟
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|||||||
@@ -16,6 +16,21 @@ use crate::dto::{
|
|||||||
LoginFailure,
|
LoginFailure,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
impl super::MockBackend {
|
||||||
|
/// 取消登录:两条轨都发 Idle(真 host 的 `CancelDeviceLogin` 就是这么做的)。
|
||||||
|
///
|
||||||
|
/// 为什么放在 mock 里也要认真做:M114 的 `Close` 回归闸与「关掉之后」的取证图都走这条
|
||||||
|
/// 通道——mock 用 `_ => {}` 兜底的话,Close 会看起来「点了没反应」,断言会假红/假绿。
|
||||||
|
pub(super) fn cancel_login(&mut self) {
|
||||||
|
self.emit(crate::dto::AppEvent::Core(
|
||||||
|
crate::dto::CoreEvent::DeviceLoginChanged(DeviceLoginView::new()),
|
||||||
|
));
|
||||||
|
self.emit(crate::dto::AppEvent::Core(
|
||||||
|
crate::dto::CoreEvent::AuthlibLoginChanged(AuthlibLoginView::new()),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// 场景名(`ULL_ACCOUNT_STATE`;未知值按 `list` 处理)。
|
/// 场景名(`ULL_ACCOUNT_STATE`;未知值按 `list` 处理)。
|
||||||
pub(super) fn scenario() -> String {
|
pub(super) fn scenario() -> String {
|
||||||
std::env::var("ULL_ACCOUNT_STATE")
|
std::env::var("ULL_ACCOUNT_STATE")
|
||||||
|
|||||||
Reference in new issue
Block a user