-
Notifications
You must be signed in to change notification settings - Fork 5
chore: add connect/disconnect notifications on Coder Connect #140
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
Conversation
var app = (App)Current; | ||
if (app != null && app.TrayWindow != null) |
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.
Shouldn't this just be if (TrayWindow != null) TrayWindow.Tray_Open();
?
|
||
private ConcurrentDictionary<string, INotificationHandler> Handlers { get; } = new(); | ||
|
||
public UserNotifier(ILogger<UserNotifier> logger, IDispatcherQueueManager dispatcherQueueManager, | ||
INotificationHandler notificationHandler) |
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.
Perhaps we should wrap it with a marker type like public interface IDefaultNotificationHandler : INotificationHandler
so we don't inadvertently add another implementation that could get DI'd here, and only have the App
implement IDefaultNotificationHandler
// This method is called when the state changes, but we don't want to notify | ||
// the user if the state hasn't changed. | ||
var isRpcLifecycleChanged = rpcModel.RpcLifecycle == RpcLifecycle.Disconnected && curRpcLifecycle != rpcModel.RpcLifecycle; | ||
var isVpnLifecycleChanged = (rpcModel.VpnLifecycle == VpnLifecycle.Started || rpcModel.VpnLifecycle == VpnLifecycle.Stopped) && curVpnLifecycle != rpcModel.VpnLifecycle; | ||
|
||
if (!isRpcLifecycleChanged && !isVpnLifecycleChanged) | ||
{ | ||
return; | ||
} | ||
|
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.
I don't think you need any of these lines since they're essentially covered by what's below right?
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.
Unfortunately no, I ignore the intermediate states of the Vpn lifecycle on purpose (and I don't update the prevRpcLifecycle for that reason).
Fixes: #40