Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Commit 2e0b9ff

Browse files
committed
Revert "feat: add ProductTypeDetails and deprecate ProductIOS (#13)"
This reverts commit 439597c.
1 parent 439597c commit 2e0b9ff

7 files changed

Lines changed: 3 additions & 152 deletions

File tree

src/generated/Types.kt

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -222,33 +222,6 @@ public enum class PaymentModeIOS(val rawValue: String) {
222222
fun toJson(): String = rawValue
223223
}
224224

225-
public enum class ProductDetailType(val rawValue: String) {
226-
Consumable("consumable"),
227-
NonConsumable("non-consumable"),
228-
AutoRenewableSubscription("auto-renewable-subscription"),
229-
NonRenewingSubscription("non-renewing-subscription")
230-
231-
companion object {
232-
fun fromJson(value: String): ProductDetailType = when (value) {
233-
"consumable" -> ProductDetailType.Consumable
234-
"CONSUMABLE" -> ProductDetailType.Consumable
235-
"Consumable" -> ProductDetailType.Consumable
236-
"non-consumable" -> ProductDetailType.NonConsumable
237-
"NON_CONSUMABLE" -> ProductDetailType.NonConsumable
238-
"NonConsumable" -> ProductDetailType.NonConsumable
239-
"auto-renewable-subscription" -> ProductDetailType.AutoRenewableSubscription
240-
"AUTO_RENEWABLE_SUBSCRIPTION" -> ProductDetailType.AutoRenewableSubscription
241-
"AutoRenewableSubscription" -> ProductDetailType.AutoRenewableSubscription
242-
"non-renewing-subscription" -> ProductDetailType.NonRenewingSubscription
243-
"NON_RENEWING_SUBSCRIPTION" -> ProductDetailType.NonRenewingSubscription
244-
"NonRenewingSubscription" -> ProductDetailType.NonRenewingSubscription
245-
else -> throw IllegalArgumentException("Unknown ProductDetailType value: $value")
246-
}
247-
}
248-
249-
fun toJson(): String = rawValue
250-
}
251-
252225
public enum class ProductQueryType(val rawValue: String) {
253226
InApp("in-app"),
254227
Subs("subs"),
@@ -416,7 +389,6 @@ public interface ProductCommon {
416389
val price: Double?
417390
val title: String
418391
val type: ProductType
419-
val typeDetails: ProductDetailType
420392
}
421393

422394
public interface PurchaseCommon {
@@ -713,8 +685,7 @@ public data class ProductAndroid(
713685
val price: Double? = null,
714686
val subscriptionOfferDetailsAndroid: List<ProductSubscriptionAndroidOfferDetails>? = null,
715687
val title: String,
716-
val type: ProductType,
717-
val typeDetails: ProductDetailType
688+
val type: ProductType
718689
) : ProductCommon, Product {
719690

720691
companion object {
@@ -733,7 +704,6 @@ public data class ProductAndroid(
733704
subscriptionOfferDetailsAndroid = (json["subscriptionOfferDetailsAndroid"] as List<*>?)?.map { ProductSubscriptionAndroidOfferDetails.fromJson((it as Map<String, Any?>)) },
734705
title = json["title"] as String,
735706
type = ProductType.fromJson(json["type"] as String),
736-
typeDetails = ProductDetailType.fromJson(json["typeDetails"] as String),
737707
)
738708
}
739709
}
@@ -753,7 +723,6 @@ public data class ProductAndroid(
753723
"subscriptionOfferDetailsAndroid" to subscriptionOfferDetailsAndroid?.map { it.toJson() },
754724
"title" to title,
755725
"type" to type.toJson(),
756-
"typeDetails" to typeDetails.toJson(),
757726
)
758727
}
759728

@@ -796,7 +765,6 @@ public data class ProductIOS(
796765
val subscriptionInfoIOS: SubscriptionInfoIOS? = null,
797766
val title: String,
798767
val type: ProductType,
799-
val typeDetails: ProductDetailType,
800768
val typeIOS: ProductTypeIOS
801769
) : ProductCommon, Product {
802770

@@ -817,7 +785,6 @@ public data class ProductIOS(
817785
subscriptionInfoIOS = (json["subscriptionInfoIOS"] as Map<String, Any?>?)?.let { SubscriptionInfoIOS.fromJson(it) },
818786
title = json["title"] as String,
819787
type = ProductType.fromJson(json["type"] as String),
820-
typeDetails = ProductDetailType.fromJson(json["typeDetails"] as String),
821788
typeIOS = ProductTypeIOS.fromJson(json["typeIOS"] as String),
822789
)
823790
}
@@ -839,7 +806,6 @@ public data class ProductIOS(
839806
"subscriptionInfoIOS" to subscriptionInfoIOS?.toJson(),
840807
"title" to title,
841808
"type" to type.toJson(),
842-
"typeDetails" to typeDetails.toJson(),
843809
"typeIOS" to typeIOS.toJson(),
844810
)
845811
}
@@ -857,8 +823,7 @@ public data class ProductSubscriptionAndroid(
857823
val price: Double? = null,
858824
val subscriptionOfferDetailsAndroid: List<ProductSubscriptionAndroidOfferDetails>,
859825
val title: String,
860-
val type: ProductType,
861-
val typeDetails: ProductDetailType
826+
val type: ProductType
862827
) : ProductCommon, ProductSubscription {
863828

864829
companion object {
@@ -877,7 +842,6 @@ public data class ProductSubscriptionAndroid(
877842
subscriptionOfferDetailsAndroid = (json["subscriptionOfferDetailsAndroid"] as List<*>).map { ProductSubscriptionAndroidOfferDetails.fromJson((it as Map<String, Any?>)) },
878843
title = json["title"] as String,
879844
type = ProductType.fromJson(json["type"] as String),
880-
typeDetails = ProductDetailType.fromJson(json["typeDetails"] as String),
881845
)
882846
}
883847
}
@@ -897,7 +861,6 @@ public data class ProductSubscriptionAndroid(
897861
"subscriptionOfferDetailsAndroid" to subscriptionOfferDetailsAndroid.map { it.toJson() },
898862
"title" to title,
899863
"type" to type.toJson(),
900-
"typeDetails" to typeDetails.toJson(),
901864
)
902865
}
903866

