简体   繁体   English

Firebase中的自定义动态链接,可转到用户个人资料

[英]Custom Dynamic Links in Firebase that goes to user profile

Im pretty new to Firebase, so please bear with me on this one. 我对Firebase来说还很陌生,所以请耐心接受这一点。 This problem has been stuck in my head for the past days. 在过去的几天里,这个问题一直困扰着我。

I have seen some videos on Dynamic Links, but i havent seen some clear answers to what im hoping to achieve. 我在动态链接上看过一些视频,但是我看不到我希望达到的目标的明确答案。 I want to create a Dynamic Link, that allow users to share their account with their friends (through a link). 我想创建一个动态链接,该链接允许用户与朋友(通过链接)共享其帐户。

So my question is how can i manually construct a dynamic link (with User A´s uid), so when User B clicks on that link (and has the app) it will go straight into the profile of User A? 所以我的问题是我该如何手动构建一个动态链接(使用用户A的uid),因此当用户B单击该链接(并拥有该应用程序)时,它将直接进入用户A的配置文件中?

Should i create a link when a user signs up and store it under their profile in the database? 当用户注册并将链接存储在其个人资料下时,是否应该创建链接?

Looking forward to hearing how you guys would go about solving this problem im having. 期待听到你们将如何解决所遇到的这个问题。

You essentially want to create link where the link parameter (what's called the "Deep link URL" in the Firebase console) looks something like https://www.example.com/userProfile?uid=314159 . 您本质上想在link参数(在Firebase控制台中称为“深层链接URL”)看起来像https://www.example.com/userProfile?uid=314159地方创建链接。 (The full deep link will look different than this.) (完整的深层链接看上去与此不同。)

When your app opens up this dynamic link, it will convert the incoming URL to a Dynamic Link object, and that object will have a url property that equals this link parameter. 当您的应用打开此动态链接时,它将输入的URL转换为动态链接对象,并且该对象将具有与该链接参数相等的url属性。 Your app will have to do the work to analyze this url and say, "Oh, this appears to be a request to view a user's profile, so I'm going to redirect to that part of my app". 您的应用程序必须完成分析此URL的工作,然后说:“哦,这似乎是查看用户个人资料的请求,因此我将重定向到应用程序的该部分”。 It won't happen automatically. 它不会自动发生。

Whether you create it when the user first signs up, or when they decide to share their profile is kinda up to you. 无论是在用户首次注册时创建它还是在用户决定共享其个人资料时创建它,都取决于您。 I'm generally not a fan of pre-generating deep links ahead of time, because you might realize later you want to change an aspect of these links, and that's easier to do if you don't have thousands of pre-generated DLs. 我通常不喜欢提前预先生成深层链接,因为您可能稍后会意识到要更改这些链接的一个方面,如果您没有成千上万个预先生成的DL,这样做会更容易。 Keep in mind that either way, there is a network call required to convert these longer URls into a prettier short URL. 请记住,无论哪种方式,都需要进行网络调用,以将这些较长的URls转换为更漂亮的短URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM