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

Notification actions/callbacks #4953

Open
2 tasks done
hkparker opened this issue Jun 20, 2024 · 3 comments
Open
2 tasks done

Notification actions/callbacks #4953

hkparker opened this issue Jun 20, 2024 · 3 comments

Comments

@hkparker
Copy link
Contributor

Checklist

  • I have searched the issue tracker for open issues that relate to the same feature, before opening a new one.
  • This issue only relates to a single feature. I will open new issues for any other features.

Is your feature request related to a problem?

Notifications right now just display a string, and on mobile you don't appear to be able to click them to enter the app. On many mobile applications, clicking notifications not only opens the app, but opens it to the context / feature of the app relevant to the notification (think how clicking the notification of a chat app takes you to the specific conversation thread that created the notification).

I'd like to be able to send notifications with Fyne that, when the platform allows for it, let the user click the notification and enter the app with context.

Is it possible to construct a solution with the existing API?

Not that I'm aware of

Describe the solution you'd like to see.

notification := fyne.NewNotification("Title", "Content", func() {
    // This notification was clicked, now I can take some action and/or display the relevant container in the app
})
@Jacalz
Copy link
Member

Jacalz commented Jun 20, 2024

This is a great addition. However, do keep in mind that modifying the NewAnimation function when implementing this would be a breaking change. It would have to be part of the struct and maybe in a separate fyne.NewAnimationWithCallback function (or similar).

@andydotxyz
Copy link
Member

I'm not sure it can be done with functions, though it would be nice if that was possible.
I think the lowest common denominator to notifications would be entering the app through a deep link... but this task needs real investigation to learn what is possible before we put an API on it.

@andydotxyz andydotxyz added this to the "F" release, Late 2024 milestone Jun 21, 2024
@hkparker
Copy link
Contributor Author

hkparker commented Jun 26, 2024

I'd imagine something like this for the API side of that

myDeepLink := url.Url{} // url that should be used to call into the app when the notification is clicked
notification := fyne.NewNotificationWithDeepLink("Title", "Content", myDeepLink)
myapp.SetDeepLinkHandler(func(deepLink url.URL) {
    // match the URL to a rule and do anything / display anything as needed
})

With this scheme the developer gets to provide their own function for matching any deep link, which is very flexible

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

No branches or pull requests

3 participants