Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

injectPreferences in projectEntitlements.js should merge associated domains with current instead of overwriting #278

Closed
djett41 opened this issue Jan 31, 2017 · 7 comments

Comments

@djett41
Copy link

djett41 commented Jan 31, 2017

If you have an Entitlements file with a list of associated domains, this plugin will read the file but then overwrite the associated domains instead of merging with them.

So instead of re-setting the array, it should first check to see if the domain exists, and if not add it to the existing array

@renesansz
Copy link
Contributor

hey @djett41 ,
I assume this is similar with the issue you've posted? #277
If so, can you do the same, please post the contents of your config.xml?
Thanks

@djett41
Copy link
Author

djett41 commented Jan 31, 2017

@renesansz this is related to the entitlements file for ios. If I have an entitlements file with multiple associated domains

    <key>com.apple.developer.associated-domains</key>
    <array>
      <string>myscheme:domain1.com</string>
      <string>myscheme:domain2.com</string>
    </array>

And have branch-config

   <branch-config>
        <ios-team-id value="{my-ios-team}" />
        <host name="domain3.com" scheme="https" />
    </branch-config>

Then I expected the entitlements file to have all 3

    <key>com.apple.developer.associated-domains</key>
    <array>
      <string>myscheme:domain1.com</string>
      <string>myscheme:domain2.com</string>
      <string>myscheme:domain3.com</string>
    </array>

however it gets overwritten and only contains domain3

@ethanneff
Copy link
Contributor

Hello @djett41,

Thank you for finding this bug. I have updated our latest Pull Request code to change the Associated Domains to append instead of remove.

May I ask what other plugins you are using which is modifying the Associated Domains? Also, what you are trying to accomplish with multiple associated domains? This information will be helpful in knowing what plugins are compatible with Branch.

Best,

@djett41
Copy link
Author

djett41 commented Feb 1, 2017

@ethanneff thanks again! We have a single cordova project for multiple apps, and app config as well as deep links, get changed depending on which app we are building for.

@ethanneff
Copy link
Contributor

Hello @djett41,

You may run into further complications if you are using the same codebase for multiple apps. For Branch to work properly, you will need to create a new Branch dashboard account for each app. Branch deep links need a way to distinguish between all your apps on the same device. For example:

This means that each of your apps will need to be assigned a unique Branch key, a unique URI Scheme, and a unique Link Domain.

Best,

@djett41
Copy link
Author

djett41 commented Feb 1, 2017

@ethanneff thats correct, thats how it is currently, and for each app the branch uri scheme and domain is changed at build time.

So given the multiple app scenario, how do you recommend setting up the config.xml or all branch config to support the following for ios and android for multiple apps given the following

  • each app has its own bnc.lt android path prefix
  • each app has both a bnc.lt link as well as an app.link domain. All new links use the app.link, but some old links from bnc.lt are still live.
  • right now we are including BOTH the bnc.lt AND app.link domains in the ios entitlements file and AndroidManifest.xml, do we only need to include the bnc.lt link domain in the android-prefix and not the app.link? or the other way around?

I would like to be able to support current app links and old bnc links which are still live by using the CLI rather than having to manually figure out a way to inject the second link in the entitlements/manifest file.

Thanks!

@ethanneff
Copy link
Contributor

Hello @djett41,

Using both bnc.lt and app.link link domains is not ideal. The bnc.lt is our older link domain with limited capabilities. It has been depreciated over a year and a half ago. bnc.lt links will not leverage Universal Linking which is a requirement for Apple devices (iOS 9.2+). For the reason, Branch recommends discontinuing your bnc.lt links and converting them to our new app.link link domain.

Additionally, filling up your iOS entitlements and Android Intents with multiple link domains is not ideal either. Whenever a user clicks on a deep link, the deep link could navigate to the wrong app because of the multiple entries. This will cause deep link data to not pass through and skew your Branch metrics with invalid clicks, opens, and installs.

What you are trying to achieve is against Branch's recommend configuration. If you want to continue using multiple apps with the same code base, your best bet is to make a build script on top of your apps to install Branch and assign a unique Branch key, a unique URI Scheme, and a unique Link Domain for each of your apps.

Best,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants