File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
modules/services/servers/src/main/java/au/com/shiftyjelly/pocketcasts/servers/sync Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -40,9 +40,16 @@ fun SubscriptionStatusResponse.toSubscription(): Subscription? {
40
40
}
41
41
42
42
val subscriptionResponse = subscriptions?.getOrNull(index) ? : fallbackSubscription
43
+ // Some older accounts use an empty string for the subscription tier inside their subscriptions.
44
+ // In these cases, the correct tier is only available at the top-level subscription status object.
45
+ //
46
+ // Therefore, we need to explicitly fall back to the top level object.
47
+ val tier = subscriptionResponse.tier
48
+ ?.takeUnless (String ::isNullOrBlank)
49
+ ? : fallbackSubscription.tier
43
50
44
51
return Subscription (
45
- tier = when (subscriptionResponse. tier?.lowercase()) {
52
+ tier = when (tier?.lowercase()) {
46
53
" plus" -> SubscriptionTier .Plus
47
54
" patron" -> SubscriptionTier .Patron
48
55
else -> return null
You can’t perform that action at this time.
0 commit comments