-
-
Notifications
You must be signed in to change notification settings - Fork 7
feat(HikVision): add Login/Logout/StartRealPlay/StopRealPlay callback #787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -58,7 +58,31 @@ public partial class HikVisionWebPlugin | |||||||||||||||||||||||||||||||||
| /// 获得/设置 插件初始化完成后回调方法 | ||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||
| [Parameter] | ||||||||||||||||||||||||||||||||||
| public Func<bool, Task> OnInitedAsync { get; set; } | ||||||||||||||||||||||||||||||||||
| public Func<bool, Task>? OnInitedAsync { get; set; } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||
| /// 获得/设置 登录成功后回调方法 | ||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||
| [Parameter] | ||||||||||||||||||||||||||||||||||
| public Func<Task>? OnLoginedAsync { get; set; } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||||
| /// 获得/设置 注销成功后回调方法 | ||||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||||
| [Parameter] | ||||||||||||||||||||||||||||||||||
| public Func<Task>? OnLogoutedAsync { get; set; } | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| public Func<Task>? OnLogoutedAsync { get; set; } | |
| public Func<Task>? OnLoggedOutAsync { get; set; } |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method name TriggerLogined uses incorrect grammar. "Logined" is not a valid past participle. This should be renamed to TriggerLoggedIn to match the suggested parameter name correction.
| await TriggerLogined(); | |
| } | |
| return IsLogined; | |
| } | |
| private async Task TriggerLogined() | |
| await TriggerLoggedIn(); | |
| } | |
| return IsLogined; | |
| } | |
| private async Task TriggerLoggedIn() |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method name TriggerLogouted uses incorrect grammar. "Logouted" is not a valid past participle. This should be renamed to TriggerLoggedOut to match the suggested parameter name correction.
| await TriggerLogouted(); | |
| } | |
| private async Task TriggerLogouted() | |
| { | |
| if (OnLogoutedAsync != null) | |
| { | |
| await OnLogoutedAsync(); | |
| await TriggerLoggedOut(); | |
| } | |
| private async Task TriggerLoggedOut() | |
| { | |
| if (OnLoggedOutAsync != null) | |
| { | |
| await OnLoggedOutAsync(); |
Copilot
AI
Dec 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method now calls InvokeVoidAsync instead of checking the return value from the JavaScript function. However, the JavaScript stopRealPlay function still returns a Promise with a boolean result. This discrepancy means potential errors from the JavaScript side will be silently ignored. The callback OnStopRealPlayedAsync is now always triggered even if the JavaScript operation fails. Consider either: (1) reverting to InvokeAsync<bool?> and checking the result, or (2) updating the JavaScript function to properly handle and throw errors.
| await InvokeVoidAsync("stopRealPlay", Id); | |
| IsRealPlaying = false; | |
| await TriggerStopRealPlay(); | |
| var result = await InvokeAsync<bool?>("stopRealPlay", Id); | |
| if (result ?? false) | |
| { | |
| IsRealPlaying = false; | |
| await TriggerStopRealPlay(); | |
| } | |
| // Optionally handle failure here (e.g., log, throw, notify user) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The callback name
OnLoginedAsyncuses incorrect grammar. "Logined" is not a valid past participle in English. Consider renaming toOnLoggedInAsyncto be grammatically correct and consistent with standard English usage, or useOnLoginSuccessAsyncas an alternative.