EatWithMeApp / eatwithme

3 stars 6 forks source link

M1 #137

Open ttww97 opened 4 years ago

ttww97 commented 4 years ago

Initialize and register notification in the chatroom, the app can get its token when it enters an chatroom. This is added in the line 121 in chat_room.dart. I have succeeded sending notification to a specific Android simulator by its token from the firebase console when the app runs background. The things should be done is: Push tokens of two devices (or uID? not sure for this part) to the document of “Chatroom”. Send messages directly via tokens got from the document. Foreground notification (Basically need cloud function and flutter_notification).

MufasaTheMusician commented 4 years ago

Sorry, I just realised this is a separate pull request from the other one, it has the same or similar name haha. I'll have a look now

ttww97 commented 4 years ago

Hi there, I’ve modified the code so that there would be no tokens for “Users”. Instead, my idea is that when the “chatroom” is created, they would push tokens to the chatroom. In this case, I modify writeToChatroom, adding one parameter token to write in. I’m not sure whether this works because at present I can’t create any new chatroom. The code is the latest version of m1. Btw, ChatNotification is useless. The Firebase_Messaging needs to be initialized in override ‘initState” function.

MufasaTheMusician commented 4 years ago

That makes sense, doing it by room seems like the best way. You should be able to make a new chat room by starting a chat with someone you haven't spoken to yet, it should be made automatically