Skip to content

Commit e290f47

Browse files
committedApr 23, 2024
Adds and uses description for FeatureGatingBehavior
1 parent 655822e commit e290f47

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed
 

‎CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ The changelog for `SuperwallKit`. Also see the [releases](https://github.com/sup
1010
- Adds `setInterfaceStyle(to:)` which can be used to override the system interface style.
1111
- Adds `device.interfaceStyleMode` to the device template, which can be `automatic` or `manual` if overriding the interface style.
1212

13+
### Fixes
14+
15+
- Changes the `$feature_gating` parameter in `PaywallInfo` from 0 and 1 to `GATED` and `NON_GATED` to prevent confusion.
16+
1317
## 3.6.1
1418

1519
### Enhancements

‎Sources/SuperwallKit/Config/Models/FeatureGatingBehaviour.swift

+10-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
/// An enum whose cases indicate whether the ``Superwall/register(event:params:handler:feature:)``
1111
/// `feature` block executes or not.
1212
@objc(SWKFeatureGatingBehavior)
13-
public enum FeatureGatingBehavior: Int, Codable {
13+
public enum FeatureGatingBehavior: Int, Codable, CustomStringConvertible {
1414
/// Prevents the ``Superwall/register(event:params:handler:feature:)`` `feature`
1515
/// block from executing on dismiss of the paywall unless the user has an active subscription.
1616
case gated
@@ -24,6 +24,15 @@ public enum FeatureGatingBehavior: Int, Codable {
2424
case nonGated = "NON_GATED"
2525
}
2626

27+
public var description: String {
28+
switch self {
29+
case .gated:
30+
return "GATED"
31+
case .nonGated:
32+
return "NON_GATED"
33+
}
34+
}
35+
2736
public init(from decoder: Decoder) throws {
2837
let container = try decoder.singleValueContainer()
2938
let rawValue = try container.decode(String.self)

‎Sources/SuperwallKit/Paywall/Presentation/PaywallInfo.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public final class PaywallInfo: NSObject {
287287
"presented_by_event_name": presentedByEventWithName as Any,
288288
"paywall_product_ids": productIds.joined(separator: ","),
289289
"is_free_trial_available": isFreeTrialAvailable as Any,
290-
"feature_gating": featureGatingBehavior.rawValue as Any,
290+
"feature_gating": featureGatingBehavior.description as Any,
291291
"presented_by": presentedBy as Any
292292
]
293293

0 commit comments

Comments
 (0)