diff --git a/core/src/commonMain/kotlin/ca/gosyer/jui/core/util/DateHandler.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/util/DateHandler.kt new file mode 100644 index 00000000..40c09add --- /dev/null +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/util/DateHandler.kt @@ -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 + + fun getDateFormat(format: String): (Instant) -> String + + val dateTimeFormat: (Instant) -> String +} diff --git a/data/src/iosMain/kotlin/ca/gosyer/jui/data/base/IosDateHandler.kt b/core/src/iosMain/kotlin/ca/gosyer/jui/core/util/DateHandler.kt similarity index 78% rename from data/src/iosMain/kotlin/ca/gosyer/jui/data/base/IosDateHandler.kt rename to core/src/iosMain/kotlin/ca/gosyer/jui/core/util/DateHandler.kt index db09671f..3a213257 100644 --- a/data/src/iosMain/kotlin/ca/gosyer/jui/data/base/IosDateHandler.kt +++ b/core/src/iosMain/kotlin/ca/gosyer/jui/core/util/DateHandler.kt @@ -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 diff --git a/data/src/jvmMain/kotlin/ca/gosyer/jui/data/base/JvmDateHandler.kt b/core/src/jvmMain/kotlin/ca/gosyer/jui/core/util/DateHandler.kt similarity index 81% rename from data/src/jvmMain/kotlin/ca/gosyer/jui/data/base/JvmDateHandler.kt rename to core/src/jvmMain/kotlin/ca/gosyer/jui/core/util/DateHandler.kt index 8118d237..a99de235 100644 --- a/data/src/jvmMain/kotlin/ca/gosyer/jui/data/base/JvmDateHandler.kt +++ b/core/src/jvmMain/kotlin/ca/gosyer/jui/core/util/DateHandler.kt @@ -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 -> diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/base/DateHandler.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/base/DateHandler.kt deleted file mode 100644 index 5c165110..00000000 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/base/DateHandler.kt +++ /dev/null @@ -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 - - fun getDateFormat(format: String): (Instant) -> String - - val dateTimeFormat: (Instant) -> String -} diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts index 8b482c7d..1756333a 100644 --- a/presentation/build.gradle.kts +++ b/presentation/build.gradle.kts @@ -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) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutViewModel.kt index 28c1e0ee..ede2d5d8 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutViewModel.kt @@ -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 diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/MangaScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/MangaScreenViewModel.kt index ebd46fae..64556d09 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/MangaScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/MangaScreenViewModel.kt @@ -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 diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsGeneralScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsGeneralScreen.kt index a4f11cd5..dbda2421 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsGeneralScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsGeneralScreen.kt @@ -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