Don't regenerate dateutils each time it's needed
This commit is contained in:
parent
3e97ee30a1
commit
88c5c6ff4b
@ -18,6 +18,7 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet
|
|||||||
set(value) { field = ArrayList(value) }
|
set(value) { field = ArrayList(value) }
|
||||||
|
|
||||||
override var baseUrl = apiDetails.getBaseUrl()
|
override var baseUrl = apiDetails.getBaseUrl()
|
||||||
|
private lateinit var dateUtils: DateUtils
|
||||||
|
|
||||||
override var displayedItems = "unread"
|
override var displayedItems = "unread"
|
||||||
set(value) {
|
set(value) {
|
||||||
@ -48,6 +49,7 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet
|
|||||||
// TODO: Dispatchers.IO not available in KMM, an alternative solution should be found
|
// TODO: Dispatchers.IO not available in KMM, an alternative solution should be found
|
||||||
CoroutineScope(Dispatchers.Main).launch {
|
CoroutineScope(Dispatchers.Main).launch {
|
||||||
updateApiVersion()
|
updateApiVersion()
|
||||||
|
dateUtils = DateUtils(apiMajorVersion)
|
||||||
reloadBadges()
|
reloadBadges()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,7 +96,6 @@ class RepositoryImpl(private val api: SelfossApi, private val apiDetails: ApiDet
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun sortItems(items: ArrayList<SelfossModel.Item>) {
|
private fun sortItems(items: ArrayList<SelfossModel.Item>) {
|
||||||
val dateUtils = DateUtils(apiMajorVersion)
|
|
||||||
items.sortByDescending { dateUtils.parseDate(it.datetime) }
|
items.sortByDescending { dateUtils.parseDate(it.datetime) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user