从应用程序内打开时,阻止 Firebase 动态链接重定向到浏览器

时间:2021-03-03 20:05:00

标签: firebase react-native react-native-firebase firebase-dynamic-links firebase-in-app-messaging

我们希望用户完成他们的个人资料,因此会弹出应用内消息,如果他们接受,则会将他们重定向到编辑个人资料页面。它正在工作,但它重定向到浏览器,返回应用程序,然后完成到个人资料页面的导航。有没有办法去掉浏览器重定向?

enter image description here

我尝试在 AndroidManifest.xml 中设置意图过滤器

<intent-filter>
    <data android:host="@string/firebaseDynamicLinkDomain" android:scheme="http"/>
    <data android:host="@string/firebaseDynamicLinkDomain" android:scheme="https"/>
</intent-filter>

这里是我们初始化的地方

export const initialize = async () => {
  try {
    disposeOnLink = dynamicLinks().onLink(handleLink);
  } catch (e) {
    throw e;
  }
};

然后处理链接

const handleLink = (link: string) => {
    if (link.url === 'https://mykomae.page.link/edit-profile') {
      navigateToEditProfile('profile');
    }
};

所以它可以运行,但看起来很糟糕,我希望避免这种行为。

0 个答案:

没有答案