Repository navigation
Conversation
bilck
force-pushed
the
fix/serialize-android-subscription-entitlements
branch
from
October 27, 2026 04:52
c3ef36b to
34887e8
Compare
Contributor
Author
|
Rebased onto |
The Android harness gains a test source set (ci~/android-harness/bridge-tests, nothing test-only ships in the package) and the native workflow runs it on both AGP versions. The first test pins what getSubscriptionStatus() hands to C#: an active status carries every entitlement in the full entitlement shape, and inactive/unknown carry no entitlements key. Removing the entitlements from the serializer fails two of the three tests. The harness also keeps the androidlib's build outputs under ci~/android-harness/build instead of inside Plugins/Android/SuperwallSDK.androidlib, and accepts -PbuildToolsVersion for machines without AGP's default build-tools.
AGP 9 creates unit-test tasks only for the tested build type (debug) by default, so testReleaseUnitTest did not exist on the AGP 9.0.1 job.
bilck
added a commit
to bilck/Superwall-Unity
that referenced
this pull request
Oct 29, 2026
… no test ran On AGP 9 the srcDirs reassignment was ignored and testDebugUnitTest went NO-SOURCE, a green job that ran nothing. srcDir() (plus the Kotlin source set where the DSL has one) works on AGP 8.5.2 and 9.0.1 (7 tests each, checked locally). The CI step now also requires the JUnit result files.
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.
Problem
The Android bridge serializes
SubscriptionStatus.Activeas{ "type": "active" }and dropsstatus.entitlements, even though the setter accepts the entitlement array. Reading a status back afterwriting
Active [premium]therefore returnsActive [].This is still the behaviour on
mainat 0.3.0:The getter and the setter disagree, and iOS does not behave this way. A consumer that reconciles
subscription status against its own backend reads an empty set, computes a union that never matches what it
just wrote, and either pushes the same entitlements repeatedly or concludes the entitlement is missing.
Change
Serialize
SubscriptionStatus.Active.entitlementswith the existing full entitlement serializer, matchingthe iOS bridge. The function moves from companion scope to
SuperwallUnityBridgeinstance scope, which iswhere it can reach
serializeEntitlementSet. No call sites change;getSubscriptionStatus()is unaffectedapart from the richer payload.
Verification
mainat 0.3.0; the two files in this PR are the entire diff.Active []at cold launch while thenative SDK held an active entitlement, and the C# side then saw its own union as a no-op. With this change
the active entitlement id and its product are present in the getter payload.
assembleReleasesucceeds with AGP 9.0.1 / Gradle 9.1.0 and with AGP 8.5.2 / Gradle 8.7.Tests (added 2026-10-29)
ci~/android-harness/bridge-tests/, so nothing test-only ships in the package), run bynative.ymlon both AGP versions afterassembleRelease:gradle :SuperwallSDK:testDebugUnitTest.SubscriptionStatusSerializationTestpins the JSONgetSubscriptionStatus()returns:activecarries every entitlement in the full entitlement shape;inactiveandunknowncarry noentitlementskey.put("entitlements", ...)line removed, 2 of 3 fail, so the test guards this regression. The AGP 9.0.1 job has only been run by CI.ci~/android-harness/build/(gitignored) instead ofPlugins/Android/SuperwallSDK.androidlib/build/, and accepts-PbuildToolsVersion=<x>for machines without AGP's default build-tools.