Skip to content

Commit

Permalink
Update to latest membership status response
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandarIlic committed Nov 12, 2024
1 parent 6caa51c commit 778fd01
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ data class MembershipStatusResponse(
@SerialName("primal_vip_profile") val primalVipProfile: String,
@SerialName("used_storage") val usedStorage: Long,
@SerialName("max_storage") val maxStorage: Long,
@SerialName("expires_on") val expiresOn: Long,
@SerialName("cohort_1") val cohort1: String,
@SerialName("cohort_2") val cohort2: String,
@SerialName("expires_on") val expiresOn: Long? = null,
@SerialName("recurring") val recurring: Boolean = false,
@SerialName("renews_on") val renewsOn: Long? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ data class PremiumMembership(
val vipProfile: String,
val usedStorageInBytes: Long,
val maxStorageInBytes: Long,
val expiresOn: Long,
val cohort1: String,
val cohort2: String,
val expiresOn: Long? = null,
val recurring: Boolean = false,
val renewsOn: Long? = null,
) {
fun isExpired() = Clock.System.now().epochSeconds > expiresOn
fun isExpired() = expiresOn != null && Clock.System.now().epochSeconds > expiresOn
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ fun PrimalPremiumTable(
value = when {
premiumMembership.recurring && premiumMembership.renewsOn != null ->
Instant.ofEpochSecond(premiumMembership.renewsOn)
.formatToDefaultDateFormat(FormatStyle.LONG)

else ->
Instant.ofEpochSecond(premiumMembership.expiresOn)
}
.formatToDefaultDateFormat(FormatStyle.LONG),
premiumMembership.expiresOn != null -> Instant.ofEpochSecond(premiumMembership.expiresOn)
.formatToDefaultDateFormat(FormatStyle.LONG)

else -> stringResource(R.string.premium_table_never)
},
alwaysHideApply = true,
)
}
Expand Down

0 comments on commit 778fd01

Please sign in to comment.