Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
atavism committed Oct 23, 2023
1 parent 325cf36 commit 7cb59c0
Show file tree
Hide file tree
Showing 2 changed files with 173 additions and 98 deletions.
60 changes: 29 additions & 31 deletions android/app/src/main/kotlin/org/getlantern/lantern/model/ProUser.kt
Original file line number Diff line number Diff line change
@@ -1,49 +1,47 @@
package org.getlantern.lantern.model

import com.google.gson.JsonObject
import org.joda.time.Days
import org.joda.time.Months
import org.joda.time.LocalDateTime
import org.joda.time.Months

data class ProUser(
val userId: Long,
val token: String,
val referral: String,
val email: String,
val userStatus: String,
val code: String,
val subscription: String,
val expiration: Long,
val devices: List<Device>,
val userLevel: String
val userId: Long,
val token: String,
val referral: String,
val email: String,
val userStatus: String,
val code: String,
val subscription: String,
val expiration: Long,
val devices: List<Device>,
val userLevel: String,
) {
private fun isUserStatus(status: String) = userStatus == status

private fun isUserStatus(status: String) = userStatus == status

private fun expirationDate() = if (expiration == null) null else LocalDateTime(expiration * 1000)
private fun expirationDate() = if (expiration == null) null else LocalDateTime(expiration * 1000)

fun monthsLeft(): Int {
val expDate = expirationDate()
if (expDate == null) return 0
return Months.monthsBetween(LocalDateTime.now(), expDate).getMonths()
}
fun monthsLeft(): Int {
val expDate = expirationDate()
if (expDate == null) return 0
return Months.monthsBetween(LocalDateTime.now(), expDate).getMonths()
}

fun daysLeft(): Int {
val expDate = expirationDate()
if (expDate == null) return 0
return Days.daysBetween(LocalDateTime.now(), expDate).getDays()
}
fun daysLeft(): Int {
val expDate = expirationDate()
if (expDate == null) return 0
return Days.daysBetween(LocalDateTime.now(), expDate).getDays()
}

fun newUserDetails(): String {
return "User ID $userId referral $referral"
}
fun newUserDetails(): String {
return "User ID $userId referral $referral"
}

val isProUser: Boolean
get() = isUserStatus("active")

val isActive: Boolean
get() = isProUser
get() = isProUser

val isExpired: Boolean
get() = isUserStatus("expired")
}
get() = isUserStatus("expired")
}
Loading

0 comments on commit 7cb59c0

Please sign in to comment.