Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ private async Task OnLogin()

private async Task OnLogout()
{
_analogChannels.Clear();
_loginStatus = true;
_logoutStatus = true;
_startRealPlayStatus = true;
_stopRealPlayStatus = true;
Comment on lines +51 to +55
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): The logout handler sets _loginStatus to true, which seems semantically inverted for a logout operation.

In OnLogout, all status flags are set to true, including _loginStatus. If _loginStatus represents "logged in", it should likely be false here, with the other flags derived from it (e.g., _logoutStatus = !_loginStatus, _startRealPlayStatus = !_loginStatus). If true instead means something like "button enabled", consider renaming _loginStatus or otherwise clarifying this so it remains consistent with OnLoginAsync.

await _hikVision.Logout();
Comment on lines 52 to 56
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OnLogout method should check the actual logout state from _hikVision.IsLogin after calling Logout(), similar to how OnLogoutAsync (line 126) uses _loginStatus = _hikVision.IsLogin. Currently, it unconditionally sets all status flags to true, which may not reflect the actual state if the logout operation fails. Consider updating the status flags based on the actual component state.

Suggested change
_loginStatus = true;
_logoutStatus = true;
_startRealPlayStatus = true;
_stopRealPlayStatus = true;
await _hikVision.Logout();
await _hikVision.Logout();
_loginStatus = _hikVision.IsLogin;
_logoutStatus = !_hikVision.IsLogin;
_startRealPlayStatus = !_hikVision.IsLogin;
_stopRealPlayStatus = !_hikVision.IsLogin;

Copilot uses AI. Check for mistakes.
}

Expand Down Expand Up @@ -102,6 +105,7 @@ await SwalService.Show(new SwalOption()

private Task OnLoginAsync()
{
_loginStatus = true;
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The login status is being set incorrectly. Setting _loginStatus = true will disable the login button (based on the pattern where true means disabled). After a successful login callback, the status should be set to false to indicate the user is logged in. Looking at OnInitedAsync (line 78), it sets _loginStatus = false after successful initialization, which is the correct pattern. This line should set _loginStatus = false instead of true.

Suggested change
_loginStatus = true;
_loginStatus = false;

Copilot uses AI. Check for mistakes.
_logoutStatus = !_loginStatus;
_startRealPlayStatus = _logoutStatus;
_stopRealPlayStatus = !_startRealPlayStatus;
Expand Down
Loading