- Notifications
You must be signed in to change notification settings - Fork5
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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 beif (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 likepublic interface IDefaultNotificationHandler : INotificationHandler
so we don't inadvertently add another implementation that could get DI'd here, and only have theApp
implementIDefaultNotificationHandler
// 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).
7e3782f
intomainUh oh!
There was an error while loading.Please reload this page.
Fixes:#40