toast notifications(+) #17

Merged
mshafer1 merged 41 commits from dev/toast_notifications_plus into master 2025-02-11 04:53:56 -05:00
mshafer1 commented 2024-12-20 18:33:33 -05:00 (Migrated from github.com)

Why

I'm looking for a Windows client that can run as a service (or minimized to notifactions tray) -> not just minimized to the task bar so that it runs "in the background" AND that has an option to make the notifications stay up until dismissed (because I'm pushing alerts that are important and need to be seen).

ntfysh-windows already has the first, but by using the default Windows notification tooling, the ability to set the notification to stay for requested time is hampered.

This PR replaces calling the built-in Windows Toast notification for using an animated window. This provides the flexibility to have a timeout progress bar or have an infinite/until-dismissed notification.

What I have done

Make an option to use "custom" notifications (if False - the default - still uses Windows toad notification, if true, use new notification).

That custom WinForm still:

  • shows title, icon, and message
  • now offers a scroll bar if the message is very long

and now:

  • uses a progress bar to show a timeout for how long the message will display (can be disabled in settings)
  • cancels that timeout if the dialogue is clicked on
  • allows copy/pasting the title and message
  • allows dismissing by click the "x" button
  • if timeout is set to 0 in settings, stays open until dismissed or another message is sent.

