-
-
Notifications
You must be signed in to change notification settings - Fork 189
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
Add local notifications and listen for challenge requests #902
Conversation
Whoa! This is a lot of work, I did not expect to receive such a PR :) I'll take the time to review it properly. I don't think adding a new translation was necessary here. As explained in the doc, we should not translate new strings for new feature right away. Could you also solve the conflicts please? If you remove the added translation, only the |
Also, can you post a screen recording showcasing this new feature? Thanks. |
Resolving that was a pain |
There is a bug that I am aware of but I don't really have a good solution for at the moment, I would appreciate some advice. When sending a notification with flutter_local_notifications, if the notification was interacted with in a way that doesnt open the application, for example when the user presses decline on the challenge notification, the resulting callback is spawned in a background isolate. From the background isolate I can send a request to the server to decline the challenge, but I have no idea how to go about updating the state of the application for when the user goes back to it. This results in declining a challenge with the notification and then it still showing in the challenges list as the state of the challengesProvider hasnt been updated. Do you have any idea how I could send a message from the background isolate to the main isolate, I have looked around and I cannot find any method of doing so. Perhaps I am just approaching the problem the wrong way. Would love to hear your thoughts Veloce. |
I'll record the videos and see if i can fix the checks failing tomorrow 😃. |
Hey @incogg do you think the issue you described would be similar to the one mentioned in my first bullet here (the first reply by me in that issue ticket)? I've outlined a few correspondence game issues for some time and I feel it matches what you outlined |
Nevermind the IsolateNameServer exists and i am aware of it now. |
Doesnt seem related no |
I cannot answer you atm sorry, and I don't know how to send a message to the main isolate. I will need to check this more thoroughly but I think the solution to this problem is to react to the app lifecycle events. We need to update the challenge list each time the app goes back to foreground (or is started)). Oh I'm just seeing your next answer about |
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.
Just a stylistic review for now. I'll review the rest asap.
Sounds like that would work in this case. |
2024-08-08.04-40-06.mp4Here is a video of the feature |
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.
Thanks again for your efforts!
Most the review is about renaming but the most important aspect is about riverpod usage which should be refactored (cf review comments).
Thanks for all the feedback Veloce, this is the first time I have ever used flutter or riverpod, it seems like I didn't fully comprehend how to use riverpod correctly. I feel like I have a much better grasp now. |
2024-08-09.16-53-47.mp4And here is a video showing the now enabled user challenges |
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.
This is getting in the right direction, thanks again for your work!
okay i think i have solved all the problems. i got rid of the messaging between isolates and i fixed the problems with not having access to refs by creating a separate riverpod provider scope that exists on the background isolate no more dealing with threads and the notification declarations are all in one file |
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.
Nicely done with the ProviderScope
. Thanks! Now there are a couple of things to fix related to the socket listening.
I must thank you again for your work and your patience @incogg , this has probably taken longer than expected on your side. This feature is essential to the app and is quite tricky, that's why the review process takes more time here. But I think we're heading in the right direction now. |
530eea0
to
bb2d515
Compare
To see the correct diff without extra main commits: main...incogg:mobile:feat/challenges |
Closes #432
Closes #438
Closes #439
Adds an api for interacting with the flutter_local_notifications package
Adds persistant websocket connection to listen for challenges in the form of a notifierProvider
Adds a screen to show, accept, and cancel incoming and outgoing challenges, both realtime and correspondance
Committing the locales makes the PR huge rip
EDIT: