binwiederhier / ntfy-android

Android app for ntfy.sh
Apache License 2.0
465 stars 92 forks source link

Custom notification channels #48

Closed doits closed 1 year ago

doits commented 1 year ago

I gave a shot to implement first part of https://github.com/binwiederhier/ntfy/issues/6#issuecomment-1332280747.

For sure there are issues in this code, please don't be too hard with your review since this is my first time hacking on a kotlin project :-). I mostly did everything by copying existing code and by try and error. It isn't much battle tested either.

It allows to toggle a checkbox for each notification called "Own notification channels" in detail settings:

Bildschirm­foto 2022-12-01 um 11 19 33

If toggled, it creates an own notification channel group with notification channels for each priority:

Bildschirm­foto 2022-12-01 um 11 21 19

Notifications get sent to the correct group priority channel.

Default notifications (e.g. if the subscription does not use own notification channels) are grouped under a new "Default" group:

Bildschirm­foto 2022-12-01 um 11 23 57

That's it.

This way you can set custom notification sounds, override dnd etc. per subscription.

Feel free to give your thoughts if this is something you want to have in your app or you think more of a different way to solve issue https://github.com/binwiederhier/ntfy/issues/6.

doits commented 1 year ago

I just realized the priority strings could be shortened now so it doesn't look so messy (still tdb for all languages):

Bildschirm­foto 2022-12-01 um 11 45 33
doits commented 1 year ago

I just pushed some commits (probably should be squashed before it is merged, but we are not there yet):

Hopefully this makes the code more understandable.

Points not addressed yet:

That's all from me for now. Feel free to review it again, I hope the code got better!

binwiederhier commented 1 year ago

Looks very very very nice.

binwiederhier commented 1 year ago

I'm going to take the PR from here. It's fantastic work. Thank you @doits! Are you on Discord/Matrix? If not, you should join :-D

binwiederhier commented 1 year ago

PR superseded by https://github.com/binwiederhier/ntfy-android/pull/49