I also introduced ntfysh_client.Themes namespace which contains a default (based on the current Settings dialogue and a darkMode to allow the user to choose the style/theming of their pop ups.

Testing / Demo

Demo: https://youtu.be/BF3kzUK8DR0

# Why I'm looking for a Windows client that can run as a service (or minimized to notifactions tray) -> not just minimized to the task bar so that it runs "in the background" AND that has an option to make the notifications stay up until dismissed (because I'm pushing alerts that are important and need to be seen). ntfysh-windows already has the first, but by using the default Windows notification tooling, the ability to set the notification to stay for requested time is hampered. This PR replaces calling the built-in Windows Toast notification for using an animated window. This provides the flexibility to have a timeout progress bar or have an infinite/until-dismissed notification. # What I have done Make an option to use "custom" notifications (if False - the default - still uses Windows toad notification, if true, use new notification). That custom WinForm still: - shows title, icon, and message - now offers a scroll bar if the message is very long and now: - uses a progress bar to show a timeout for how long the message will display (can be disabled in settings) - cancels that timeout if the dialogue is clicked on - allows copy/pasting the title and message - allows dismissing by click the "x" button - if timeout is set to 0 in settings, stays open until dismissed or another message is sent. I also introduced ntfysh_client.Themes namespace which contains a `default` (based on the current Settings dialogue and a `darkMode` to allow the user to choose the style/theming of their pop ups. # Testing / Demo Demo: https://youtu.be/BF3kzUK8DR0
alexhorner commented 2024-12-20 19:04:32 -05:00 (Migrated from github.com)

Hey there @mshafer1,

I haven't been able to do a full code review yet, but will do so tomorrow when I get the chance.

I think my main response right now would be your use case doesn't fit everyone's requirements. I for one wouldn't like the new notifications and would find them extremely frustrating and distracting, but I can absolutely see the appeal in the more obstructive and attention grabbing style.

I think a full replacement is a little too far, but a good compromise would be to add a configuration option which allows the user to choose which type of notification they would like to receive, with the native Windows one being the default as this is what users so far have come to expect from the application.

Hey there @mshafer1, I haven't been able to do a full code review yet, but will do so tomorrow when I get the chance. I think my main response right now would be your use case doesn't fit everyone's requirements. I for one wouldn't like the new notifications and would find them extremely frustrating and distracting, but I can absolutely see the appeal in the more obstructive and attention grabbing style. I think a full replacement is a little too far, but a good compromise would be to add a configuration option which allows the user to choose which type of notification they would like to receive, with the native Windows one being the default as this is what users so far have come to expect from the application.
mshafer1 commented 2024-12-20 19:20:50 -05:00 (Migrated from github.com)

I think a config option is a good idea. I contemplated adding that in round
one but thought but wasn't sure if it should be included in the MVP.

I could also see a strong case for making them sized more like before, but
beyond just shrinking it, I would argue non MVP.

I also don't actually want the status/progress bar, as my use-case is
important only (i.e. would be set to not timeout).

Would you rather I take that part back out, or make that a config option as
well.

On Fri, Dec 20, 2024, 18:04 Alexander Horner @.***>
wrote:

Hey there @mshafer1 https://github.com/mshafer1,

I haven't been able to do a full code review yet, but will do so tomorrow
when I get the chance.

I think my main response right now would be your use case doesn't fit
everyone's requirements. I for one wouldn't like the new notifications and
would find them extremely frustrating and distracting, but I can absolutely
see the appeal in the more obstructive and attention grabbing style.

I think a full replacement is a little too far, but a good compromise
would be to add a configuration option which allows the user to choose
which type of notification they would like to receive, with the native
Windows one being the default as this is what users so far have come to
expect from the application.


Reply to this email directly, view it on GitHub
https://github.com/lucas-bortoli/ntfysh-windows/pull/17#issuecomment-2557898786,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AATSJ4M2YEENZOZPDQPYPFT2GSWCPAVCNFSM6AAAAABUAAD4F2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJXHA4TQNZYGY
.
You are receiving this because you were mentioned.Message ID:
@.***>

I think a config option is a good idea. I contemplated adding that in round one but thought but wasn't sure if it should be included in the MVP. I could also see a strong case for making them sized more like before, but beyond just shrinking it, I would argue non MVP. I also don't actually want the status/progress bar, as my use-case is important only (i.e. would be set to not timeout). Would you rather I take that part back out, or make that a config option as well. On Fri, Dec 20, 2024, 18:04 Alexander Horner ***@***.***> wrote: > Hey there @mshafer1 <https://github.com/mshafer1>, > > I haven't been able to do a full code review yet, but will do so tomorrow > when I get the chance. > > I think my main response right now would be your use case doesn't fit > everyone's requirements. I for one wouldn't like the new notifications and > would find them extremely frustrating and distracting, but I can absolutely > see the appeal in the more obstructive and attention grabbing style. > > I think a full replacement is a little too far, but a good compromise > would be to add a configuration option which allows the user to choose > which type of notification they would like to receive, with the native > Windows one being the default as this is what users so far have come to > expect from the application. > > — > Reply to this email directly, view it on GitHub > <https://github.com/lucas-bortoli/ntfysh-windows/pull/17#issuecomment-2557898786>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AATSJ4M2YEENZOZPDQPYPFT2GSWCPAVCNFSM6AAAAABUAAD4F2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJXHA4TQNZYGY> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> >
alexhorner commented 2024-12-20 19:25:07 -05:00 (Migrated from github.com)

A feature MVP should strive to at least not break existing expectations or functionality for sure, so I think it's an important addition for a config option to choose.

You might wish to add an option to show or hide the counter and/or progress bar, but I think it's a good attention catching feature once again and has value.

The size and style could do with being made more consistent with the rest of the application, but for now I would say it works fine

A feature MVP should strive to at least not break existing expectations or functionality for sure, so I think it's an important addition for a config option to choose. You might wish to add an option to show or hide the counter and/or progress bar, but I think it's a good attention catching feature once again and has value. The size and style could do with being made more consistent with the rest of the application, but for now I would say it works fine
mshafer1 commented 2024-12-20 22:49:52 -05:00 (Migrated from github.com)

@alexhorner, all right, I got a draft of the settings dialogue updated and have tested that everything but the dark-mode switch works (that's not implemented yet). I'll plan to work on making the default be winForms default colors in the morning.

@alexhorner, all right, I got a draft of the settings dialogue updated and have tested that everything but the dark-mode switch works (that's not implemented yet). I'll plan to work on making the default be winForms default colors in the morning.
mshafer1 (Migrated from github.com) reviewed 2024-12-20 22:53:52 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-20 22:53:43 -05:00

I noticed this while debugging.... while I didn't do a proper Chesterton's Fence investigation on it, it seem pretty wrong...., I'll dig into history on this more later.

I noticed this while debugging.... while I didn't do a proper [Chesterton's Fence investigation](https://en.wikipedia.org/wiki/G._K._Chesterton#Chesterton's_fence) on it, it seem pretty wrong...., I'll dig into history on this more later.
alexhorner (Migrated from github.com) reviewed 2024-12-21 03:50:34 -05:00
alexhorner (Migrated from github.com) commented 2024-12-21 03:50:34 -05:00

Thaaaat looks like a keyboard ninja tab tab enter move typo 🤣 Was that me? Whoops!

Thaaaat looks like a keyboard ninja tab tab enter move typo 🤣 Was that me? Whoops!
alexhorner (Migrated from github.com) requested changes 2024-12-21 06:19:34 -05:00
alexhorner (Migrated from github.com) left a comment

HI @mshafer1

Please see attached review comments for my full code review.

Thanks for your work!

HI @mshafer1 Please see attached review comments for my full code review. Thanks for your work!
alexhorner (Migrated from github.com) commented 2024-12-21 05:52:28 -05:00

In keeping with established convention please use a _ and remote the this.

In keeping with established convention please use a _ and remote the this.
alexhorner (Migrated from github.com) commented 2024-12-21 06:13:13 -05:00

Nitpick: newline

this.notificationDialog.ShowNotification
(
    ...
);
Nitpick: newline ```csharp this.notificationDialog.ShowNotification ( ... ); ```
alexhorner (Migrated from github.com) commented 2024-12-21 06:15:25 -05:00

This seems a little cursed. If that's the best way to do it, fair enough, but if there's a better way (such as changing the type of timeout_ms) that might be better because we're throwing away precision.

This seems a little cursed. If that's the best way to do it, fair enough, but if there's a better way (such as changing the type of `timeout_ms`) that might be better because we're throwing away precision.
alexhorner (Migrated from github.com) commented 2024-12-21 05:54:01 -05:00

Can UseNativeWindowsNotifications and UseCustomTrayNotifications not be merged?

Can `UseNativeWindowsNotifications` and `UseCustomTrayNotifications` not be merged?
alexhorner (Migrated from github.com) commented 2024-12-21 05:55:28 -05:00

A blank line between the previous if closure and this one's opening, and a comment consistent with the one above the previous if would be good

A blank line between the previous if closure and this one's opening, and a comment consistent with the one above the previous if would be good
alexhorner (Migrated from github.com) commented 2024-12-21 05:57:02 -05:00

Nitpick: newline

Nitpick: newline
alexhorner (Migrated from github.com) commented 2024-12-21 05:57:38 -05:00

Nitpick: One liner? if (this.shownStopwatch is null) return;

Nitpick: One liner? `if (this.shownStopwatch is null) return;`
alexhorner (Migrated from github.com) commented 2024-12-21 05:57:57 -05:00

Nitpick: newline

Nitpick: newline
alexhorner (Migrated from github.com) commented 2024-12-21 05:59:25 -05:00

What's the purpose of this override?

What's the purpose of this override?
alexhorner (Migrated from github.com) commented 2024-12-21 06:00:03 -05:00

Nitpick: newline

Nitpick: newline
alexhorner (Migrated from github.com) commented 2024-12-21 06:02:43 -05:00

This is a great candidate for the new switch expression syntax, and then it can be turned into a lambda

private Image? ConvertToolTipIconToImage(ToolTipIcon icon) => icon switch
{
    ToolTipIcon.Info => SystemIcons.Information.ToBitmap(),
    ToolTipIcon.Warning => SystemIcons.Warning.ToBitmap(),
    ToolTipIcon.Error => SystemIcons.Error.ToBitmap(),
    _ => null
}
This is a great candidate for the new `switch expression` syntax, and then it can be turned into a lambda ```csharp private Image? ConvertToolTipIconToImage(ToolTipIcon icon) => icon switch { ToolTipIcon.Info => SystemIcons.Information.ToBitmap(), ToolTipIcon.Warning => SystemIcons.Warning.ToBitmap(), ToolTipIcon.Error => SystemIcons.Error.ToBitmap(), _ => null } ```
alexhorner (Migrated from github.com) commented 2024-12-21 06:03:45 -05:00

Nitpick: Lambda one liner

Nitpick: Lambda one liner
alexhorner (Migrated from github.com) commented 2024-12-21 06:05:35 -05:00

Nitpick: Naming convention is capitalised first letter

Nitpick: Naming convention is capitalised first letter
alexhorner (Migrated from github.com) commented 2024-12-21 06:05:39 -05:00

Nitpick: Naming convention is capitalised first letter title casing without underscores

Nitpick: Naming convention is capitalised first letter title casing without underscores
alexhorner (Migrated from github.com) commented 2024-12-21 06:06:34 -05:00

Nitpick: convention is use of _ for private variables to avoid the use of this. Goes for all others in this section

Nitpick: convention is use of _ for private variables to avoid the use of this. Goes for all others in this section
alexhorner (Migrated from github.com) commented 2024-12-21 06:08:17 -05:00

This appears to be set but never read outside of the progress getter

This appears to be set but never read outside of the `progress` getter
alexhorner (Migrated from github.com) commented 2024-12-21 06:08:39 -05:00

Could this just read this.progressBar1.Value instead?

Could this just read `this.progressBar1.Value` instead?
alexhorner (Migrated from github.com) commented 2024-12-21 06:09:01 -05:00

Any reason we're wrapping this? Is it protected usually?

Any reason we're wrapping this? Is it protected usually?
alexhorner (Migrated from github.com) commented 2024-12-21 06:09:43 -05:00

Does this need thises?

Does this need `this`es?
alexhorner (Migrated from github.com) commented 2024-12-21 06:10:00 -05:00

Nitpick: newline

Nitpick: newline
alexhorner (Migrated from github.com) commented 2024-12-21 06:10:06 -05:00

Nitpick: newline

Nitpick: newline
alexhorner (Migrated from github.com) commented 2024-12-21 06:10:24 -05:00

Nitpick: newline

Nitpick: newline
alexhorner (Migrated from github.com) commented 2024-12-21 06:11:04 -05:00

Nitpick: Naming convention is capitalised first letter

Nitpick: Naming convention is capitalised first letter
alexhorner (Migrated from github.com) commented 2024-12-21 06:14:19 -05:00

Nitpick: timeout_ms should be timeoutMilliseconds

Nitpick: `timeout_ms` should be `timeoutMilliseconds`
alexhorner (Migrated from github.com) commented 2024-12-21 06:16:07 -05:00

immediate?

immediate?
alexhorner (Migrated from github.com) commented 2024-12-21 06:16:43 -05:00

I try to rename my elements to match the TitleCase naming convention. Not a major one, just a nice-to-have. I appreciate this isn't consistent within the application anyway.

I try to rename my elements to match the TitleCase naming convention. Not a major one, just a nice-to-have. I appreciate this isn't consistent within the application anyway.
@@ -0,0 +41,4 @@
{
// close the current notification
HandleTimeout(null, null);
}
alexhorner (Migrated from github.com) commented 2024-12-21 06:09:54 -05:00

Nitpick: newline

Nitpick: newline
@@ -0,0 +58,4 @@
{
_displayTimeoutTimer.Stop();
_displayTimeoutTimer.Dispose();
}
alexhorner (Migrated from github.com) commented 2024-12-21 06:10:11 -05:00

Nitpick: newline

Nitpick: newline
@@ -0,0 +64,4 @@
{
_updateTimer.Stop();
_updateTimer.Dispose();
}
alexhorner (Migrated from github.com) commented 2024-12-21 06:10:16 -05:00

Nitpick: newline

Nitpick: newline
@@ -0,0 +148,4 @@
{
BringToFront();
AnimateWindow(
alexhorner (Migrated from github.com) commented 2024-12-21 05:59:04 -05:00

Nitpick: newlines

this.BringToFront();

AnimateWindow
(
    ...
);
Nitpick: newlines ```csharp this.BringToFront(); AnimateWindow ( ... ); ```
@@ -0,0 +153,4 @@
time: 250,
flags: NFWinUserAnimateWindowConstants.AW_SLIDE | NFWinUserAnimateWindowConstants.AW_VER_NEGATIVE
);
}
alexhorner (Migrated from github.com) commented 2024-12-21 05:58:07 -05:00

Nitpick: newline

Nitpick: newline
@@ -0,0 +170,4 @@
private void UIThreadAnimatedHideWindow(object? sender, EventArgs? e)
{
AnimateWindow(
alexhorner (Migrated from github.com) commented 2024-12-21 05:59:54 -05:00

Nitpick: Newlines, same as earlier AnimateWindow example

Nitpick: Newlines, same as earlier `AnimateWindow` example
@@ -0,0 +174,4 @@
Handle,
time: 250,
flags: NFWinUserAnimateWindowConstants.AW_SLIDE | NFWinUserAnimateWindowConstants.AW_VER_POSITIVE | NFWinUserAnimateWindowConstants.AW_HIDE
);
alexhorner (Migrated from github.com) commented 2024-12-21 05:59:59 -05:00

Nitpick: newline

Nitpick: newline
@@ -0,0 +269,4 @@
{
_shownStopwatch.Stop();
_shownStopwatch = null;
}
alexhorner (Migrated from github.com) commented 2024-12-21 06:03:58 -05:00

Nitpick: newline

Nitpick: newline
@@ -0,0 +285,4 @@
SoundPlayer loadedSound = new(defaultSoundPath);
loadedSound.Play();
}
alexhorner (Migrated from github.com) commented 2024-12-21 06:04:05 -05:00

Nitpick: newline

Nitpick: newline
@@ -26,1 +69,4 @@
}
#endregion
public SettingsDialog()
alexhorner (Migrated from github.com) commented 2024-12-21 06:04:57 -05:00

Nitpick: Naming convention is capitalised first letter

Nitpick: Naming convention is capitalised first letter
alexhorner (Migrated from github.com) commented 2024-12-21 06:05:01 -05:00

Nitpick: Naming convention is capitalised first letter

Nitpick: Naming convention is capitalised first letter
alexhorner (Migrated from github.com) commented 2024-12-21 06:18:52 -05:00

Would it be better to make 0 no timeout requiring closing notifications instead of -1? My logic behind this is 0 is not a valid value anyway, and would result in the immediate closure of the notification, which seems somewhat pointless and a bug. Then we don't end up with an invalid value between two valid values (-1 and 1) and can enforce a minimum value of 0 easily.

Would it be better to make `0` no timeout requiring closing notifications instead of `-1`? My logic behind this is `0` is not a valid value anyway, and would result in the immediate closure of the notification, which seems somewhat pointless and a bug. Then we don't end up with an invalid value between two valid values (`-1` and `1`) and can enforce a minimum value of `0` easily.
mshafer1 (Migrated from github.com) reviewed 2024-12-21 08:41:00 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 08:41:00 -05:00

They can. Currently these two are mutually exclusive. Preference between "UseOldNotificationsStyle" (or "New") and making it an enum? I can't imagine a 3rd notification style getting added, but FOSS is not exactly predictable. (i.e., I would lean toward the single boolean)

They can. Currently these two are mutually exclusive. Preference between "UseOldNotificationsStyle" (or "New") and making it an enum? I can't imagine a 3rd notification style getting added, but FOSS is not exactly predictable. (i.e., I would lean toward the single boolean)
mshafer1 (Migrated from github.com) reviewed 2024-12-21 08:42:01 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 08:42:00 -05:00

@alexhorner, is there a linter tool or editor config file that I can setup to check code against the desired style?

@alexhorner, is there a linter tool or editor config file that I can setup to check code against the desired style?
mshafer1 (Migrated from github.com) reviewed 2024-12-21 08:44:27 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 08:44:27 -05:00

I'll change it to seconds and drop the whole conversion. Only reason I made it take mS originally was to create a minimal diff with the old method.

I'll change it to seconds and drop the whole conversion. Only reason I made it take mS originally was to create a minimal diff with the old method.
mshafer1 (Migrated from github.com) reviewed 2024-12-21 08:47:26 -05:00
@@ -26,1 +69,4 @@
}
#endregion
public SettingsDialog()
mshafer1 (Migrated from github.com) commented 2024-12-21 08:47:26 -05:00

0 for not timeout makes sense. Although, a 0 was valid before.

(but...., If I understand correctly, a default Windows install will ignore anything outside of 1-10 and just use 10 instead, so a 0 before became 10 s, ...., but the way we have it setup now anyone upgrading will have to open the settings dialogue to switch over anyays...)

I'm leaning toward using 0.

0 for not timeout makes sense. Although, a 0 was valid before. (but...., If I understand correctly, a default Windows install will ignore anything outside of 1-10 and just use 10 instead, so a 0 before became 10 s, ...., but the way we have it setup now anyone upgrading will have to open the settings dialogue to switch over anyays...) I'm leaning toward using 0.
mshafer1 (Migrated from github.com) reviewed 2024-12-21 09:07:45 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 09:07:45 -05:00

I'll change the comment to better explain the desired intent

            // don't animate, immediately "close"

rationale:
if a user click the x button, they expect the window to go away "now". My observation is that general Windows users are about 50% split on whether a going away animation in response to telling a window to close is annoying or "fine" (and only a few people "prefer it"). Because of this, I intentionally implemented the button close handler to immediately close the pop up (don't animate, and don't wait for the timeout).

I'll change the comment to better explain the desired intent ```suggestion // don't animate, immediately "close" ``` rationale: if a user click the x button, they expect the window to go away "now". My observation is that general Windows users are about 50% split on whether a going away animation in response to telling a window to close is annoying or "fine" (and only a few people "prefer it"). Because of this, I intentionally implemented the button close handler to immediately close the pop up (don't animate, and don't wait for the timeout).
mshafer1 (Migrated from github.com) reviewed 2024-12-21 09:10:55 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 09:10:55 -05:00

I think this is just left over from my first attempts at getting the animation to work.

I think this is just left over from my first attempts at getting the animation to work.
mshafer1 (Migrated from github.com) reviewed 2024-12-21 10:55:31 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 10:55:31 -05:00

I tried to rename all new private fields to _... and remove all occurrences of this.. It seems to be working.

I tried to rename all new private fields to `_...` and remove all occurrences of `this.`. It seems to be working.
mshafer1 (Migrated from github.com) reviewed 2024-12-21 10:56:10 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 10:56:10 -05:00

updated

updated
mshafer1 (Migrated from github.com) reviewed 2024-12-21 10:57:42 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 10:57:42 -05:00

I went through and attempted to add a blank line before every if statement that was not the opening statement of the parent scope (and if preceded by a comment, the blank line went before the comment).

I went through and attempted to add a blank line before every if statement that was not the opening statement of the parent scope (and if preceded by a comment, the blank line went before the comment).
mshafer1 (Migrated from github.com) reviewed 2024-12-21 10:57:52 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 10:57:52 -05:00

changed

changed
mshafer1 (Migrated from github.com) reviewed 2024-12-21 10:58:24 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 10:58:24 -05:00

I added a blank line before the if statement

I added a blank line before the if statement
mshafer1 (Migrated from github.com) reviewed 2024-12-21 10:58:33 -05:00
@@ -0,0 +153,4 @@
time: 250,
flags: NFWinUserAnimateWindowConstants.AW_SLIDE | NFWinUserAnimateWindowConstants.AW_VER_NEGATIVE
);
}
mshafer1 (Migrated from github.com) commented 2024-12-21 10:58:32 -05:00

I added a blank line before the if statement

I added a blank line before the if statement
mshafer1 (Migrated from github.com) reviewed 2024-12-21 10:58:55 -05:00
@@ -0,0 +148,4 @@
{
BringToFront();
AnimateWindow(
mshafer1 (Migrated from github.com) commented 2024-12-21 10:58:55 -05:00

Added

Added
mshafer1 (Migrated from github.com) reviewed 2024-12-21 10:59:02 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 10:59:02 -05:00

removed

removed
mshafer1 (Migrated from github.com) reviewed 2024-12-21 10:59:08 -05:00
@@ -0,0 +170,4 @@
private void UIThreadAnimatedHideWindow(object? sender, EventArgs? e)
{
AnimateWindow(
mshafer1 (Migrated from github.com) commented 2024-12-21 10:59:07 -05:00

added

added
mshafer1 (Migrated from github.com) reviewed 2024-12-21 10:59:37 -05:00
@@ -0,0 +174,4 @@
Handle,
time: 250,
flags: NFWinUserAnimateWindowConstants.AW_SLIDE | NFWinUserAnimateWindowConstants.AW_VER_POSITIVE | NFWinUserAnimateWindowConstants.AW_HIDE
);
mshafer1 (Migrated from github.com) commented 2024-12-21 10:59:37 -05:00

I added a blank line before the call to the parent class

I added a blank line before the call to the parent class
mshafer1 (Migrated from github.com) reviewed 2024-12-21 11:00:02 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 11:00:02 -05:00

I added a blank line before the if statement

I added a blank line before the if statement
mshafer1 (Migrated from github.com) reviewed 2024-12-21 11:00:11 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 11:00:11 -05:00

updated

updated
mshafer1 (Migrated from github.com) reviewed 2024-12-21 11:00:18 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-21 11:00:17 -05:00

swapped

swapped
mshafer1 (Migrated from github.com) reviewed 2024-12-21 11:00:31 -05:00
@@ -0,0 +269,4 @@
{
_shownStopwatch.Stop();
_shownStopwatch = null;
}
mshafer1 (Migrated from github.com) commented 2024-12-21 11:00:31 -05:00

I added a blank line before the if statement

I added a blank line before the if statement
mshafer1 (Migrated from github.com) reviewed 2024-12-21 11:00:35 -05:00
@@ -0,0 +285,4 @@
SoundPlayer loadedSound = new(defaultSoundPath);
loadedSound.Play();
}
mshafer1 (Migrated from github.com) commented 2024-12-21 11:00:35 -05:00

I added a blank line before the if statement

I added a blank line before the if statement
mshafer1 (Migrated from github.com) reviewed 2024-12-21 11:11:08 -05:00
mshafer1 (Migrated from github.com) left a comment

I think I've addressed all current comments.

I also added in "themes" and implemented the "showCustomNotificationsInDarkMode" switch.

There are some open questions still. I'll update the demo/screen-recording once those are addressed.

I think I've addressed all current comments. I also added in "themes" and implemented the "showCustomNotificationsInDarkMode" switch. There are some open questions still. I'll update the demo/screen-recording once those are addressed.
mshafer1 (Migrated from github.com) commented 2024-12-21 11:04:04 -05:00

interesting....

Settings.Timeout is a decimal, but the UI element for changing it is set to increment=1. Which means that the only way to get it to not be an int would be to edit the json file by hand...

interesting.... Settings.Timeout is a `decimal`, but the UI element for changing it is set to `increment=1`. Which means that the only way to get it to not be an int would be to edit the json file by hand...
mshafer1 (Migrated from github.com) commented 2024-12-21 11:04:27 -05:00

I'm going to mark this as resolved.

I'm going to mark this as resolved.
mshafer1 (Migrated from github.com) commented 2024-12-21 11:04:37 -05:00

removed

removed
mshafer1 (Migrated from github.com) commented 2024-12-21 11:04:52 -05:00

yes, I originally thought there would be more to the setter. Removed.

yes, I originally thought there would be more to the setter. Removed.
mshafer1 (Migrated from github.com) commented 2024-12-21 11:05:59 -05:00

Not in the end. Removed. (I had originally though the UI would be .SetInfo(...); .Show() or something, but the way it is now has a better expandability and doesn't use this.

Not in the end. Removed. (I had originally though the UI would be `.SetInfo(...); .Show()` or something, but the way it is now has a better expandability and doesn't use this.
mshafer1 (Migrated from github.com) commented 2024-12-21 11:06:22 -05:00

no, that's just what style I was used to back when I last worked in C# (removed all)

no, that's just what style I was used to back when I last worked in C# (removed all)
mshafer1 (Migrated from github.com) commented 2024-12-21 11:06:56 -05:00

This got changed to timeoutSeconds to deal with corresponding comment in MainForm.cs

This got changed to `timeoutSeconds` to deal with corresponding comment in `MainForm.cs`
mshafer1 (Migrated from github.com) commented 2024-12-21 11:07:20 -05:00

I added a blank line before the if statement

I added a blank line before the if statement
mshafer1 (Migrated from github.com) commented 2024-12-21 11:07:23 -05:00

I added a blank line before the if statement

I added a blank line before the if statement
mshafer1 (Migrated from github.com) commented 2024-12-21 11:07:45 -05:00

heh, wonder where that style came from...

heh, wonder where that style came from...
mshafer1 (Migrated from github.com) commented 2024-12-21 11:09:41 -05:00

settings dialog is using camelCase for everything....

I think the Pep8 guidance that "consistency within a file is most important" is a good point here.

I opted to make the new things in SettingsDialogue always use camelCase, but changed the NotificationDialogue be TitleCase.

settings dialog is using camelCase for everything.... I think the Pep8 guidance that "consistency within a file is most important" is a good point here. I opted to make the new things in SettingsDialogue always use camelCase, but changed the NotificationDialogue be TitleCase.
mshafer1 (Migrated from github.com) commented 2024-12-21 11:10:10 -05:00

renamed

renamed
@@ -0,0 +41,4 @@
{
// close the current notification
HandleTimeout(null, null);
}
mshafer1 (Migrated from github.com) commented 2024-12-21 11:07:05 -05:00

I added a blank line before the if statement

I added a blank line before the if statement
@@ -0,0 +58,4 @@
{
_displayTimeoutTimer.Stop();
_displayTimeoutTimer.Dispose();
}
mshafer1 (Migrated from github.com) commented 2024-12-21 11:07:16 -05:00

I added a blank line before the if statement

I added a blank line before the if statement
@@ -0,0 +64,4 @@
{
_updateTimer.Stop();
_updateTimer.Dispose();
}
mshafer1 (Migrated from github.com) commented 2024-12-21 11:07:29 -05:00

I added a blank line before the if statement

I added a blank line before the if statement
@@ -26,1 +69,4 @@
}
#endregion
public SettingsDialog()
mshafer1 (Migrated from github.com) commented 2024-12-21 11:01:48 -05:00

renamed

renamed
mshafer1 (Migrated from github.com) commented 2024-12-21 11:02:20 -05:00

Changed

Changed
mshafer1 (Migrated from github.com) commented 2024-12-21 11:02:37 -05:00

Changed to 0 and dropped -1 handling/updating

Changed to 0 and dropped -1 handling/updating
alexhorner (Migrated from github.com) reviewed 2024-12-21 18:41:08 -05:00
alexhorner (Migrated from github.com) commented 2024-12-21 18:41:08 -05:00

Could do an enum?

Could do an enum?
alexhorner (Migrated from github.com) reviewed 2024-12-21 18:57:21 -05:00
alexhorner (Migrated from github.com) commented 2024-12-21 18:57:21 -05:00

@alexhorner, is there a linter tool or editor config file that I can setup to check code against the desired style?

So typically I use Rider (alternatively Resharper) whilst working and it picks out most of these things. As far as I know, what it works on is the microsoft standard convention, so I just use that as it's pretty universal and sensible.

> @alexhorner, is there a linter tool or editor config file that I can setup to check code against the desired style? So typically I use Rider (alternatively Resharper) whilst working and it picks out most of these things. As far as I know, what it works on is the microsoft standard convention, so I just use that as it's pretty universal and sensible.
mshafer1 (Migrated from github.com) reviewed 2024-12-23 15:12:54 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-23 15:12:53 -05:00

Changed to an enum.

Changed to an enum.
mshafer1 (Migrated from github.com) reviewed 2024-12-23 15:14:39 -05:00
mshafer1 (Migrated from github.com) commented 2024-12-23 15:14:39 -05:00

I installed an ran the Rider ide and looked through for additional style changes (and applied the ones that didn't seem to conflict with the previous comments).

I installed an ran the Rider ide and looked through for additional style changes (and applied the ones that didn't seem to conflict with the previous comments).
mshafer1 commented 2024-12-24 10:20:24 -05:00 (Migrated from github.com)

@alexhorner, are you accustomed to "reviewer marks conversations as resolved once they confirm they have been addressed" or to "submitter marks conversations as resolved once they have attempted to address them"?

@alexhorner, are you accustomed to "reviewer marks conversations as resolved once they confirm they have been addressed" or to "submitter marks conversations as resolved once they have attempted to address them"?
alexhorner commented 2024-12-24 10:26:13 -05:00 (Migrated from github.com)

I wouldn't say either to be honest. As long as they remain visible and I can go back and see them I guess you can mark them as resolved once you're satisfied with the solution you have produced.

I wouldn't say either to be honest. As long as they remain visible and I can go back and see them I guess you can mark them as resolved once you're satisfied with the solution you have produced.
mshafer1 commented 2024-12-24 10:29:05 -05:00 (Migrated from github.com)

I wouldn't say either to be honest. As long as they remain visible and I can go back and see them I guess you can mark them as resolved once you're satisfied with the solution you have produced.

GitHub kind of tries to hide resolved conversations....

> I wouldn't say either to be honest. As long as they remain visible and I can go back and see them I guess you can mark them as resolved once you're satisfied with the solution you have produced. GitHub kind of tries to hide resolved conversations....
alexhorner commented 2024-12-24 11:18:09 -05:00 (Migrated from github.com)

I wouldn't say either to be honest. As long as they remain visible and I can go back and see them I guess you can mark them as resolved once you're satisfied with the solution you have produced.

GitHub kind of tries to hide resolved conversations....

Ah that's a pain. I'm not used to using GitHub code review tools. Too used to DevOps

> > I wouldn't say either to be honest. As long as they remain visible and I can go back and see them I guess you can mark them as resolved once you're satisfied with the solution you have produced. > > GitHub kind of tries to hide resolved conversations.... Ah that's a pain. I'm not used to using GitHub code review tools. Too used to DevOps
mshafer1 commented 2025-01-08 21:16:54 -05:00 (Migrated from github.com)

@alexhorner, do you need anything else from me before doing another round of review?

@alexhorner, do you need anything else from me before doing another round of review?
alexhorner commented 2025-01-09 16:59:06 -05:00 (Migrated from github.com)

@mshafer1 Looks fine to me at this point. One bug I have noticed in testing is that in native windows notification mode, the ping sound still plays. This is unnecessary as Windows plays its own sound.

@mshafer1 Looks fine to me at this point. One bug I have noticed in testing is that in native windows notification mode, the ping sound still plays. This is unnecessary as Windows plays its own sound.
mshafer1 commented 2025-01-09 17:37:00 -05:00 (Migrated from github.com)

Heh, I hadn't thought of sound.

Let me check on that.

On Thu, Jan 9, 2025, 15:59 Alexander Horner @.***>
wrote:

@mshafer1 https://github.com/mshafer1 Looks fine to me at this point.
One bug I have noticed in testing is that in native windows notification
mode, the ping sound still plays. This is unnecessary as Windows plays its
own sound.


Reply to this email directly, view it on GitHub
https://github.com/lucas-bortoli/ntfysh-windows/pull/17#issuecomment-2581322226,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AATSJ4P25TTEXIUWVZ6BODT2J3WMDAVCNFSM6AAAAABUAAD4F2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOBRGMZDEMRSGY
.
You are receiving this because you were mentioned.Message ID:
@.***>

Heh, I hadn't thought of sound. Let me check on that. On Thu, Jan 9, 2025, 15:59 Alexander Horner ***@***.***> wrote: > @mshafer1 <https://github.com/mshafer1> Looks fine to me at this point. > One bug I have noticed in testing is that in native windows notification > mode, the ping sound still plays. This is unnecessary as Windows plays its > own sound. > > — > Reply to this email directly, view it on GitHub > <https://github.com/lucas-bortoli/ntfysh-windows/pull/17#issuecomment-2581322226>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AATSJ4P25TTEXIUWVZ6BODT2J3WMDAVCNFSM6AAAAABUAAD4F2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOBRGMZDEMRSGY> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> >
mshafer1 commented 2025-01-10 22:07:13 -05:00 (Migrated from github.com)

Heh, I hadn't thought of sound. Let me check on that.

On Thu, Jan 9, 2025, 15:59 Alexander Horner @.***> wrote: @mshafer1 https://github.com/mshafer1 Looks fine to me at this point. One bug I have noticed in testing is that in native windows notification mode, the ping sound still plays. This is unnecessary as Windows plays its own sound.

@alexhorner, I have added a setting for "custom notifications play default Windows sound" and implemented and tested it.

> Heh, I hadn't thought of sound. Let me check on that. > […](#) > On Thu, Jan 9, 2025, 15:59 Alexander Horner ***@***.***> wrote: @mshafer1 <https://github.com/mshafer1> Looks fine to me at this point. One bug I have noticed in testing is that in native windows notification mode, the ping sound still plays. This is unnecessary as Windows plays its own sound. @alexhorner, I have added a setting for "custom notifications play default Windows sound" and implemented and tested it.
alexhorner (Migrated from github.com) requested changes 2025-01-11 05:01:47 -05:00
alexhorner (Migrated from github.com) left a comment

@mshafer1 I'm a fool! The ping sound was coming from the ntfy.sh website I was using during testing. My comment must've been a bit confusing lol, I thought you implemented a custom sound for your notifications too. which played at the same time as the Windows sound, but I see now that you actually just didn't play any sound.

Either way, your latest commit looks good and fixes the real issue, not the one I mistook it for 😛 I have tested and provided a little more review feedback but other than that I think this is a nice addition ready to make its way in

@mshafer1 I'm a fool! The ping sound was coming from the ntfy.sh website I was using during testing. My comment must've been a bit confusing lol, I thought you implemented a custom sound for your notifications too. which played at the same time as the Windows sound, but I see now that you actually just didn't play any sound. Either way, your latest commit looks good and fixes the real issue, not the one I mistook it for 😛 I have tested and provided a little more review feedback but other than that I think this is a nice addition ready to make its way in
@@ -0,0 +98,4 @@
ProgressBar1.Visible = false;
LblTimeout.Visible = false;
}
alexhorner (Migrated from github.com) commented 2025-01-11 05:00:52 -05:00

Nitpick: One liner & newline

SetWindowPosition();

if (playNotificationSound) PlayNotificationSound();
Nitpick: One liner & newline ```csharp SetWindowPosition(); if (playNotificationSound) PlayNotificationSound(); ```
alexhorner (Migrated from github.com) commented 2025-01-11 04:59:53 -05:00
private void PlayNotificationSound()
{
    try
    {
        using RegistryKey? defaultSoundPathKey = Registry.CurrentUser.OpenSubKey(@"AppEvents\Schemes\Apps\.Default\Notification.Default\.Current");

        if (defaultSoundPathKey is null) throw new Exception();

        if (defaultSoundPathKey.GetValue(null) is not string defaultSoundPath) throw new Exception();

        SoundPlayer loadedSound = new(defaultSoundPath);

        loadedSound.Play();
    }
    catch
    {
        SystemSounds.Beep.Play(); // consolation prize
    }       
}

Just made some tweaks for you on this one. I thought it'd be easier to do them and let you read and understand them rather than attempt to explain every tweak to you to try and do yourself when you're not a mind reader

```csharp private void PlayNotificationSound() { try { using RegistryKey? defaultSoundPathKey = Registry.CurrentUser.OpenSubKey(@"AppEvents\Schemes\Apps\.Default\Notification.Default\.Current"); if (defaultSoundPathKey is null) throw new Exception(); if (defaultSoundPathKey.GetValue(null) is not string defaultSoundPath) throw new Exception(); SoundPlayer loadedSound = new(defaultSoundPath); loadedSound.Play(); } catch { SystemSounds.Beep.Play(); // consolation prize } } ``` Just made some tweaks for you on this one. I thought it'd be easier to do them and let you read and understand them rather than attempt to explain every tweak to you to try and do yourself when you're not a mind reader
mshafer1 (Migrated from github.com) reviewed 2025-01-11 09:58:06 -05:00
@@ -0,0 +98,4 @@
ProgressBar1.Visible = false;
LblTimeout.Visible = false;
}
mshafer1 (Migrated from github.com) commented 2025-01-11 09:58:06 -05:00

applied

applied
mshafer1 (Migrated from github.com) reviewed 2025-01-11 09:58:21 -05:00
mshafer1 (Migrated from github.com) commented 2025-01-11 09:58:21 -05:00

Thanks

Thanks
mshafer1 commented 2025-01-11 10:00:31 -05:00 (Migrated from github.com)

@alexhorner I was quite surprised when I unmuted my laptop and heard a bell noise on the custom :) (things made a little more sense to me when I switched back to default and also heard the bell -> I wound up muting the site's tab while testing :D)

I have addressed your feedback, and pushed one more commit to deal with the title text continuing to be selected on my machine.

@alexhorner I was quite surprised when I unmuted my laptop and heard a bell noise on the custom :) (things made a little more sense to me when I switched back to default and also heard the bell -> I wound up muting the site's tab while testing :D) I have addressed your feedback, and pushed one more commit to deal with the title text continuing to be selected on my machine.
alexhorner commented 2025-01-11 10:29:36 -05:00 (Migrated from github.com)

@alexhorner I was quite surprised when I unmuted my laptop and heard a bell noise on the custom :) (things made a little more sense to me when I switched back to default and also heard the bell -> I wound up muting the site's tab while testing :D)

I have addressed your feedback, and pushed one more commit to deal with the title text continuing to be selected on my machine.

Aha! We both got caught by that one did we? 😆

All looks good to me, thank you for your hard work!

@lucas-bortoli This one should be ready to merge, I have tested. As an aside, would you consider adding me as a maintainer so I may accept pull requests and package and release binaries on the releases page? Thanks!

> @alexhorner I was quite surprised when I unmuted my laptop and heard a bell noise on the custom :) (things made a little more sense to me when I switched back to default and also heard the bell -> I wound up muting the site's tab while testing :D) > > I have addressed your feedback, and pushed one more commit to deal with the title text continuing to be selected on my machine. Aha! We both got caught by that one did we? 😆 All looks good to me, thank you for your hard work! @lucas-bortoli This one should be ready to merge, I have tested. As an aside, would you consider adding me as a maintainer so I may accept pull requests and package and release binaries on the releases page? Thanks!
alexhorner (Migrated from github.com) approved these changes 2025-01-11 10:30:08 -05:00
mshafer1 commented 2025-01-20 22:24:43 -05:00 (Migrated from github.com)

@lucas-bortoli, any updates? I would like to deploy this soon and would prefer to do so with a build from the shared main branch.

@lucas-bortoli, any updates? I would like to deploy this soon and would prefer to do so with a build from the shared main branch.
alexhorner commented 2025-02-11 04:35:27 -05:00 (Migrated from github.com)

@lucas-bortoli Bump

@lucas-bortoli Bump
Sign in to join this conversation.
No description provided.