@@ -954,7 +917,6 @@ public data class ProductSubscriptionIOS(
954917
val subscriptionPeriodUnitIOS: SubscriptionPeriodIOS? = null,
955918
val title: String,
956919
val type: ProductType,
957-
val typeDetails: ProductDetailType,
958920
val typeIOS: ProductTypeIOS
959921
) : ProductCommon, ProductSubscription {
960922

@@ -983,7 +945,6 @@ public data class ProductSubscriptionIOS(
983945
subscriptionPeriodUnitIOS = (json["subscriptionPeriodUnitIOS"] as String?)?.let { SubscriptionPeriodIOS.fromJson(it) },
984946
title = json["title"] as String,
985947
type = ProductType.fromJson(json["type"] as String),
986-
typeDetails = ProductDetailType.fromJson(json["typeDetails"] as String),
987948
typeIOS = ProductTypeIOS.fromJson(json["typeIOS"] as String),
988949
)
989950
}
@@ -1013,7 +974,6 @@ public data class ProductSubscriptionIOS(
1013974
"subscriptionPeriodUnitIOS" to subscriptionPeriodUnitIOS?.toJson(),
1014975
"title" to title,
1015976
"type" to type.toJson(),
1016-
"typeDetails" to typeDetails.toJson(),
1017977
"typeIOS" to typeIOS.toJson(),
1018978
)
1019979
}

src/generated/Types.swift

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@ public enum PaymentModeIOS: String, Codable, CaseIterable {
6262
case payUpFront = "pay-up-front"
6363
}
6464

65-
public enum ProductDetailType: String, Codable, CaseIterable {
66-
case consumable = "consumable"
67-
case nonConsumable = "non-consumable"
68-
case autoRenewableSubscription = "auto-renewable-subscription"
69-
case nonRenewingSubscription = "non-renewing-subscription"
70-
}
71-
7265
public enum ProductQueryType: String, Codable, CaseIterable {
7366
case inApp = "in-app"
7467
case subs = "subs"
@@ -122,7 +115,6 @@ public protocol ProductCommon: Codable {
122115
var price: Double? { get }
123116
var title: String { get }
124117
var type: ProductType { get }
125-
var typeDetails: ProductDetailType { get }
126118
}
127119

128120
public protocol PurchaseCommon: Codable {
@@ -231,7 +223,6 @@ public struct ProductAndroid: Codable, ProductCommon {
231223
public var subscriptionOfferDetailsAndroid: [ProductSubscriptionAndroidOfferDetails]?
232224
public var title: String
233225
public var type: ProductType
234-
public var typeDetails: ProductDetailType
235226
}
236227

237228
public struct ProductAndroidOneTimePurchaseOfferDetail: Codable {
@@ -255,7 +246,6 @@ public struct ProductIOS: Codable, ProductCommon {
255246
public var subscriptionInfoIOS: SubscriptionInfoIOS?
256247
public var title: String
257248
public var type: ProductType
258-
public var typeDetails: ProductDetailType
259249
public var typeIOS: ProductTypeIOS
260250
}
261251

@@ -273,7 +263,6 @@ public struct ProductSubscriptionAndroid: Codable, ProductCommon {
273263
public var subscriptionOfferDetailsAndroid: [ProductSubscriptionAndroidOfferDetails]
274264
public var title: String
275265
public var type: ProductType
276-
public var typeDetails: ProductDetailType
277266
}
278267

279268
public struct ProductSubscriptionAndroidOfferDetails: Codable {
@@ -307,7 +296,6 @@ public struct ProductSubscriptionIOS: Codable, ProductCommon {
307296
public var subscriptionPeriodUnitIOS: SubscriptionPeriodIOS?
308297
public var title: String
309298
public var type: ProductType
310-
public var typeDetails: ProductDetailType
311299
public var typeIOS: ProductTypeIOS
312300
}
313301

@@ -745,15 +733,6 @@ public enum Product: Codable, ProductCommon {
745733
return value.type
746734
}
747735
}
748-
749-
public var typeDetails: ProductDetailType {
750-
switch self {
751-
case let .productAndroid(value):
752-
return value.typeDetails
753-
case let .productIos(value):
754-
return value.typeDetails
755-
}
756-
}
757736
}
758737

759738
public enum ProductSubscription: Codable, ProductCommon {
@@ -849,15 +828,6 @@ public enum ProductSubscription: Codable, ProductCommon {
849828
return value.type
850829
}
851830
}
852-
853-
public var typeDetails: ProductDetailType {
854-
switch self {
855-
case let .productSubscriptionAndroid(value):
856-
return value.typeDetails
857-
case let .productSubscriptionIos(value):
858-
return value.typeDetails
859-
}
860-
}
861831
}
862832

863833
public enum Purchase: Codable, PurchaseCommon {

0 commit comments

Comments
 (0)