Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added content/docs/images/gc_unity.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/docs/images/upm_add.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion content/docs/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"android",
"expo",
"flutter",
"unity",
"react-native",
"community"
]
}
}
86 changes: 86 additions & 0 deletions content/docs/unity/changelog.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
title: "Changelog"
description: "Changelog for the Superwall Unity SDK beta."
---

# Changelog

All notable changes to this package will be documented in this file.

## [0.2.3]

### Breaking Changes

- `Configure` completion signature changed from `Action<bool>` to `Action<ConfigurationResult>` to match the native SDKs' `Result<Unit>` semantics. The result exposes `IsSuccess` and a typed `FailedResult.Error` on failure. Android now propagates SDK init errors through this; iOS still always signals success since SuperwallKit's completion has no failure variant.

### Cleanup

- Renamed asmdef files to `Superwall.*`

## [0.2.1]

## Enhancements

### New APIs

- `SetLocalResources(Dictionary<string, string>)` - map asset names to local file paths for paywall WebViews (Android only)

### Delegate Fixes

- Android: added `willRedeemLink`, `didRedeemLink`, `userAttributesDidChange` delegate callbacks
- iOS: added `handleSuperwallDeepLink`, `userAttributesDidChange` delegate callbacks
- iOS: added `ShowAlert` no-op stub to prevent missing symbol crash

## [0.2.0]

### Android Support

- Full Android support via bundled `.androidlib` Gradle module - no manual `mainTemplate.gradle` setup needed
- Kotlin bridge compiled with Kotlin 2.0.21 to match Superwall Android SDK 2.x
- Custom `ActivityProvider` for Unity ensures paywall presentation works correctly
- AndroidManifest with required activity declarations merged automatically

### New APIs

- `Purchase(productId, callback)` - programmatic purchase without a paywall
- `GetProducts(productIds, callback)` - fetch product details by ID
- `GetAssignments(callback)` - get experiment assignments without confirming
- `ShowAlert(title, message, ...)` - show alerts on the current paywall
- `RefreshConfiguration()` - force SDK config refresh

### Options

- Full `SuperwallOptions` parsing on both platforms (was incomplete)
- Added `PaywallOptions.UseCachedTemplates` and `PaywallOptions.TimeoutAfter`
- `TestModeBehavior`, `NetworkEnvironment`, `Paywalls.*`, `Logging.Scopes` now properly passed to native SDKs

### Delegate & Callbacks

- All `ISuperwallDelegate` callbacks now receive deserialized objects instead of null
- `SubscriptionStatus` getter properly deserializes native state (was always returning Unknown)
- All async getters (`Entitlements`, `CustomerInfo`, `PaywallInfo`, `PresentationResult`, `ConfirmedAssignment`, `RestorationResult`) now deserialize correctly
- Fixed async callback mechanism - was dropping response data, causing `Configure` completion to always return false

### iOS

- Purchase controller flow implemented with async continuations
- Integration attributes mapping implemented
- Full options parity with Android

### Cleanup

- Removed legacy `com.ian_unity558.com.superwall.sdk` package
- Removed stale `EnsureAndroidGradleDependency` editor script (replaced by `.androidlib`)

## [0.1.1]

- Android package support
- Handler callback arguments
- More properties implemented
- Improved option support

## [0.1.0]

### This is the first release of _&lt;com.superwall.sdk&gt;_.

- iOS support, registering and callbacks
221 changes: 221 additions & 0 deletions content/docs/unity/guides/advanced-configuration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
---
title: "Advanced Configuration"
description: "Configure beta Superwall Unity SDK options and advanced APIs."
---

`SuperwallOptions` lets you tune paywall behavior, logging, locale, test mode, and platform-specific
behavior at configuration time.

```csharp C#
using System.Collections.Generic;
using Superwall;

var options = new SuperwallOptions
{
NetworkEnvironment = NetworkEnvironment.Release,
TestModeBehavior = TestModeBehavior.Automatic,
IsGameControllerEnabled = true,
Logging = new Logging
{
Level = LogLevel.Debug,
Scopes = new List<LogScope> { LogScope.PaywallPresentation }
},
Paywalls = new PaywallOptions
{
ShouldPreload = true,
AutomaticallyDismiss = true,
ShouldShowPurchaseFailureAlert = true,
RestoreFailed = new RestoreFailed
{
Title = "No Subscription Found",
Message = "We couldn't find an active subscription for your account.",
CloseButtonTitle = "Okay"
}
}
};

Superwall.Configure("MY_PUBLIC_API_KEY", options: options);
```

## `SuperwallOptions`

