How to make Rules for chat app #6879
Unanswered
VincentCauch
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using flutter to make a chat app. I have group chat between two users, I don't know how to make rules so that only the two users can read and write in the group chat. This his how I store data on Firebase:
String date = DateTime.now() .millisecondsSinceEpoch .toString();
var ref = FirebaseFirestore.instance
.collection('messages')
.doc(groupChatId)
.collection(groupChatId)
.doc(date);
FirebaseFirestore.instance.runTransaction((transaction) async {
transaction.set(ref, {
"senderId": userId,
"receiverId": anotherId,
"timestamp": date,
'content': msg,
"type": 'text',
});
});
groupChatId is userId-anotherId
Thanks for any help.
Beta Was this translation helpful? Give feedback.
All reactions