chore/mock-multiplatform #86

Merged
AmineB merged 3 commits from chore/mock-multiplatform into master 2022-10-29 12:10:54 +00:00
Showing only changes of commit 131101d2ee - Show all commits

View File

@ -16,10 +16,18 @@ actual class DateUtils actual constructor(actual val appSettingsService: AppSett
val FORMATTERV1 = "yyyy-MM-dd HH:mm:ss"
return if (appSettingsService.getApiVersion() >= 4) {
OffsetDateTime.parse(dateString).toInstant().toEpochMilli()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
OffsetDateTime.parse(dateString).toInstant().toEpochMilli()
} else {
TODO("VERSION.SDK_INT < O")
}
} else {
LocalDateTime.parse(dateString, DateTimeFormatter.ofPattern(FORMATTERV1)).toInstant(
ZoneOffset.UTC).toEpochMilli()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
LocalDateTime.parse(dateString, DateTimeFormatter.ofPattern(FORMATTERV1)).toInstant(
ZoneOffset.UTC).toEpochMilli()
} else {
TODO("VERSION.SDK_INT < O")
}
}
}
@ -27,11 +35,15 @@ actual class DateUtils actual constructor(actual val appSettingsService: AppSett
val date = parseDate(dateString)
return " " + DateUtils.getRelativeTimeSpanString(
date,
Instant.now().toEpochMilli(),
DateUtils.MINUTE_IN_MILLIS,
DateUtils.FORMAT_ABBREV_RELATIVE
)
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
" " + DateUtils.getRelativeTimeSpanString(
date,
Instant.now().toEpochMilli(),
DateUtils.MINUTE_IN_MILLIS,
DateUtils.FORMAT_ABBREV_RELATIVE
)
} else {
TODO("VERSION.SDK_INT < O")
}
}
}