firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.55k stars 1.45k forks source link

FR: Support apps with different bundle IDs opening same dynamic link #9542

Closed charmingtoad closed 1 year ago

charmingtoad commented 2 years ago

Feature proposal

I work on an iOS app that has both an Enterprise version and an App Store version. The two have different bundle IDs, since they must be managed by two different Apple Developer accounts.

The app uses Firebase dynamic links for deep linking. In our apple-app-site-association, we associate BOTH bundle IDs with the same domain. We used to have the same deep link working in both apps (whichever app happened to be installed would open), but after updating the FirebaseDynamicLinks SDK (to 8.13.0 from 4.3.1), the installed app still opens but we are no longer able to expand short links generated on Firebase unless the app's bundle ID matches the one selected when generating the link.

Specifically, the FIRDynamicLinks handleUniversalLink:completion: method calls its completion block with a link and no error, but when the bundle ids don't match, link.url is nil instead of containing the long link.

Is this by design? We can work around it by generating two links, one for the App store version and one for the Enterprise version, but this would complicate the product and our ability to use and test deep links.

eldhosembabu commented 2 years ago

If we have more than one iOS app associated to a firebase project, then when you create a firebase dynamic link, both of the app bundle id details will be added to the generated AASA file. This is an issue which we are aware(which is on our road map to resolve) and because of which if the user has installed any of these apps which is configured to handle the same FDL, the FDL can invoke that app through universal linking.

But from FDL perspective, an FDL can point to one iOS app with which it is configured and so the FDL backend will verify whether the link resolution call is made from the right App (by comparing the bundle id of the app and the bundle id of the app configured for the FDL) and then only resolve it.

Possible Issues with supporting multiple apps with the same FDL are:

Thanks for reaching out and happy to hear your thoughts on this!

google-oss-bot commented 2 years ago

Hey @charmingtoad. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

charmingtoad commented 2 years ago

For our specific use case, we always want the App Store app to be prioritized (if neither app is installed, install the App Store app. If both apps are installed, open the FDL in the App Store app). If only the Enterprise app is installed, we want to open the FDL in the Enterprise app.

One way this could be implemented from the FDL short link generator is to allow the user to specify whether they want to create a short link for one app or multiple apps, and if multiple apps, allow the user to set the priority order. If one app, give the short link a path and specify in the AASA that the path should only be used for the specified app. If multiple apps, list the apps in priority order in the AASA.

Currently we have the issue that the short link does open the Enterprise app if it's the only app installed, but then the handleUniversalLink:completion: method does not return the link.url because the app's bundle ID doesn't match the FDL bundle ID. Ideally there would not exist a case where the link opens the app yet the app is unable to use the framework to expand the link. If this restriction were removed, our use case would be solved.

madmacc commented 2 years ago

I have the same requirements. I have multiple apps (4 apps for both iOS and Android) that I want to be able to open a dynamic link in. If one of the apps is installed then use that otherwise go to the appropriate store for the first app in the list (AASA).

I have previously used deeplinks to open in multiple apps depending on what the user has installed. I have now upgraded to use firebase dynamic links and couldn't figure out how to get this to work. I guess I will have to go back to using deeplinks.

eldhosembabu commented 1 year ago

Internal feature request created : b/253041519

cgossain commented 1 year ago

+1 to this.

The priority with which iOS picks which app to open is based on the order in which the bundle IDs are listed in the AASA file. Having the ability to customize the AASA file or the order in which the apps are listed would be super helpful. Currently it seems Firebase is listing the bundle IDs alphabetically in the AASA it generates for FDL.

ebubedimobi commented 1 year ago

+1 to this

i am experiencing a similar use case. I have two different apps and i want to use the same dynamic link to open the two apps depending on which one is installed.

Currently it seems like a bug since both apps are being launched but if the bundleID doesn't match then link.url is nil instead of containing the url and we can't perform the right routing for the app that the bundle id doesn't match.

A possible solution:

1) Dynamic links should fully support multiple ios apps, no need for matching of bundleID 2) if no app is installed then it redirects to appstore of the app which the user picked in the firebase console 3) if multiple apps are installed, apple already has a mechanism in place to open apps based on priority from either the first bundle-id in the apple-association-file or the app that was last installed, so basically it should open any app as firebase shouldn't need to handle this

We really need this fix

paulb777 commented 1 year ago

Now that Firebase DynamicLinks is planned to shut down, closing its feature requests.