<TypeTable
type={{
Paywalls: {
type: "PaywallOptions",
typeDescriptionLink: "/unity/guides/advanced-configuration#paywalloptions",
description: "Paywall presentation and transaction UI behavior.",
default: "new PaywallOptions()",
},
NetworkEnvironment: {
type: "NetworkEnvironment",
description: "Superwall API environment. Use `Release` unless Superwall tells you otherwise.",
default: "NetworkEnvironment.Release",
},
IsExternalDataCollectionEnabled: {
type: "bool",
description: "Enables Superwall-managed external data collection.",
default: "true",
},
LocaleIdentifier: {
type: "string",
description: "Overrides the device locale for paywall localization.",
default: "null",
},
IsGameControllerEnabled: {
type: "bool",
description: "Enables native game controller handling for paywalls.",
default: "false",
},
Logging: {
type: "Logging",
description: "SDK log level and optional log scopes.",
default: "new Logging()",
},
PassIdentifiersToPlayStore: {
type: "bool",
description:
"Android-only. Sends identifiers to Google Play according to the native SDK behavior.",
default: "false",
},
TestModeBehavior: {
type: "TestModeBehavior",
description:
"Controls test mode. Values: `Automatic`, `WhenEnabledForUser`, `Never`, `Always`.",
default: "TestModeBehavior.Automatic",
},
ShouldObservePurchases: {
type: "bool",
description:
"Enables observation of purchases made outside Superwall when supported by the native SDK.",
default: "false",
},
ShouldBypassAppTransactionCheck: {
type: "bool",
description: "iOS-only app transaction check bypass.",
default: "false",
},
MaxConfigRetryCount: {
type: "int",
description: "Maximum native configuration retry count.",
default: "6",
},
UseMockReviews: {
type: "bool",
description: "Android-only mock review behavior.",
default: "false",
},
}}
/>

## `PaywallOptions`

<TypeTable
type={{
IsHapticFeedbackEnabled: {
type: "bool",
description: "Enables haptic feedback from paywall interactions.",
default: "true",
},
RestoreFailed: {
type: "RestoreFailed",
description: "Text shown when restore does not find an active subscription.",
default: "new RestoreFailed()",
},
ShouldShowPurchaseFailureAlert: {
type: "bool",
description: "Shows a default alert when a purchase fails.",
default: "true",
},
ShouldPreload: {
type: "bool",
description: "Preloads paywalls when configuration is available.",
default: "true",
},
AutomaticallyDismiss: {
type: "bool",
description: "Automatically dismisses the paywall after a successful purchase.",
default: "true",
},
ShouldShowWebRestorationAlert: {
type: "bool",
description: "Shows the default web restoration alert.",
default: "true",
},
TransactionBackgroundView: {
type: "TransactionBackgroundView",
description: "Background view shown during transactions. Values: `Spinner`, `None`.",
default: "TransactionBackgroundView.Spinner",
},
OverrideProductsByName: {
type: "Dictionary<string, string>",
description: "Maps product names in paywalls to specific store product identifiers.",
default: "null",
},
ShouldShowWebPurchaseConfirmationAlert: {
type: "bool",
description: "Shows the web purchase confirmation alert.",
default: "false",
},
UseCachedTemplates: {
type: "bool",
description: "Uses cached paywall templates when available.",
default: "false",
},
TimeoutAfter: {
type: "float?",
description: "Optional paywall request timeout in seconds.",
default: "null",
},
}}
/>

## Preloading

```csharp C#
Superwall.Shared.PreloadAllPaywalls();

Superwall.Shared.PreloadPaywallsForPlacements(new List<string>
{
"onboarding",
"upgrade"
});
```

## Locale

```csharp C#
Superwall.Shared.LocaleIdentifier = "es_ES";
```

## Local Resources

Android builds can map paywall asset names to local file paths.

```csharp C#
Superwall.Shared.SetLocalResources(new Dictionary<string, string>
{
{ "hero_image", "/absolute/path/to/hero.png" }
});
```

<Note>`SetLocalResources` is Android-only in the current beta. It is a no-op on iOS.</Note>

## Programmatic Purchase and Products

```csharp C#
Superwall.Shared.GetProducts(new List<string> { "monthly", "annual" }, products =>
{
foreach (var product in products)
{
Debug.Log($"{product.Key}: {product.Value.LocalizedPrice}");
}
});

Superwall.Shared.Purchase("monthly", result =>
{
Debug.Log($"Purchase result: {result.Type}");
});
```

For normal paywall flows, prefer `RegisterPlacement`.
Loading
Loading