We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ac30e4e commit 3235992Copy full SHA for 3235992
superwall/src/main/java/com/superwall/sdk/store/abstractions/product/SubscriptionPeriod.kt
@@ -26,7 +26,21 @@ data class SubscriptionPeriod(
26
27
fun normalized(): SubscriptionPeriod =
28
when (unit) {
29
- Unit.day -> if (value % 7 == 0) copy(value = value / 7, unit = Unit.week) else this
+ Unit.day ->
30
+ if (value % 30 == 0) {
31
+ copy(value = value / 30, unit = Unit.month).normalized()
32
+ } else {
33
+ if (value % 7 == 0) {
34
+ copy(value = value / 7, unit = Unit.week).normalized()
35
36
+ if (value % 360 == 0) {
37
+ copy(value = value / 360, unit = Unit.year)
38
39
+ this
40
+ }
41
42
43
+
44
Unit.month -> if (value % 12 == 0) copy(value = value / 12, unit = Unit.year) else this
45
else -> this
46
}
0 commit comments