mirror of
https://github.com/Suwayomi/TachideskJUI.git
synced 2025-12-10 06:42:05 +01:00
Move date handler out of data
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package ca.gosyer.jui.core.util
|
||||
|
||||
import kotlinx.datetime.Instant
|
||||
|
||||
@Suppress("NO_ACTUAL_FOR_EXPECT")
|
||||
expect class DateHandler {
|
||||
val formatOptions: List<String>
|
||||
|
||||
fun getDateFormat(format: String): (Instant) -> String
|
||||
|
||||
val dateTimeFormat: (Instant) -> String
|
||||
}
|
||||
@@ -1,19 +1,9 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package ca.gosyer.jui.data.base
|
||||
package ca.gosyer.jui.core.util
|
||||
|
||||
import androidx.compose.ui.text.intl.Locale
|
||||
import ca.gosyer.jui.core.lang.toPlatform
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlinx.datetime.toNSDate
|
||||
import me.tatarka.inject.annotations.Inject
|
||||
import platform.Foundation.NSDateFormatter
|
||||
import platform.Foundation.NSDateFormatterNoStyle
|
||||
import platform.Foundation.NSDateFormatterShortStyle
|
||||
|
||||
actual class DateHandler
|
||||
@Inject
|
||||
@@ -1,10 +1,4 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package ca.gosyer.jui.data.base
|
||||
package ca.gosyer.jui.core.util
|
||||
|
||||
import androidx.compose.ui.text.intl.Locale
|
||||
import ca.gosyer.jui.core.lang.toPlatform
|
||||
@@ -42,8 +36,7 @@ actual class DateHandler
|
||||
}
|
||||
|
||||
actual val dateTimeFormat: (Instant) -> String by lazy {
|
||||
DateTimeFormatter
|
||||
.ofLocalizedDateTime(FormatStyle.SHORT)
|
||||
DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT)
|
||||
.withLocale(Locale.current.toPlatform())
|
||||
.withZone(ZoneId.systemDefault())
|
||||
.let { formatter ->
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package ca.gosyer.jui.data.base
|
||||
|
||||
import kotlinx.datetime.Instant
|
||||
|
||||
@Suppress("NO_ACTUAL_FOR_EXPECT")
|
||||
expect class DateHandler {
|
||||
val formatOptions: List<String>
|
||||
|
||||
fun getDateFormat(format: String): (Instant) -> String
|
||||
|
||||
val dateTimeFormat: (Instant) -> String
|
||||
}
|
||||
@@ -85,7 +85,6 @@ kotlin {
|
||||
api(projects.core)
|
||||
api(projects.i18n)
|
||||
api(projects.domain)
|
||||
api(projects.data)
|
||||
api(projects.uiCore)
|
||||
api(compose.runtime)
|
||||
api(compose.foundation)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
package ca.gosyer.jui.ui.main.about
|
||||
|
||||
import ca.gosyer.jui.data.base.DateHandler
|
||||
import ca.gosyer.jui.core.util.DateHandler
|
||||
import ca.gosyer.jui.domain.settings.interactor.AboutServer
|
||||
import ca.gosyer.jui.domain.settings.model.About
|
||||
import ca.gosyer.jui.domain.updates.interactor.UpdateChecker
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
package ca.gosyer.jui.ui.manga
|
||||
|
||||
import ca.gosyer.jui.data.base.DateHandler
|
||||
import ca.gosyer.jui.core.util.DateHandler
|
||||
import ca.gosyer.jui.domain.category.interactor.AddMangaToCategory
|
||||
import ca.gosyer.jui.domain.category.interactor.GetCategories
|
||||
import ca.gosyer.jui.domain.category.interactor.GetMangaCategories
|
||||
|
||||
@@ -30,7 +30,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.text.intl.Locale
|
||||
import ca.gosyer.jui.core.lang.getDisplayName
|
||||
import ca.gosyer.jui.core.lang.withIOContext
|
||||
import ca.gosyer.jui.data.base.DateHandler
|
||||
import ca.gosyer.jui.core.util.DateHandler
|
||||
import ca.gosyer.jui.domain.ui.model.StartScreen
|
||||
import ca.gosyer.jui.domain.ui.service.UiPreferences
|
||||
import ca.gosyer.jui.i18n.MR
|
||||
|
||||
Reference in New Issue
Block a user