Cleaning.
This commit is contained in:
parent
823a8c3692
commit
7b40a31979
@ -10,9 +10,7 @@ import kotlinx.datetime.toInstant
|
||||
import org.junit.Test
|
||||
|
||||
class DatesTest {
|
||||
private val appSettingsService = mockk<AppSettingsService>()
|
||||
|
||||
private val dateUtils: DateUtils = DateUtils(appSettingsService)
|
||||
private val dateUtils: DateUtils = DateUtils()
|
||||
|
||||
private val v3Date = "2013-04-07T13:43:00+01:00"
|
||||
private val v4Date = "2013-04-07 13:43:00"
|
||||
|
@ -1,6 +1,5 @@
|
||||
package bou.amine.apps.readerforselfossv2.repository
|
||||
|
||||
import bou.amine.apps.readerforselfossv2.dao.ITEM
|
||||
import bou.amine.apps.readerforselfossv2.dao.ReaderForSelfossDB
|
||||
import bou.amine.apps.readerforselfossv2.dao.SOURCE
|
||||
import bou.amine.apps.readerforselfossv2.dao.TAG
|
||||
|
@ -1,12 +1,10 @@
|
||||
package bou.amine.apps.readerforselfossv2.utils
|
||||
|
||||
import android.text.format.DateUtils
|
||||
import bou.amine.apps.readerforselfossv2.service.AppSettingsService
|
||||
import kotlinx.datetime.*
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
||||
|
||||
actual class DateUtils actual constructor(actual val appSettingsService: AppSettingsService) {
|
||||
actual class DateUtils {
|
||||
|
||||
actual fun parseDate(dateString: String): Long {
|
||||
return try {
|
||||
|
@ -11,7 +11,6 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
class Repository(private val api: SelfossApi, private val appSettingsService: AppSettingsService, val isConnectionAvailable: MutableStateFlow<Boolean>, private val db: ReaderForSelfossDB) {
|
||||
|
||||
@ -19,7 +18,7 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
|
||||
var connectionMonitored = false
|
||||
|
||||
var baseUrl = appSettingsService.getBaseUrl()
|
||||
lateinit var dateUtils: DateUtils
|
||||
var dateUtils: DateUtils = DateUtils()
|
||||
|
||||
var displayedItems = ItemType.UNREAD
|
||||
|
||||
@ -394,7 +393,6 @@ class Repository(private val api: SelfossApi, private val appSettingsService: Ap
|
||||
appSettingsService.updateApiVersion(fetchedVersion.data.getApiMajorVersion())
|
||||
}
|
||||
}
|
||||
dateUtils = DateUtils(appSettingsService)
|
||||
}
|
||||
|
||||
fun isNetworkAvailable() = isConnectionAvailable.value && !offlineOverride
|
||||
|
@ -7,9 +7,7 @@ import bou.amine.apps.readerforselfossv2.service.AppSettingsService
|
||||
fun SelfossModel.Item.parseDate(dateUtils: DateUtils): Long =
|
||||
dateUtils.parseDate(this.datetime)
|
||||
|
||||
expect class DateUtils constructor(appSettingsService: AppSettingsService) {
|
||||
val appSettingsService: AppSettingsService // This is needed because of https://stackoverflow.com/a/65249085
|
||||
|
||||
expect class DateUtils() {
|
||||
fun parseDate(dateString: String): Long
|
||||
|
||||
fun parseRelativeDate(dateString: String): String
|
||||
|
Loading…
Reference in New Issue
Block a user