ionic-team / trapeze

The mobile project configuration toolbox. Manage native iOS, Android, Ionic/Capacitor, React Native, and Flutter apps through a simple YAML format.
https://trapeze.dev
Other
323 stars 40 forks source link

Entitlements duplicate entries #177

Open sanderschnydrig opened 1 year ago

sanderschnydrig commented 1 year ago

Hi Max! Hope you're well.

Not really an issue but more of a question:

I have two targets that I use the application for. One of those targets has recently gone through a domain change. Now I'm trying to keep the old domain for deep linking only for one of the targets:

<key>com.apple.developer.associated-domains</key>
<array>
    <string>applinks:example.ch</string>
    <string>applinks:exampletwo.ch</string>
</array>

Which works fine, but when I'm applying the config for the other target I get a duplicate entry:

<key>com.apple.developer.associated-domains</key>
<array>
    <string>applinks:example.ch</string>
    <string>applinks:example.ch</string>
</array>

Since the other target does not need backward compatibility. I managed this using the following trapeze config:

platforms:
  ios:
    targets:
      App:
        entitlements:
          replace: true
          entries:
            - com.apple.developer.associated-domains: ['applinks:$BASE_URL', 'applinks:$ALTERNATIVE_BASE_URL', 'applinks:$NEWSAPP_PAGE_LINK']

Is there a way I can remove the ALTERNATIVE_BASE_URL applink for the second target (i.e. conditionally add entries to this array used for com.apple.developer.associated-domains)?

Best regards

mlynch commented 1 year ago

I'm not quite following. If you have two targets then you would use two different blocks under the targets: entry, right? And they would have different entries below, so you could replace them separately. Or if I'm not understanding can you rephrase it?

sanderschnydrig commented 1 year ago

@mlynch sorry I should have elaborated more.

With target I mean one of our clients (we use the same codebase and whitelabel it so that our clients get an application with the same features but different databases and color themes for example). And every client has their own domain with their own configs etc.

Trying to avoid redundancy in the code is why I'm using a single yaml file for the capacitor configuration with trapeze for all clients.

One of our clients has recently switched their domain. In order to preserve backwards compatibility with old deeplinks for only 1 single client, I was wondering if it's already possible to achieve this, so building the application for one client with all configs would give us the com.apple.developer.associated-domains entitlements for both domains example.com and exampletwo.com. However for the other clients we only need 1 single value for that entitlement key: examplethree.com.

For now I just duplicate the examplethree.com domain for all other clients (as they dont need a secondary domain but still need this .env variable for a secondary domain, I guess), so far it seemed to work.

TLDR

Is there a way to omit the secondary domain (ALTERNATIVE_BASE_URL) from the array below for our customers that dont need one?

platforms:
  ios:
    targets:
      App:
        entitlements:
          replace: true
          entries:
            - com.apple.developer.associated-domains: ['applinks:$BASE_URL', 'applinks:$ALTERNATIVE_BASE_URL', 'applinks:$NEWSAPP_PAGE_LINK']

If not we will just use the duplicated entry, seems to be no problem. Was just wondering if its possible somehow.

mlynch commented 1 year ago

Yea I'm not sure, I would just duplicate the entries for now. Sorry, I'm having trouble understanding the use case