如何使用Firebase创建好友列表? [英] How to create a friends list using Firebase?

查看:122
本文介绍了如何使用Firebase创建好友列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究如何使用Firebase创建好友列表系统。到目前为止,我没有运气,并被给予不是我正在寻找的资源。信息的预范读范亦范范亦作亦范范信息区内信息身份验证创建一个帐户(完成),然后一旦用户有一个帐户,他们可以添加在firbase用户注册的人。这可以媲美朋友列表。一旦用户添加了另一个用户,他们可以选择创建一个只有他的朋友才能看到的帖子,用户可以在帖子旁边聊天。



问题:


  • 不知道从哪里开始使用Firebase自定义用户登录&身份验证

  • 之后,只有添加到用户好友列表的用户才能看到发布的内容。



PS只是寻找一些关于这个问题的指导,从任何东西到资源/提示

加藤的评论是关于点。对于Firebase来说,超级新手可能有点令人生畏,所以这里有一些想法:

你不能使用Login&以您想要的方式进行身份验证。这是一个功能,允许您创建可以访问您的Firebase的用户,就是这样。



如果您想要对用户做更多的事情,请创建一个/ users节点,其他的东西。

 用户
uid_0
名字:Frank
friends
uid_1:true
uid_2:true
uid_1
名称:Kato
uid_2
名称:Bill



这告诉我们弗兰克有两个朋友,加藤和比尔。

完成任务,当新用户注册时(通过将其添加到用户节点并观察用户节点中的.childAdded),Firebase将需要通知您的应用,然后将新用户显示给您的用户,以便他们可以将其添加到他们的朋友列表。 / b>

文章可以用类似的方式处理

 文章
post_id_0
msg:嘿,看看孩子,有大笨钟,还有议会
posted_by:uid_0
观众:
uid_1:true

这个结构有一个post引用(由autoId创建)谁允许查看它,在这种情况下用户使用uid_1,加藤。



保存数据检索数据是重要的阅读内容,只需阅读精心编写的 Firebase星际指南即可。



希望这会提供一些方向,并且在将来,制作代码,创建Firebase结构,当您遇到困难时,请发布这些内容方面作信息亦读信息亦读信息预读信息

I have been researching around the web on how to create a friends list system using firebase. So far I had no luck and was given resources that was not quite what I was looking for. The premise of the app is using the User Login & Authentication to create a account(completed), then once the user has an account they can add people that are register in the firbase users. This can comparable to a friends list. once the user adds another user they can have an option to create a post that only his friends can see and the users can group chat in side the post.

The Problem:

  • Don't know where to start in creating a friends list using firebase custom User Login & Authentication
  • After that how do only the people that are add to the users friends list see the content posted.

P.S. just looking for some guidance on the subject from anything to resources to/ tips

解决方案

Kato's comment is on point. Being super new to Firebase can be a bit daunting so here's some ideas:

You cannot use the Login & Authentication in the way you want. It is a function that allows you to create users that can access your Firebase and that's it.

If you want to do more with users, create a /users node that contains other stuff.

users
  uid_0
    name: "Frank"
    friends
      uid_1: true
      uid_2: true
  uid_1
    name: "Kato"
  uid_2
    name: "Bill"

This tells us that Frank has two friends, Kato and Bill.

To accomplish your task, Firebase will need to notify your app when new users sign up (by adding them to the users node and observing the Users node for .childAdded) and then display the new users to your user so they can add them to their friends list.

Posts can be handled in a similar fashion

posts
  post_id_0
     msg: "Hey look kids, there's Big Ben, and there's Parliament"
     posted_by: uid_0
     viewers:
      uid_1: true

This structure has a post reference (created by autoId), a msg and who posted it and who's allowed to view it, in this case user with a uid_1, Kato.

Saving Data and Retrieving Data are critical reads and simply going through the well-written Firebase Guide to the Stars is a must.

Hope this provides some direction, and in the future, craft your code, create a Firebase structure and when you really get stuck, post those (as text please) as they will help us, help you.

这篇关于如何使用Firebase创建好友列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