Skip to content
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

Use Notification struct + Type impl for Notifications #132

Closed
TTWNO opened this issue Mar 4, 2024 · 1 comment · Fixed by #135
Closed

Use Notification struct + Type impl for Notifications #132

TTWNO opened this issue Mar 4, 2024 · 1 comment · Fixed by #135
Assignees
Milestone

Comments

@TTWNO
Copy link
Member

TTWNO commented Mar 4, 2024

The quickly-slapped together, but well tested ;) #125 was merged recently. This added notification reading support. Although this is exciting, I'd like it in a better state: a big list of random, unnamed fields in a tuple is not an ideal way to be deconstructing the message body.

We should have a Notification struct which implements Type instead, giving us access to all properties, along with their names.

This will require some additional work, especially related to how to (de)serialize key names in the receiving HashMap; ideally, we'd like to be able to deserialize this as an enum containing its internal data, like so:

pub enum Priority {
    Low
    Medium
    High
    Critical
}
#[non_exhaustive]
pub enum Hints {
    Priority(Priority),
    ...
    Other((String, OwnedValue))
}
pub struct Notification {
    app_name: String,
    body: String,
    hints: Vec<Hint>,
    ...
}

That will give us a much more flexible notification module.

@TTWNO TTWNO added this to the 0.2.0 milestone Mar 4, 2024
@albertotirla
Copy link
Member

for most of what you're saying, this commit covers it. Hints and afew other things weren't implemented there, but at the time, I believed, and somewhat still do, that it's out of scope. The only reason for the odilia-notify crate existing is to serve the needs of odilia when it comes to capturing notifications. I rejected that particular commit though, for the reason outlined above, and also because I thought it would add more bloat. In any case, work from this can begin by either reverting the commit after it, or cherry picking the commit I just linked and solving merge conflicts. The rest of what you said, aka hints as enums and other such things, can continue from there.

@TTWNO TTWNO linked a pull request Mar 7, 2024 that will close this issue
@TTWNO TTWNO closed this as completed in #135 Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants