feat: add PurchasesConfiguration.Builder.SetProxyURL - #1041
Draft
vegaro wants to merge 1 commit into
Draft
Conversation
The proxyURL inspector field's tooltip has always told runtime-setup users to "configure it through PurchasesConfiguration instead", but PurchasesConfiguration never had a proxy URL option, so there was nowhere to go. This adds it. Configure forwards the proxy URL to the wrapper before calling Setup, since the native SDKs need it in place before they are configured. It is only forwarded when set, which mirrors how the inspector field is applied in Start and keeps a configuration without a proxy URL from clearing one that was already set through the inspector. Also corrects the tooltip, which was wrong twice: it claimed the field is ignored when Use Runtime Setup is true, but Start applies it before the early return, so it takes effect on both paths. Matches the shape used elsewhere: proxyURL lives on the configuration builder on Android, and purchases-hybrid-common already exposes the setter on both platforms, so no native or hybrid-common change is needed.
vegaro
force-pushed
the
cesar/unity-configuration-proxy-url
branch
from
August 6, 2026 08:59
510858e to
ccd223d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
proxyURLinspector field's tooltip has always told runtime-setup users to "configure it through PurchasesConfiguration instead", butPurchasesConfigurationnever had a proxy URL option, so there was nowhere to go. A developer using runtime setup would read that, look for the option, not find it, and reasonably conclude proxy URLs aren't supported for runtime setup.Adds
PurchasesConfiguration.ProxyURLandBuilder.SetProxyURL(string).Configureforwards it to the wrapper before callingSetup, since the native SDKs need the proxy in place before they're configured. It's only forwarded when set. That guard matters for more than tidiness: an unconditional call would passnullfor every configuration without a proxy URL and clear one that had already been set through the inspector field inStart.Also fixes the tooltip, which was wrong twice. It claimed the value "will be ignored if Use Runtime Setup is true", but
Startapplies it atPurchases.cs:119-121, before theif (useRuntimeSetup) return;on line 124. It takes effect on both paths, and now the pointer to the builder is accurate too.That note is shared boilerplate across 8 inspector fields, and it is correct for the other 7: the API keys,
useAmazon,autoSyncPurchases,appUserID,productIdentifiers,userDefaultsSuiteNameandpurchasesAreCompletedByare all read insideConfigureor below the early return, so runtime setup really does skip them.proxyURLis the only field applied above it, and it looks like the note was just inherited from its neighbours. Git history backs that up: theproxyURLblock was added in #25 before runtime setup existed, has one commit in its whole history and has never moved, whileuseRuntimeSetuparrived later in #118 and the note later still in #125. So the note was already false when it was written, rather than being made stale by a refactor. That is also why the new wording leads with "unlike the other fields here".Known inconsistency, deferred to the next major
This PR does not make
proxyURLbehave like its neighbours, and that is on purpose.proxyURLstays the one inspector field runtime setup does not ignore. The consistent version would move it below theif (useRuntimeSetup) return;, so that runtime-setup apps had to useBuilder.SetProxyURLand the original boilerplate note became true. I did not do that here because it silently breaks a working setup: anyone using runtime setup together with the inspector field has a working proxy today, and after such a change their traffic would go straight to RevenueCat's default endpoints with no error and no log line. Proxy URLs are handed out to customers who proxy for egress control, compliance or regional routing, so silently bypassing it is worse than failing loudly.There is also a wrinkle that makes the "consistent" version less clean than it sounds. The proxy has to reach the native SDK before configure, and for inspector-configured apps
Startis the only place that can happen, so the current placement is the one spot that serves both paths. Moving it down would make the inspector field dead for runtime setup unlessConfigurefell back to reading it, which would mix inspector state into a runtime configuration object.So the alignment is deferred to the next major, alongside #1018, which is the same family of inspector-path versus runtime-path divergence. There is a comment at the application site in
Startrecording this, so it does not read as an oversight.Parity
No native or purchases-hybrid-common change is needed.
CommonFunctionality.proxyURLStringandsetProxyURLString(common.kt:876) already exist on both platforms, and all three Unity wrappers already implementSetProxyURL. This also matches Android, whereproxyURLlives on the configuration builder rather than being a separate static.Behavior change
None for existing apps. This is additive: the new field defaults to null, and a configuration that doesn't set it behaves exactly as before, including leaving an inspector-set proxy URL alone.
Tests
PurchasesAPITestsexercisesSetProxyURLand readsProxyURLback, for compile-time API stability.BuildUsesBuilderDefaultsasserts the default is null;BuildUsesConfiguredValuesasserts it round-trips.ConfigureSetsProxyUrlBeforeSettingUppins the ordering, not just that both calls happen.ConfigureWithoutProxyUrlDoesNotCallSetProxyUrlpins the guard.The last two were mutation-tested against the real runner. Each mutation failed exactly the intended test and nothing else:
SetProxyURLcallConfigureSetsProxyUrlBeforeSettingUpfails, invocation count 2 to 1ConfigureWithoutProxyUrlDoesNotCallSetProxyUrlfails, count 1 to 2SetupConfigureSetsProxyUrlBeforeSettingUpfails, first invocation wasSetupRemoving the guard also breaks the pre-existing
ConfigureForwardsEveryConfigurationValue, which is the other reason it's there.Verification
test-edit-modelocally on Unity 6000.2.6f2: 23/23 passed, 0 failed, 0 skipped, and 23/23 again after restoring from the mutation runs.scripts/check-meta-files.sh