diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/App.kt b/android/src/main/kotlin/ca/gosyer/jui/android/App.kt index ce3a92e7..6152186d 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/App.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/App.kt @@ -42,7 +42,7 @@ class App : Application(), DefaultLifecycleObserver { ThemeMode.System -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM ThemeMode.Light -> AppCompatDelegate.MODE_NIGHT_NO ThemeMode.Dark -> AppCompatDelegate.MODE_NIGHT_YES - } + }, ) } .launchIn(ProcessLifecycleOwner.get().lifecycleScope) @@ -65,8 +65,8 @@ class App : Application(), DefaultLifecycleObserver { AppCompatDelegate.setApplicationLocales( LocaleListCompat.create( Locale.forLanguageTag(it), - Locale.forLanguageTag("en") - ) + Locale.forLanguageTag("en"), + ), ) } else if ( AppCompatDelegate.getApplicationLocales().isEmpty.not() && diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/AppComponent.kt b/android/src/main/kotlin/ca/gosyer/jui/android/AppComponent.kt index 9436283c..3daeb726 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/AppComponent.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/AppComponent.kt @@ -21,7 +21,7 @@ import me.tatarka.inject.annotations.Provides abstract class AppComponent( @get:AppScope @get:Provides - val context: Context + val context: Context, ) : ViewModelComponent, DataComponent, DomainComponent, UiComponent { abstract val appMigrations: AppMigrations diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/AppMigrations.kt b/android/src/main/kotlin/ca/gosyer/jui/android/AppMigrations.kt index 948b893b..154ce56d 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/AppMigrations.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/AppMigrations.kt @@ -13,7 +13,7 @@ import me.tatarka.inject.annotations.Inject class AppMigrations @Inject constructor( private val migrationPreferences: MigrationPreferences, - private val contextWrapper: ContextWrapper + private val contextWrapper: ContextWrapper, ) { fun runMigrations(): Boolean { diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/MainActivity.kt b/android/src/main/kotlin/ca/gosyer/jui/android/MainActivity.kt index 1913f81c..cabab6d7 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/MainActivity.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/MainActivity.kt @@ -58,12 +58,12 @@ class MainActivity : AppCompatActivity() { DisposableEffect(systemUiController, useDarkIcons, primaryColor) { systemUiController.setStatusBarColor( color = primaryColor, - darkIcons = useDarkIcons + darkIcons = useDarkIcons, ) systemUiController.setNavigationBarColor( color = Color.Transparent, darkIcons = useDarkIcons, - navigationBarContrastEnforced = false + navigationBarContrastEnforced = false, ) onDispose {} diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/ReaderActivity.kt b/android/src/main/kotlin/ca/gosyer/jui/android/ReaderActivity.kt index ed3b7177..aff7cf23 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/ReaderActivity.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/ReaderActivity.kt @@ -44,7 +44,7 @@ class ReaderActivity : AppCompatActivity() { ReaderMenu( chapterIndex = chapterIndex, mangaId = mangaId, - onCloseRequest = onBackPressedDispatcher::onBackPressed + onCloseRequest = onBackPressedDispatcher::onBackPressed, ) } } diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/data/download/AndroidDownloadService.kt b/android/src/main/kotlin/ca/gosyer/jui/android/data/download/AndroidDownloadService.kt index 4a6a6e63..072234ee 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/data/download/AndroidDownloadService.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/data/download/AndroidDownloadService.kt @@ -115,7 +115,8 @@ class AndroidDownloadService : Service() { log.info { "using an intent with action $action" } when (action) { Actions.START.name, - Actions.RESTART.name -> startWebsocket() + Actions.RESTART.name, + -> startWebsocket() Actions.STOP.name -> stopSelf() else -> log.info { "This should never happen. No action in the received intent" } } @@ -158,7 +159,7 @@ class AndroidDownloadService : Service() { if (serverUrl.protocol == URLProtocol.HTTPS) { url.protocol = URLProtocol.WSS } - } + }, ) { errorConnectionCount = 0 status.value = Status.RUNNING @@ -208,14 +209,14 @@ class AndroidDownloadService : Service() { MR.strings.chapter_downloading_progress .format( current, - max + max, ) - .toString(this@AndroidDownloadService) + .toString(this@AndroidDownloadService), ) }.build() notificationManager.notify( Notifications.ID_DOWNLOADER_DOWNLOADING, - notification + notification, ) } else { notificationManager.cancel(Notifications.ID_DOWNLOADER_DOWNLOADING) diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/data/library/AndroidLibraryService.kt b/android/src/main/kotlin/ca/gosyer/jui/android/data/library/AndroidLibraryService.kt index c1a1f68e..98d33ffa 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/data/library/AndroidLibraryService.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/data/library/AndroidLibraryService.kt @@ -115,7 +115,8 @@ class AndroidLibraryService : Service() { log.info { "using an intent with action $action" } when (action) { Actions.START.name, - Actions.RESTART.name -> startWebsocket() + Actions.RESTART.name, + -> startWebsocket() Actions.STOP.name -> stopSelf() else -> log.info { "This should never happen. No action in the received intent" } } @@ -158,7 +159,7 @@ class AndroidLibraryService : Service() { if (serverUrl.protocol == URLProtocol.HTTPS) { url.protocol = URLProtocol.WSS } - } + }, ) { errorConnectionCount = 0 status.value = Status.RUNNING @@ -205,14 +206,14 @@ class AndroidLibraryService : Service() { setContentTitle( MR.strings.notification_updating .format(current, total) - .toString(this@AndroidLibraryService) + .toString(this@AndroidLibraryService), ) setStyle(NotificationCompat.BigTextStyle().bigText(updatingText)) setProgress(total, current, false) }.build() notificationManager.notify( Notifications.ID_LIBRARY_PROGRESS, - notification + notification, ) } else { notificationManager.cancel(Notifications.ID_LIBRARY_PROGRESS) diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/data/notification/Notifications.kt b/android/src/main/kotlin/ca/gosyer/jui/android/data/notification/Notifications.kt index 839d7617..a3afe40a 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/data/notification/Notifications.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/data/notification/Notifications.kt @@ -55,15 +55,15 @@ object Notifications { }, buildNotificationChannelGroup(GROUP_APK_UPDATES) { setName(MR.strings.group_updates.desc().toString(context)) - } - ) + }, + ), ) notificationService.createNotificationChannelsCompat( listOf( buildNotificationChannel( CHANNEL_DOWNLOADER_RUNNING, - NotificationManagerCompat.IMPORTANCE_LOW + NotificationManagerCompat.IMPORTANCE_LOW, ) { setName(MR.strings.channel_active.desc().toString(context)) setGroup(GROUP_DOWNLOADER) @@ -71,7 +71,7 @@ object Notifications { }, buildNotificationChannel( CHANNEL_DOWNLOADER_DOWNLOADING, - NotificationManagerCompat.IMPORTANCE_LOW + NotificationManagerCompat.IMPORTANCE_LOW, ) { setName(MR.strings.channel_progress.desc().toString(context)) setGroup(GROUP_DOWNLOADER) @@ -79,7 +79,7 @@ object Notifications { }, buildNotificationChannel( CHANNEL_LIBRARY_UPDATES, - NotificationManagerCompat.IMPORTANCE_LOW + NotificationManagerCompat.IMPORTANCE_LOW, ) { setName(MR.strings.channel_active.desc().toString(context)) setGroup(GROUP_LIBRARY) @@ -87,7 +87,7 @@ object Notifications { }, buildNotificationChannel( CHANNEL_LIBRARY_PROGRESS, - NotificationManagerCompat.IMPORTANCE_LOW + NotificationManagerCompat.IMPORTANCE_LOW, ) { setName(MR.strings.channel_progress.desc().toString(context)) setGroup(GROUP_LIBRARY) @@ -95,19 +95,19 @@ object Notifications { }, buildNotificationChannel( CHANNEL_APP_UPDATE, - NotificationManagerCompat.IMPORTANCE_DEFAULT + NotificationManagerCompat.IMPORTANCE_DEFAULT, ) { setGroup(GROUP_APK_UPDATES) setName(MR.strings.group_updates_channel_app.desc().toString(context)) }, buildNotificationChannel( CHANNEL_EXTENSIONS_UPDATE, - NotificationManagerCompat.IMPORTANCE_DEFAULT + NotificationManagerCompat.IMPORTANCE_DEFAULT, ) { setGroup(GROUP_APK_UPDATES) setName(MR.strings.group_updates_channel_ext.desc().toString(context)) - } - ) + }, + ), ) } } diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/data/update/UpdateCheckWorker.kt b/android/src/main/kotlin/ca/gosyer/jui/android/data/update/UpdateCheckWorker.kt index 56777c1a..ae795fb7 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/data/update/UpdateCheckWorker.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/data/update/UpdateCheckWorker.kt @@ -62,7 +62,7 @@ class UpdateCheckWorker(private val context: Context, workerParams: WorkerParame 7, TimeUnit.DAYS, 3, - TimeUnit.HOURS + TimeUnit.HOURS, ) .addTag(TAG) .setConstraints(constraints) diff --git a/android/src/main/kotlin/ca/gosyer/jui/android/util/NotificationExtensions.kt b/android/src/main/kotlin/ca/gosyer/jui/android/util/NotificationExtensions.kt index 7dbed911..4eb20f20 100644 --- a/android/src/main/kotlin/ca/gosyer/jui/android/util/NotificationExtensions.kt +++ b/android/src/main/kotlin/ca/gosyer/jui/android/util/NotificationExtensions.kt @@ -20,7 +20,7 @@ import androidx.core.app.NotificationChannelGroupCompat */ fun buildNotificationChannelGroup( channelId: String, - block: (NotificationChannelGroupCompat.Builder.() -> Unit) + block: (NotificationChannelGroupCompat.Builder.() -> Unit), ): NotificationChannelGroupCompat { val builder = NotificationChannelGroupCompat.Builder(channelId) builder.block() @@ -38,7 +38,7 @@ fun buildNotificationChannelGroup( fun buildNotificationChannel( channelId: String, channelImportance: Int, - block: (NotificationChannelCompat.Builder.() -> Unit) + block: (NotificationChannelCompat.Builder.() -> Unit), ): NotificationChannelCompat { val builder = NotificationChannelCompat.Builder(channelId, channelImportance) builder.block() diff --git a/core/src/androidMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStoreFactory.kt b/core/src/androidMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStoreFactory.kt index f6fcfe28..1f840383 100644 --- a/core/src/androidMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStoreFactory.kt +++ b/core/src/androidMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStoreFactory.kt @@ -16,9 +16,9 @@ actual class PreferenceStoreFactory @Inject constructor(private val context: Con SharedPreferencesSettings( context.getSharedPreferences( names.joinToString(separator = "_"), - Context.MODE_PRIVATE - ) - ) + Context.MODE_PRIVATE, + ), + ), ) } } diff --git a/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/CoroutineExtensions.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/CoroutineExtensions.kt index 7ac0dece..d867b83f 100644 --- a/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/CoroutineExtensions.kt +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/CoroutineExtensions.kt @@ -18,46 +18,46 @@ import kotlinx.coroutines.withContext @DelicateCoroutinesApi fun launch( start: CoroutineStart = CoroutineStart.DEFAULT, - block: suspend CoroutineScope.() -> Unit + block: suspend CoroutineScope.() -> Unit, ) = GlobalScope.launch(Dispatchers.Default, start, block) @DelicateCoroutinesApi fun launchUI( start: CoroutineStart = CoroutineStart.DEFAULT, - block: suspend CoroutineScope.() -> Unit + block: suspend CoroutineScope.() -> Unit, ) = GlobalScope.launch(Dispatchers.Main, start, block) @DelicateCoroutinesApi fun launchIO( start: CoroutineStart = CoroutineStart.DEFAULT, - block: suspend CoroutineScope.() -> Unit + block: suspend CoroutineScope.() -> Unit, ) = GlobalScope.launch(Dispatchers.IO, start, block) fun CoroutineScope.launchDefault( start: CoroutineStart = CoroutineStart.DEFAULT, - block: suspend CoroutineScope.() -> Unit + block: suspend CoroutineScope.() -> Unit, ) = launch(Dispatchers.Default, start, block) fun CoroutineScope.launchUI( start: CoroutineStart = CoroutineStart.DEFAULT, - block: suspend CoroutineScope.() -> Unit + block: suspend CoroutineScope.() -> Unit, ) = launch(Dispatchers.Main, start, block) fun CoroutineScope.launchIO( start: CoroutineStart = CoroutineStart.DEFAULT, - block: suspend CoroutineScope.() -> Unit + block: suspend CoroutineScope.() -> Unit, ) = launch(Dispatchers.IO, start, block) suspend fun withDefaultContext( - block: suspend CoroutineScope.() -> T + block: suspend CoroutineScope.() -> T, ): T = withContext(Dispatchers.Default, block) suspend fun withUIContext( - block: suspend CoroutineScope.() -> T + block: suspend CoroutineScope.() -> T, ): T = withContext(Dispatchers.Main, block) suspend fun withIOContext( - block: suspend CoroutineScope.() -> T + block: suspend CoroutineScope.() -> T, ): T = withContext(Dispatchers.IO, block) fun Throwable.throwIfCancellation() { if (this is CancellationException) throw this } diff --git a/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/PriorityChannel.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/PriorityChannel.kt index f5b3ad6f..065da720 100644 --- a/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/PriorityChannel.kt +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/lang/PriorityChannel.kt @@ -26,7 +26,7 @@ import kotlinx.coroutines.yield */ internal open class ProcessChannel( internal val inChannel: Channel, - internal val outChannel: Channel + internal val outChannel: Channel, ) : Channel { @ExperimentalCoroutinesApi override val isClosedForReceive: Boolean @@ -46,7 +46,7 @@ internal open class ProcessChannel( @Deprecated( "Since 1.2.0, binary compatibility with versions <= 1.1.x", - level = DeprecationLevel.HIDDEN + level = DeprecationLevel.HIDDEN, ) override fun cancel(cause: Throwable?): Boolean { outChannel.cancel() @@ -67,14 +67,14 @@ internal open class ProcessChannel( @Deprecated( "Deprecated in the favour of 'trySend' method", replaceWith = ReplaceWith("trySend(element).isSuccess"), - level = DeprecationLevel.ERROR + level = DeprecationLevel.ERROR, ) override fun offer(element: T): Boolean = inChannel.trySend(element).isSuccess @Deprecated( "Deprecated in the favour of 'tryReceive'. Please note that the provided replacement does not rethrow channel's close cause as 'poll' did, for the precise replacement please refer to the 'poll' documentation", replaceWith = ReplaceWith("tryReceive().getOrNull()"), - level = DeprecationLevel.ERROR + level = DeprecationLevel.ERROR, ) override fun poll(): T? = outChannel.tryReceive().getOrNull() @@ -101,7 +101,7 @@ internal open class ProcessChannel( internal class PriorityChannelImpl( private val maxCapacity: Int, scope: CoroutineScope, - comparator: Comparator + comparator: Comparator, ) : ProcessChannel( // why a rendezvous channel should be the input channel? // because we buffer and sort the messages in the co-routine @@ -111,7 +111,7 @@ internal class PriorityChannelImpl( // output channel is rendezvous channel because we may still // get higher priority input meanwhile and we will send that // when output consumer is ready to take it - outChannel = Channel(Channel.RENDEZVOUS) + outChannel = Channel(Channel.RENDEZVOUS), ) { private val buffer = PriorityQueue(comparator) @@ -198,5 +198,5 @@ internal class PriorityChannelImpl( fun PriorityChannel( maxCapacity: Int = 4096, scope: CoroutineScope, - comparator: Comparator + comparator: Comparator, ): Channel = PriorityChannelImpl(maxCapacity, scope, comparator) diff --git a/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/LazyPreferenceStore.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/LazyPreferenceStore.kt index f1f38344..bcd674b7 100644 --- a/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/LazyPreferenceStore.kt +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/LazyPreferenceStore.kt @@ -14,7 +14,7 @@ import kotlinx.serialization.modules.SerializersModule * providing preference instances to classes that may not use them at all. */ class LazyPreferenceStore( - private val lazyStore: Lazy + private val lazyStore: Lazy, ) : PreferenceStore { /** @@ -67,7 +67,7 @@ class LazyPreferenceStore( key: String, defaultValue: T, serializer: (T) -> String, - deserializer: (String) -> T + deserializer: (String) -> T, ): Preference { return lazyStore.value.getObject(key, defaultValue, serializer, deserializer) } @@ -76,7 +76,7 @@ class LazyPreferenceStore( key: String, defaultValue: T, serializer: KSerializer, - serializersModule: SerializersModule + serializersModule: SerializersModule, ): Preference { return lazyStore.value.getJsonObject(key, defaultValue, serializer) } diff --git a/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStore.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStore.kt index ac9fb9b1..feea7580 100644 --- a/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStore.kt +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStore.kt @@ -54,7 +54,7 @@ interface PreferenceStore { key: String, defaultValue: T, serializer: (T) -> String, - deserializer: (String) -> T + deserializer: (String) -> T, ): Preference /** @@ -64,7 +64,7 @@ interface PreferenceStore { key: String, defaultValue: T, serializer: KSerializer, - serializersModule: SerializersModule = EmptySerializersModule() + serializersModule: SerializersModule = EmptySerializersModule(), ): Preference } @@ -73,7 +73,7 @@ interface PreferenceStore { */ inline fun > PreferenceStore.getEnum( key: String, - defaultValue: T + defaultValue: T, ): Preference { return getObject( key, @@ -85,6 +85,6 @@ inline fun > PreferenceStore.getEnum( } catch (e: IllegalArgumentException) { defaultValue } - } + }, ) } diff --git a/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/StandardAdapters.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/StandardAdapters.kt index 194bd73b..d6892ced 100644 --- a/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/StandardAdapters.kt +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/StandardAdapters.kt @@ -125,7 +125,7 @@ internal object StringSetAdapter : Adapter> { internal class ObjectAdapter( private val serializer: (T) -> String, - private val deserializer: (String) -> T + private val deserializer: (String) -> T, ) : Adapter { override fun get(key: String, preferences: ObservableSettings): T { @@ -144,7 +144,7 @@ internal class ObjectAdapter( internal class JsonObjectAdapter( private val defaultValue: T, private val serializer: KSerializer, - private val serializersModule: SerializersModule = EmptySerializersModule() + private val serializersModule: SerializersModule = EmptySerializersModule(), ) : Adapter { override fun get(key: String, preferences: ObservableSettings): T { diff --git a/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/StandardPreference.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/StandardPreference.kt index 9c34941a..b2a4129c 100644 --- a/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/StandardPreference.kt +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/StandardPreference.kt @@ -19,7 +19,7 @@ internal class StandardPreference( private val preferences: ObservableSettings, private val key: String, private val defaultValue: T, - private val adapter: Adapter + private val adapter: Adapter, ) : Preference { /** diff --git a/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/StandardPreferenceStore.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/StandardPreferenceStore.kt index ca33082f..c81fe2d3 100644 --- a/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/StandardPreferenceStore.kt +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/prefs/StandardPreferenceStore.kt @@ -62,7 +62,7 @@ class StandardPreferenceStore(private val preferences: ObservableSettings) : Pre key: String, defaultValue: T, serializer: (T) -> String, - deserializer: (String) -> T + deserializer: (String) -> T, ): Preference { val adapter = ObjectAdapter(serializer, deserializer) return StandardPreference(preferences, key, defaultValue, adapter) @@ -75,7 +75,7 @@ class StandardPreferenceStore(private val preferences: ObservableSettings) : Pre key: String, defaultValue: T, serializer: KSerializer, - serializersModule: SerializersModule + serializersModule: SerializersModule, ): Preference { val adapter = JsonObjectAdapter(defaultValue, serializer, serializersModule) return StandardPreference(preferences, key, defaultValue, adapter) diff --git a/core/src/commonMain/kotlin/ca/gosyer/jui/core/util/ImageUtil.kt b/core/src/commonMain/kotlin/ca/gosyer/jui/core/util/ImageUtil.kt index ea4f4c36..f1822956 100644 --- a/core/src/commonMain/kotlin/ca/gosyer/jui/core/util/ImageUtil.kt +++ b/core/src/commonMain/kotlin/ca/gosyer/jui/core/util/ImageUtil.kt @@ -40,6 +40,6 @@ object ImageUtil { JPG("image/jpeg", "jpg"), PNG("image/png", "png"), GIF("image/gif", "gif"), - WEBP("image/webp", "webp") + WEBP("image/webp", "webp"), } } diff --git a/core/src/desktopMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStoreFactory.kt b/core/src/desktopMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStoreFactory.kt index 328027a1..2ad0522c 100644 --- a/core/src/desktopMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStoreFactory.kt +++ b/core/src/desktopMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStoreFactory.kt @@ -17,8 +17,8 @@ actual class PreferenceStoreFactory @Inject constructor() { actual fun create(vararg names: String): PreferenceStore { return StandardPreferenceStore( PreferencesSettings( - rootNode.node(names.joinToString(separator = "/")) - ) + rootNode.node(names.joinToString(separator = "/")), + ), ) } } diff --git a/core/src/iosMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStoreFactory.kt b/core/src/iosMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStoreFactory.kt index 1b76c830..5146a8eb 100644 --- a/core/src/iosMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStoreFactory.kt +++ b/core/src/iosMain/kotlin/ca/gosyer/jui/core/prefs/PreferenceStoreFactory.kt @@ -14,8 +14,8 @@ actual class PreferenceStoreFactory @Inject constructor() { actual fun create(vararg names: String): PreferenceStore { return StandardPreferenceStore( NSUserDefaultsSettings( - NSUserDefaults.standardUserDefaults - ) + NSUserDefaults.standardUserDefaults, + ), ) } } diff --git a/data/src/commonMain/kotlin/ca/gosyer/jui/data/FlowIOResponseConverter.kt b/data/src/commonMain/kotlin/ca/gosyer/jui/data/FlowIOResponseConverter.kt index b3ba36c5..b524cffc 100644 --- a/data/src/commonMain/kotlin/ca/gosyer/jui/data/FlowIOResponseConverter.kt +++ b/data/src/commonMain/kotlin/ca/gosyer/jui/data/FlowIOResponseConverter.kt @@ -27,7 +27,7 @@ class FlowIOResponseConverter @Inject constructor(private val json: Json) : Resp override fun wrapResponse( typeData: TypeData, requestFunction: suspend () -> Pair, - ktorfit: Ktorfit + ktorfit: Ktorfit, ): Any { return flow { try { diff --git a/data/src/iosMain/kotlin/ca/gosyer/jui/data/base/IosDateHandler.kt b/data/src/iosMain/kotlin/ca/gosyer/jui/data/base/IosDateHandler.kt index e7f4109c..b9f21b84 100644 --- a/data/src/iosMain/kotlin/ca/gosyer/jui/data/base/IosDateHandler.kt +++ b/data/src/iosMain/kotlin/ca/gosyer/jui/data/base/IosDateHandler.kt @@ -21,7 +21,7 @@ actual class DateHandler @Inject constructor() { "", "MM/dd/yy", "dd/MM/yy", - "yyyy-MM-dd" + "yyyy-MM-dd", ) } diff --git a/data/src/jvmMain/kotlin/ca/gosyer/jui/data/base/JvmDateHandler.kt b/data/src/jvmMain/kotlin/ca/gosyer/jui/data/base/JvmDateHandler.kt index f9b0711e..961c4403 100644 --- a/data/src/jvmMain/kotlin/ca/gosyer/jui/data/base/JvmDateHandler.kt +++ b/data/src/jvmMain/kotlin/ca/gosyer/jui/data/base/JvmDateHandler.kt @@ -21,7 +21,7 @@ actual class DateHandler @Inject constructor() { "", "MM/dd/yy", "dd/MM/yy", - "yyyy-MM-dd" + "yyyy-MM-dd", ) } diff --git a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppComponent.kt b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppComponent.kt index 985352c5..48d21e09 100644 --- a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppComponent.kt +++ b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppComponent.kt @@ -19,7 +19,7 @@ import me.tatarka.inject.annotations.Provides @Component abstract class AppComponent( @get:Provides - val context: ContextWrapper + val context: ContextWrapper, ) : ViewModelComponent, DataComponent, DomainComponent, UiComponent { abstract val appMigrations: AppMigrations diff --git a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppMigrations.kt b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppMigrations.kt index e468c93e..d3dff8ce 100644 --- a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppMigrations.kt +++ b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/AppMigrations.kt @@ -13,7 +13,7 @@ import me.tatarka.inject.annotations.Inject class AppMigrations @Inject constructor( private val migrationPreferences: MigrationPreferences, - private val contextWrapper: ContextWrapper + private val contextWrapper: ContextWrapper, ) { fun runMigrations(): Boolean { diff --git a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/logging/LoggingSetup.kt b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/logging/LoggingSetup.kt index e3b256e8..9bcd0edf 100644 --- a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/logging/LoggingSetup.kt +++ b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/logging/LoggingSetup.kt @@ -47,45 +47,45 @@ fun initializeLogger(loggingLocation: Path) { newAppender("Console", "Console") .addAttribute( "target", - ConsoleAppender.Target.SYSTEM_OUT + ConsoleAppender.Target.SYSTEM_OUT, ) .add( newLayout("PatternLayout") .addAttribute("disableAnsi", "false") - .addAttribute("pattern", consolePattern) - ) + .addAttribute("pattern", consolePattern), + ), ) add( newAppender("Rolling", "RollingFile") .addAttribute( "fileName", - loggingLocation.toString().trimEnd('/', '\\') + "/rolling.log" + loggingLocation.toString().trimEnd('/', '\\') + "/rolling.log", ) .addAttribute( "filePattern", - loggingLocation.toString().trimEnd('/', '\\') + "/archive/rolling-%d{yyyy-MM-dd-}.log.gz" + loggingLocation.toString().trimEnd('/', '\\') + "/archive/rolling-%d{yyyy-MM-dd-}.log.gz", ) .add( newLayout("PatternLayout") - .addAttribute("pattern", filePattern) + .addAttribute("pattern", filePattern), ) .addComponent( newComponent<_>("Policies") .addComponent( newComponent<_>("CronTriggeringPolicy") .addAttribute("schedule", "0 0 0 * * ?") - .addAttribute("evaluateOnStartup", "true") + .addAttribute("evaluateOnStartup", "true"), ) .addComponent( newComponent<_>("SizeBasedTriggeringPolicy") - .addAttribute("size", "100M") - ) - ) + .addAttribute("size", "100M"), + ), + ), ) add( newRootLogger(Level.DEBUG) .add(newAppenderRef("Console")) - .add(newAppenderRef("Rolling")) + .add(newAppenderRef("Rolling")), ) } ctx.configuration = builder.build() @@ -97,7 +97,7 @@ fun initializeLogger(loggingLocation: Path) { java.util.logging.Level.FINE } else { java.util.logging.Level.WARNING - } + }, ) JLogManager.getLogManager().getLogger("com.github.weisj.darklaf").apply { handlers.forEach { removeHandler(it) } diff --git a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/main.kt b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/main.kt index 99858991..94da022c 100644 --- a/desktop/src/main/kotlin/ca/gosyer/jui/desktop/main.kt +++ b/desktop/src/main/kotlin/ca/gosyer/jui/desktop/main.kt @@ -143,7 +143,7 @@ suspend fun main() { val ( position, size, - placement + placement, ) = WindowGet.from(windowSettings.get()) val confirmExit = uiPreferences.confirmExit().asStateIn(GlobalScope) @@ -161,7 +161,7 @@ suspend fun main() { val windowState = rememberWindowState( size = size, position = position, - placement = placement + placement = placement, ) val icon = remember { StableHolder(MR.images.icon.image.toPainter()) } @@ -197,7 +197,7 @@ suspend fun main() { } else { false } - } + }, ) { LaunchedEffect(Unit) { serverService.startServer() @@ -216,7 +216,7 @@ suspend fun main() { modifier = Modifier .align(Alignment.BottomCenter) .padding(bottom = 64.dp), - context = context + context = context, ) } } @@ -226,7 +226,7 @@ suspend fun main() { initialized == ServerResult.STARTING, errorMessage = stringResource(MR.strings.unable_to_start_server), retryMessage = stringResource(MR.strings.action_start_anyway), - retry = serverService::startAnyway + retry = serverService::startAnyway, ) } } @@ -240,8 +240,8 @@ suspend fun main() { negativeButton(stringResource(MR.strings.action_cancel)) }, properties = getMaterialDialogProperties( - size = DpSize(400.dp, 200.dp) - ) + size = DpSize(400.dp, 200.dp), + ), ) { title(stringResource(MR.strings.confirm_exit)) message(stringResource(MR.strings.confirm_exit_message)) @@ -269,7 +269,7 @@ fun ToastOverlay(modifier: Modifier, context: ContextWrapper) { Length.SHORT -> 2.seconds Length.LONG -> 5.seconds else -> ZERO - } + }, ) toast = null } @@ -277,13 +277,13 @@ fun ToastOverlay(modifier: Modifier, context: ContextWrapper) { @Suppress("NAME_SHADOWING") Crossfade( toast?.first, - modifier = modifier + modifier = modifier, ) { toast -> if (toast != null) { Card( Modifier.sizeIn(maxWidth = 200.dp), shape = CircleShape, - backgroundColor = Color.DarkGray + backgroundColor = Color.DarkGray, ) { Text( toast, @@ -292,7 +292,7 @@ fun ToastOverlay(modifier: Modifier, context: ContextWrapper) { maxLines = 2, overflow = TextOverflow.Ellipsis, fontSize = 12.sp, - textAlign = TextAlign.Center + textAlign = TextAlign.Center, ) } } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ServerListeners.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ServerListeners.kt index 685f14ce..94b528da 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ServerListeners.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ServerListeners.kt @@ -29,26 +29,26 @@ class ServerListeners @Inject constructor() { private fun Flow.startWith(value: T) = onStart { emit(value) } private val _mangaListener = MutableSharedFlow>( - extraBufferCapacity = Channel.UNLIMITED + extraBufferCapacity = Channel.UNLIMITED, ) val mangaListener = _mangaListener.asSharedFlow() private val _chapterIndexesListener = MutableSharedFlow?>>( - extraBufferCapacity = Channel.UNLIMITED + extraBufferCapacity = Channel.UNLIMITED, ) val chapterIndexesListener = _chapterIndexesListener.asSharedFlow() private val _chapterIdsListener = MutableSharedFlow>>( - extraBufferCapacity = Channel.UNLIMITED + extraBufferCapacity = Channel.UNLIMITED, ) val chapterIdsListener = _chapterIdsListener.asSharedFlow() private val categoryMangaListener = MutableSharedFlow( - extraBufferCapacity = Channel.UNLIMITED + extraBufferCapacity = Channel.UNLIMITED, ) private val extensionListener = MutableSharedFlow>( - extraBufferCapacity = Channel.UNLIMITED + extraBufferCapacity = Channel.UNLIMITED, ) fun combineMangaUpdates(flow: Flow, predate: (suspend (List) -> Boolean)? = null) = @@ -86,7 +86,7 @@ class ServerListeners @Inject constructor() { fun combineChapters( flow: Flow, indexPredate: (suspend (Long, List?) -> Boolean)? = null, - idPredate: (suspend (Long?, List) -> Boolean)? = null + idPredate: (suspend (Long?, List) -> Boolean)? = null, ): Flow { val indexListener = if (indexPredate != null) { _chapterIndexesListener.filter { indexPredate(it.first, it.second) }.startWith(Unit) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/model/BackupValidationResult.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/model/BackupValidationResult.kt index e6c13c8b..c2f73fd7 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/model/BackupValidationResult.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/model/BackupValidationResult.kt @@ -11,5 +11,5 @@ import kotlinx.serialization.Serializable @Serializable data class BackupValidationResult( val missingSources: List, - val missingTrackers: List + val missingTrackers: List, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/service/BackupRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/service/BackupRepository.kt index 6262a1c2..14002929 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/service/BackupRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/backup/service/BackupRepository.kt @@ -31,19 +31,19 @@ interface BackupRepository { @POST("api/v1/backup/import/file") fun importBackupFile( @Part("") formData: List, - @ReqBuilder block: HttpRequestBuilder.() -> Unit = {} + @ReqBuilder block: HttpRequestBuilder.() -> Unit = {}, ): Flow @Multipart @POST("api/v1/backup/validate/file") fun validateBackupFile( @Part("") formData: List, - @ReqBuilder block: HttpRequestBuilder.() -> Unit = {} + @ReqBuilder block: HttpRequestBuilder.() -> Unit = {}, ): Flow @GET("api/v1/backup/export/file") fun exportBackupFile( - @ReqBuilder block: HttpRequestBuilder.() -> Unit = {} + @ReqBuilder block: HttpRequestBuilder.() -> Unit = {}, ): Flow companion object { @@ -54,7 +54,7 @@ interface BackupRepository { Headers.build { append(HttpHeaders.ContentType, ContentType.MultiPart.FormData.toString()) append(HttpHeaders.ContentDisposition, "filename=backup.proto.gz") - } + }, ) } } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/base/WebsocketService.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/base/WebsocketService.kt index 675cf059..1fe5c78b 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/base/WebsocketService.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/base/WebsocketService.kt @@ -29,7 +29,7 @@ import org.lighthousegames.logging.logging @OptIn(DelicateCoroutinesApi::class) abstract class WebsocketService( protected val serverPreferences: ServerPreferences, - protected val client: Http + protected val client: Http, ) { protected val json = Json { ignoreUnknownKeys = true @@ -62,7 +62,7 @@ abstract class WebsocketService( if (serverUrl.protocol == URLProtocol.HTTPS) { url.protocol = URLProtocol.WSS } - } + }, ) { errorConnectionCount = 0 _status.value = Status.RUNNING @@ -96,13 +96,13 @@ abstract class WebsocketService( enum class Status { STARTING, RUNNING, - STOPPED + STOPPED, } enum class Actions { STOP, START, - RESTART + RESTART, } private companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/AddMangaToCategory.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/AddMangaToCategory.kt index 37dc7674..aeccdee8 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/AddMangaToCategory.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/AddMangaToCategory.kt @@ -19,7 +19,7 @@ import org.lighthousegames.logging.logging class AddMangaToCategory @Inject constructor( private val categoryRepository: CategoryRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await(mangaId: Long, categoryId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId, categoryId) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/GetMangaListFromCategory.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/GetMangaListFromCategory.kt index 9dadc633..f7b6fea8 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/GetMangaListFromCategory.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/GetMangaListFromCategory.kt @@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging class GetMangaListFromCategory @Inject constructor( private val categoryRepository: CategoryRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await(categoryId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(categoryId) @@ -37,11 +37,11 @@ class GetMangaListFromCategory @Inject constructor( .singleOrNull() fun asFlow(categoryId: Long) = serverListeners.combineCategoryManga( - categoryRepository.getMangaFromCategory(categoryId) + categoryRepository.getMangaFromCategory(categoryId), ) { categoryId == it } fun asFlow(category: Category) = serverListeners.combineCategoryManga( - categoryRepository.getMangaFromCategory(category.id) + categoryRepository.getMangaFromCategory(category.id), ) { category.id == it } companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/ModifyCategory.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/ModifyCategory.kt index 9f9b1da7..a0f5f706 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/ModifyCategory.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/ModifyCategory.kt @@ -17,7 +17,7 @@ class ModifyCategory @Inject constructor(private val categoryRepository: Categor suspend fun await(categoryId: Long, name: String, onError: suspend (Throwable) -> Unit = {}) = asFlow( categoryId = categoryId, - name = name + name = name, ).catch { onError(it) log.warn(it) { "Failed to modify category $categoryId with options: name=$name" } @@ -25,7 +25,7 @@ class ModifyCategory @Inject constructor(private val categoryRepository: Categor suspend fun await(category: Category, name: String? = null, onError: suspend (Throwable) -> Unit = {}) = asFlow( category = category, - name = name + name = name, ).catch { onError(it) log.warn(it) { "Failed to modify category ${category.name} with options: name=$name" } @@ -33,12 +33,12 @@ class ModifyCategory @Inject constructor(private val categoryRepository: Categor fun asFlow(categoryId: Long, name: String) = categoryRepository.modifyCategory( categoryId = categoryId, - name = name + name = name, ) fun asFlow(category: Category, name: String? = null) = categoryRepository.modifyCategory( categoryId = category.id, - name = name ?: category.name + name = name ?: category.name, ) companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/RemoveMangaFromCategory.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/RemoveMangaFromCategory.kt index b6edd437..953ed1c3 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/RemoveMangaFromCategory.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/RemoveMangaFromCategory.kt @@ -19,7 +19,7 @@ import org.lighthousegames.logging.logging class RemoveMangaFromCategory @Inject constructor( private val categoryRepository: CategoryRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await(mangaId: Long, categoryId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId, categoryId) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/UpdateCategoryMeta.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/UpdateCategoryMeta.kt index dbcaa8c3..bc639df8 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/UpdateCategoryMeta.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/interactor/UpdateCategoryMeta.kt @@ -19,7 +19,7 @@ class UpdateCategoryMeta @Inject constructor(private val categoryRepository: Cat suspend fun await( category: Category, example: Int = category.meta.example, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(category, example) .catch { onError(it) @@ -29,13 +29,13 @@ class UpdateCategoryMeta @Inject constructor(private val categoryRepository: Cat fun asFlow( category: Category, - example: Int = category.meta.example + example: Int = category.meta.example, ) = flow { if (example != category.meta.example) { categoryRepository.updateCategoryMeta( category.id, "example", - example.toString() + example.toString(), ).collect() } emit(Unit) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/model/Category.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/model/Category.kt index f65bb915..5070bc72 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/model/Category.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/model/Category.kt @@ -16,11 +16,11 @@ data class Category( val order: Int, val name: String, val default: Boolean, - val meta: CategoryMeta + val meta: CategoryMeta, ) @Serializable @Immutable data class CategoryMeta( - val example: Int = 0 + val example: Int = 0, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/service/CategoryRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/service/CategoryRepository.kt index 3ec39848..6c05b119 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/service/CategoryRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/category/service/CategoryRepository.kt @@ -21,19 +21,19 @@ import kotlinx.coroutines.flow.Flow interface CategoryRepository { @GET("api/v1/manga/{mangaId}/category/") fun getMangaCategories( - @Path("mangaId") mangaId: Long + @Path("mangaId") mangaId: Long, ): Flow> @GET("api/v1/manga/{mangaId}/category/{categoryId}") fun addMangaToCategory( @Path("mangaId") mangaId: Long, - @Path("categoryId") categoryId: Long + @Path("categoryId") categoryId: Long, ): Flow @DELETE("api/v1/manga/{mangaId}/category/{categoryId}") fun removeMangaFromCategory( @Path("mangaId") mangaId: Long, - @Path("categoryId") categoryId: Long + @Path("categoryId") categoryId: Long, ): Flow @GET("api/v1/category/") @@ -42,31 +42,31 @@ interface CategoryRepository { @FormUrlEncoded @POST("api/v1/category/") fun createCategory( - @Field("name") name: String + @Field("name") name: String, ): Flow @FormUrlEncoded @PATCH("api/v1/category/{categoryId}") fun modifyCategory( @Path("categoryId") categoryId: Long, - @Field("name") name: String + @Field("name") name: String, ): Flow @FormUrlEncoded @PATCH("api/v1/category/reorder") fun reorderCategory( @Field("to") to: Int, - @Field("from") from: Int + @Field("from") from: Int, ): Flow @DELETE("api/v1/category/{categoryId}") fun deleteCategory( - @Path("categoryId") categoryId: Long + @Path("categoryId") categoryId: Long, ): Flow @GET("api/v1/category/{categoryId}") fun getMangaFromCategory( - @Path("categoryId") categoryId: Long + @Path("categoryId") categoryId: Long, ): Flow> @FormUrlEncoded @@ -74,6 +74,6 @@ interface CategoryRepository { fun updateCategoryMeta( @Path("categoryId") categoryId: Long, @Field("key") key: String, - @Field("value") value: String + @Field("value") value: String, ): Flow } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/BatchUpdateChapter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/BatchUpdateChapter.kt index fdda06db..cb50721c 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/BatchUpdateChapter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/BatchUpdateChapter.kt @@ -22,7 +22,7 @@ import kotlin.jvm.JvmName class BatchUpdateChapter @Inject constructor( private val chapterRepository: ChapterRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { @JvmName("awaitChapters") @@ -33,7 +33,7 @@ class BatchUpdateChapter @Inject constructor( isBookmarked: Boolean? = null, lastPageRead: Int? = null, delete: Boolean? = null, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(mangaId, chapters, isRead, isBookmarked, lastPageRead, delete) .catch { onError(it) @@ -48,7 +48,7 @@ class BatchUpdateChapter @Inject constructor( isBookmarked: Boolean? = null, lastPageRead: Int? = null, delete: Boolean? = null, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(mangaId, chapterIds, isRead, isBookmarked, lastPageRead, delete) .catch { onError(it) @@ -64,7 +64,7 @@ class BatchUpdateChapter @Inject constructor( isBookmarked: Boolean? = null, lastPageRead: Int? = null, delete: Boolean? = null, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(manga, chapters, isRead, isBookmarked, lastPageRead, delete) .catch { onError(it) @@ -79,7 +79,7 @@ class BatchUpdateChapter @Inject constructor( isBookmarked: Boolean? = null, lastPageRead: Int? = null, delete: Boolean? = null, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(manga, chapterIds, isRead, isBookmarked, lastPageRead, delete) .catch { onError(it) @@ -94,7 +94,7 @@ class BatchUpdateChapter @Inject constructor( isBookmarked: Boolean? = null, lastPageRead: Int? = null, delete: Boolean? = null, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(chapters, isRead, isBookmarked, lastPageRead, delete) .catch { onError(it) @@ -108,7 +108,7 @@ class BatchUpdateChapter @Inject constructor( isBookmarked: Boolean? = null, lastPageRead: Int? = null, delete: Boolean? = null, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(chapterIds, isRead, isBookmarked, lastPageRead, delete) .catch { onError(it) @@ -123,14 +123,14 @@ class BatchUpdateChapter @Inject constructor( isRead: Boolean? = null, isBookmarked: Boolean? = null, lastPageRead: Int? = null, - delete: Boolean? = null + delete: Boolean? = null, ) = getFlow( mangaId = mangaId, chapterIds = chapters.map { it.id }, isRead = isRead, isBookmarked = isBookmarked, lastPageRead = lastPageRead, - delete = delete + delete = delete, ) fun asFlow( @@ -139,14 +139,14 @@ class BatchUpdateChapter @Inject constructor( isRead: Boolean? = null, isBookmarked: Boolean? = null, lastPageRead: Int? = null, - delete: Boolean? = null + delete: Boolean? = null, ) = getFlow( mangaId = mangaId, chapterIds = chapterIds, isRead = isRead, isBookmarked = isBookmarked, lastPageRead = lastPageRead, - delete = delete + delete = delete, ) @JvmName("asFlowChapters") @@ -156,14 +156,14 @@ class BatchUpdateChapter @Inject constructor( isRead: Boolean? = null, isBookmarked: Boolean? = null, lastPageRead: Int? = null, - delete: Boolean? = null + delete: Boolean? = null, ) = getFlow( mangaId = manga.id, chapterIds = chapters.map { it.id }, isRead = isRead, isBookmarked = isBookmarked, lastPageRead = lastPageRead, - delete = delete + delete = delete, ) fun asFlow( @@ -172,14 +172,14 @@ class BatchUpdateChapter @Inject constructor( isRead: Boolean? = null, isBookmarked: Boolean? = null, lastPageRead: Int? = null, - delete: Boolean? = null + delete: Boolean? = null, ) = getFlow( mangaId = manga.id, chapterIds = chapterIds, isRead = isRead, isBookmarked = isBookmarked, lastPageRead = lastPageRead, - delete = delete + delete = delete, ) @JvmName("asFlowChapters") @@ -188,14 +188,14 @@ class BatchUpdateChapter @Inject constructor( isRead: Boolean? = null, isBookmarked: Boolean? = null, lastPageRead: Int? = null, - delete: Boolean? = null + delete: Boolean? = null, ) = getFlow( mangaId = null, chapterIds = chapters.map { it.id }, isRead = isRead, isBookmarked = isBookmarked, lastPageRead = lastPageRead, - delete = delete + delete = delete, ) fun asFlow( @@ -203,14 +203,14 @@ class BatchUpdateChapter @Inject constructor( isRead: Boolean? = null, isBookmarked: Boolean? = null, lastPageRead: Int? = null, - delete: Boolean? = null + delete: Boolean? = null, ) = getFlow( mangaId = null, chapterIds = chapterIds, isRead = isRead, isBookmarked = isBookmarked, lastPageRead = lastPageRead, - delete = delete + delete = delete, ) private fun getFlow( @@ -219,7 +219,7 @@ class BatchUpdateChapter @Inject constructor( isRead: Boolean? = null, isBookmarked: Boolean? = null, lastPageRead: Int? = null, - delete: Boolean? = null + delete: Boolean? = null, ) = if (mangaId != null) { chapterRepository.batchUpdateChapter( mangaId, @@ -229,9 +229,9 @@ class BatchUpdateChapter @Inject constructor( isRead = isRead, isBookmarked = isBookmarked, lastPageRead = lastPageRead, - delete = delete - ) - ) + delete = delete, + ), + ), ) } else { chapterRepository.batchUpdateChapter( @@ -241,9 +241,9 @@ class BatchUpdateChapter @Inject constructor( isRead = isRead, isBookmarked = isBookmarked, lastPageRead = lastPageRead, - delete = delete - ) - ) + delete = delete, + ), + ), ) }.onEach { serverListeners.updateChapters(mangaId, chapterIds) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/DeleteChapterDownload.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/DeleteChapterDownload.kt index 0ecde0f0..7168af6d 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/DeleteChapterDownload.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/DeleteChapterDownload.kt @@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging class DeleteChapterDownload @Inject constructor( private val chapterRepository: ChapterRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await(mangaId: Long, index: Int, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId, index) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapter.kt index 622510a8..420bc7bd 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapter.kt @@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging class GetChapter @Inject constructor( private val chapterRepository: ChapterRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await(mangaId: Long, index: Int, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId, index) @@ -50,7 +50,7 @@ class GetChapter @Inject constructor( indexPredate = { id, chapterIndexes -> id == mangaId && (chapterIndexes == null || index in chapterIndexes) }, - idPredate = { id, _ -> id == mangaId } + idPredate = { id, _ -> id == mangaId }, ) fun asFlow(manga: Manga, index: Int) = serverListeners.combineChapters( @@ -58,7 +58,7 @@ class GetChapter @Inject constructor( indexPredate = { id, chapterIndexes -> id == manga.id && (chapterIndexes == null || index in chapterIndexes) }, - idPredate = { id, _ -> id == manga.id } + idPredate = { id, _ -> id == manga.id }, ) fun asFlow(chapter: Chapter) = serverListeners.combineChapters( @@ -66,7 +66,7 @@ class GetChapter @Inject constructor( indexPredate = { id, chapterIndexes -> id == chapter.mangaId && (chapterIndexes == null || chapter.index in chapterIndexes) }, - idPredate = { id, _ -> id == chapter.mangaId } + idPredate = { id, _ -> id == chapter.mangaId }, ) companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapterPage.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapterPage.kt index 94ffc34d..73cbbdc6 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapterPage.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapterPage.kt @@ -22,7 +22,7 @@ class GetChapterPage @Inject constructor(private val chapterRepository: ChapterR index: Int, pageNum: Int, block: HttpRequestBuilder.() -> Unit, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(mangaId, index, pageNum, block) .catch { onError(it) @@ -35,7 +35,7 @@ class GetChapterPage @Inject constructor(private val chapterRepository: ChapterR index: Int, pageNum: Int, block: HttpRequestBuilder.() -> Unit, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(manga, index, pageNum, block) .catch { onError(it) @@ -47,7 +47,7 @@ class GetChapterPage @Inject constructor(private val chapterRepository: ChapterR chapter: Chapter, pageNum: Int, block: HttpRequestBuilder.() -> Unit, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(chapter, pageNum, block) .catch { onError(it) @@ -59,20 +59,20 @@ class GetChapterPage @Inject constructor(private val chapterRepository: ChapterR mangaId: Long, index: Int, pageNum: Int, - block: HttpRequestBuilder.() -> Unit + block: HttpRequestBuilder.() -> Unit, ) = chapterRepository.getPage(mangaId, index, pageNum, block) fun asFlow( manga: Manga, index: Int, pageNum: Int, - block: HttpRequestBuilder.() -> Unit + block: HttpRequestBuilder.() -> Unit, ) = chapterRepository.getPage(manga.id, index, pageNum, block) fun asFlow( chapter: Chapter, pageNum: Int, - block: HttpRequestBuilder.() -> Unit + block: HttpRequestBuilder.() -> Unit, ) = chapterRepository.getPage(chapter.mangaId, chapter.index, pageNum, block) companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapters.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapters.kt index ea7309c5..a45e8a44 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapters.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/GetChapters.kt @@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging class GetChapters @Inject constructor( private val chapterRepository: ChapterRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId) @@ -39,13 +39,13 @@ class GetChapters @Inject constructor( fun asFlow(mangaId: Long) = serverListeners.combineChapters( chapterRepository.getChapters(mangaId), indexPredate = { id, _ -> id == mangaId }, - idPredate = { id, _ -> id == mangaId } + idPredate = { id, _ -> id == mangaId }, ) fun asFlow(manga: Manga) = serverListeners.combineChapters( chapterRepository.getChapters(manga.id), indexPredate = { id, _ -> id == manga.id }, - idPredate = { id, _ -> id == manga.id } + idPredate = { id, _ -> id == manga.id }, ) companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/RefreshChapters.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/RefreshChapters.kt index 411430f0..31909809 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/RefreshChapters.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/RefreshChapters.kt @@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging class RefreshChapters @Inject constructor( private val chapterRepository: ChapterRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterBookmarked.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterBookmarked.kt index ff932acb..ba367ad0 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterBookmarked.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterBookmarked.kt @@ -18,14 +18,14 @@ import org.lighthousegames.logging.logging class UpdateChapterBookmarked @Inject constructor( private val chapterRepository: ChapterRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await( mangaId: Long, index: Int, bookmarked: Boolean, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(mangaId, index, bookmarked) .catch { onError(it) @@ -37,7 +37,7 @@ class UpdateChapterBookmarked @Inject constructor( manga: Manga, index: Int, bookmarked: Boolean, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(manga, index, bookmarked) .catch { onError(it) @@ -48,7 +48,7 @@ class UpdateChapterBookmarked @Inject constructor( suspend fun await( chapter: Chapter, bookmarked: Boolean, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(chapter, bookmarked) .catch { onError(it) @@ -59,30 +59,30 @@ class UpdateChapterBookmarked @Inject constructor( fun asFlow( mangaId: Long, index: Int, - bookmarked: Boolean + bookmarked: Boolean, ) = chapterRepository.updateChapter( mangaId = mangaId, chapterIndex = index, - bookmarked = bookmarked + bookmarked = bookmarked, ).onEach { serverListeners.updateChapters(mangaId, index) } fun asFlow( manga: Manga, index: Int, - bookmarked: Boolean + bookmarked: Boolean, ) = chapterRepository.updateChapter( mangaId = manga.id, chapterIndex = index, - bookmarked = bookmarked + bookmarked = bookmarked, ).onEach { serverListeners.updateChapters(manga.id, index) } fun asFlow( chapter: Chapter, - bookmarked: Boolean + bookmarked: Boolean, ) = chapterRepository.updateChapter( mangaId = chapter.mangaId, chapterIndex = chapter.index, - bookmarked = bookmarked + bookmarked = bookmarked, ).onEach { serverListeners.updateChapters(chapter.mangaId, chapter.index) } companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterLastPageRead.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterLastPageRead.kt index 01084f36..d346e8f8 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterLastPageRead.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterLastPageRead.kt @@ -18,14 +18,14 @@ import org.lighthousegames.logging.logging class UpdateChapterLastPageRead @Inject constructor( private val chapterRepository: ChapterRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await( mangaId: Long, index: Int, lastPageRead: Int, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(mangaId, index, lastPageRead) .catch { onError(it) @@ -37,7 +37,7 @@ class UpdateChapterLastPageRead @Inject constructor( manga: Manga, index: Int, lastPageRead: Int, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(manga, index, lastPageRead) .catch { onError(it) @@ -48,7 +48,7 @@ class UpdateChapterLastPageRead @Inject constructor( suspend fun await( chapter: Chapter, lastPageRead: Int, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(chapter, lastPageRead) .catch { onError(it) @@ -59,30 +59,30 @@ class UpdateChapterLastPageRead @Inject constructor( fun asFlow( mangaId: Long, index: Int, - lastPageRead: Int + lastPageRead: Int, ) = chapterRepository.updateChapter( mangaId = mangaId, chapterIndex = index, - lastPageRead = lastPageRead + lastPageRead = lastPageRead, ).onEach { serverListeners.updateChapters(mangaId, index) } fun asFlow( manga: Manga, index: Int, - lastPageRead: Int + lastPageRead: Int, ) = chapterRepository.updateChapter( mangaId = manga.id, chapterIndex = index, - lastPageRead = lastPageRead + lastPageRead = lastPageRead, ).onEach { serverListeners.updateChapters(manga.id, index) } fun asFlow( chapter: Chapter, - lastPageRead: Int + lastPageRead: Int, ) = chapterRepository.updateChapter( mangaId = chapter.mangaId, chapterIndex = chapter.index, - lastPageRead = lastPageRead + lastPageRead = lastPageRead, ).onEach { serverListeners.updateChapters(chapter.mangaId, chapter.index) } companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMarkPreviousRead.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMarkPreviousRead.kt index ba94d850..5cb3ff60 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMarkPreviousRead.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMarkPreviousRead.kt @@ -18,13 +18,13 @@ import org.lighthousegames.logging.logging class UpdateChapterMarkPreviousRead @Inject constructor( private val chapterRepository: ChapterRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await( mangaId: Long, index: Int, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(mangaId, index) .catch { onError(it) @@ -35,7 +35,7 @@ class UpdateChapterMarkPreviousRead @Inject constructor( suspend fun await( manga: Manga, index: Int, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(manga, index) .catch { onError(it) @@ -45,7 +45,7 @@ class UpdateChapterMarkPreviousRead @Inject constructor( suspend fun await( chapter: Chapter, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(chapter) .catch { onError(it) @@ -55,28 +55,28 @@ class UpdateChapterMarkPreviousRead @Inject constructor( fun asFlow( mangaId: Long, - index: Int + index: Int, ) = chapterRepository.updateChapter( mangaId = mangaId, chapterIndex = index, - markPreviousRead = true + markPreviousRead = true, ).onEach { serverListeners.updateChapters(mangaId, index) } fun asFlow( manga: Manga, - index: Int + index: Int, ) = chapterRepository.updateChapter( mangaId = manga.id, chapterIndex = index, - markPreviousRead = true + markPreviousRead = true, ).onEach { serverListeners.updateChapters(manga.id, index) } fun asFlow( - chapter: Chapter + chapter: Chapter, ) = chapterRepository.updateChapter( mangaId = chapter.mangaId, chapterIndex = chapter.index, - markPreviousRead = true + markPreviousRead = true, ).onEach { serverListeners.updateChapters(chapter.mangaId, chapter.index) } companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMeta.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMeta.kt index 31688fbf..09b3083f 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMeta.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterMeta.kt @@ -17,13 +17,13 @@ import org.lighthousegames.logging.logging class UpdateChapterMeta @Inject constructor( private val chapterRepository: ChapterRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await( chapter: Chapter, pageOffset: Int = chapter.meta.juiPageOffset, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(chapter, pageOffset) .catch { onError(it) @@ -33,14 +33,14 @@ class UpdateChapterMeta @Inject constructor( fun asFlow( chapter: Chapter, - pageOffset: Int = chapter.meta.juiPageOffset + pageOffset: Int = chapter.meta.juiPageOffset, ) = flow { if (pageOffset != chapter.meta.juiPageOffset) { chapterRepository.updateChapterMeta( chapter.mangaId, chapter.index, "juiPageOffset", - pageOffset.toString() + pageOffset.toString(), ).collect() serverListeners.updateChapters(chapter.mangaId, chapter.index) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterRead.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterRead.kt index 003ff3a8..45ac1639 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterRead.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/interactor/UpdateChapterRead.kt @@ -18,14 +18,14 @@ import org.lighthousegames.logging.logging class UpdateChapterRead @Inject constructor( private val chapterRepository: ChapterRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await( mangaId: Long, index: Int, read: Boolean, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(mangaId, index, read) .catch { onError(it) @@ -37,7 +37,7 @@ class UpdateChapterRead @Inject constructor( manga: Manga, index: Int, read: Boolean, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(manga, index, read) .catch { onError(it) @@ -48,7 +48,7 @@ class UpdateChapterRead @Inject constructor( suspend fun await( chapter: Chapter, read: Boolean, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(chapter, read) .catch { onError(it) @@ -59,30 +59,30 @@ class UpdateChapterRead @Inject constructor( fun asFlow( mangaId: Long, index: Int, - read: Boolean + read: Boolean, ) = chapterRepository.updateChapter( mangaId = mangaId, chapterIndex = index, - read = read + read = read, ).onEach { serverListeners.updateChapters(mangaId, index) } fun asFlow( manga: Manga, index: Int, - read: Boolean + read: Boolean, ) = chapterRepository.updateChapter( mangaId = manga.id, chapterIndex = index, - read = read + read = read, ).onEach { serverListeners.updateChapters(manga.id, index) } fun asFlow( chapter: Chapter, - read: Boolean + read: Boolean, ) = chapterRepository.updateChapter( mangaId = chapter.mangaId, chapterIndex = chapter.index, - read = read + read = read, ).onEach { serverListeners.updateChapters(chapter.mangaId, chapter.index) } companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/Chapter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/Chapter.kt index d489ae5d..f2fd7b13 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/Chapter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/Chapter.kt @@ -29,11 +29,11 @@ data class Chapter( val pageCount: Int?, val lastReadAt: Int?, val downloaded: Boolean, - val meta: ChapterMeta + val meta: ChapterMeta, ) @Serializable @Immutable data class ChapterMeta( - val juiPageOffset: Int = 0 + val juiPageOffset: Int = 0, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/ChapterBatchEditInput.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/ChapterBatchEditInput.kt index fb4a3672..f8765836 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/ChapterBatchEditInput.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/ChapterBatchEditInput.kt @@ -11,5 +11,5 @@ import kotlinx.serialization.Serializable @Serializable data class ChapterBatchEditInput( val chapterIds: List? = null, - val change: ChapterChange? + val change: ChapterChange?, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/ChapterChange.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/ChapterChange.kt index 56f09482..55f86fac 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/ChapterChange.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/ChapterChange.kt @@ -13,5 +13,5 @@ data class ChapterChange( val isRead: Boolean? = null, val isBookmarked: Boolean? = null, val lastPageRead: Int? = null, - val delete: Boolean? = null + val delete: Boolean? = null, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/MangaChapterBatchEditInput.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/MangaChapterBatchEditInput.kt index 2b4bfd55..be9e477c 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/MangaChapterBatchEditInput.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/model/MangaChapterBatchEditInput.kt @@ -12,5 +12,5 @@ import kotlinx.serialization.Serializable data class MangaChapterBatchEditInput( val chapterIds: List? = null, val chapterIndexes: List? = null, - val change: ChapterChange? + val change: ChapterChange?, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/service/ChapterRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/service/ChapterRepository.kt index f88fc8b1..10e60dda 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/service/ChapterRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/chapter/service/ChapterRepository.kt @@ -29,13 +29,13 @@ interface ChapterRepository { @GET("api/v1/manga/{mangaId}/chapters") fun getChapters( @Path("mangaId") mangaId: Long, - @Query("onlineFetch") refresh: Boolean = false + @Query("onlineFetch") refresh: Boolean = false, ): Flow> @GET("api/v1/manga/{mangaId}/chapter/{chapterIndex}") fun getChapter( @Path("mangaId") mangaId: Long, - @Path("chapterIndex") chapterIndex: Int + @Path("chapterIndex") chapterIndex: Int, ): Flow @FormUrlEncoded @@ -46,20 +46,20 @@ interface ChapterRepository { @Field("read") read: Boolean? = null, @Field("bookmarked") bookmarked: Boolean? = null, @Field("lastPageRead") lastPageRead: Int? = null, - @Field("markPrevRead") markPreviousRead: Boolean? = null + @Field("markPrevRead") markPreviousRead: Boolean? = null, ): Flow @POST("api/v1/manga/{mangaId}/chapter/batch") @Headers("Content-Type: application/json") fun batchUpdateChapter( @Path("mangaId") mangaId: Long, - @Body input: MangaChapterBatchEditInput + @Body input: MangaChapterBatchEditInput, ): Flow @POST("api/v1/chapter/batch") @Headers("Content-Type: application/json") fun batchUpdateChapter( - @Body input: ChapterBatchEditInput + @Body input: ChapterBatchEditInput, ): Flow @GET("api/v1/manga/{mangaId}/chapter/{chapterIndex}/page/{pageNum}") @@ -67,13 +67,13 @@ interface ChapterRepository { @Path("mangaId") mangaId: Long, @Path("chapterIndex") chapterIndex: Int, @Path("pageNum") pageNum: Int, - @ReqBuilder block: HttpRequestBuilder.() -> Unit + @ReqBuilder block: HttpRequestBuilder.() -> Unit, ): Flow @DELETE("api/v1/manga/{mangaId}/chapter/{chapterIndex}") fun deleteChapterDownload( @Path("mangaId") mangaId: Long, - @Path("chapterIndex") chapterIndex: Int + @Path("chapterIndex") chapterIndex: Int, ): Flow @FormUrlEncoded @@ -82,6 +82,6 @@ interface ChapterRepository { @Path("mangaId") mangaId: Long, @Path("chapterIndex") chapterIndex: Int, @Field("key") key: String, - @Field("value") value: String + @Field("value") value: String, ): Flow } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadChapter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadChapter.kt index 549051ee..648a50e6 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadChapter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadChapter.kt @@ -20,5 +20,5 @@ data class DownloadChapter( val manga: Manga, val state: DownloadState = DownloadState.Queued, val progress: Float = 0f, - val tries: Int = 0 + val tries: Int = 0, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadEnqueue.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadEnqueue.kt index d9d9312e..c419f676 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadEnqueue.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadEnqueue.kt @@ -10,5 +10,5 @@ import kotlinx.serialization.Serializable @Serializable data class DownloadEnqueue( - val chapterIds: List + val chapterIds: List, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadState.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadState.kt index e9d94b91..8dfba077 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadState.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadState.kt @@ -15,5 +15,5 @@ enum class DownloadState(val state: Int) { Queued(0), Downloading(1), Finished(2), - Error(3) + Error(3), } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadStatus.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadStatus.kt index 817ce44c..1e98bc18 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadStatus.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloadStatus.kt @@ -13,5 +13,5 @@ import kotlinx.serialization.Serializable @Immutable data class DownloadStatus( val status: DownloaderStatus, - val queue: List + val queue: List, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloaderStatus.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloaderStatus.kt index 6f201d34..785ba6cb 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloaderStatus.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/model/DownloaderStatus.kt @@ -13,5 +13,5 @@ import kotlinx.serialization.Serializable @Stable enum class DownloaderStatus { Started, - Stopped + Stopped, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadRepository.kt index b12a3806..16cc02fa 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadRepository.kt @@ -30,25 +30,25 @@ interface DownloadRepository { @GET("api/v1/download/{mangaId}/chapter/{chapterIndex}") fun queueChapterDownload( @Path("mangaId") mangaId: Long, - @Path("chapterIndex") chapterIndex: Int + @Path("chapterIndex") chapterIndex: Int, ): Flow @DELETE("api/v1/download/{mangaId}/chapter/{chapterIndex}") fun stopChapterDownload( @Path("mangaId") mangaId: Long, - @Path("chapterIndex") chapterIndex: Int + @Path("chapterIndex") chapterIndex: Int, ): Flow @PATCH("api/v1/download/{mangaId}/chapter/{chapterIndex}/reorder/{to}") fun reorderChapterDownload( @Path("mangaId") mangaId: Long, @Path("chapterIndex") chapterIndex: Int, - @Path("to") to: Int + @Path("to") to: Int, ): Flow @POST("api/v1/download/batch") @Headers("Content-Type: application/json") fun batchDownload( - @Body downloadEnqueue: DownloadEnqueue + @Body downloadEnqueue: DownloadEnqueue, ): Flow } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadService.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadService.kt index e41a63ee..84d17964 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadService.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/download/service/DownloadService.kt @@ -21,7 +21,7 @@ import me.tatarka.inject.annotations.Inject class DownloadService @Inject constructor( serverPreferences: ServerPreferences, - client: Http + client: Http, ) : WebsocketService(serverPreferences, client) { override val _status: MutableStateFlow get() = status diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/model/Extension.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/model/Extension.kt index 9b47d9d0..cacf798f 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/model/Extension.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/model/Extension.kt @@ -22,5 +22,5 @@ data class Extension( val installed: Boolean, val hasUpdate: Boolean, val obsolete: Boolean, - val isNsfw: Boolean + val isNsfw: Boolean, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/service/ExtensionRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/service/ExtensionRepository.kt index 3140e7d2..992d9839 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/service/ExtensionRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/extension/service/ExtensionRepository.kt @@ -33,28 +33,28 @@ interface ExtensionRepository { @Multipart @POST("api/v1/extension/install") fun installExtension( - @Part("") formData: List + @Part("") formData: List, ): Flow @GET("api/v1/extension/install/{pkgName}") fun installExtension( - @Path("pkgName") pkgName: String + @Path("pkgName") pkgName: String, ): Flow @GET("api/v1/extension/update/{pkgName}") fun updateExtension( - @Path("pkgName") pkgName: String + @Path("pkgName") pkgName: String, ): Flow @GET("api/v1/extension/uninstall/{pkgName}") fun uninstallExtension( - @Path("pkgName") pkgName: String + @Path("pkgName") pkgName: String, ): Flow @GET("api/v1/extension/icon/{apkName}") fun getApkIcon( @Path("apkName") apkName: String, - @ReqBuilder block: HttpRequestBuilder.() -> Unit + @ReqBuilder block: HttpRequestBuilder.() -> Unit, ): Flow companion object { @@ -65,7 +65,7 @@ interface ExtensionRepository { Headers.build { append(HttpHeaders.ContentType, ContentType.MultiPart.FormData.toString()) append(HttpHeaders.ContentDisposition, "filename=file") - } + }, ) } } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/global/interactor/UpdateGlobalMeta.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/global/interactor/UpdateGlobalMeta.kt index da2e14fe..cad6f5d0 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/global/interactor/UpdateGlobalMeta.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/global/interactor/UpdateGlobalMeta.kt @@ -19,7 +19,7 @@ class UpdateGlobalMeta @Inject constructor(private val globalRepository: GlobalR suspend fun await( globalMeta: GlobalMeta, example: Int = globalMeta.example, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(globalMeta, example) .catch { onError(it) @@ -29,12 +29,12 @@ class UpdateGlobalMeta @Inject constructor(private val globalRepository: GlobalR fun asFlow( globalMeta: GlobalMeta, - example: Int = globalMeta.example + example: Int = globalMeta.example, ) = flow { if (example != globalMeta.example) { globalRepository.updateGlobalMeta( "example", - example.toString() + example.toString(), ).collect() } emit(Unit) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/global/model/GlobalMeta.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/global/model/GlobalMeta.kt index f1fa3828..0d12eb90 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/global/model/GlobalMeta.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/global/model/GlobalMeta.kt @@ -12,5 +12,5 @@ import kotlinx.serialization.Serializable @Serializable @Immutable data class GlobalMeta( - val example: Int = 0 + val example: Int = 0, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/global/service/GlobalRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/global/service/GlobalRepository.kt index 5df24ef4..f6405455 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/global/service/GlobalRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/global/service/GlobalRepository.kt @@ -22,6 +22,6 @@ interface GlobalRepository { @PATCH("api/v1/meta") fun updateGlobalMeta( @Field("key") key: String, - @Field("value") value: String + @Field("value") value: String, ): Flow } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/interactor/AddMangaToLibrary.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/interactor/AddMangaToLibrary.kt index 6aee2b95..9e0ae32f 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/interactor/AddMangaToLibrary.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/interactor/AddMangaToLibrary.kt @@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging class AddMangaToLibrary @Inject constructor( private val libraryRepository: LibraryRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/interactor/RemoveMangaFromLibrary.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/interactor/RemoveMangaFromLibrary.kt index f91d8d33..f77ab478 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/interactor/RemoveMangaFromLibrary.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/interactor/RemoveMangaFromLibrary.kt @@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging class RemoveMangaFromLibrary @Inject constructor( private val libraryRepository: LibraryRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/DisplayMode.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/DisplayMode.kt index b8026829..336bbbc8 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/DisplayMode.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/DisplayMode.kt @@ -18,7 +18,8 @@ enum class DisplayMode(@Transient val res: StringResource) { CompactGrid(MR.strings.display_compact), ComfortableGrid(MR.strings.display_comfortable), CoverOnlyGrid(MR.strings.display_cover_only), - List(MR.strings.display_list); + List(MR.strings.display_list), + ; companion object { val values by lazy { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/FilterState.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/FilterState.kt index ffd5b3b1..0d063ba2 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/FilterState.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/FilterState.kt @@ -14,5 +14,5 @@ import kotlinx.serialization.Serializable enum class FilterState { IGNORED, INCLUDED, - EXCLUDED + EXCLUDED, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/JobStatus.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/JobStatus.kt index e3a4b800..9df368ce 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/JobStatus.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/JobStatus.kt @@ -15,5 +15,5 @@ enum class JobStatus { PENDING, RUNNING, COMPLETE, - FAILED + FAILED, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/Sort.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/Sort.kt index 1e4d2c78..d4e71ecd 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/Sort.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/Sort.kt @@ -24,5 +24,5 @@ enum class Sort(@Transient val res: StringResource) { // TOTAL_CHAPTERS, // LATEST_CHAPTER, // DATE_FETCHED, - DATE_ADDED(MR.strings.sort_date_added) + DATE_ADDED(MR.strings.sort_date_added), } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/UpdateStatus.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/UpdateStatus.kt index 05e96458..1823d837 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/UpdateStatus.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/model/UpdateStatus.kt @@ -14,5 +14,5 @@ import kotlinx.serialization.Serializable @Immutable data class UpdateStatus( val statusMap: Map>, - val running: Boolean + val running: Boolean, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryRepository.kt index 0eaada9a..266ac1d8 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryRepository.kt @@ -16,11 +16,11 @@ interface LibraryRepository { @GET("api/v1/manga/{mangaId}/library") fun addMangaToLibrary( - @Path("mangaId") mangaId: Long + @Path("mangaId") mangaId: Long, ): Flow @DELETE("api/v1/manga/{mangaId}/library") fun removeMangaFromLibrary( - @Path("mangaId") mangaId: Long + @Path("mangaId") mangaId: Long, ): Flow } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryUpdateService.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryUpdateService.kt index c392a978..75440809 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryUpdateService.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/library/service/LibraryUpdateService.kt @@ -19,7 +19,7 @@ import org.lighthousegames.logging.logging class LibraryUpdateService @Inject constructor( serverPreferences: ServerPreferences, - client: Http + client: Http, ) : WebsocketService(serverPreferences, client) { override val _status: MutableStateFlow diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/GetManga.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/GetManga.kt index f2cb0e16..6127e46a 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/GetManga.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/GetManga.kt @@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging class GetManga @Inject constructor( private val mangaRepository: MangaRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId) @@ -37,11 +37,11 @@ class GetManga @Inject constructor( .singleOrNull() fun asFlow(mangaId: Long) = serverListeners.combineMangaUpdates( - mangaRepository.getManga(mangaId) + mangaRepository.getManga(mangaId), ) { mangaId in it } fun asFlow(manga: Manga) = serverListeners.combineMangaUpdates( - mangaRepository.getManga(manga.id) + mangaRepository.getManga(manga.id), ) { manga.id in it } companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/GetMangaFull.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/GetMangaFull.kt index d482a29f..1171bf43 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/GetMangaFull.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/GetMangaFull.kt @@ -17,7 +17,7 @@ import org.lighthousegames.logging.logging class GetMangaFull @Inject constructor( private val mangaRepository: MangaRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId) @@ -37,11 +37,11 @@ class GetMangaFull @Inject constructor( .singleOrNull() fun asFlow(mangaId: Long) = serverListeners.combineMangaUpdates( - mangaRepository.getMangaFull(mangaId) + mangaRepository.getMangaFull(mangaId), ) { mangaId in it } fun asFlow(manga: Manga) = serverListeners.combineMangaUpdates( - mangaRepository.getMangaFull(manga.id) + mangaRepository.getMangaFull(manga.id), ) { manga.id in it } companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/RefreshManga.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/RefreshManga.kt index fee47a63..3757650a 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/RefreshManga.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/RefreshManga.kt @@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging class RefreshManga @Inject constructor( private val mangaRepository: MangaRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/RefreshMangaFull.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/RefreshMangaFull.kt index d56f119c..eabf13e3 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/RefreshMangaFull.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/RefreshMangaFull.kt @@ -18,7 +18,7 @@ import org.lighthousegames.logging.logging class RefreshMangaFull @Inject constructor( private val mangaRepository: MangaRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await(mangaId: Long, onError: suspend (Throwable) -> Unit = {}) = asFlow(mangaId) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/UpdateMangaMeta.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/UpdateMangaMeta.kt index 38ed938e..5f81d616 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/UpdateMangaMeta.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/interactor/UpdateMangaMeta.kt @@ -19,13 +19,13 @@ import org.lighthousegames.logging.logging class UpdateMangaMeta @Inject constructor( private val mangaRepository: MangaRepository, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) { suspend fun await( manga: Manga, readerMode: String = manga.meta.juiReaderMode, - onError: suspend (Throwable) -> Unit = {} + onError: suspend (Throwable) -> Unit = {}, ) = asFlow(manga, readerMode) .catch { onError(it) @@ -35,13 +35,13 @@ class UpdateMangaMeta @Inject constructor( fun asFlow( manga: Manga, - readerMode: String = manga.meta.juiReaderMode.decodeURLQueryComponent() + readerMode: String = manga.meta.juiReaderMode.decodeURLQueryComponent(), ) = flow { if (readerMode.encodeURLQueryComponent() != manga.meta.juiReaderMode) { mangaRepository.updateMangaMeta( manga.id, "juiReaderMode", - readerMode + readerMode, ).collect() serverListeners.updateManga(manga.id) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/model/Manga.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/model/Manga.kt index 80be920e..a33df1c3 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/model/Manga.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/model/Manga.kt @@ -44,13 +44,13 @@ data class Manga( val chapterCount: Int?, val lastChapterRead: Chapter? = null, val age: Long?, - val chaptersAge: Long? + val chaptersAge: Long?, ) @Serializable @Immutable data class MangaMeta( - val juiReaderMode: String = DEFAULT_READER_MODE + val juiReaderMode: String = DEFAULT_READER_MODE, ) { companion object { const val DEFAULT_READER_MODE = "default" @@ -66,12 +66,12 @@ enum class MangaStatus(@Transient val res: StringResource) { LICENSED(MR.strings.status_licensed), PUBLISHING_FINISHED(MR.strings.status_publishing_finished), CANCELLED(MR.strings.status_cancelled), - ON_HIATUS(MR.strings.status_on_hiatus) + ON_HIATUS(MR.strings.status_on_hiatus), } @Serializable @Stable enum class UpdateStrategy { ALWAYS_UPDATE, - ONLY_FETCH_ONCE + ONLY_FETCH_ONCE, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/service/MangaRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/service/MangaRepository.kt index fac4661f..4974ceba 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/service/MangaRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/manga/service/MangaRepository.kt @@ -23,19 +23,19 @@ interface MangaRepository { @GET("api/v1/manga/{mangaId}/") fun getManga( @Path("mangaId") mangaId: Long, - @Query("onlineFetch") refresh: Boolean = false + @Query("onlineFetch") refresh: Boolean = false, ): Flow @GET("api/v1/manga/{mangaId}/full") fun getMangaFull( @Path("mangaId") mangaId: Long, - @Query("onlineFetch") refresh: Boolean = false + @Query("onlineFetch") refresh: Boolean = false, ): Flow @GET("api/v1/manga/{mangaId}/thumbnail") fun getMangaThumbnail( @Path("mangaId") mangaId: Long, - @ReqBuilder block: HttpRequestBuilder.() -> Unit + @ReqBuilder block: HttpRequestBuilder.() -> Unit, ): Flow @PATCH("api/v1/manga/{mangaId}/meta") @@ -43,6 +43,6 @@ interface MangaRepository { fun updateMangaMeta( @Path("mangaId") mangaId: Long, @Field("key") key: String, - @Field("value") value: String + @Field("value") value: String, ): Flow } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/migration/interactor/RunMigrations.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/migration/interactor/RunMigrations.kt index e0fea6ee..3e78efd3 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/migration/interactor/RunMigrations.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/migration/interactor/RunMigrations.kt @@ -13,7 +13,7 @@ import me.tatarka.inject.annotations.Inject class RunMigrations @Inject constructor( private val migrationPreferences: MigrationPreferences, - private val readerPreferences: ReaderPreferences + private val readerPreferences: ReaderPreferences, ) { fun runMigrations() { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/ReaderModeWatch.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/ReaderModeWatch.kt index 5aa112cf..3336d94a 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/ReaderModeWatch.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/ReaderModeWatch.kt @@ -21,8 +21,8 @@ class ReaderModeWatch( private val scope: CoroutineScope, private val mode: StateFlow = readerPreferences.mode().stateIn(scope), initialPreferences: ReaderModePreferences = readerPreferences.getMode( - mode.value - ) + mode.value, + ), ) { private val preferenceJobs = mutableListOf() val direction = MutableStateFlow(initialPreferences.direction().get()) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/DefaultReaderMode.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/DefaultReaderMode.kt index a839559e..352bfd12 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/DefaultReaderMode.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/DefaultReaderMode.kt @@ -15,11 +15,11 @@ enum class DefaultReaderMode( val direction: Direction = Direction.Down, val padding: Int = 0, val imageScale: ImageScale = ImageScale.FitScreen, - val navigationMode: NavigationMode = NavigationMode.LNavigation + val navigationMode: NavigationMode = NavigationMode.LNavigation, ) { RTL("RTL", false, Direction.Left, navigationMode = NavigationMode.RightAndLeftNavigation), LTR("LTR", false, Direction.Right, navigationMode = NavigationMode.RightAndLeftNavigation), Vertical("Vertical", false), ContinuesVertical("Continues Vertical", true, padding = 16), - LongStrip("Long Strip", true) + LongStrip("Long Strip", true), } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/Direction.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/Direction.kt index c9594961..ef655913 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/Direction.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/Direction.kt @@ -18,7 +18,8 @@ enum class Direction(@Transient val res: StringResource) { Down(MR.strings.dir_down), Left(MR.strings.dir_rtl), Right(MR.strings.dir_ltr), - Up(MR.strings.dir_up); + Up(MR.strings.dir_up), + ; val isVertical get() = this == Down || this == Up diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/ImageScale.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/ImageScale.kt index 8aed53be..e18ad722 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/ImageScale.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/ImageScale.kt @@ -20,5 +20,5 @@ enum class ImageScale(@Transient val res: StringResource) { FitWidth(MR.strings.scale_fit_width), FitHeight(MR.strings.scale_fit_height), OriginalSize(MR.strings.scale_original), - SmartFit(MR.strings.scale_smart) + SmartFit(MR.strings.scale_smart), } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/NavigationMode.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/NavigationMode.kt index 3a9f820b..1e2eb573 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/NavigationMode.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/NavigationMode.kt @@ -19,5 +19,5 @@ enum class NavigationMode(@Transient val res: StringResource) { LNavigation(MR.strings.nav_l_shaped), KindlishNavigation(MR.strings.nav_kindle_ish), EdgeNavigation(MR.strings.nav_edge), - RightAndLeftNavigation(MR.strings.nav_left_right) + RightAndLeftNavigation(MR.strings.nav_left_right), } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/TappingInvertMode.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/TappingInvertMode.kt index 4912ce72..bd729d63 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/TappingInvertMode.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/model/TappingInvertMode.kt @@ -15,5 +15,5 @@ enum class TappingInvertMode(val shouldInvertHorizontal: Boolean = false, val sh NONE, HORIZONTAL(shouldInvertHorizontal = true), VERTICAL(shouldInvertVertical = true), - BOTH(shouldInvertHorizontal = true, shouldInvertVertical = true) + BOTH(shouldInvertHorizontal = true, shouldInvertVertical = true), } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderModePreferences.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderModePreferences.kt index db7cae17..7d2ce5e6 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderModePreferences.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderModePreferences.kt @@ -54,7 +54,7 @@ class ReaderModePreferences(private val mode: String, private val preferenceStor } } else { 0 - } + }, ) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderPreferences.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderPreferences.kt index 9988ad12..f2bbf5b3 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderPreferences.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/reader/service/ReaderPreferences.kt @@ -26,7 +26,7 @@ class ReaderPreferences(private val preferenceStore: PreferenceStore, private va return preferenceStore.getJsonObject( "modes", DefaultReaderMode.values().map { it.res }, - ListSerializer(String.serializer()) + ListSerializer(String.serializer()), ) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/HttpClient.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/HttpClient.kt index c5f44716..b2b48a54 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/HttpClient.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/HttpClient.kt @@ -52,12 +52,12 @@ fun httpClient(serverPreferences: ServerPreferences, json: Json): Http { Proxy.HTTP_PROXY -> ProxyBuilder.http( URLBuilder( host = serverPreferences.proxyHttpHost().get(), - port = serverPreferences.proxyHttpPort().get() - ).build() + port = serverPreferences.proxyHttpPort().get(), + ).build(), ) Proxy.SOCKS_PROXY -> ProxyBuilder.socks( serverPreferences.proxySocksHost().get(), - serverPreferences.proxySocksPort().get() + serverPreferences.proxySocksPort().get(), ) } } @@ -71,7 +71,7 @@ fun httpClient(serverPreferences: ServerPreferences, json: Json): Http { credentials { BasicAuthCredentials( serverPreferences.authUsername().get(), - serverPreferences.authPassword().get() + serverPreferences.authPassword().get(), ) } } @@ -81,7 +81,7 @@ fun httpClient(serverPreferences: ServerPreferences, json: Json): Http { credentials { DigestAuthCredentials( serverPreferences.authUsername().get(), - serverPreferences.authPassword().get() + serverPreferences.authPassword().get(), ) } } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Auth.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Auth.kt index 7a1c7fef..8281a28d 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Auth.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Auth.kt @@ -14,5 +14,5 @@ import kotlinx.serialization.Serializable enum class Auth { NONE, BASIC, - DIGEST + DIGEST, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Proxy.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Proxy.kt index b63c800a..fd892aa8 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Proxy.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/Proxy.kt @@ -14,5 +14,5 @@ import kotlinx.serialization.Serializable enum class Proxy { NO_PROXY, HTTP_PROXY, - SOCKS_PROXY + SOCKS_PROXY, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/ServerUrlPreference.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/ServerUrlPreference.kt index f3b297b1..4c808459 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/ServerUrlPreference.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/server/model/ServerUrlPreference.kt @@ -23,7 +23,7 @@ class ServerUrlPreference( private val key: String, private val server: Preference, private val port: Preference, - private val pathPrefix: Preference + private val pathPrefix: Preference, ) : Preference { override fun key(): String { return key diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/About.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/About.kt index 87a58eab..15a8f695 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/About.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/settings/model/About.kt @@ -19,12 +19,12 @@ data class About( val buildType: AboutBuildType, val buildTime: Long, val github: String, - val discord: String + val discord: String, ) @Serializable @Stable enum class AboutBuildType { Preview, - Stable + Stable, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/GetQuickSearchManga.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/GetQuickSearchManga.kt index 646adc5a..8bc23499 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/GetQuickSearchManga.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/GetQuickSearchManga.kt @@ -36,8 +36,8 @@ class GetQuickSearchManga @Inject constructor(private val sourceRepository: Sour page, SourceFilterData( searchTerm?.ifBlank { null }, - filters?.ifEmpty { null } - ) + filters?.ifEmpty { null }, + ), ) fun asFlow(sourceId: Long, searchTerm: String?, page: Int, filters: List?) = sourceRepository.getQuickSearchResults( @@ -45,8 +45,8 @@ class GetQuickSearchManga @Inject constructor(private val sourceRepository: Sour page, SourceFilterData( searchTerm?.ifBlank { null }, - filters?.ifEmpty { null } - ) + filters?.ifEmpty { null }, + ), ) companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/GetSearchManga.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/GetSearchManga.kt index ce254a28..c70f1251 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/GetSearchManga.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/GetSearchManga.kt @@ -32,13 +32,13 @@ class GetSearchManga @Inject constructor(private val sourceRepository: SourceRep fun asFlow(source: Source, searchTerm: String?, page: Int) = sourceRepository.getSearchResults( source.id, searchTerm?.ifBlank { null }, - page + page, ) fun asFlow(sourceId: Long, searchTerm: String?, page: Int) = sourceRepository.getSearchResults( sourceId, searchTerm?.ifBlank { null }, - page + page, ) companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SetSourceFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SetSourceFilter.kt index 9e924d40..951ca77a 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SetSourceFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SetSourceFilter.kt @@ -48,22 +48,22 @@ class SetSourceFilter @Inject constructor(private val sourceRepository: SourceRe fun asFlow(source: Source, filterIndex: Int, filter: Any) = sourceRepository.setFilter( source.id, - SourceFilterChange(filterIndex, filter) + SourceFilterChange(filterIndex, filter), ) fun asFlow(sourceId: Long, filterIndex: Int, filter: Any) = sourceRepository.setFilter( sourceId, - SourceFilterChange(filterIndex, filter) + SourceFilterChange(filterIndex, filter), ) fun asFlow(source: Source, filterIndex: Int, childFilterIndex: Int, filter: Any) = sourceRepository.setFilter( source.id, - SourceFilterChange(filterIndex, Json.encodeToString(SourceFilterChange(childFilterIndex, filter))) + SourceFilterChange(filterIndex, Json.encodeToString(SourceFilterChange(childFilterIndex, filter))), ) fun asFlow(sourceId: Long, filterIndex: Int, childFilterIndex: Int, filter: Any) = sourceRepository.setFilter( sourceId, - SourceFilterChange(filterIndex, Json.encodeToString(SourceFilterChange(childFilterIndex, filter))) + SourceFilterChange(filterIndex, Json.encodeToString(SourceFilterChange(childFilterIndex, filter))), ) companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SetSourceSetting.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SetSourceSetting.kt index 23132ec6..70e0d82c 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SetSourceSetting.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SetSourceSetting.kt @@ -32,12 +32,12 @@ class SetSourceSetting @Inject constructor(private val sourceRepository: SourceR fun asFlow(source: Source, settingIndex: Int, setting: Any) = sourceRepository.setSourceSetting( source.id, - SourcePreferenceChange(settingIndex, setting) + SourcePreferenceChange(settingIndex, setting), ) fun asFlow(sourceId: Long, settingIndex: Int, setting: Any) = sourceRepository.setSourceSetting( sourceId, - SourcePreferenceChange(settingIndex, setting) + SourcePreferenceChange(settingIndex, setting), ) companion object { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SourcePager.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SourcePager.kt index 3dac064c..bdc68835 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SourcePager.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/interactor/SourcePager.kt @@ -34,7 +34,7 @@ typealias GetMangaPage = @param:Assisted suspend (page: Int) -> MangaPage? class SourcePager @Inject constructor( private val getManga: GetManga, private val serverListeners: ServerListeners, - private val fetcher: GetMangaPage + private val fetcher: GetMangaPage, ) : CoroutineScope by CoroutineScope(Dispatchers.Default + SupervisorJob()) { private val sourceMutex = Mutex() diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/MangaPage.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/MangaPage.kt index 40f46005..dde8110b 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/MangaPage.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/MangaPage.kt @@ -14,5 +14,5 @@ import kotlinx.serialization.Serializable @Stable data class MangaPage( val mangaList: List, - val hasNextPage: Boolean + val hasNextPage: Boolean, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/Source.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/Source.kt index cb7377d8..259063ec 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/Source.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/Source.kt @@ -20,7 +20,7 @@ data class Source( val supportsLatest: Boolean, val isConfigurable: Boolean, val isNsfw: Boolean, - val displayName: String + val displayName: String, ) : JvmSerializable { val displayLang: String get() = if (id == LOCAL_SOURCE_ID) { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/CheckBoxFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/CheckBoxFilter.kt index a871cdce..0c6b6666 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/CheckBoxFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/CheckBoxFilter.kt @@ -12,11 +12,11 @@ import kotlinx.serialization.Serializable @Serializable @SerialName("CheckBox") data class CheckBoxFilter( - override val filter: CheckBoxProps + override val filter: CheckBoxProps, ) : SourceFilter() { @Serializable data class CheckBoxProps( override val name: String, - override val state: Boolean + override val state: Boolean, ) : Props } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/GroupFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/GroupFilter.kt index aaf2d46b..4eb54975 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/GroupFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/GroupFilter.kt @@ -12,11 +12,11 @@ import kotlinx.serialization.Serializable @Serializable @SerialName("Group") data class GroupFilter( - override val filter: GroupProps + override val filter: GroupProps, ) : SourceFilter() { @Serializable data class GroupProps( override val name: String, - override val state: List + override val state: List, ) : Props> } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/HeaderFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/HeaderFilter.kt index 143ac688..74e40782 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/HeaderFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/HeaderFilter.kt @@ -13,12 +13,12 @@ import kotlinx.serialization.Transient @Serializable @SerialName("Header") data class HeaderFilter( - override val filter: HeaderProps + override val filter: HeaderProps, ) : SourceFilter() { @Serializable data class HeaderProps( override val name: String, @Transient - override val state: Int = 0 + override val state: Int = 0, ) : Props } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SelectFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SelectFilter.kt index 40b389cd..02e4d1d7 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SelectFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SelectFilter.kt @@ -13,13 +13,13 @@ import kotlinx.serialization.json.JsonElement @Serializable @SerialName("Select") data class SelectFilter( - override val filter: SelectProps + override val filter: SelectProps, ) : SourceFilter() { @Serializable data class SelectProps( override val name: String, override val state: Int, val values: List, - val displayValues: List? = null + val displayValues: List? = null, ) : Props } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SeparatorFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SeparatorFilter.kt index b0479a87..654cf480 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SeparatorFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SeparatorFilter.kt @@ -13,12 +13,12 @@ import kotlinx.serialization.Transient @Serializable @SerialName("Separator") data class SeparatorFilter( - override val filter: SeparatorProps + override val filter: SeparatorProps, ) : SourceFilter() { @Serializable data class SeparatorProps( override val name: String, @Transient - override val state: Int = 0 + override val state: Int = 0, ) : Props } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SortFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SortFilter.kt index a617cb30..35fdc818 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SortFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SortFilter.kt @@ -12,18 +12,18 @@ import kotlinx.serialization.Serializable @Serializable @SerialName("Sort") data class SortFilter( - override val filter: SortProps + override val filter: SortProps, ) : SourceFilter() { @Serializable data class SortProps( override val name: String, override val state: Selection?, - val values: List + val values: List, ) : Props @Serializable data class Selection( val index: Int, - val ascending: Boolean + val ascending: Boolean, ) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt index 15d3ac4c..ad093ec8 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterChange.kt @@ -18,6 +18,6 @@ data class SourceFilterChange(val position: Int, val state: String) { Json.encodeToString(state) } else { state.toString() - } + }, ) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterData.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterData.kt index 773bc86f..d1d06ce1 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterData.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/SourceFilterData.kt @@ -11,5 +11,5 @@ import kotlinx.serialization.Serializable @Serializable data class SourceFilterData( val searchTerm: String?, - val filter: List? + val filter: List?, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TextFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TextFilter.kt index ad39d655..1e0b352b 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TextFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TextFilter.kt @@ -12,11 +12,11 @@ import kotlinx.serialization.Serializable @Serializable @SerialName("Text") data class TextFilter( - override val filter: TextProps + override val filter: TextProps, ) : SourceFilter() { @Serializable data class TextProps( override val name: String, - override val state: String + override val state: String, ) : Props } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TriStateFilter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TriStateFilter.kt index 16f7ea1c..9c9a15cf 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TriStateFilter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcefilters/TriStateFilter.kt @@ -12,11 +12,11 @@ import kotlinx.serialization.Serializable @Serializable @SerialName("TriState") data class TriStateFilter( - override val filter: TriStateProps + override val filter: TriStateProps, ) : SourceFilter() { @Serializable data class TriStateProps( override val name: String, - override val state: Int + override val state: Int, ) : Props } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/CheckBoxPreference.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/CheckBoxPreference.kt index c7d40c91..04b58b1e 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/CheckBoxPreference.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/CheckBoxPreference.kt @@ -14,5 +14,5 @@ import kotlinx.serialization.Serializable @SerialName("CheckBoxPreference") @Immutable data class CheckBoxPreference( - override val props: TwoStateProps + override val props: TwoStateProps, ) : SourcePreference() diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/EditTextPreference.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/EditTextPreference.kt index b9ed63d5..ccdd9a24 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/EditTextPreference.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/EditTextPreference.kt @@ -14,7 +14,7 @@ import kotlinx.serialization.Serializable @SerialName("EditTextPreference") @Immutable data class EditTextPreference( - override val props: EditTextProps + override val props: EditTextProps, ) : SourcePreference() { @Serializable @Immutable @@ -27,6 +27,6 @@ data class EditTextPreference( override val defaultValueType: String, val dialogTitle: String?, val dialogMessage: String?, - val text: String? + val text: String?, ) : Props } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/ListPreference.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/ListPreference.kt index f83413bd..1a86c97b 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/ListPreference.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/ListPreference.kt @@ -24,6 +24,6 @@ data class ListPreference(override val props: ListProps) : SourcePreference() { override val defaultValue: String?, override val defaultValueType: String, val entries: List, - val entryValues: List + val entryValues: List, ) : Props } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/MultiSelectListPreference.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/MultiSelectListPreference.kt index aca73dc4..85f180b9 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/MultiSelectListPreference.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/MultiSelectListPreference.kt @@ -26,6 +26,6 @@ data class MultiSelectListPreference(override val props: MultiSelectListProps) : val dialogTitle: String?, val dialogMessage: String?, val entries: List, - val entryValues: List + val entryValues: List, ) : Props?> } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreferenceChange.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreferenceChange.kt index d78821a7..36da9304 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreferenceChange.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SourcePreferenceChange.kt @@ -19,6 +19,6 @@ data class SourcePreferenceChange(val position: Int, val value: String) { Json.encodeToString(value as List) } else { value.toString() - } + }, ) } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SwitchPreference.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SwitchPreference.kt index 00e27ecd..1398bb8c 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SwitchPreference.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/SwitchPreference.kt @@ -14,5 +14,5 @@ import kotlinx.serialization.Serializable @SerialName("SwitchPreferenceCompat") @Immutable data class SwitchPreference( - override val props: TwoStateProps + override val props: TwoStateProps, ) : SourcePreference() diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/TwoStateProps.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/TwoStateProps.kt index 066ad90b..6c42742d 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/TwoStateProps.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/model/sourcepreference/TwoStateProps.kt @@ -17,5 +17,5 @@ data class TwoStateProps( override val summary: String?, override val currentValue: Boolean?, override val defaultValue: Boolean?, - override val defaultValueType: String + override val defaultValueType: String, ) : Props diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/service/SourceRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/service/SourceRepository.kt index bd10bd04..4678ee11 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/service/SourceRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/source/service/SourceRepository.kt @@ -28,46 +28,46 @@ interface SourceRepository { @GET("api/v1/source/{sourceId}") fun getSourceInfo( - @Path("sourceId") sourceId: Long + @Path("sourceId") sourceId: Long, ): Flow @GET("api/v1/source/{sourceId}/popular/{pageNum}") fun getPopularManga( @Path("sourceId") sourceId: Long, - @Path("pageNum") pageNum: Int + @Path("pageNum") pageNum: Int, ): Flow @GET("api/v1/source/{sourceId}/latest/{pageNum}") fun getLatestManga( @Path("sourceId") sourceId: Long, - @Path("pageNum") pageNum: Int + @Path("pageNum") pageNum: Int, ): Flow @GET("api/v1/source/{sourceId}/search") fun getSearchResults( @Path("sourceId") sourceId: Long, @Query("searchTerm") searchTerm: String?, - @Query("pageNum") pageNum: Int + @Query("pageNum") pageNum: Int, ): Flow @GET("api/v1/source/{sourceId}/filters") fun getFilterList( @Path("sourceId") sourceId: Long, - @Query("reset") reset: Boolean = false + @Query("reset") reset: Boolean = false, ): Flow> @POST("api/v1/source/{sourceId}/filters") @Headers("Content-Type: application/json") fun setFilter( @Path("sourceId") sourceId: Long, - @Body sourceFilter: SourceFilterChange + @Body sourceFilter: SourceFilterChange, ): Flow @POST("api/v1/source/{sourceId}/filters") @Headers("Content-Type: application/json") fun setFilters( @Path("sourceId") sourceId: Long, - @Body sourceFilters: List + @Body sourceFilters: List, ): Flow @POST("api/v1/source/{sourceId}/quick-search") @@ -75,18 +75,18 @@ interface SourceRepository { fun getQuickSearchResults( @Path("sourceId") sourceId: Long, @Query("pageNum") pageNum: Int, - @Body filterData: SourceFilterData + @Body filterData: SourceFilterData, ): Flow @GET("api/v1/source/{sourceId}/preferences") fun getSourceSettings( - @Path("sourceId") sourceId: Long + @Path("sourceId") sourceId: Long, ): Flow> @POST("api/v1/source/{sourceId}/preferences") @Headers("Content-Type: application/json") fun setSourceSetting( @Path("sourceId") sourceId: Long, - @Body sourcePreference: SourcePreferenceChange + @Body sourcePreference: SourcePreferenceChange, ): Flow } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/StartScreen.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/StartScreen.kt index 659ec304..6507f54b 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/StartScreen.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/StartScreen.kt @@ -17,5 +17,5 @@ enum class StartScreen { // History, Sources, - Extensions + Extensions, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/ThemeMode.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/ThemeMode.kt index 1e5c0526..420d8315 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/ThemeMode.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/ThemeMode.kt @@ -14,5 +14,5 @@ import kotlinx.serialization.Serializable enum class ThemeMode { System, Light, - Dark + Dark, } diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/WindowSettings.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/WindowSettings.kt index a1444f91..5a455599 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/WindowSettings.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/ui/model/WindowSettings.kt @@ -17,5 +17,5 @@ data class WindowSettings( val width: Int? = null, val height: Int? = null, val maximized: Boolean? = null, - val fullscreen: Boolean? = null + val fullscreen: Boolean? = null, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/interactor/UpdateChecker.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/interactor/UpdateChecker.kt index 1b386926..e4b7fef2 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/interactor/UpdateChecker.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/interactor/UpdateChecker.kt @@ -23,7 +23,7 @@ import org.lighthousegames.logging.logging class UpdateChecker @Inject constructor( private val updatePreferences: UpdatePreferences, - private val client: Http + private val client: Http, ) { suspend fun await(manualFetch: Boolean, onError: suspend (Throwable) -> Unit = {}) = asFlow(manualFetch) .catch { @@ -35,7 +35,7 @@ class UpdateChecker @Inject constructor( fun asFlow(manualFetch: Boolean) = flow { if (!manualFetch && !updatePreferences.enabled().get()) return@flow val latestRelease = client.get( - "https://api.github.com/repos/$GITHUB_REPO/releases/latest" + "https://api.github.com/repos/$GITHUB_REPO/releases/latest", ).body() if (isNewVersion(latestRelease.version)) { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/interactor/UpdatesPager.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/interactor/UpdatesPager.kt index 99e6d8e5..55347cd7 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/interactor/UpdatesPager.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/interactor/UpdatesPager.kt @@ -41,7 +41,7 @@ class UpdatesPager @Inject constructor( private val getRecentUpdates: GetRecentUpdates, private val getManga: GetManga, private val getChapter: GetChapter, - private val serverListeners: ServerListeners + private val serverListeners: ServerListeners, ) : CoroutineScope by CoroutineScope(Dispatchers.Default + SupervisorJob()) { private val updatesMutex = Mutex() @@ -53,8 +53,8 @@ class UpdatesPager @Inject constructor( Updates.Date( Instant.fromEpochSeconds(first.fetchedAt) .toLocalDateTime(TimeZone.currentSystemDefault()) - .date - ) + .date, + ), ) } + newUpdates.fold(emptyList()) { list, (manga, chapter) -> val date = (list.lastOrNull() as? Updates.Update)?.let { @@ -136,14 +136,14 @@ class UpdatesPager @Inject constructor( val updates = combine( foldedUpdates, changedManga, - changedChapters + changedChapters, ) { updates, changedManga, changedChapters -> updates.map { when (it) { is Updates.Date -> it is Updates.Update -> it.copy( manga = changedManga[it.manga.id] ?: it.manga, - chapter = changedChapters[it.chapter.id] ?: it.chapter + chapter = changedChapters[it.chapter.id] ?: it.chapter, ) } } @@ -165,7 +165,7 @@ class UpdatesPager @Inject constructor( fun loadNextPage( onComplete: (() -> Unit)? = null, - onError: suspend (Throwable) -> Unit + onError: suspend (Throwable) -> Unit, ) { launch { if (hasNextPage.value && updatesMutex.tryLock()) { diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/GithubRelease.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/GithubRelease.kt index c776bf37..7df79b2f 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/GithubRelease.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/GithubRelease.kt @@ -15,5 +15,5 @@ import kotlinx.serialization.Serializable data class GithubRelease( @SerialName("tag_name") val version: String, @SerialName("body") val info: String, - @SerialName("html_url") val releaseLink: String + @SerialName("html_url") val releaseLink: String, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/MangaAndChapter.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/MangaAndChapter.kt index 14fa4373..6b8ca8d3 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/MangaAndChapter.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/MangaAndChapter.kt @@ -15,5 +15,5 @@ import kotlinx.serialization.Serializable @Immutable data class MangaAndChapter( val manga: Manga, - val chapter: Chapter + val chapter: Chapter, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/Updates.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/Updates.kt index 9930d289..28abdb17 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/Updates.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/model/Updates.kt @@ -13,5 +13,5 @@ import kotlinx.serialization.Serializable @Immutable data class Updates( val page: List, - val hasNextPage: Boolean + val hasNextPage: Boolean, ) diff --git a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/service/UpdatesRepository.kt b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/service/UpdatesRepository.kt index 25a8d74c..da395513 100644 --- a/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/service/UpdatesRepository.kt +++ b/domain/src/commonMain/kotlin/ca/gosyer/jui/domain/updates/service/UpdatesRepository.kt @@ -18,7 +18,7 @@ import kotlinx.coroutines.flow.Flow interface UpdatesRepository { @GET("api/v1/update/recentChapters/{pageNum}/") fun getRecentUpdates( - @Path("pageNum") pageNum: Int + @Path("pageNum") pageNum: Int, ): Flow @POST("api/v1/update/fetch/") @@ -27,6 +27,6 @@ interface UpdatesRepository { @POST("api/v1/update/fetch/") @FormUrlEncoded fun updateCategory( - @Field("category") categoryId: Long + @Field("category") categoryId: Long, ): Flow } diff --git a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerHostPreferences.kt b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerHostPreferences.kt index b8748a29..abb9cad7 100644 --- a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerHostPreferences.kt +++ b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerHostPreferences.kt @@ -98,7 +98,7 @@ class ServerHostPreferences(private val preferenceStore: PreferenceStore) { openInBrowserEnabled, basicAuthEnabled, basicAuthUsername, - basicAuthPassword + basicAuthPassword, ).mapNotNull { it.getProperty() }.toTypedArray() diff --git a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerService.kt b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerService.kt index 2cee329e..26d54f35 100644 --- a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerService.kt +++ b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/ServerService.kt @@ -40,7 +40,7 @@ import kotlin.io.path.isExecutable @OptIn(DelicateCoroutinesApi::class) class ServerService @Inject constructor( - private val serverHostPreferences: ServerHostPreferences + private val serverHostPreferences: ServerHostPreferences, ) { private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default) @@ -50,7 +50,7 @@ class ServerService @Inject constructor( ServerResult.STARTING } else { ServerResult.UNUSED - } + }, ) val initialized = _initialized.asStateFlow() private var process: Process? = null @@ -188,7 +188,7 @@ class ServerService @Inject constructor( thread(start = false) { process?.destroy() process = null - } + }, ) } @@ -196,7 +196,7 @@ class ServerService @Inject constructor( UNUSED, STARTING, STARTED, - FAILED + FAILED, } private companion object { diff --git a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt index 3dd08335..a3cd4977 100644 --- a/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt +++ b/domain/src/desktopMain/kotlin/ca/gosyer/jui/domain/server/service/host/ServerHostPreference.kt @@ -40,7 +40,7 @@ sealed class ServerHostPreference { override val preferenceStore: PreferenceStore, override val propertyName: String, override val defaultValue: String, - override val serverValue: String = defaultValue + override val serverValue: String = defaultValue, ) : ServerHostPreference() { override fun preference(): Preference { return preferenceStore.getString(propertyName, defaultValue) @@ -50,7 +50,7 @@ sealed class ServerHostPreference { override val preferenceStore: PreferenceStore, override val propertyName: String, override val defaultValue: Int, - override val serverValue: Int = defaultValue + override val serverValue: Int = defaultValue, ) : ServerHostPreference() { override fun preference(): Preference { return preferenceStore.getInt(propertyName, defaultValue) @@ -60,7 +60,7 @@ sealed class ServerHostPreference { override val preferenceStore: PreferenceStore, override val propertyName: String, override val defaultValue: Boolean, - override val serverValue: Boolean = defaultValue + override val serverValue: Boolean = defaultValue, ) : ServerHostPreference() { override fun preference(): Preference { return preferenceStore.getBoolean(propertyName, defaultValue) @@ -70,55 +70,55 @@ sealed class ServerHostPreference { class IP(preferenceStore: PreferenceStore) : StringServerHostPreference( preferenceStore, "ip", - "0.0.0.0" + "0.0.0.0", ) class Port(override val preferenceStore: PreferenceStore) : IntServerHostPreference( preferenceStore, "port", - 4567 + 4567, ) // Proxy class SocksProxyEnabled(preferenceStore: PreferenceStore) : BooleanServerHostPreference( preferenceStore, "socksProxyEnabled", - false + false, ) class SocksProxyHost(preferenceStore: PreferenceStore) : StringServerHostPreference( preferenceStore, "socksProxyHost", - "" + "", ) class SocksProxyPort(override val preferenceStore: PreferenceStore) : IntServerHostPreference( preferenceStore, "socksProxyPort", - 0 + 0, ) // Misc class DebugLogsEnabled(preferenceStore: PreferenceStore) : BooleanServerHostPreference( preferenceStore, "debugLogsEnabled", - false + false, ) class SystemTrayEnabled(preferenceStore: PreferenceStore) : BooleanServerHostPreference( preferenceStore, "systemTrayEnabled", false, - true + true, ) // Downloader class DownloadPath(preferenceStore: PreferenceStore) : StringServerHostPreference( preferenceStore, "downloadsPath", - "" + "", ) class DownloadAsCbz(preferenceStore: PreferenceStore) : BooleanServerHostPreference( preferenceStore, "downloadAsCbz", - false + false, ) // WebUI @@ -126,30 +126,30 @@ sealed class ServerHostPreference { preferenceStore, "webUIEnabled", false, - true + true, ) class OpenInBrowserEnabled(preferenceStore: PreferenceStore) : BooleanServerHostPreference( preferenceStore, "initialOpenInBrowserEnabled", false, - true + true, ) // Authentication class BasicAuthEnabled(preferenceStore: PreferenceStore) : BooleanServerHostPreference( preferenceStore, "basicAuthEnabled", - false + false, ) class BasicAuthUsername(preferenceStore: PreferenceStore) : StringServerHostPreference( preferenceStore, "basicAuthUsername", - "" + "", ) class BasicAuthPassword(preferenceStore: PreferenceStore) : StringServerHostPreference( preferenceStore, "basicAuthPassword", - "" + "", ) } diff --git a/ios/src/uikitMain/kotlin/ca/gosyer/jui/ios/AppComponent.kt b/ios/src/uikitMain/kotlin/ca/gosyer/jui/ios/AppComponent.kt index 39bc78f7..c313fc72 100644 --- a/ios/src/uikitMain/kotlin/ca/gosyer/jui/ios/AppComponent.kt +++ b/ios/src/uikitMain/kotlin/ca/gosyer/jui/ios/AppComponent.kt @@ -19,7 +19,7 @@ import me.tatarka.inject.annotations.Provides @Component abstract class AppComponent( @get:Provides - val context: ContextWrapper + val context: ContextWrapper, ) : ViewModelComponent, DataComponent, DomainComponent, UiComponent { abstract val appMigrations: AppMigrations diff --git a/ios/src/uikitMain/kotlin/ca/gosyer/jui/ios/AppMigrations.kt b/ios/src/uikitMain/kotlin/ca/gosyer/jui/ios/AppMigrations.kt index 792f80c5..3972dc20 100644 --- a/ios/src/uikitMain/kotlin/ca/gosyer/jui/ios/AppMigrations.kt +++ b/ios/src/uikitMain/kotlin/ca/gosyer/jui/ios/AppMigrations.kt @@ -13,7 +13,7 @@ import me.tatarka.inject.annotations.Inject class AppMigrations @Inject constructor( private val migrationPreferences: MigrationPreferences, - private val contextWrapper: ContextWrapper + private val contextWrapper: ContextWrapper, ) { fun runMigrations(): Boolean { diff --git a/ios/src/uikitMain/kotlin/ca/gosyer/jui/ios/Main.kt b/ios/src/uikitMain/kotlin/ca/gosyer/jui/ios/Main.kt index c9cf2109..7a8547d4 100644 --- a/ios/src/uikitMain/kotlin/ca/gosyer/jui/ios/Main.kt +++ b/ios/src/uikitMain/kotlin/ca/gosyer/jui/ios/Main.kt @@ -99,7 +99,7 @@ class SkikoAppDelegate @OverrideInit constructor() : UIResponder(), UIApplicatio modifier = Modifier .align(Alignment.BottomCenter) .padding(bottom = 64.dp), - context = context + context = context, ) } } @@ -128,7 +128,7 @@ fun ToastOverlay(modifier: Modifier, context: ContextWrapper) { Length.SHORT -> 2.seconds Length.LONG -> 5.seconds else -> Duration.ZERO - } + }, ) toast = null } @@ -136,13 +136,13 @@ fun ToastOverlay(modifier: Modifier, context: ContextWrapper) { @Suppress("NAME_SHADOWING") Crossfade( toast?.first, - modifier = modifier + modifier = modifier, ) { toast -> if (toast != null) { Card( Modifier.sizeIn(maxWidth = 200.dp), shape = CircleShape, - backgroundColor = Color.DarkGray + backgroundColor = Color.DarkGray, ) { Text( toast, @@ -151,7 +151,7 @@ fun ToastOverlay(modifier: Modifier, context: ContextWrapper) { maxLines = 2, overflow = TextOverflow.Ellipsis, fontSize = 12.sp, - textAlign = TextAlign.Center + textAlign = TextAlign.Center, ) } } diff --git a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/AndroidViewModelComponent.kt b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/AndroidViewModelComponent.kt index f1059214..9640057e 100644 --- a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/AndroidViewModelComponent.kt +++ b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/AndroidViewModelComponent.kt @@ -24,7 +24,7 @@ actual interface ViewModelComponent : SharedViewModelComponent @Composable actual inline fun Screen.realStateViewModel( tag: String?, - crossinline factory: @DisallowComposableCalls ViewModelComponent.(SavedStateHandle) -> VM + crossinline factory: @DisallowComposableCalls ViewModelComponent.(SavedStateHandle) -> VM, ): VM { val viewModelFactory = LocalViewModels.current val lifecycle = LocalLifecycleOwner.current as AndroidScreenLifecycleOwner diff --git a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/base/components/AndroidTooltipArea.kt b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/base/components/AndroidTooltipArea.kt index 1fb4940c..c35d5e0b 100644 --- a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/base/components/AndroidTooltipArea.kt +++ b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/base/components/AndroidTooltipArea.kt @@ -18,13 +18,13 @@ actual interface TooltipPlacement actual class CursorPointImpl actual constructor( offset: DpOffset, alignment: Alignment, - windowMargin: Dp + windowMargin: Dp, ) : TooltipPlacement actual class ComponentRectImpl actual constructor( anchor: Alignment, alignment: Alignment, - offset: DpOffset + offset: DpOffset, ) : TooltipPlacement @Composable @@ -33,7 +33,7 @@ internal actual fun RealTooltipArea( modifier: Modifier, delayMillis: Int, tooltipPlacement: TooltipPlacement, - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { Box(Modifier) { content() diff --git a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/base/file/AndroidFileSaver.kt b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/base/file/AndroidFileSaver.kt index 69cb768f..bdc00059 100644 --- a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/base/file/AndroidFileSaver.kt +++ b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/base/file/AndroidFileSaver.kt @@ -18,7 +18,7 @@ import okio.Sink import okio.sink actual class FileSaver( - private val resultLauncher: ManagedActivityResultLauncher + private val resultLauncher: ManagedActivityResultLauncher, ) { actual fun save(name: String) { resultLauncher.launch(name) @@ -30,7 +30,7 @@ actual class FileSaver( internal actual fun realRememberFileSaver( onFileSelected: (Sink) -> Unit, onCancel: () -> Unit, - onError: () -> Unit + onError: () -> Unit, ): FileSaver { val context = LocalContext.current val result = rememberLauncherForActivityResult(ActivityResultContracts.CreateDocument()) { diff --git a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/base/state/SavedStateHandleSupport.kt b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/base/state/SavedStateHandleSupport.kt index ef331c59..fdc249ba 100644 --- a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/base/state/SavedStateHandleSupport.kt +++ b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/base/state/SavedStateHandleSupport.kt @@ -35,7 +35,7 @@ private fun createSavedStateHandle( savedStateRegistryOwner: SavedStateRegistryOwner, viewModelStoreOwner: ViewModelStoreOwner, key: String, - defaultArgs: Bundle? + defaultArgs: Bundle?, ): SavedStateHandle { val provider = savedStateRegistryOwner.savedStateHandlesProvider // If we already have a reference to a previously created SavedStateHandle @@ -51,7 +51,7 @@ private fun createSavedStateHandle( return handles[key] ?: SavedStateHandle.createHandle( provider.consumeRestoredStateForKey(key), - defaultArgs + defaultArgs, ).also { handles[key] = it } } @@ -72,21 +72,21 @@ private fun createSavedStateHandle( fun CreationExtras.createSavedStateHandle(): SavedStateHandle { val savedStateRegistryOwner = this[SAVED_STATE_REGISTRY_OWNER_KEY] ?: throw IllegalArgumentException( - "CreationExtras must have a value by `SAVED_STATE_REGISTRY_OWNER_KEY`" + "CreationExtras must have a value by `SAVED_STATE_REGISTRY_OWNER_KEY`", ) val viewModelStateRegistryOwner = this[VIEW_MODEL_STORE_OWNER_KEY] ?: throw IllegalArgumentException( - "CreationExtras must have a value by `VIEW_MODEL_STORE_OWNER_KEY`" + "CreationExtras must have a value by `VIEW_MODEL_STORE_OWNER_KEY`", ) val defaultArgs = this[DEFAULT_ARGS_KEY] val key = this[VIEW_MODEL_KEY] ?: throw IllegalArgumentException( - "CreationExtras must have a value by `VIEW_MODEL_KEY`" + "CreationExtras must have a value by `VIEW_MODEL_KEY`", ) return createSavedStateHandle( savedStateRegistryOwner, viewModelStateRegistryOwner, key, - defaultArgs + defaultArgs, ) } @@ -94,7 +94,7 @@ internal val SavedStateRegistryOwner.savedStateHandlesProvider: SavedStateHandle get() = savedStateRegistry.getSavedStateProvider(SAVED_STATE_KEY)?.let(::SavedStateHandlesProvider) ?: throw IllegalStateException( "enableSavedStateHandles() wasn't called " + - "prior to createSavedStateHandle() call" + "prior to createSavedStateHandle() call", ) /** @@ -102,7 +102,7 @@ internal val SavedStateRegistryOwner.savedStateHandlesProvider: SavedStateHandle * SavedStateHandle associated with the SavedState/ViewModel pair. */ internal class SavedStateHandlesProvider( - private val savedStateRegistry: SavedStateRegistry.SavedStateProvider + private val savedStateRegistry: SavedStateRegistry.SavedStateProvider, ) { /** * Restore the state associated with a particular SavedStateHandle, identified by its [key] @@ -119,7 +119,7 @@ inline fun CreationExtras.addScreenModelKey(screen: Sc return MutableCreationExtras(this).apply { set( VIEW_MODEL_KEY, - "${screen.key}:${T::class.qualifiedName}:${tag ?: "default"}" + "${screen.key}:${T::class.qualifiedName}:${tag ?: "default"}", ) } } diff --git a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/downloads/AndroidDownloadService.kt b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/downloads/AndroidDownloadService.kt index efd5471c..d56532df 100644 --- a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/downloads/AndroidDownloadService.kt +++ b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/downloads/AndroidDownloadService.kt @@ -15,11 +15,11 @@ import ca.gosyer.jui.uicore.vm.ContextWrapper internal actual fun startDownloadService( contextWrapper: ContextWrapper, downloadService: DownloadService, - actions: WebsocketService.Actions + actions: WebsocketService.Actions, ) { val intent = Intent( contextWrapper, - Class.forName("ca.gosyer.jui.android.data.download.AndroidDownloadService") + Class.forName("ca.gosyer.jui.android.data.download.AndroidDownloadService"), ).apply { action = actions.name } diff --git a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/library/components/AndroidLibraryGrid.kt b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/library/components/AndroidLibraryGrid.kt index cb682a20..8e704065 100644 --- a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/library/components/AndroidLibraryGrid.kt +++ b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/library/components/AndroidLibraryGrid.kt @@ -21,21 +21,21 @@ import ca.gosyer.jui.uicore.resources.stringResource actual fun Modifier.libraryMangaModifier( onClickManga: () -> Unit, - onClickRemoveManga: () -> Unit + onClickRemoveManga: () -> Unit, ): Modifier = composed { var expanded by remember { mutableStateOf(false) } DropdownMenu( expanded, - onDismissRequest = { expanded = false } + onDismissRequest = { expanded = false }, ) { listOf( - stringResource(MR.strings.action_remove_favorite) to onClickRemoveManga + stringResource(MR.strings.action_remove_favorite) to onClickRemoveManga, ).forEach { (label, onClick) -> DropdownMenuItem( onClick = { expanded = false onClick() - } + }, ) { Text(text = label) } @@ -46,6 +46,6 @@ actual fun Modifier.libraryMangaModifier( onClick = { onClickManga() }, onLongClick = { expanded = true - } + }, ) } diff --git a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/AndroidLicenses.kt b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/AndroidLicenses.kt index d357fae5..14c51e84 100644 --- a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/AndroidLicenses.kt +++ b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/AndroidLicenses.kt @@ -19,7 +19,7 @@ actual fun getLicenses(): Libs? { val context = LocalContext.current val libs by produceState( null, - context + context, ) { withIOContext { value = Libs.Builder().withContext(context).build() diff --git a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/main/components/AndroidLibraryUpdatesService.kt b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/main/components/AndroidLibraryUpdatesService.kt index e1d5501b..3a651895 100644 --- a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/main/components/AndroidLibraryUpdatesService.kt +++ b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/main/components/AndroidLibraryUpdatesService.kt @@ -15,11 +15,11 @@ import ca.gosyer.jui.uicore.vm.ContextWrapper internal actual fun startLibraryUpdatesService( contextWrapper: ContextWrapper, libraryUpdatesService: LibraryUpdateService, - actions: WebsocketService.Actions + actions: WebsocketService.Actions, ) { val intent = Intent( contextWrapper, - Class.forName("ca.gosyer.jui.android.data.library.AndroidLibraryService") + Class.forName("ca.gosyer.jui.android.data.library.AndroidLibraryService"), ).apply { action = actions.name } diff --git a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/manga/components/AndroidChapterItem.kt b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/manga/components/AndroidChapterItem.kt index 17d90f07..d45c8c95 100644 --- a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/manga/components/AndroidChapterItem.kt +++ b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/manga/components/AndroidChapterItem.kt @@ -17,8 +17,8 @@ actual fun Modifier.chapterItemModifier( unBookmarkChapter: (() -> Unit)?, markPreviousAsRead: () -> Unit, onSelectChapter: (() -> Unit)?, - onUnselectChapter: (() -> Unit)? + onUnselectChapter: (() -> Unit)?, ): Modifier = combinedClickable( onClick = onUnselectChapter ?: onClick, - onLongClick = onSelectChapter + onLongClick = onSelectChapter, ) diff --git a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/reader/AndroidReaderMenu.kt b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/reader/AndroidReaderMenu.kt index 1c3d0f4c..2d55d1d5 100644 --- a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/reader/AndroidReaderMenu.kt +++ b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/reader/AndroidReaderMenu.kt @@ -15,7 +15,7 @@ import androidx.compose.ui.platform.LocalContext actual class ReaderLauncher(private val context: Context) { actual fun launch( chapterIndex: Int, - mangaId: Long + mangaId: Long, ) { Intent(context, Class.forName("ca.gosyer.jui.android.ReaderActivity")).apply { putExtra("manga", mangaId) diff --git a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/sources/components/AndroidSourcesMenu.kt b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/sources/components/AndroidSourcesMenu.kt index 60cacfaf..ec473745 100644 --- a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/sources/components/AndroidSourcesMenu.kt +++ b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/sources/components/AndroidSourcesMenu.kt @@ -11,7 +11,7 @@ import androidx.compose.ui.Modifier actual fun Modifier.sourceSideMenuItem( onSourceTabClick: () -> Unit, - onSourceCloseTabClick: () -> Unit + onSourceCloseTabClick: () -> Unit, ): Modifier = clickable( - onClick = onSourceTabClick + onClick = onSourceTabClick, ) diff --git a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/updates/components/AndroidUpdatesItem.kt b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/updates/components/AndroidUpdatesItem.kt index cfc27fb2..f5f23e0d 100644 --- a/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/updates/components/AndroidUpdatesItem.kt +++ b/presentation/src/androidMain/kotlin/ca/gosyer/jui/ui/updates/components/AndroidUpdatesItem.kt @@ -16,8 +16,8 @@ actual fun Modifier.updatesItemModifier( bookmarkChapter: (() -> Unit)?, unBookmarkChapter: (() -> Unit)?, onSelectChapter: (() -> Unit)?, - onUnselectChapter: (() -> Unit)? + onUnselectChapter: (() -> Unit)?, ): Modifier = combinedClickable( onClick = onUnselectChapter ?: onClick, - onLongClick = onSelectChapter + onLongClick = onSelectChapter, ) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/ViewModelComponent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/ViewModelComponent.kt index 5d137e44..244bbf41 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/ViewModelComponent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/ViewModelComponent.kt @@ -74,19 +74,19 @@ expect interface ViewModelComponent : SharedViewModelComponent @Composable inline fun Screen.stateViewModel( tag: String? = null, - crossinline factory: @DisallowComposableCalls ViewModelComponent.(SavedStateHandle) -> VM + crossinline factory: @DisallowComposableCalls ViewModelComponent.(SavedStateHandle) -> VM, ): VM = realStateViewModel(tag, factory) @Composable expect inline fun Screen.realStateViewModel( tag: String?, - crossinline factory: @DisallowComposableCalls ViewModelComponent.(SavedStateHandle) -> VM + crossinline factory: @DisallowComposableCalls ViewModelComponent.(SavedStateHandle) -> VM, ): VM @Composable inline fun Screen.viewModel( tag: String? = null, - crossinline factory: @DisallowComposableCalls ViewModelComponent.() -> VM + crossinline factory: @DisallowComposableCalls ViewModelComponent.() -> VM, ): VM { val viewModelFactory = LocalViewModels.current return rememberScreenModel(tag) { viewModelFactory.factory() } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/UiComponent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/UiComponent.kt index af79e9e3..7802c3eb 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/UiComponent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/UiComponent.kt @@ -48,7 +48,7 @@ interface UiComponent { @Provides fun getHooks(viewModelComponent: ViewModelComponent) = arrayOf( LocalViewModels provides viewModelComponent, - LocalImageLoader provides imageLoader + LocalImageLoader provides imageLoader, ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/chapter/ChapterDownloadButtons.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/chapter/ChapterDownloadButtons.kt index 69d7e0a1..888210d3 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/chapter/ChapterDownloadButtons.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/chapter/ChapterDownloadButtons.kt @@ -48,7 +48,7 @@ import kotlinx.coroutines.flow.asStateFlow @Stable data class ChapterDownloadItem( val manga: Manga?, - val chapter: Chapter + val chapter: Chapter, ) { private val _isSelected = MutableStateFlow(false) val isSelected = _isSelected.asStateFlow() @@ -57,7 +57,7 @@ data class ChapterDownloadItem( when (chapter.downloaded) { true -> ChapterDownloadState.Downloaded false -> ChapterDownloadState.NotDownloaded - } + }, ) val downloadState = _downloadState.asStateFlow() @@ -99,7 +99,7 @@ data class ChapterDownloadItem( enum class ChapterDownloadState { NotDownloaded, Downloading, - Downloaded + Downloaded, } @Composable @@ -107,7 +107,7 @@ fun ChapterDownloadIcon( chapter: ChapterDownloadItem, onClickDownload: (Chapter) -> Unit, onClickStop: (Chapter) -> Unit, - onClickDelete: (Chapter) -> Unit + onClickDelete: (Chapter) -> Unit, ) { val downloadChapter by chapter.downloadChapterFlow.collectAsState() val downloadState by chapter.downloadState.collectAsState() @@ -116,13 +116,13 @@ fun ChapterDownloadIcon( ChapterDownloadState.Downloaded -> { DownloadedIconButton( chapter.chapter.mangaId to chapter.chapter.index, - onClick = { onClickDelete(chapter.chapter) } + onClick = { onClickDelete(chapter.chapter) }, ) } ChapterDownloadState.Downloading -> { DownloadingIconButton( downloadChapter, - onClick = { onClickStop(chapter.chapter) } + onClick = { onClickStop(chapter.chapter) }, ) } ChapterDownloadState.NotDownloaded -> { @@ -135,11 +135,11 @@ fun ChapterDownloadIcon( private fun DownloadIconButton(onClick: () -> Unit) { IconButton( onClick = onClick, - modifier = Modifier.fillMaxHeight() + modifier = Modifier.fillMaxHeight(), ) { Surface( shape = CircleShape, - border = BorderStroke(2.dp, LocalContentColor.current.copy(alpha = ContentAlpha.disabled)) + border = BorderStroke(2.dp, LocalContentColor.current.copy(alpha = ContentAlpha.disabled)), ) { Icon( Icons.Rounded.ArrowDownward, @@ -147,7 +147,7 @@ private fun DownloadIconButton(onClick: () -> Unit) { Modifier .size(22.dp) .padding(2.dp), - LocalContentColor.current.copy(alpha = ContentAlpha.disabled) + LocalContentColor.current.copy(alpha = ContentAlpha.disabled), ) } } @@ -161,7 +161,7 @@ private fun DownloadingIconButton(downloadChapter: DownloadChapter?, onClick: () DropdownMenuItem(onClick = onClick) { Text(stringResource(MR.strings.action_cancel)) } - } + }, ) { when (downloadChapter?.state) { null, DownloadState.Queued -> CircularProgressIndicator( @@ -169,12 +169,12 @@ private fun DownloadingIconButton(downloadChapter: DownloadChapter?, onClick: () .size(26.dp) .padding(2.dp), LocalContentColor.current.copy(alpha = ContentAlpha.disabled), - 2.dp + 2.dp, ) DownloadState.Downloading -> if (downloadChapter.progress != 0.0F) { val animatedProgress by animateFloatAsState( targetValue = downloadChapter.progress, - animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec + animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec, ) CircularProgressIndicator( animatedProgress, @@ -182,7 +182,7 @@ private fun DownloadingIconButton(downloadChapter: DownloadChapter?, onClick: () .size(26.dp) .padding(2.dp), LocalContentColor.current.copy(alpha = ContentAlpha.disabled), - 2.dp + 2.dp, ) Icon( Icons.Rounded.ArrowDownward, @@ -190,7 +190,7 @@ private fun DownloadingIconButton(downloadChapter: DownloadChapter?, onClick: () Modifier .size(22.dp) .padding(2.dp), - LocalContentColor.current.copy(alpha = ContentAlpha.disabled) + LocalContentColor.current.copy(alpha = ContentAlpha.disabled), ) } else { CircularProgressIndicator( @@ -198,7 +198,7 @@ private fun DownloadingIconButton(downloadChapter: DownloadChapter?, onClick: () .size(26.dp) .padding(2.dp), LocalContentColor.current.copy(alpha = ContentAlpha.disabled), - 2.dp + 2.dp, ) } DownloadState.Error -> Surface(shape = CircleShape, color = LocalContentColor.current) { @@ -208,7 +208,7 @@ private fun DownloadingIconButton(downloadChapter: DownloadChapter?, onClick: () Modifier .size(22.dp) .padding(2.dp), - Color.Red + Color.Red, ) } DownloadState.Finished -> Surface(shape = CircleShape, color = LocalContentColor.current) { @@ -218,7 +218,7 @@ private fun DownloadingIconButton(downloadChapter: DownloadChapter?, onClick: () Modifier .size(22.dp) .padding(2.dp), - MaterialTheme.colors.surface + MaterialTheme.colors.surface, ) } } @@ -233,7 +233,7 @@ private fun DownloadedIconButton(chapter: Pair, onClick: () -> Unit) DropdownMenuItem(onClick = onClick) { Text(stringResource(MR.strings.action_delete)) } - } + }, ) { Surface(shape = CircleShape, color = LocalContentColor.current) { Icon( @@ -242,7 +242,7 @@ private fun DownloadedIconButton(chapter: Pair, onClick: () -> Unit) Modifier .size(22.dp) .padding(2.dp), - MaterialTheme.colors.surface + MaterialTheme.colors.surface, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/components/TooltipArea.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/components/TooltipArea.kt index 96c26540..089698ff 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/components/TooltipArea.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/components/TooltipArea.kt @@ -20,27 +20,27 @@ expect interface TooltipPlacement fun CursorPoint( offset: DpOffset = DpOffset.Zero, alignment: Alignment = Alignment.BottomEnd, - windowMargin: Dp = 4.dp + windowMargin: Dp = 4.dp, ) = CursorPointImpl(offset, alignment, windowMargin) @ExperimentalFoundationApi expect class CursorPointImpl( offset: DpOffset, alignment: Alignment, - windowMargin: Dp + windowMargin: Dp, ) : TooltipPlacement fun ComponentRect( anchor: Alignment = Alignment.BottomCenter, alignment: Alignment = Alignment.BottomCenter, - offset: DpOffset = DpOffset.Zero + offset: DpOffset = DpOffset.Zero, ) = ComponentRectImpl(anchor, alignment, offset) @ExperimentalFoundationApi expect class ComponentRectImpl( anchor: Alignment, alignment: Alignment, - offset: DpOffset + offset: DpOffset, ) : TooltipPlacement @OptIn(ExperimentalFoundationApi::class) @@ -50,15 +50,15 @@ fun TooltipArea( modifier: Modifier = Modifier, delayMillis: Int = 500, tooltipPlacement: TooltipPlacement = CursorPoint( - offset = DpOffset(0.dp, 16.dp) + offset = DpOffset(0.dp, 16.dp), ), - content: @Composable () -> Unit + content: @Composable () -> Unit, ) = RealTooltipArea( tooltip = tooltip, modifier = modifier, delayMillis = delayMillis, tooltipPlacement = tooltipPlacement, - content = content + content = content, ) @OptIn(ExperimentalFoundationApi::class) @@ -68,5 +68,5 @@ internal expect fun RealTooltipArea( modifier: Modifier, delayMillis: Int, tooltipPlacement: TooltipPlacement, - content: @Composable () -> Unit + content: @Composable () -> Unit, ) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/dialog/MaterialDialogProperties.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/dialog/MaterialDialogProperties.kt index e4449fbb..0156ac30 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/dialog/MaterialDialogProperties.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/dialog/MaterialDialogProperties.kt @@ -28,7 +28,7 @@ fun getMaterialDialogProperties( size: DpSize = DpSize(400.dp, 300.dp), title: String = BuildKonfig.NAME, icon: Painter = MR.images.icon.toPainter(), - resizable: Boolean = true + resizable: Boolean = true, ): MaterialDialogProperties { return MaterialDialogProperties( dismissOnBackPress = dismissOnBackPress, @@ -39,6 +39,6 @@ fun getMaterialDialogProperties( size = size, title = title, icon = icon, - resizable = resizable + resizable = resizable, ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/file/FileSaver.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/file/FileSaver.kt index 00b10616..736ab0b6 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/file/FileSaver.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/file/FileSaver.kt @@ -17,16 +17,16 @@ expect class FileSaver { fun rememberFileSaver( onFileSelected: (Sink) -> Unit, onCancel: () -> Unit = {}, - onError: () -> Unit = {} + onError: () -> Unit = {}, ): FileSaver = realRememberFileSaver( onFileSelected = onFileSelected, onCancel = onCancel, - onError = onError + onError = onError, ) @Composable internal expect fun realRememberFileSaver( onFileSelected: (Sink) -> Unit, onCancel: () -> Unit, - onError: () -> Unit + onError: () -> Unit, ): FileSaver diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/image/ImageLoaderProvider.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/image/ImageLoaderProvider.kt index 2c7d3bc9..590e7a7c 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/image/ImageLoaderProvider.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/image/ImageLoaderProvider.kt @@ -28,7 +28,7 @@ import me.tatarka.inject.annotations.Inject class ImageLoaderProvider @Inject constructor( private val http: Http, serverPreferences: ServerPreferences, - private val context: ContextWrapper + private val context: ContextWrapper, ) { @OptIn(DelicateCoroutinesApi::class) val serverUrl = serverPreferences.serverUrl().stateIn(GlobalScope) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/navigation/ActionMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/navigation/ActionMenu.kt index fdee7882..6fce7d3f 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/navigation/ActionMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/navigation/ActionMenu.kt @@ -48,7 +48,7 @@ sealed class Action { data class ActionGroup( override val name: String, override val icon: ImageVector? = null, - val actions: ImmutableList + val actions: ImmutableList, ) : Action() @Stable @@ -57,7 +57,7 @@ data class ActionItem( override val icon: ImageVector? = null, override val overflowMode: OverflowMode = OverflowMode.IF_NECESSARY, override val enabled: Boolean = true, - val doAction: () -> Unit + val doAction: () -> Unit, ) : Action() { // allow 'calling' the action like a function operator fun invoke() = doAction() @@ -74,7 +74,7 @@ fun ActionMenu( items: ImmutableList, numIcons: Int = 3, // includes overflow menu icon; may be overridden by NEVER_OVERFLOW menuVisible: MutableState = remember { mutableStateOf(false) }, - iconItem: @Composable (onClick: () -> Unit, name: String, icon: ImageVector, enabled: Boolean) -> Unit + iconItem: @Composable (onClick: () -> Unit, name: String, icon: ImageVector, enabled: Boolean) -> Unit, ) { if (items.isEmpty()) { return @@ -99,11 +99,11 @@ fun ActionMenu( is ActionGroup -> { { openGroup = item } } is ActionItem -> item.doAction }, - enabled = item.enabled + enabled = item.enabled, ) { Text( text = item.name, - color = MaterialTheme.colors.onPrimary.copy(alpha = LocalContentAlpha.current) + color = MaterialTheme.colors.onPrimary.copy(alpha = LocalContentAlpha.current), ) } } @@ -115,12 +115,12 @@ fun ActionMenu( { menuVisible.value = true }, stringResource(MR.strings.action_more_actions), Icons.Default.MoreVert, - true + true, ) DropdownMenu( expanded = menuVisible.value, onDismissRequest = { menuVisible.value = false }, - offset = DpOffset(8.dp, (-56).dp) + offset = DpOffset(8.dp, (-56).dp), ) { overflowActions.fastForEach { item -> key(item.hashCode()) { @@ -132,7 +132,7 @@ fun ActionMenu( is ActionItem -> item() } }, - enabled = item.enabled + enabled = item.enabled, ) { // Icon(item.icon, item.name) just have text in the overflow menu Text(item.name) @@ -144,7 +144,7 @@ fun ActionMenu( DropdownMenu( openGroup != null, onDismissRequest = { openGroup = null }, - offset = DpOffset(8.dp, (-56).dp) + offset = DpOffset(8.dp, (-56).dp), ) { openGroup?.actions?.fastForEach { item -> key(item.hashCode()) { @@ -158,7 +158,7 @@ fun ActionMenu( } } }, - enabled = item.enabled + enabled = item.enabled, ) { // Icon(item.icon, item.name) just have text in the overflow menu Text(item.name) @@ -170,7 +170,7 @@ fun ActionMenu( private fun separateIntoIconAndOverflow( items: ImmutableList, - numIcons: Int + numIcons: Int, ): Pair, List> { var (iconCount, overflowCount, preferIconCount) = Triple(0, 0, 0) for (item in items) { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/navigation/DisplayController.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/navigation/DisplayController.kt index 4d66072e..89b4e24b 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/navigation/DisplayController.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/navigation/DisplayController.kt @@ -17,7 +17,7 @@ val LocalDisplayController = compositionLocalOf { null } class DisplayController( - private val _sideMenuVisible: MutableState = mutableStateOf(true) + private val _sideMenuVisible: MutableState = mutableStateOf(true), ) { val sideMenuVisible by _sideMenuVisible @@ -33,6 +33,6 @@ class DisplayController( fun withDisplayController(controller: DisplayController, content: @Composable () -> Unit) { CompositionLocalProvider( LocalDisplayController provides controller, - content = content + content = content, ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/navigation/Toolbar.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/navigation/Toolbar.kt index c3091d06..cd31bb23 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/navigation/Toolbar.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/navigation/Toolbar.kt @@ -93,7 +93,7 @@ fun Toolbar( elevation: Dp = Dp.Hairline, searchText: String? = null, search: ((String) -> Unit)? = null, - searchSubmit: (() -> Unit)? = null + searchSubmit: (() -> Unit)? = null, ) { BoxWithConstraints { if (maxWidth > 600.dp) { @@ -109,7 +109,7 @@ fun Toolbar( elevation = elevation, searchText = searchText, search = search, - searchSubmit = searchSubmit + searchSubmit = searchSubmit, ) } else { ThinToolbar( @@ -124,7 +124,7 @@ fun Toolbar( elevation = elevation, searchText = searchText, search = search, - searchSubmit = searchSubmit + searchSubmit = searchSubmit, ) } } @@ -143,28 +143,28 @@ private fun WideToolbar( elevation: Dp, searchText: String?, search: ((String) -> Unit)?, - searchSubmit: (() -> Unit)? + searchSubmit: (() -> Unit)?, ) { Surface( modifier = modifier, elevation = elevation, shape = RectangleShape, color = backgroundColor, - contentColor = contentColor + contentColor = contentColor, ) { Row( Modifier.fillMaxWidth().padding(start = 16.dp, end = 4.dp).height(72.dp), horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { Row( Modifier.fillMaxHeight().animateContentSize(), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { val displayController = LocalDisplayController.current if (displayController != null) { AnimatedVisibility( - !displayController.sideMenuVisible + !displayController.sideMenuVisible, ) { ActionIcon(displayController::openSideMenu, "Open nav", Icons.Rounded.Sort) } @@ -185,14 +185,14 @@ private fun WideToolbar( onClick = onClick, text = name, icon = icon, - enabled = enabled + enabled = enabled, ) } if (closable) { TextActionIcon( onClick = onClose, text = stringResource(MR.strings.action_close), - icon = if (closeIcon === ToolbarDefault) Icons.Rounded.Close else closeIcon + icon = if (closeIcon === ToolbarDefault) Icons.Rounded.Close else closeIcon, ) } } @@ -213,7 +213,7 @@ private fun ThinToolbar( elevation: Dp, searchText: String?, search: ((String) -> Unit)?, - searchSubmit: (() -> Unit)? + searchSubmit: (() -> Unit)?, ) { var searchMode by remember { mutableStateOf(!searchText.isNullOrEmpty()) } fun closeSearch() { @@ -227,7 +227,7 @@ private fun ThinToolbar( contentColor = contentColor, elevation = elevation, shape = RectangleShape, - modifier = modifier + modifier = modifier, ) { CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { Row( @@ -235,14 +235,14 @@ private fun ThinToolbar( .padding(AppBarDefaults.ContentPadding) .height(56.dp), horizontalArrangement = Arrangement.Start, - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { if (!closable && !searchMode) { Spacer(Modifier.width(12.dp)) } else { Row(Modifier.width(68.dp), verticalAlignment = Alignment.CenterVertically) { CompositionLocalProvider( - LocalContentAlpha provides ContentAlpha.high + LocalContentAlpha provides ContentAlpha.high, ) { IconButton( onClick = { @@ -251,11 +251,11 @@ private fun ThinToolbar( } else { onClose() } - } + }, ) { Icon( if (closeIcon === ToolbarDefault) Icons.Rounded.ArrowBack else closeIcon, - stringResource(MR.strings.action_close) + stringResource(MR.strings.action_close), ) } } @@ -265,7 +265,7 @@ private fun ThinToolbar( if (searchMode) { Row( Modifier.fillMaxHeight().weight(1f), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { val focusManager = LocalFocusManager.current BasicTextField( @@ -289,23 +289,23 @@ private fun ThinToolbar( if (searchText.isNullOrEmpty()) { Text( stringResource(MR.strings.action_searching), - color = LocalTextStyle.current.color.copy(alpha = ContentAlpha.medium) + color = LocalTextStyle.current.color.copy(alpha = ContentAlpha.medium), ) } innerTextField() } }, - keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search) + keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search), ) } } else { Row( Modifier.fillMaxHeight().weight(1f), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { ProvideTextStyle(value = MaterialTheme.typography.h6) { CompositionLocalProvider( - LocalContentAlpha provides ContentAlpha.high + LocalContentAlpha provides ContentAlpha.high, ) { Text(name, maxLines = 1, overflow = TextOverflow.Ellipsis) } @@ -317,7 +317,7 @@ private fun ThinToolbar( Row( Modifier.fillMaxHeight(), horizontalArrangement = Arrangement.End, - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { if (search != null && !searchMode) { IconButton(onClick = { searchMode = true }) { @@ -330,7 +330,7 @@ private fun ThinToolbar( 1 } else { 3 - } + }, ) { onClick: () -> Unit, name: String, icon: ImageVector, enabled: Boolean -> IconButton(onClick = onClick, enabled = enabled) { Icon(icon, name) @@ -348,7 +348,7 @@ private fun SearchBox( contentColor: Color, searchText: String?, search: ((String) -> Unit)?, - searchSubmit: (() -> Unit)? + searchSubmit: (() -> Unit)?, ) { Card( Modifier.fillMaxHeight() @@ -356,7 +356,7 @@ private fun SearchBox( .padding(8.dp), shape = RoundedCornerShape(4.dp), elevation = 2.dp, - border = BorderStroke(1.dp, MaterialTheme.colors.primary) + border = BorderStroke(1.dp, MaterialTheme.colors.primary), ) { Box(Modifier.fillMaxSize().padding(8.dp), Alignment.CenterStart) { BasicTextField( @@ -370,7 +370,7 @@ private fun SearchBox( }, textStyle = TextStyle(contentColor, 18.sp), cursorBrush = SolidColor(contentColor.copy(alpha = 0.50F)), - keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search) + keyboardOptions = KeyboardOptions(imeAction = ImeAction.Search), ) } } @@ -382,7 +382,7 @@ fun TextActionIcon( text: String, icon: ImageVector, enabled: Boolean = true, - interactionSource: MutableInteractionSource = remember { MutableInteractionSource() } + interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, ) { Column( Modifier @@ -391,11 +391,11 @@ fun TextActionIcon( enabled = enabled, role = Role.Button, interactionSource = interactionSource, - indication = rememberRipple(bounded = false, radius = 32.dp) + indication = rememberRipple(bounded = false, radius = 32.dp), ) .size(56.dp), verticalArrangement = Arrangement.SpaceAround, - horizontalAlignment = Alignment.CenterHorizontally + horizontalAlignment = Alignment.CenterHorizontally, ) { Icon( icon, @@ -404,7 +404,7 @@ fun TextActionIcon( LocalContentColor.current } else { LocalContentColor.current.copy(alpha = ContentAlpha.disabled) - } + }, ) Text( text, @@ -416,7 +416,7 @@ fun TextActionIcon( LocalContentColor.current } else { LocalContentColor.current.copy(alpha = ContentAlpha.disabled) - } + }, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/prefs/ColorPickerDialog.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/prefs/ColorPickerDialog.kt index b7290c2c..bd014bc7 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/prefs/ColorPickerDialog.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/prefs/ColorPickerDialog.kt @@ -80,7 +80,7 @@ fun ColorPickerDialog( title: String, onCloseRequest: () -> Unit = {}, onSelected: (Color) -> Unit, - initialColor: Color = Color.Unspecified + initialColor: Color = Color.Unspecified, ) { var currentColor by remember(initialColor) { mutableStateOf(initialColor) } var showPresets by remember { mutableStateOf(true) } @@ -93,27 +93,27 @@ fun ColorPickerDialog( if (showPresets) "Custom" else "Presets", onClick = { showPresets = !showPresets - } + }, ) }, properties = getMaterialDialogProperties( - size = DpSize(300.dp, 580.dp) + size = DpSize(300.dp, 580.dp), ), onCloseRequest = { it.hide() onCloseRequest() - } + }, ) { title(title) if (showPresets) { ColorPresets( initialColor = currentColor, - onColorChanged = { currentColor = it } + onColorChanged = { currentColor = it }, ) } else { ColorPalette( initialColor = currentColor, - onColorChanged = { currentColor = it } + onColorChanged = { currentColor = it }, ) } } @@ -123,7 +123,7 @@ fun ColorPickerDialog( @Composable private fun ColorPresets( initialColor: Color, - onColorChanged: (Color) -> Unit + onColorChanged: (Color) -> Unit, ) { val presets = remember { if (initialColor.isSpecified) { @@ -151,13 +151,13 @@ private fun ColorPresets( selectedShade = null selectedColor = color onColorChanged(color) - } + }, ) } } Spacer( modifier = Modifier.padding(vertical = 16.dp).fillMaxWidth().requiredHeight(1.dp) - .background(MaterialTheme.colors.onBackground.copy(alpha = 0.2f)) + .background(MaterialTheme.colors.onBackground.copy(alpha = 0.2f)), ) LazyVerticalGrid(columns = GridCells.Fixed(5)) { @@ -169,7 +169,7 @@ private fun ColorPresets( onClick = { selectedShade = color onColorChanged(color) - } + }, ) } } @@ -181,7 +181,7 @@ private fun ColorPresetItem( color: Color, borderColor: Color, isSelected: Boolean, - onClick: () -> Unit + onClick: () -> Unit, ) { Box( contentAlignment = Alignment.Center, @@ -192,14 +192,14 @@ private fun ColorPresetItem( .clip(CircleShape) .background(color) .border(BorderStroke(1.dp, borderColor), CircleShape) - .clickable(onClick = onClick) + .clickable(onClick = onClick), ) { if (isSelected) { Icon( imageVector = Icons.Rounded.Check, tint = if (color.luminance() > 0.5) Color.Black else Color.White, contentDescription = null, - modifier = Modifier.requiredWidth(32.dp).requiredHeight(32.dp) + modifier = Modifier.requiredWidth(32.dp).requiredHeight(32.dp), ) } } @@ -211,7 +211,7 @@ private fun getColorShades(color: Color): ImmutableList { shadeColor(f, 0.9), shadeColor(f, 0.7), shadeColor(f, 0.5), shadeColor(f, 0.333), shadeColor(f, 0.166), shadeColor(f, -0.125), shadeColor(f, -0.25), shadeColor(f, -0.375), shadeColor(f, -0.5), - shadeColor(f, -0.675), shadeColor(f, -0.7), shadeColor(f, -0.775) + shadeColor(f, -0.675), shadeColor(f, -0.7), shadeColor(f, -0.775), ).toImmutableList() } @@ -231,7 +231,7 @@ private fun shadeColor(f: Long, percent: Double): Color { @Composable fun ColorPalette( initialColor: Color = Color.White, - onColorChanged: (Color) -> Unit = {} + onColorChanged: (Color) -> Unit = {}, ) { var selectedColor by remember { mutableStateOf(initialColor) } var textFieldHex by remember { mutableStateOf(initialColor.toHexString()) } @@ -246,14 +246,14 @@ fun ColorPalette( Brush.linearGradient( colors = listOf(Color.White, hueToColor(hue)), start = Offset(0f, 0f), - end = Offset(matrixSize.width.toFloat(), 0f) + end = Offset(matrixSize.width.toFloat(), 0f), ) } val valueGradient = remember(matrixSize) { Brush.linearGradient( colors = listOf(Color.White, Color.Black), start = Offset(0f, 0f), - end = Offset(0f, matrixSize.height.toFloat()) + end = Offset(0f, matrixSize.height.toFloat()), ) } @@ -294,26 +294,26 @@ fun ColorPalette( Color.Black, radius = 8f, center = matrixCursor, - style = cursorStroke + style = cursorStroke, ) drawCircle( Color.LightGray, radius = 12f, center = matrixCursor, - style = cursorStroke + style = cursorStroke, ) } .pointerInput(Unit) { detectMove { offset -> val safeOffset = offset.copy( x = offset.x.coerceIn(0f, matrixSize.width.toFloat()), - y = offset.y.coerceIn(0f, matrixSize.height.toFloat()) + y = offset.y.coerceIn(0f, matrixSize.height.toFloat()), ) matrixCursor = safeOffset val newColor = matrixCoordinatesToColor(hue, safeOffset, matrixSize) setSelectedColor(newColor) } - } + }, ) Box( Modifier @@ -339,7 +339,7 @@ fun ColorPalette( cursorColor, topLeft = cursorTopLeft, size = cursorSize, - style = cursorStroke + style = cursorStroke, ) } } @@ -351,13 +351,13 @@ fun ColorPalette( val newColor = matrixCoordinatesToColor(hue, matrixCursor, matrixSize) setSelectedColor(newColor) } - } + }, ) } Row(Modifier.padding(top = 8.dp), verticalAlignment = Alignment.Bottom) { Box( Modifier.size(72.dp, 48.dp).background(selectedColor) - .border(1.dp, MaterialTheme.colors.onBackground.copy(alpha = 0.54f)) + .border(1.dp, MaterialTheme.colors.onBackground.copy(alpha = 0.54f)), ) Spacer(Modifier.requiredWidth(32.dp)) OutlinedTextField( @@ -373,7 +373,7 @@ fun ColorPalette( singleLine = true, modifier = Modifier.keyboardHandler(singleLine = true) { it.clearFocus() - } + }, ) } } @@ -446,5 +446,5 @@ private val presetColors = listOf( Color(0xFFFF9800), // ORANGE 500 Color(0xFF795548), // BROWN 500 Color(0xFF607D8B), // BLUE GREY 500 - Color(0xFF9E9E9E) // GREY 500 + Color(0xFF9E9E9E), // GREY 500 ).toImmutableList() diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/prefs/PreferencesUiBuilder.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/prefs/PreferencesUiBuilder.kt index cbb38ccd..70d8010b 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/prefs/PreferencesUiBuilder.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/prefs/PreferencesUiBuilder.kt @@ -96,7 +96,7 @@ fun PreferenceRow( onLongClick: () -> Unit = {}, subtitle: String? = null, enabled: Boolean = true, - action: @Composable (BoxScope.() -> Unit)? = null + action: @Composable (BoxScope.() -> Unit)? = null, ) { val height = if (subtitle != null) 72.dp else 56.dp @@ -104,19 +104,19 @@ fun PreferenceRow( if (enabled) { modifier = modifier.combinedClickable( onLongClick = onLongClick, - onClick = onClick + onClick = onClick, ) } Row( modifier = modifier, - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { if (icon != null) { Icon( imageVector = icon, modifier = Modifier.padding(start = 16.dp).size(24.dp), tint = MaterialTheme.colors.primary, - contentDescription = null + contentDescription = null, ) } Column(Modifier.padding(horizontal = 16.dp).weight(1f)) { @@ -129,7 +129,7 @@ fun PreferenceRow( LocalContentColor.current } else { LocalContentColor.current.copy(alpha = ContentAlpha.disabled) - } + }, ) if (subtitle != null) { Text( @@ -139,7 +139,7 @@ fun PreferenceRow( } else { LocalContentColor.current.copy(alpha = ContentAlpha.disabled) }, - style = MaterialTheme.typography.subtitle1 + style = MaterialTheme.typography.subtitle1, ) } } @@ -158,7 +158,7 @@ fun SwitchPreference( subtitle: String? = null, icon: ImageVector? = null, changeListener: () -> Unit = {}, - enabled: Boolean = true + enabled: Boolean = true, ) { PreferenceRow( title = title, @@ -172,7 +172,7 @@ fun SwitchPreference( preference.value = !preference.value changeListener() }, - enabled = enabled + enabled = enabled, ) } @@ -186,7 +186,7 @@ fun EditTextPreference( enabled: Boolean = true, maxLines: Int = 1, singleLine: Boolean = true, - visualTransformation: VisualTransformation = VisualTransformation.None + visualTransformation: VisualTransformation = VisualTransformation.None, ) { val dialogState = rememberMaterialDialogState() PreferenceRow( @@ -194,7 +194,7 @@ fun EditTextPreference( subtitle = subtitle, icon = icon, onClick = dialogState::show, - enabled = enabled + enabled = enabled, ) val value by preference.collectAsState() MaterialDialog( @@ -205,7 +205,7 @@ fun EditTextPreference( } negativeButton(stringResource(MR.strings.action_cancel)) }, - properties = getMaterialDialogProperties() + properties = getMaterialDialogProperties(), ) { title(title) input( @@ -216,7 +216,7 @@ fun EditTextPreference( onInput = { preference.value = it }, maxLines = maxLines, singleLine = singleLine, - modifier = Modifier.keyboardHandler(singleLine, enterAction = { it.moveFocus(FocusDirection.Next) }) + modifier = Modifier.keyboardHandler(singleLine, enterAction = { it.moveFocus(FocusDirection.Next) }), ) } } @@ -228,7 +228,7 @@ fun ChoicePreference( title: String, subtitle: String? = null, changeListener: () -> Unit = {}, - enabled: Boolean = true + enabled: Boolean = true, ) { val prefValue by preference.collectAsState() val dialogState = rememberMaterialDialogState() @@ -238,7 +238,7 @@ fun ChoicePreference( onClick = { dialogState.show() }, - enabled = enabled + enabled = enabled, ) ChoiceDialog( state = dialogState, @@ -248,7 +248,7 @@ fun ChoicePreference( onSelected = { selected -> preference.value = selected changeListener() - } + }, ) } @@ -260,7 +260,7 @@ fun ChoiceDialog( onCloseRequest: () -> Unit = {}, onSelected: (T) -> Unit, title: String, - buttons: @Composable MaterialDialogButtons.() -> Unit = { } + buttons: @Composable MaterialDialogButtons.() -> Unit = { }, ) { MaterialDialog( state, @@ -269,7 +269,7 @@ fun ChoiceDialog( onCloseRequest = { state.hide() onCloseRequest() - } + }, ) { title(title) Box { @@ -282,14 +282,14 @@ fun ChoiceDialog( onChoiceChange = { onSelected(items[it].first) submit() - } + }, ) Box(Modifier.matchParentSize().height(IntrinsicSize.Min)) { VerticalScrollbar( rememberScrollbarAdapter(listState), Modifier.align(Alignment.CenterEnd) .fillMaxHeight() - .scrollbarPadding() + .scrollbarPadding(), ) } } @@ -303,7 +303,7 @@ fun MultiSelectDialog( selected: ImmutableList?, onCloseRequest: () -> Unit = {}, onFinished: (ImmutableList) -> Unit, - title: String + title: String, ) { MaterialDialog( state, @@ -315,7 +315,7 @@ fun MultiSelectDialog( onCloseRequest = { state.hide() onCloseRequest() - } + }, ) { title(title) Box { @@ -330,14 +330,14 @@ fun MultiSelectDialog( .orEmpty(), onCheckedChange = { indexes -> onFinished(indexes.map { items[it].first }.toImmutableList()) - } + }, ) Box(Modifier.matchParentSize().height(IntrinsicSize.Min)) { VerticalScrollbar( rememberScrollbarAdapter(listState), Modifier.align(Alignment.CenterEnd) .fillMaxHeight() - .scrollbarPadding() + .scrollbarPadding(), ) } } @@ -350,7 +350,7 @@ fun ColorPreference( title: String, subtitle: String? = null, enabled: Boolean = true, - unsetColor: Color = Color.Unspecified + unsetColor: Color = Color.Unspecified, ) { val initialColor = preference.value.takeOrElse { unsetColor } val dialogState = rememberMaterialDialogState() @@ -371,11 +371,11 @@ fun ColorPreference( .size(32.dp) .clip(CircleShape) .background(color = initialColor) - .border(BorderStroke(1.dp, borderColor), CircleShape) + .border(BorderStroke(1.dp, borderColor), CircleShape), ) } }, - enabled = enabled + enabled = enabled, ) ColorPickerDialog( state = dialogState, @@ -383,7 +383,7 @@ fun ColorPreference( onSelected = { preference.value = it }, - initialColor = initialColor + initialColor = initialColor, ) } @@ -397,7 +397,7 @@ fun ExpandablePreference( title: String, startExpanded: Boolean = false, onExpandedChanged: ((Boolean) -> Unit)? = null, - expandedContent: @Composable ColumnScope.() -> Unit + expandedContent: @Composable ColumnScope.() -> Unit, ) { var expanded by remember { mutableStateOf(startExpanded) } LaunchedEffect(expanded) { @@ -425,7 +425,7 @@ fun ExpandablePreference( Surface( elevation = elevation, modifier = Modifier - .fillMaxWidth() + .fillMaxWidth(), ) { Column { Box(Modifier.clickable { expanded = !expanded }) { @@ -433,20 +433,20 @@ fun ExpandablePreference( imageVector = Icons.Rounded.ArrowDropUp, contentDescription = "Expandable Arrow", modifier = Modifier.rotate(arrowRotationDegree) - .align(Alignment.CenterStart) + .align(Alignment.CenterStart), ) Text( text = title, modifier = Modifier .fillMaxWidth() .padding(16.dp), - textAlign = TextAlign.Center + textAlign = TextAlign.Center, ) } ExpandableContent( visible = expanded, initiallyVisible = expanded, - expandedContent = expandedContent + expandedContent = expandedContent, ) } } @@ -456,14 +456,14 @@ fun ExpandablePreference( private fun ExpandableContent( visible: Boolean = true, initiallyVisible: Boolean = false, - expandedContent: @Composable ColumnScope.() -> Unit + expandedContent: @Composable ColumnScope.() -> Unit, ) { val enterFadeIn = remember { fadeIn( animationSpec = TweenSpec( durationMillis = FADE_IN_ANIMATION_DURATION, - easing = FastOutLinearInEasing - ) + easing = FastOutLinearInEasing, + ), ) } val enterExpand = remember { @@ -473,8 +473,8 @@ private fun ExpandableContent( fadeOut( animationSpec = TweenSpec( durationMillis = FADE_OUT_ANIMATION_DURATION, - easing = LinearOutSlowInEasing - ) + easing = LinearOutSlowInEasing, + ), ) } val exitCollapse = remember { @@ -485,11 +485,11 @@ private fun ExpandableContent( .apply { targetState = visible }, modifier = Modifier, enter = enterExpand + enterFadeIn, - exit = exitCollapse + exitFadeOut + exit = exitCollapse + exitFadeOut, ) { Column( modifier = Modifier.padding(8.dp), - content = expandedContent + content = expandedContent, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/state/SavedStateHandleFlow.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/state/SavedStateHandleFlow.kt index cfc71e6a..7dc9cddb 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/state/SavedStateHandleFlow.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/state/SavedStateHandleFlow.kt @@ -15,7 +15,7 @@ import kotlin.properties.ReadOnlyProperty import kotlin.reflect.KProperty fun SavedStateHandle.getStateFlow( - initialValue: () -> T + initialValue: () -> T, ): SavedStateHandleDelegate { return SavedStateHandleDelegate(this, initialValue) } @@ -23,7 +23,7 @@ fun SavedStateHandle.getStateFlow( @OptIn(InternalCoroutinesApi::class) class SavedStateHandleDelegate( private val savedStateHandle: SavedStateHandle, - private val initialValue: () -> T + private val initialValue: () -> T, ) : ReadOnlyProperty> { private val synchronizedObject = SynchronizedObject() @@ -44,7 +44,7 @@ class SavedStateHandleDelegate( class SavedStateHandleStateFlow( private val key: String, private val savedStateHandle: SavedStateHandle, - private val stateFlow: StateFlow + private val stateFlow: StateFlow, ) : StateFlow by stateFlow { override var value: T @@ -60,7 +60,7 @@ class SavedStateHandleStateFlow( fun SavedStateHandle.getSavedStateFlow( key: String, - initialValue: () -> T + initialValue: () -> T, ): SavedStateHandleStateFlow { val value = get(key) @@ -73,6 +73,6 @@ fun SavedStateHandle.getSavedStateFlow( return SavedStateHandleStateFlow( key = key, savedStateHandle = this, - stateFlow = flow + stateFlow = flow, ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppColorsPreference.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppColorsPreference.kt index 9d0b15ab..8bf5280f 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppColorsPreference.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppColorsPreference.kt @@ -17,20 +17,20 @@ import kotlinx.coroutines.CoroutineScope data class AppColorsPreference( val primary: Preference, val secondary: Preference, - val tertiary: Preference + val tertiary: Preference, ) class AppColorsPreferenceState( val primaryStateFlow: PreferenceMutableStateFlow, val secondaryStateFlow: PreferenceMutableStateFlow, - val tertiaryStateFlow: PreferenceMutableStateFlow + val tertiaryStateFlow: PreferenceMutableStateFlow, ) fun UiPreferences.getLightColors(): AppColorsPreference { return AppColorsPreference( colorPrimaryLight().asColor(), colorSecondaryLight().asColor(), - colorTertiaryLight().asColor() + colorTertiaryLight().asColor(), ) } @@ -38,7 +38,7 @@ fun UiPreferences.getDarkColors(): AppColorsPreference { return AppColorsPreference( colorPrimaryDark().asColor(), colorSecondaryDark().asColor(), - colorTertiaryDark().asColor() + colorTertiaryDark().asColor(), ) } @@ -46,6 +46,6 @@ fun AppColorsPreference.asStateFlow(scope: CoroutineScope): AppColorsPreferenceS return AppColorsPreferenceState( primary.asStateIn(scope), secondary.asStateIn(scope), - tertiary.asStateIn(scope) + tertiary.asStateIn(scope), ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppTheme.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppTheme.kt index 15437e40..5352e926 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppTheme.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/base/theme/AppTheme.kt @@ -53,7 +53,7 @@ fun AppTheme(content: @Composable () -> Unit) { ExtraColors.WithExtraColors(extraColors) { CompositionLocalProvider( LocalScrollbarStyle provides getScrollbarStyle(), - content = content + content = content, ) } } @@ -61,7 +61,7 @@ fun AppTheme(content: @Composable () -> Unit) { class AppThemeViewModel @Inject constructor( private val uiPreferences: UiPreferences, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { override val scope = MainScope() @@ -100,7 +100,7 @@ class AppThemeViewModel @Inject constructor( private fun getBaseTheme( themeMode: ThemeMode, lightTheme: Int, - darkTheme: Int + darkTheme: Int, ): Theme { fun getTheme(id: Int, isLight: Boolean): Theme { return themes.find { it.id == id && it.colors.isLight == isLight } @@ -121,7 +121,7 @@ class AppThemeViewModel @Inject constructor( private fun getMaterialColors( baseColors: Colors, colorPrimary: Color, - colorSecondary: Color + colorSecondary: Color, ): Colors { val primary = colorPrimary.takeOrElse { baseColors.primary } val secondary = colorSecondary.takeOrElse { baseColors.secondary } @@ -131,17 +131,17 @@ class AppThemeViewModel @Inject constructor( secondary = secondary, secondaryVariant = secondary, onPrimary = if (primary.luminance() > 0.5) Color.Black else Color.White, - onSecondary = if (secondary.luminance() > 0.5) Color.Black else Color.White + onSecondary = if (secondary.luminance() > 0.5) Color.Black else Color.White, ) } private fun getExtraColors( baseExtraColors: ExtraColors, - colorTertiary: Color + colorTertiary: Color, ): ExtraColors { val tertiary = colorTertiary.takeOrElse { baseExtraColors.tertiary } return baseExtraColors.copy( - tertiary = tertiary + tertiary = tertiary, ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesScreen.kt index b1a43c44..d1919f6d 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesScreen.kt @@ -28,7 +28,7 @@ expect fun rememberCategoriesLauncher(notifyFinished: () -> Unit): CategoriesLau class CategoriesScreen( @Transient - private val notifyFinished: (() -> Unit)? = null + private val notifyFinished: (() -> Unit)? = null, ) : Screen { override val key: ScreenKey = uniqueScreenKey @@ -44,7 +44,7 @@ class CategoriesScreen( renameCategory = vm::renameCategory, deleteCategory = vm::deleteCategory, createCategory = vm::createCategory, - notifyFinished = notifyFinished + notifyFinished = notifyFinished, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesScreenViewModel.kt index 334791fc..ba45fe34 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesScreenViewModel.kt @@ -33,7 +33,7 @@ class CategoriesScreenViewModel @Inject constructor( private val deleteCategory: DeleteCategory, private val modifyCategory: ModifyCategory, private val reorderCategory: ReorderCategory, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { private var originalCategories = emptyList() private val _categories = MutableStateFlow>(persistentListOf()) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/components/CategoriesDialogs.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/components/CategoriesDialogs.kt index 6ac6fe0a..ee2cd4f5 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/components/CategoriesDialogs.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/components/CategoriesDialogs.kt @@ -25,7 +25,7 @@ import com.vanpra.composematerialdialogs.title fun RenameDialog( state: MaterialDialogState, category: CategoriesScreenViewModel.MenuCategory, - onRename: (String) -> Unit + onRename: (String) -> Unit, ) { MaterialDialog( state, @@ -33,7 +33,7 @@ fun RenameDialog( positiveButton(stringResource(MR.strings.action_rename)) negativeButton(stringResource(MR.strings.action_cancel)) }, - properties = getMaterialDialogProperties() + properties = getMaterialDialogProperties(), ) { title(stringResource(MR.strings.categories_rename)) input( @@ -43,7 +43,7 @@ fun RenameDialog( onInput = { onRename(it) }, maxLines = 1, singleLine = true, - modifier = Modifier.keyboardHandler(true, enterAction = { it.moveFocus(FocusDirection.Next) }) + modifier = Modifier.keyboardHandler(true, enterAction = { it.moveFocus(FocusDirection.Next) }), ) } } @@ -52,7 +52,7 @@ fun RenameDialog( fun DeleteDialog( state: MaterialDialogState, category: CategoriesScreenViewModel.MenuCategory, - onDelete: (CategoriesScreenViewModel.MenuCategory) -> Unit + onDelete: (CategoriesScreenViewModel.MenuCategory) -> Unit, ) { MaterialDialog( state, @@ -62,7 +62,7 @@ fun DeleteDialog( } negativeButton(stringResource(MR.strings.action_no)) }, - properties = getMaterialDialogProperties() + properties = getMaterialDialogProperties(), ) { title(stringResource(MR.strings.categories_delete)) message(stringResource(MR.strings.categories_delete_confirm, category.name)) @@ -72,7 +72,7 @@ fun DeleteDialog( @Composable fun CreateDialog( state: MaterialDialogState, - onCreate: (String) -> Unit + onCreate: (String) -> Unit, ) { MaterialDialog( state, @@ -80,7 +80,7 @@ fun CreateDialog( positiveButton(stringResource(MR.strings.action_create)) negativeButton(stringResource(MR.strings.action_cancel)) }, - properties = getMaterialDialogProperties() + properties = getMaterialDialogProperties(), ) { title(stringResource(MR.strings.categories_create)) input( @@ -89,7 +89,7 @@ fun CreateDialog( onInput = { onCreate(it) }, maxLines = 1, singleLine = true, - modifier = Modifier.keyboardHandler(true, enterAction = { it.moveFocus(FocusDirection.Next) }) + modifier = Modifier.keyboardHandler(true, enterAction = { it.moveFocus(FocusDirection.Next) }), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/components/CategoriesScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/components/CategoriesScreenContent.kt index 2007884d..01c453ce 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/components/CategoriesScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/categories/components/CategoriesScreenContent.kt @@ -77,7 +77,7 @@ fun CategoriesScreenContent( renameCategory: (MenuCategory, String) -> Unit, deleteCategory: (MenuCategory) -> Unit, createCategory: (String) -> Unit, - notifyFinished: (() -> Unit)? = null + notifyFinished: (() -> Unit)? = null, ) { DisposableEffect(Unit) { onDispose { @@ -96,14 +96,14 @@ fun CategoriesScreenContent( Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar( - stringResource(MR.strings.location_categories) + stringResource(MR.strings.location_categories), ) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -112,9 +112,9 @@ fun CategoriesScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { itemsIndexed(categories) { i, category -> val renameDialogState = rememberMaterialDialogState() @@ -130,7 +130,7 @@ fun CategoriesScreenContent( }, onDelete = { deleteDialogState.show() - } + }, ) RenameDialog(renameDialogState, category) { renameCategory(category, it) @@ -149,7 +149,7 @@ fun CategoriesScreenContent( modifier = Modifier.align(Alignment.BottomEnd).padding(16.dp), onClick = { createDialogState.show() - } + }, ) VerticalScrollbar( rememberScrollbarAdapter(state), @@ -159,10 +159,10 @@ fun CategoriesScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -177,7 +177,7 @@ private fun CategoryRow( onMoveUp: () -> Unit = {}, onMoveDown: () -> Unit = {}, onRename: () -> Unit = {}, - onDelete: () -> Unit = {} + onDelete: () -> Unit = {}, ) { Card(Modifier.padding(8.dp)) { Column { @@ -186,11 +186,11 @@ private fun CategoryRow( imageVector = Icons.Outlined.List, modifier = Modifier.padding(16.dp), tint = MaterialTheme.colors.primary, - contentDescription = null + contentDescription = null, ) Text( text = category.name, - modifier = Modifier.weight(1f).padding(end = 16.dp) + modifier = Modifier.weight(1f).padding(end = 16.dp), ) } Row(verticalAlignment = Alignment.CenterVertically) { @@ -199,35 +199,35 @@ private fun CategoryRow( val disabledColor = enabledColor.copy(ContentAlpha.disabled) IconButton( onClick = onMoveUp, - enabled = moveUpEnabled + enabled = moveUpEnabled, ) { Icon( imageVector = Icons.Rounded.KeyboardArrowUp, tint = if (moveUpEnabled) enabledColor else disabledColor, - contentDescription = null + contentDescription = null, ) } IconButton( onClick = onMoveDown, - enabled = moveDownEnabled + enabled = moveDownEnabled, ) { Icon( imageVector = Icons.Rounded.KeyboardArrowDown, tint = if (moveDownEnabled) enabledColor else disabledColor, - contentDescription = null + contentDescription = null, ) } Spacer(modifier = Modifier.weight(1f)) IconButton(onClick = onRename) { Icon( imageVector = Icons.Rounded.Edit, - contentDescription = null + contentDescription = null, ) } IconButton(onClick = onDelete) { Icon( imageVector = Icons.Rounded.Delete, - contentDescription = null + contentDescription = null, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadService.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadService.kt index f7ef0fca..38d8731d 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadService.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadService.kt @@ -13,5 +13,5 @@ import ca.gosyer.jui.uicore.vm.ContextWrapper internal expect fun startDownloadService( contextWrapper: ContextWrapper, downloadService: DownloadService, - actions: WebsocketService.Actions + actions: WebsocketService.Actions, ) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreen.kt index 7344ea8e..e692d643 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreen.kt @@ -35,7 +35,7 @@ class DownloadsScreen : Screen { moveDownloadUp = vm::moveUp, moveDownloadDown = vm::moveDown, moveDownloadToTop = vm::moveToTop, - moveDownloadToBottom = vm::moveToBottom + moveDownloadToBottom = vm::moveToBottom, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreenViewModel.kt index b95a1c84..16da489f 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/DownloadsScreenViewModel.kt @@ -40,7 +40,7 @@ class DownloadsScreenViewModel @Inject constructor( private val stopChapterDownload: StopChapterDownload, private val reorderChapterDownload: ReorderChapterDownload, private val contextWrapper: ContextWrapper, - @Assisted standalone: Boolean + @Assisted standalone: Boolean, ) : ViewModel(contextWrapper) { private val uiScope = if (standalone) { MainScope() diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/components/DownloadsScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/components/DownloadsScreenContent.kt index e811e5c5..6eeda5e3 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/components/DownloadsScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/downloads/components/DownloadsScreenContent.kt @@ -81,13 +81,13 @@ fun DownloadsScreenContent( moveDownloadUp: (Chapter) -> Unit, moveDownloadDown: (Chapter) -> Unit, moveDownloadToTop: (Chapter) -> Unit, - moveDownloadToBottom: (Chapter) -> Unit + moveDownloadToBottom: (Chapter) -> Unit, ) { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar( @@ -97,11 +97,11 @@ fun DownloadsScreenContent( downloadStatus = downloadStatus, startDownloading = startDownloading, pauseDownloading = pauseDownloading, - clearQueue = clearQueue + clearQueue = clearQueue, ) - } + }, ) - } + }, ) { paddingValues -> Box(Modifier.padding(paddingValues)) { val state = rememberLazyListState() @@ -110,9 +110,9 @@ fun DownloadsScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { items(downloadQueue, key = { "${it.mangaId}-${it.chapterIndex}" }) { DownloadsItem( @@ -123,7 +123,7 @@ fun DownloadsScreenContent( onClickMoveUp = moveDownloadUp, onClickMoveDown = moveDownloadDown, onClickMoveToTop = moveDownloadToTop, - onClickMoveToBottom = moveDownloadToBottom + onClickMoveToBottom = moveDownloadToBottom, ) } } @@ -135,10 +135,10 @@ fun DownloadsScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -153,13 +153,13 @@ fun DownloadsItem( onClickMoveUp: (Chapter) -> Unit, onClickMoveDown: (Chapter) -> Unit, onClickMoveToTop: (Chapter) -> Unit, - onClickMoveToBottom: (Chapter) -> Unit + onClickMoveToBottom: (Chapter) -> Unit, ) { MangaListItem( modifier = modifier .height(96.dp) .fillMaxWidth() - .padding(end = 4.dp) + .padding(end = 4.dp), ) { MangaListItemImage( modifier = Modifier @@ -169,16 +169,16 @@ fun DownloadsItem( .clip(MaterialTheme.shapes.medium) .clickable { onClickCover() }, data = item.manga, - contentDescription = item.manga.title + contentDescription = item.manga.title, ) MangaListItemColumn( modifier = Modifier .weight(1f) - .padding(start = 16.dp) + .padding(start = 16.dp), ) { MangaListItemTitle( text = item.manga.title, - fontWeight = FontWeight.SemiBold + fontWeight = FontWeight.SemiBold, ) val progress = if (item.chapter.pageCount != null && item.chapter.pageCount != -1) { " - " + "${(item.chapter.pageCount!! * item.progress).toInt()}/${item.chapter.pageCount}" @@ -186,17 +186,17 @@ fun DownloadsItem( "" } MangaListItemSubtitle( - text = item.chapter.name + progress + text = item.chapter.name + progress, ) Spacer(Modifier.height(4.dp)) val animatedProgress by animateFloatAsState( targetValue = item.progress, - animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec + animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec, ) LinearProgressIndicator( animatedProgress, Modifier.fillMaxWidth() - .padding(bottom = 8.dp) + .padding(bottom = 8.dp), ) } DropdownIconButton( @@ -217,11 +217,11 @@ fun DownloadsItem( DropdownMenuItem(onClick = { onClickMoveToBottom(item.chapter) }) { Text(stringResource(MR.strings.action_move_to_bottom)) } - } + }, ) { Icon( Icons.Rounded.MoreVert, - null + null, ) } Spacer(Modifier.width(16.dp)) @@ -234,22 +234,22 @@ private fun getActionItems( downloadStatus: DownloaderStatus, startDownloading: () -> Unit, pauseDownloading: () -> Unit, - clearQueue: () -> Unit + clearQueue: () -> Unit, ): ImmutableList { return listOf( if (downloadStatus == DownloaderStatus.Started) { ActionItem( stringResource(MR.strings.action_pause), Icons.Rounded.Pause, - doAction = pauseDownloading + doAction = pauseDownloading, ) } else { ActionItem( stringResource(MR.strings.action_continue), Icons.Rounded.PlayArrow, - doAction = startDownloading + doAction = startDownloading, ) }, - ActionItem(stringResource(MR.strings.action_clear_queue), Icons.Rounded.ClearAll, doAction = clearQueue) + ActionItem(stringResource(MR.strings.action_clear_queue), Icons.Rounded.ClearAll, doAction = clearQueue), ).toImmutableList() } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreen.kt index db43dc02..473aa081 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreen.kt @@ -33,7 +33,7 @@ class ExtensionsScreen : Screen { installExtensionFile = vm::install, installExtension = vm::install, updateExtension = vm::update, - uninstallExtension = vm::uninstall + uninstallExtension = vm::uninstall, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreenViewModel.kt index f522433d..4671b02b 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/ExtensionsScreenViewModel.kt @@ -48,7 +48,7 @@ class ExtensionsScreenViewModel @Inject constructor( private val updateExtension: UpdateExtension, private val uninstallExtension: UninstallExtension, extensionPreferences: ExtensionPreferences, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { private val extensionList = MutableStateFlow?>(null) @@ -65,7 +65,7 @@ class ExtensionsScreenViewModel @Inject constructor( searchQuery, extensionList, enabledLangs, - workingExtensions + workingExtensions, ) { searchQuery, extensions, enabledLangs, workingExtensions -> search(searchQuery, extensions, enabledLangs, workingExtensions) }.stateIn(scope, SharingStarted.Eagerly, persistentListOf()) @@ -148,7 +148,7 @@ class ExtensionsScreenViewModel @Inject constructor( searchQuery: String?, extensionList: List?, enabledLangs: Set, - workingExtensions: List + workingExtensions: List, ): ImmutableList { val extensions = extensionList?.filter { it.lang in enabledLangs } .orEmpty() @@ -177,7 +177,7 @@ class ExtensionsScreenViewModel @Inject constructor( } } .thenBy(Extension::lang) - .thenBy(String.CASE_INSENSITIVE_ORDER, Extension::name) + .thenBy(String.CASE_INSENSITIVE_ORDER, Extension::name), ) .map { ExtensionUI.ExtensionItem(it, it.apkName in workingExtensions) } .let { @@ -207,11 +207,11 @@ class ExtensionsScreenViewModel @Inject constructor( all -> 1 else -> 2 } - }.thenBy(String.CASE_INSENSITIVE_ORDER, Pair::first) + }.thenBy(String.CASE_INSENSITIVE_ORDER, Pair::first), ) .flatMap { (key, value) -> listOf(ExtensionUI.Header(key)) + value - } + }, ) .toImmutableList() } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/components/ExtensionsScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/components/ExtensionsScreenContent.kt index 6bb3dc54..820ba9dd 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/components/ExtensionsScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/extensions/components/ExtensionsScreenContent.kt @@ -91,15 +91,15 @@ fun ExtensionsScreenContent( installExtensionFile: (Source) -> Unit, installExtension: (Extension) -> Unit, updateExtension: (Extension) -> Unit, - uninstallExtension: (Extension) -> Unit + uninstallExtension: (Extension) -> Unit, ) { val languageDialogState = rememberMaterialDialogState() val chooser = rememberFileChooser(installExtensionFile) Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { ExtensionsToolbar( @@ -108,9 +108,9 @@ fun ExtensionsScreenContent( openLanguageDialog = languageDialogState::show, openInstallExtensionFile = { chooser.launch("apk") - } + }, ) - } + }, ) { padding -> if (isLoading) { LoadingScreen() @@ -123,9 +123,9 @@ fun ExtensionsScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { items( extensions, @@ -140,14 +140,14 @@ fun ExtensionsScreenContent( is ExtensionUI.Header -> it.header is ExtensionUI.ExtensionItem -> it.extension.pkgName } - } + }, ) { when (it) { is ExtensionUI.Header -> Text( it.header, style = MaterialTheme.typography.h6, modifier = Modifier.animateItemPlacement() - .padding(16.dp, 16.dp, 16.dp, 4.dp) + .padding(16.dp, 16.dp, 16.dp, 4.dp), ) is ExtensionUI.ExtensionItem -> Column { ExtensionItem( @@ -155,7 +155,7 @@ fun ExtensionsScreenContent( it, onInstallClicked = installExtension, onUpdateClicked = updateExtension, - onUninstallClicked = uninstallExtension + onUninstallClicked = uninstallExtension, ) Spacer(Modifier.height(8.dp)) } @@ -169,11 +169,11 @@ fun ExtensionsScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) + WindowInsetsSides.Bottom, + ), + ), ), - adapter = rememberScrollbarAdapter(state) + adapter = rememberScrollbarAdapter(state), ) } } @@ -186,7 +186,7 @@ fun ExtensionsToolbar( searchText: String?, search: (String) -> Unit, openLanguageDialog: () -> Unit, - openInstallExtensionFile: () -> Unit + openInstallExtensionFile: () -> Unit, ) { Toolbar( stringResource(MR.strings.location_extensions), @@ -195,9 +195,9 @@ fun ExtensionsToolbar( actions = { getActionItems( openLanguageDialog, - openInstallExtensionFile + openInstallExtensionFile, ) - } + }, ) } @@ -207,14 +207,14 @@ fun ExtensionItem( extensionItem: ExtensionUI.ExtensionItem, onInstallClicked: (Extension) -> Unit, onUpdateClicked: (Extension) -> Unit, - onUninstallClicked: (Extension) -> Unit + onUninstallClicked: (Extension) -> Unit, ) { val extension = extensionItem.extension Box( modifier = Modifier.fillMaxWidth() .padding(end = 12.dp) .height(50.dp) - .background(MaterialTheme.colors.background) then modifier + .background(MaterialTheme.colors.background) then modifier, ) { Row(verticalAlignment = Alignment.CenterVertically) { Spacer(Modifier.width(4.dp)) @@ -222,7 +222,7 @@ fun ExtensionItem( data = extension, contentDescription = extension.name, modifier = Modifier.size(50.dp), - filterQuality = FilterQuality.Medium + filterQuality = FilterQuality.Medium, ) Spacer(Modifier.width(8.dp)) Column { @@ -255,7 +255,7 @@ fun ExtensionItem( } }, modifier = Modifier.align(Alignment.CenterEnd), - enabled = !extensionItem.isWorking + enabled = !extensionItem.isWorking, ) { Text( when { @@ -263,7 +263,7 @@ fun ExtensionItem( extension.hasUpdate -> stringResource(MR.strings.action_update) extension.installed -> stringResource(MR.strings.action_uninstall) else -> stringResource(MR.strings.action_install) - } + }, ) } } @@ -274,7 +274,7 @@ fun LanguageDialog( state: MaterialDialogState, enabledLangs: ImmutableSet, availableLangs: ImmutableList, - setLangs: (Set) -> Unit + setLangs: (Set) -> Unit, ) { MaterialDialog( state, @@ -282,7 +282,7 @@ fun LanguageDialog( positiveButton(stringResource(MR.strings.action_ok)) negativeButton(stringResource(MR.strings.action_cancel)) }, - properties = getMaterialDialogProperties(size = DpSize(400.dp, 600.dp)) + properties = getMaterialDialogProperties(size = DpSize(400.dp, 600.dp)), ) { title(BuildKonfig.NAME) @@ -305,7 +305,7 @@ fun LanguageDialog( "other" -> 3 else -> 2 } - }.thenBy(String.CASE_INSENSITIVE_ORDER, Pair<*, String>::second) + }.thenBy(String.CASE_INSENSITIVE_ORDER, Pair<*, String>::second), ) } listItemsMultiChoice( @@ -316,14 +316,14 @@ fun LanguageDialog( }.toSet(), onCheckedChange = { indexes -> setLangs(indexes.map { list[it].first }.toSet()) - } + }, ) Box(Modifier.matchParentSize().height(IntrinsicSize.Min)) { VerticalScrollbar( rememberScrollbarAdapter(listState), Modifier.align(Alignment.CenterEnd) .fillMaxHeight() - .scrollbarPadding() + .scrollbarPadding(), ) } } @@ -334,18 +334,18 @@ fun LanguageDialog( @Composable private fun getActionItems( openLanguageDialog: () -> Unit, - openInstallExtensionFile: () -> Unit + openInstallExtensionFile: () -> Unit, ): ImmutableList { return listOf( ActionItem( stringResource(MR.strings.enabled_languages), Icons.Rounded.Translate, - doAction = openLanguageDialog + doAction = openLanguageDialog, ), ActionItem( stringResource(MR.strings.action_install), Icons.Rounded.Add, - doAction = openInstallExtensionFile - ) + doAction = openInstallExtensionFile, + ), ).toImmutableList() } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/LibraryScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/LibraryScreen.kt index d756a922..bf7428ef 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/LibraryScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/LibraryScreen.kt @@ -52,7 +52,7 @@ class LibraryScreen : BaseScreen() { showLanguage = vm.languageBadges.collectAsState().value, showLocal = vm.localBadges.collectAsState().value, updateWebsocketStatus = updatesVM.serviceStatus.collectAsState().value, - restartLibraryUpdates = updatesVM::restartLibraryUpdates + restartLibraryUpdates = updatesVM::restartLibraryUpdates, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/LibraryScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/LibraryScreenViewModel.kt index c61ca3b4..80aac654 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/LibraryScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/LibraryScreenViewModel.kt @@ -63,7 +63,7 @@ sealed class CategoryState { @Stable data class Loaded( val items: StateFlow>, - val unfilteredItems: MutableStateFlow> + val unfilteredItems: MutableStateFlow>, ) : CategoryState() } @@ -96,7 +96,7 @@ class LibraryScreenViewModel @Inject constructor( private val updateCategory: UpdateCategory, libraryPreferences: LibraryPreferences, contextWrapper: ContextWrapper, - @Assisted private val savedStateHandle: SavedStateHandle + @Assisted private val savedStateHandle: SavedStateHandle, ) : ViewModel(contextWrapper) { private val library = Library(MutableStateFlow(persistentListOf()), mutableMapOf()) val categories = library.categories.asStateFlow() @@ -121,7 +121,7 @@ class LibraryScreenViewModel @Inject constructor( private val filter: Flow<(Manga) -> Boolean> = combine( libraryPreferences.filterDownloaded().getAsFlow(), libraryPreferences.filterUnread().getAsFlow(), - libraryPreferences.filterCompleted().getAsFlow() + libraryPreferences.filterCompleted().getAsFlow(), ) { downloaded, unread, completed -> { manga -> when (downloaded) { @@ -172,7 +172,7 @@ class LibraryScreenViewModel @Inject constructor( library.mangaMap.setManga( id = category.id, manga = it.toImmutableList(), - getItemsFlow = ::getMangaItemsFlow + getItemsFlow = ::getMangaItemsFlow, ) } .catch { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaBadges.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaBadges.kt index b49dd7f5..d43d7641 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaBadges.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaBadges.kt @@ -32,7 +32,7 @@ fun LibraryMangaBadges( showUnread: Boolean, showDownloaded: Boolean, showLanguage: Boolean, - showLocal: Boolean + showLocal: Boolean, ) { val unread = manga.unreadCount?.takeIf { showUnread && it > 0 } val downloaded = manga.downloadCount?.takeIf { showDownloaded && it > 0 } @@ -49,7 +49,7 @@ fun LibraryMangaBadges( Badge( text = unread.toString(), color = MaterialTheme.extraColors.tertiary, - textColor = MaterialTheme.extraColors.onTertiary + textColor = MaterialTheme.extraColors.onTertiary, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaList.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaList.kt index 1df0a8d9..a58a5567 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaList.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryMangaList.kt @@ -48,7 +48,7 @@ fun LibraryMangaList( showUnread: Boolean, showDownloaded: Boolean, showLanguage: Boolean, - showLocal: Boolean + showLocal: Boolean, ) { Box { val state = rememberLazyListState() @@ -57,21 +57,21 @@ fun LibraryMangaList( modifier = Modifier.fillMaxSize(), contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { items(library) { manga -> LibraryMangaListItem( modifier = Modifier.libraryMangaModifier( { onClickManga(manga.id) }, - { onRemoveMangaClicked(manga.id) } + { onRemoveMangaClicked(manga.id) }, ), manga = manga, showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) } } @@ -83,10 +83,10 @@ fun LibraryMangaList( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -98,25 +98,25 @@ private fun LibraryMangaListItem( showUnread: Boolean, showDownloaded: Boolean, showLanguage: Boolean, - showLocal: Boolean + showLocal: Boolean, ) { MangaListItem( modifier = modifier then Modifier .requiredHeight(56.dp) - .padding(horizontal = 16.dp) + .padding(horizontal = 16.dp), ) { MangaListItemImage( modifier = Modifier .size(40.dp) .clip(MaterialTheme.shapes.medium), data = manga, - contentDescription = manga.title + contentDescription = manga.title, ) MangaListItemTitle( modifier = Modifier .weight(1f) .padding(horizontal = 16.dp), - text = manga.title + text = manga.title, ) Box(Modifier.width(IntrinsicSize.Min)) { LibraryMangaBadges( @@ -124,7 +124,7 @@ private fun LibraryMangaListItem( showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryPager.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryPager.kt index c4db4aa6..457dc67d 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryPager.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryPager.kt @@ -33,7 +33,7 @@ fun LibraryPager( showUnread: Boolean, showDownloaded: Boolean, showLanguage: Boolean, - showLocal: Boolean + showLocal: Boolean, ) { if (categories.isEmpty()) return @@ -51,7 +51,7 @@ fun LibraryPager( showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) } } @@ -68,7 +68,7 @@ private fun LibraryLoadedPage( showUnread: Boolean, showDownloaded: Boolean, showLanguage: Boolean, - showLocal: Boolean + showLocal: Boolean, ) { val items by library.items.collectAsState() when (displayMode) { @@ -81,7 +81,7 @@ private fun LibraryLoadedPage( showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) DisplayMode.ComfortableGrid -> LibraryMangaComfortableGrid( library = items, @@ -92,7 +92,7 @@ private fun LibraryLoadedPage( showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) DisplayMode.CoverOnlyGrid -> LibraryMangaCoverOnlyGrid( library = items, @@ -103,7 +103,7 @@ private fun LibraryLoadedPage( showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) DisplayMode.List -> LibraryMangaList( library = items, @@ -112,7 +112,7 @@ private fun LibraryLoadedPage( showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) else -> Box {} } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryScreenContent.kt index 258b2dc3..f0fab261 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryScreenContent.kt @@ -84,7 +84,7 @@ fun LibraryScreenContent( showLanguage: Boolean, showLocal: Boolean, updateWebsocketStatus: WebsocketService.Status, - restartLibraryUpdates: () -> Unit + restartLibraryUpdates: () -> Unit, ) { BackHandler(showingMenu) { setShowingMenu(false) @@ -127,7 +127,7 @@ fun LibraryScreenContent( showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) } else { ThinLibraryScreenContent( @@ -156,7 +156,7 @@ fun LibraryScreenContent( showLanguage = showLanguage, showLocal = showLocal, updateWebsocketStatus = updateWebsocketStatus, - restartLibraryUpdates = restartLibraryUpdates + restartLibraryUpdates = restartLibraryUpdates, ) } } @@ -187,13 +187,13 @@ fun WideLibraryScreenContent( showUnread: Boolean, showDownloaded: Boolean, showLanguage: Boolean, - showLocal: Boolean + showLocal: Boolean, ) { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Column { @@ -204,19 +204,19 @@ fun WideLibraryScreenContent( actions = { getActionItems( onToggleFiltersClick = { setShowingMenu(true) }, - onUpdateLibrary = onUpdateLibrary + onUpdateLibrary = onUpdateLibrary, ) - } + }, ) LibraryTabs( visible = true, // vm.showCategoryTabs, pagerState = pagerState, categories = categories, selectedPage = selectedCategoryIndex, - onPageChanged = onPageChanged + onPageChanged = onPageChanged, ) } - } + }, ) { padding -> Box(Modifier.padding(padding)) { if (categories.isEmpty()) { @@ -234,7 +234,7 @@ fun WideLibraryScreenContent( showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) if (showingMenu) { @@ -245,19 +245,19 @@ fun WideLibraryScreenContent( setShowingMenu(false) } } - } + }, ) } AnimatedVisibility( showingMenu, enter = fadeIn() + slideInHorizontally(initialOffsetX = { it * 2 }), exit = fadeOut() + slideOutHorizontally(targetOffsetX = { it * 2 }), - modifier = Modifier.align(Alignment.TopEnd) + modifier = Modifier.align(Alignment.TopEnd), ) { LibrarySideMenu( libraryFilters = libraryFilters, librarySort = librarySort, - libraryDisplay = libraryDisplay + libraryDisplay = libraryDisplay, ) } } @@ -292,7 +292,7 @@ fun ThinLibraryScreenContent( showLanguage: Boolean, showLocal: Boolean, updateWebsocketStatus: WebsocketService.Status, - restartLibraryUpdates: () -> Unit + restartLibraryUpdates: () -> Unit, ) { val bottomSheetState = rememberModalBottomSheetState( ModalBottomSheetValue.Hidden, @@ -300,10 +300,11 @@ fun ThinLibraryScreenContent( when (it) { ModalBottomSheetValue.Hidden -> setShowingSheet(false) ModalBottomSheetValue.Expanded, - ModalBottomSheetValue.HalfExpanded -> setShowingSheet(true) + ModalBottomSheetValue.HalfExpanded, + -> setShowingSheet(true) } true - } + }, ) LaunchedEffect(showingSheet) { if (showingSheet) { @@ -315,8 +316,8 @@ fun ThinLibraryScreenContent( Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Column { @@ -329,19 +330,19 @@ fun ThinLibraryScreenContent( onToggleFiltersClick = { setShowingSheet(true) }, onUpdateLibrary = onUpdateLibrary, updateWebsocketStatus = updateWebsocketStatus, - restartLibraryUpdates = restartLibraryUpdates + restartLibraryUpdates = restartLibraryUpdates, ) - } + }, ) LibraryTabs( visible = true, // vm.showCategoryTabs, pagerState = pagerState, categories = categories, selectedPage = selectedCategoryIndex, - onPageChanged = onPageChanged + onPageChanged = onPageChanged, ) } - } + }, ) { padding -> ModalBottomSheetLayout( sheetState = bottomSheetState, @@ -350,9 +351,9 @@ fun ThinLibraryScreenContent( LibrarySheet( libraryFilters = libraryFilters, librarySort = librarySort, - libraryDisplay = libraryDisplay + libraryDisplay = libraryDisplay, ) - } + }, ) { if (categories.isEmpty()) { LoadingScreen(isLoading, errorMessage = error) @@ -369,7 +370,7 @@ fun ThinLibraryScreenContent( showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) } } @@ -382,27 +383,27 @@ private fun getActionItems( onToggleFiltersClick: () -> Unit, onUpdateLibrary: () -> Unit, updateWebsocketStatus: WebsocketService.Status? = null, - restartLibraryUpdates: (() -> Unit)? = null + restartLibraryUpdates: (() -> Unit)? = null, ): ImmutableList { return listOfNotNull( ActionItem( name = stringResource(MR.strings.action_filter), icon = Icons.Rounded.FilterList, - doAction = onToggleFiltersClick + doAction = onToggleFiltersClick, ), ActionItem( name = stringResource(MR.strings.action_update_library), icon = Icons.Rounded.Refresh, - doAction = onUpdateLibrary + doAction = onUpdateLibrary, ), if (updateWebsocketStatus == WebsocketService.Status.STOPPED && restartLibraryUpdates != null) { ActionItem( name = stringResource(MR.strings.action_restart_library), overflowMode = OverflowMode.ALWAYS_OVERFLOW, - doAction = restartLibraryUpdates + doAction = restartLibraryUpdates, ) } else { null - } + }, ).toImmutableList() } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryTabs.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryTabs.kt index ad674d63..934981f3 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryTabs.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/LibraryTabs.kt @@ -34,14 +34,14 @@ fun LibraryTabs( pagerState: PagerState, categories: ImmutableList, selectedPage: Int, - onPageChanged: (Int) -> Unit + onPageChanged: (Int) -> Unit, ) { if (categories.isEmpty()) return AnimatedVisibility( visible = visible, enter = expandVertically(), - exit = shrinkVertically() + exit = shrinkVertically(), ) { Column { ScrollableTabRow( @@ -54,10 +54,10 @@ fun LibraryTabs( .padding(horizontal = 8.dp) .clip(RoundedCornerShape(topStart = 3.dp, topEnd = 3.dp)), height = 3.dp, - color = MaterialTheme.colors.primary + color = MaterialTheme.colors.primary, ) }, - divider = {} + divider = {}, ) { categories.fastForEachIndexed { i, category -> Tab( @@ -65,7 +65,7 @@ fun LibraryTabs( onClick = { onPageChanged(i) }, text = { Text(category.name) }, selectedContentColor = MaterialTheme.colors.primary, - unselectedContentColor = MaterialTheme.colors.onSurface + unselectedContentColor = MaterialTheme.colors.onSurface, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaComfortableGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaComfortableGrid.kt index 79224df4..3311a026 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaComfortableGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaComfortableGrid.kt @@ -54,7 +54,7 @@ fun LibraryMangaComfortableGrid( showUnread: Boolean, showDownloaded: Boolean, showLanguage: Boolean, - showLocal: Boolean + showLocal: Boolean, ) { Box { val state = rememberLazyGridState() @@ -69,21 +69,21 @@ fun LibraryMangaComfortableGrid( modifier = Modifier.fillMaxSize().padding(4.dp), contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { items(library) { manga -> LibraryMangaComfortableGridItem( modifier = Modifier.libraryMangaModifier( { onClickManga(manga.id) }, - { onRemoveMangaClicked(manga.id) } + { onRemoveMangaClicked(manga.id) }, ), manga = manga, showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) } } @@ -95,10 +95,10 @@ fun LibraryMangaComfortableGrid( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -110,13 +110,13 @@ private fun LibraryMangaComfortableGridItem( showUnread: Boolean, showDownloaded: Boolean, showLanguage: Boolean, - showLocal: Boolean + showLocal: Boolean, ) { Box( modifier = Modifier .padding(4.dp) .fillMaxWidth() - .clip(MaterialTheme.shapes.medium) then modifier + .clip(MaterialTheme.shapes.medium) then modifier, ) { Column { ImageLoaderImage( @@ -127,7 +127,7 @@ private fun LibraryMangaComfortableGridItem( .aspectRatio(mangaAspectRatio) .clip(MaterialTheme.shapes.medium), contentScale = ContentScale.Crop, - filterQuality = FilterQuality.Medium + filterQuality = FilterQuality.Medium, ) Text( text = manga.title, @@ -136,7 +136,7 @@ private fun LibraryMangaComfortableGridItem( maxLines = 2, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(vertical = 4.dp, horizontal = 4.dp), - style = MaterialTheme.typography.subtitle2 + style = MaterialTheme.typography.subtitle2, ) } LibraryMangaBadges( @@ -145,7 +145,7 @@ private fun LibraryMangaComfortableGridItem( showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCompactGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCompactGrid.kt index ac2980c5..c666c9fa 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCompactGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCompactGrid.kt @@ -50,7 +50,7 @@ import kotlinx.collections.immutable.ImmutableList expect fun Modifier.libraryMangaModifier( onClickManga: () -> Unit, - onClickRemoveManga: () -> Unit + onClickRemoveManga: () -> Unit, ): Modifier @Composable @@ -63,7 +63,7 @@ fun LibraryMangaCompactGrid( showUnread: Boolean, showDownloaded: Boolean, showLanguage: Boolean, - showLocal: Boolean + showLocal: Boolean, ) { Box { val state = rememberLazyGridState() @@ -78,21 +78,21 @@ fun LibraryMangaCompactGrid( modifier = Modifier.fillMaxSize().padding(4.dp), contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { items(library) { manga -> LibraryMangaCompactGridItem( modifier = Modifier.libraryMangaModifier( { onClickManga(manga.id) }, - { onRemoveMangaClicked(manga.id) } + { onRemoveMangaClicked(manga.id) }, ), manga = manga, showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) } } @@ -104,10 +104,10 @@ fun LibraryMangaCompactGrid( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -119,20 +119,20 @@ private fun LibraryMangaCompactGridItem( showUnread: Boolean, showDownloaded: Boolean, showLanguage: Boolean, - showLocal: Boolean + showLocal: Boolean, ) { Box( modifier = Modifier.padding(4.dp) .fillMaxWidth() .aspectRatio(mangaAspectRatio) - .clip(MaterialTheme.shapes.medium) then modifier + .clip(MaterialTheme.shapes.medium) then modifier, ) { ImageLoaderImage( manga, manga.title, modifier = Modifier.fillMaxSize(), contentScale = ContentScale.Crop, - filterQuality = FilterQuality.Medium + filterQuality = FilterQuality.Medium, ) Box( modifier = Modifier @@ -140,12 +140,12 @@ private fun LibraryMangaCompactGridItem( .background( Brush.verticalGradient( 0f to Color.Transparent, - 1f to Color(0xAA000000) - ) + 1f to Color(0xAA000000), + ), ) .fillMaxHeight(0.33f) .fillMaxWidth() - .align(Alignment.BottomCenter) + .align(Alignment.BottomCenter), ) Text( modifier = Modifier @@ -157,13 +157,13 @@ private fun LibraryMangaCompactGridItem( color = Color.White, shadow = Shadow( color = Color.Black, - blurRadius = 4f - ) + blurRadius = 4f, + ), ), fontSize = 12.sp, lineHeight = 18.sp, maxLines = 2, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, ) LibraryMangaBadges( modifier = Modifier.padding(4.dp), @@ -171,7 +171,7 @@ private fun LibraryMangaCompactGridItem( showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCoverOnlyGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCoverOnlyGrid.kt index 099076ed..1ad8a5e2 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCoverOnlyGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/components/MangaCoverOnlyGrid.kt @@ -50,7 +50,7 @@ fun LibraryMangaCoverOnlyGrid( showUnread: Boolean, showDownloaded: Boolean, showLanguage: Boolean, - showLocal: Boolean + showLocal: Boolean, ) { Box { val state = rememberLazyGridState() @@ -65,21 +65,21 @@ fun LibraryMangaCoverOnlyGrid( modifier = Modifier.fillMaxSize().padding(4.dp), contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { items(library) { manga -> LibraryMangaCoverOnlyGridItem( modifier = Modifier.libraryMangaModifier( { onClickManga(manga.id) }, - { onRemoveMangaClicked(manga.id) } + { onRemoveMangaClicked(manga.id) }, ), manga = manga, showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) } } @@ -91,10 +91,10 @@ fun LibraryMangaCoverOnlyGrid( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -106,20 +106,20 @@ private fun LibraryMangaCoverOnlyGridItem( showUnread: Boolean, showDownloaded: Boolean, showLanguage: Boolean, - showLocal: Boolean + showLocal: Boolean, ) { Box( modifier = Modifier.padding(4.dp) .fillMaxWidth() .aspectRatio(mangaAspectRatio) - .clip(MaterialTheme.shapes.medium) then modifier + .clip(MaterialTheme.shapes.medium) then modifier, ) { ImageLoaderImage( manga, contentDescription = manga.title, modifier = Modifier.fillMaxSize(), contentScale = ContentScale.Crop, - filterQuality = FilterQuality.Medium + filterQuality = FilterQuality.Medium, ) LibraryMangaBadges( modifier = Modifier.padding(4.dp), @@ -127,7 +127,7 @@ private fun LibraryMangaCoverOnlyGridItem( showUnread = showUnread, showDownloaded = showDownloaded, showLanguage = showLanguage, - showLocal = showLocal + showLocal = showLocal, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryDisplay.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryDisplay.kt index fad737c1..b00ae437 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryDisplay.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryDisplay.kt @@ -37,7 +37,7 @@ fun getLibraryDisplay(vm: LibrarySettingsViewModel): @Composable () -> Unit = re setUnreadBadges = { vm.unreadBadges.value = it }, setDownloadBadges = { vm.downloadBadges.value = it }, setLanguageBadges = { vm.languageBadges.value = it }, - setLocalBadges = { vm.localBadges.value = it } + setLocalBadges = { vm.localBadges.value = it }, ) } } @@ -53,7 +53,7 @@ fun LibraryDisplay( setUnreadBadges: (Boolean) -> Unit, setDownloadBadges: (Boolean) -> Unit, setLanguageBadges: (Boolean) -> Unit, - setLocalBadges: (Boolean) -> Unit + setLocalBadges: (Boolean) -> Unit, ) { Column(Modifier.fillMaxWidth()) { TitleText(stringResource(MR.strings.display_mode)) @@ -61,24 +61,24 @@ fun LibraryDisplay( RadioSelectionItem( text = stringResource(it.res), selected = it == displayMode, - onClick = { setDisplayMode(it) } + onClick = { setDisplayMode(it) }, ) } TitleText(stringResource(MR.strings.display_badges)) CheckboxItem( text = stringResource(MR.strings.display_badge_downloaded), checked = downloadBadges, - onClick = { setDownloadBadges(!downloadBadges) } + onClick = { setDownloadBadges(!downloadBadges) }, ) CheckboxItem( text = stringResource(MR.strings.display_badge_unread), checked = unreadBadges, - onClick = { setUnreadBadges(!unreadBadges) } + onClick = { setUnreadBadges(!unreadBadges) }, ) CheckboxItem( text = stringResource(MR.strings.display_badge_local), checked = localBadges, - onClick = { setLocalBadges(!localBadges) } + onClick = { setLocalBadges(!localBadges) }, ) // TODO: 2022-04-06 Enable when library contains manga source in manga object /*CheckboxItem( @@ -94,7 +94,7 @@ private fun TitleText(text: String) { Text( text = text, fontWeight = FontWeight.Bold, - modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp) + modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp), ) } @@ -106,9 +106,9 @@ private fun RadioSelectionItem(text: String, selected: Boolean, onClick: () -> U action = { RadioButton( selected = selected, - onClick = null + onClick = null, ) - } + }, ) } @@ -120,8 +120,8 @@ private fun CheckboxItem(text: String, checked: Boolean, onClick: () -> Unit) { action = { Checkbox( checked = checked, - onCheckedChange = null + onCheckedChange = null, ) - } + }, ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryFilters.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryFilters.kt index 79c8af05..ad15112f 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryFilters.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibraryFilters.kt @@ -28,7 +28,7 @@ fun getLibraryFilters(vm: LibrarySettingsViewModel): @Composable () -> Unit = re completed = vm.filterCompleted.collectAsState().value, setDownloadedFilter = { vm.filterDownloaded.value = it }, setUnreadFilter = { vm.filterUnread.value = it }, - setCompletedFilter = { vm.filterCompleted.value = it } + setCompletedFilter = { vm.filterCompleted.value = it }, ) } } @@ -40,23 +40,23 @@ fun LibraryFilters( completed: FilterState, setDownloadedFilter: (FilterState) -> Unit, setUnreadFilter: (FilterState) -> Unit, - setCompletedFilter: (FilterState) -> Unit + setCompletedFilter: (FilterState) -> Unit, ) { Column(Modifier.fillMaxWidth()) { Filter( stringResource(MR.strings.filter_downloaded), downloaded, - onClick = { setDownloadedFilter(toggleState(downloaded)) } + onClick = { setDownloadedFilter(toggleState(downloaded)) }, ) Filter( stringResource(MR.strings.filter_unread), unread, - onClick = { setUnreadFilter(toggleState(unread)) } + onClick = { setUnreadFilter(toggleState(unread)) }, ) Filter( stringResource(MR.strings.filter_completed), completed, - onClick = { setCompletedFilter(toggleState(completed)) } + onClick = { setCompletedFilter(toggleState(completed)) }, ) } } @@ -79,8 +79,8 @@ private fun Filter(text: String, state: FilterState, onClick: () -> Unit) { FilterState.EXCLUDED -> ToggleableState.Indeterminate FilterState.IGNORED -> ToggleableState.Off }, - onClick = null + onClick = null, ) - } + }, ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySettingsViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySettingsViewModel.kt index a3fab8a6..e6bbf4d8 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySettingsViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySettingsViewModel.kt @@ -13,7 +13,7 @@ import me.tatarka.inject.annotations.Inject class LibrarySettingsViewModel @Inject constructor( libraryPreferences: LibraryPreferences, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { val filterDownloaded = libraryPreferences.filterDownloaded().asStateFlow() val filterUnread = libraryPreferences.filterUnread().asStateFlow() diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySheet.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySheet.kt index d13ac275..5a581e0e 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySheet.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySheet.kt @@ -36,14 +36,14 @@ import kotlinx.coroutines.launch enum class LibrarySheetTabs(val res: StringResource) { FILTERS(MR.strings.action_filter), SORT(MR.strings.library_sort), - DISPLAY(MR.strings.library_display) + DISPLAY(MR.strings.library_display), } @Composable fun LibrarySheet( libraryFilters: @Composable () -> Unit, librarySort: @Composable () -> Unit, - libraryDisplay: @Composable () -> Unit + libraryDisplay: @Composable () -> Unit, ) { val pagerState = rememberPagerState() val selectedPage = pagerState.currentPage @@ -53,9 +53,9 @@ fun LibrarySheet( selectedTabIndex = pagerState.currentPage, indicator = { tabPositions -> TabRowDefaults.Indicator( - Modifier.pagerTabIndicatorOffset(pagerState, tabPositions) + Modifier.pagerTabIndicatorOffset(pagerState, tabPositions), ) - } + }, ) { LibrarySheetTabs.values().asList().fastForEachIndexed { index, tab -> Tab( @@ -63,20 +63,20 @@ fun LibrarySheet( onClick = { scope.launch { pagerState.animateScrollToPage(index) } }, - text = { Text(stringResource(tab.res)) } + text = { Text(stringResource(tab.res)) }, ) } } HorizontalPager( count = LibrarySheetTabs.values().size, state = pagerState, - verticalAlignment = Alignment.Top + verticalAlignment = Alignment.Top, ) { val scrollState = rememberScrollState() Box { Column( Modifier.fillMaxWidth() - .verticalScroll(scrollState) + .verticalScroll(scrollState), ) { when (it) { LibrarySheetTabs.FILTERS.ordinal -> libraryFilters() @@ -89,7 +89,7 @@ fun LibrarySheet( rememberScrollbarAdapter(scrollState), Modifier.align(Alignment.CenterEnd) .fillMaxHeight() - .scrollbarPadding() + .scrollbarPadding(), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySideMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySideMenu.kt index bd456e08..0067a7a7 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySideMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySideMenu.kt @@ -33,14 +33,14 @@ import ca.gosyer.jui.uicore.resources.stringResource fun LibrarySideMenu( libraryFilters: @Composable () -> Unit, librarySort: @Composable () -> Unit, - libraryDisplay: @Composable () -> Unit + libraryDisplay: @Composable () -> Unit, ) { Surface(Modifier.fillMaxHeight().width(260.dp), elevation = 1.dp) { Box { val scrollState = rememberScrollState() Column( Modifier.fillMaxWidth() - .verticalScroll(scrollState) + .verticalScroll(scrollState), ) { TitleText(stringResource(MR.strings.action_filter)) libraryFilters() @@ -56,7 +56,7 @@ fun LibrarySideMenu( rememberScrollbarAdapter(scrollState), Modifier.align(Alignment.CenterEnd) .fillMaxHeight() - .scrollbarPadding() + .scrollbarPadding(), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySort.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySort.kt index c5c6004d..6a40965d 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySort.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/library/settings/LibrarySort.kt @@ -35,7 +35,7 @@ fun getLibrarySort(vm: LibrarySettingsViewModel): @Composable () -> Unit = remem vm.sortMode.value = it vm.sortAscending.value = true }, - setAscending = { vm.sortAscending.value = it } + setAscending = { vm.sortAscending.value = it }, ) } } @@ -45,7 +45,7 @@ fun LibrarySort( mode: Sort, ascending: Boolean, setMode: (Sort) -> Unit, - setAscending: (Boolean) -> Unit + setAscending: (Boolean) -> Unit, ) { Column(Modifier.fillMaxWidth()) { Sort.values().asList().fastForEach { sort -> @@ -66,12 +66,12 @@ fun LibrarySort( false -> Icons.Rounded.ArrowDownward }, contentDescription = stringResource(sort.res), - modifier = Modifier.fillMaxHeight() + modifier = Modifier.fillMaxHeight(), ) } else { Box(Modifier.size(24.dp)) } - } + }, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/MainMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/MainMenu.kt index a27d9dd6..4791c250 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/MainMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/MainMenu.kt @@ -74,7 +74,7 @@ fun MainMenu() { confirmExit && navigator.size == 1 && navigator.lastItem::class == vm.startScreen.toScreenClazz() && - !exitConfirmed + !exitConfirmed, ) { exitConfirmed = true vm.confirmExitToast() @@ -85,7 +85,7 @@ fun MainMenu() { @Composable fun SkinnyMainMenu( - navigator: Navigator + navigator: Navigator, ) { WithBottomNav(navigator) { MainWindow(navigator, Modifier) @@ -96,7 +96,7 @@ fun SkinnyMainMenu( @Composable fun WideMainMenu( navigator: Navigator, - controller: DisplayController + controller: DisplayController, ) { Box { val startPadding by animateDpAsState( @@ -105,7 +105,7 @@ fun WideMainMenu( } else { 0.dp }, - animationSpec = tween(SIDE_MENU_EXPAND_DURATION) + animationSpec = tween(SIDE_MENU_EXPAND_DURATION), ) if (startPadding != 0.dp) { SideMenu(Modifier.width(200.dp), controller, navigator) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/MainViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/MainViewModel.kt index d5c817d6..11b72cb7 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/MainViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/MainViewModel.kt @@ -16,7 +16,7 @@ import me.tatarka.inject.annotations.Inject class MainViewModel @Inject constructor( uiPreferences: UiPreferences, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { override val scope = MainScope() diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/TopLevelMenus.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/TopLevelMenus.kt index cd7ddf3a..4eb41e2b 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/TopLevelMenus.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/TopLevelMenus.kt @@ -58,13 +58,13 @@ enum class TopLevelMenus( override val selectedIcon: ImageVector, override val screen: KClass<*>, override val createScreen: () -> Screen, - override val extraInfo: (@Composable () -> Unit)? = null + override val extraInfo: (@Composable () -> Unit)? = null, ) : Menu { Library(MR.strings.location_library, Icons.Outlined.Book, Icons.Rounded.Book, LibraryScreen::class, { LibraryScreen() }, extraInfo = { LibraryUpdatesExtraInfo() }), Updates(MR.strings.location_updates, Icons.Outlined.NewReleases, Icons.Rounded.NewReleases, UpdatesScreen::class, { UpdatesScreen() }), Sources(MR.strings.location_sources, Icons.Outlined.Explore, Icons.Rounded.Explore, SourcesScreen::class, { SourcesScreen() }), Extensions(MR.strings.location_extensions, Icons.Outlined.Store, Icons.Rounded.Store, ExtensionsScreen::class, { ExtensionsScreen() }), - More(MR.strings.location_more, Icons.Outlined.MoreHoriz, Icons.Rounded.MoreHoriz, MoreScreen::class, { MoreScreen() }) + More(MR.strings.location_more, Icons.Outlined.MoreHoriz, Icons.Rounded.MoreHoriz, MoreScreen::class, { MoreScreen() }), } enum class MoreMenus( @@ -73,9 +73,9 @@ enum class MoreMenus( override val selectedIcon: ImageVector, override val screen: KClass<*>, override val createScreen: () -> Screen, - override val extraInfo: (@Composable () -> Unit)? = null + override val extraInfo: (@Composable () -> Unit)? = null, ) : Menu { Downloads(MR.strings.location_downloads, Icons.Outlined.Download, Icons.Rounded.Download, DownloadsScreen::class, { DownloadsScreen() }, extraInfo = { DownloadsExtraInfo() }), Settings(MR.strings.location_settings, Icons.Outlined.Settings, Icons.Rounded.Settings, SettingsScreen::class, { SettingsScreen() }), - About(MR.strings.location_about, Icons.Outlined.Info, Icons.Rounded.Info, AboutScreen::class, { AboutScreen() }) + About(MR.strings.location_about, Icons.Outlined.Info, Icons.Rounded.Info, AboutScreen::class, { AboutScreen() }), } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutScreen.kt index 09b51c65..51a7f83b 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/AboutScreen.kt @@ -42,7 +42,7 @@ class AboutScreen : Screen { checkForUpdates = vm::checkForUpdates, openSourceLicenses = { navigator push LicensesScreen() - } + }, ) } } 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 6210489c..eb0e0e33 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 @@ -30,7 +30,7 @@ class AboutViewModel @Inject constructor( private val dateHandler: DateHandler, private val aboutServer: AboutServer, private val updateChecker: UpdateChecker, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { private val _aboutHolder = MutableStateFlow(null) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/components/AboutContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/components/AboutContent.kt index 8711eaed..0ec480a0 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/components/AboutContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/components/AboutContent.kt @@ -66,17 +66,17 @@ fun AboutContent( about: About?, formattedBuildTime: String, checkForUpdates: () -> Unit, - openSourceLicenses: () -> Unit + openSourceLicenses: () -> Unit, ) { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.location_about)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -85,9 +85,9 @@ fun AboutContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { item { IconImage() @@ -124,11 +124,11 @@ fun AboutContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) + WindowInsetsSides.Bottom, + ), + ), ), - adapter = rememberScrollbarAdapter(state) + adapter = rememberScrollbarAdapter(state), ) } } @@ -140,7 +140,7 @@ private fun IconImage() { Image( painter = MR.images.icon.toPainter(), contentDescription = "icon", - modifier = Modifier.height(140.dp).padding(vertical = 8.dp) + modifier = Modifier.height(140.dp).padding(vertical = 8.dp), ) } } @@ -149,7 +149,7 @@ private fun IconImage() { private fun CheckForUpdates(checkForUpdates: () -> Unit) { PreferenceRow( title = stringResource(MR.strings.update_checker), - onClick = checkForUpdates + onClick = checkForUpdates, ) } @@ -169,9 +169,9 @@ private fun ClientVersionInfo() { clipboardManager.setText( buildAnnotatedString { append(getDebugInfo()) - } + }, ) - } + }, ) } @@ -184,7 +184,7 @@ private fun ServerVersionInfo(about: About?, formattedBuildTime: String) { } else { PreferenceRow( title = stringResource(MR.strings.server_version), - subtitle = "${about.buildType.name} ${about.version}-${about.revision} ($formattedBuildTime)" + subtitle = "${about.buildType.name} ${about.version}-${about.revision} ($formattedBuildTime)", ) } } @@ -196,7 +196,7 @@ private fun WhatsNew() { title = stringResource(MR.strings.whats_new), onClick = { uriHandler.openUri(UpdateChecker.RELEASE_URL) - } + }, ) } @@ -207,7 +207,7 @@ private fun HelpTranslate() { title = stringResource(MR.strings.help_translate), onClick = { uriHandler.openUri("https://hosted.weblate.org/projects/tachideskjui/desktop/") - } + }, ) } @@ -215,7 +215,7 @@ private fun HelpTranslate() { private fun OpenSourceLicenses(openSourceLicenses: () -> Unit) { PreferenceRow( title = stringResource(MR.strings.open_source_licenses), - onClick = openSourceLicenses + onClick = openSourceLicenses, ) } @@ -227,7 +227,7 @@ sealed class LinkIcon { enum class Link(val nameRes: StringResource, val icon: LinkIcon, val uri: String) { Github(MR.strings.github, LinkIcon.Resource(MR.images.github), "https://github.com/Suwayomi/Tachidesk-JUI"), Discord(MR.strings.discord, LinkIcon.Resource(MR.images.discord), "https://discord.gg/DDZdqZWaHA"), - Reddit(MR.strings.reddit, LinkIcon.Resource(MR.images.reddit), "https://reddit.com/r/Tachidesk/") + Reddit(MR.strings.reddit, LinkIcon.Resource(MR.images.reddit), "https://reddit.com/r/Tachidesk/"), } @Composable @@ -243,7 +243,7 @@ private fun LinkDisplay() { .clip(MaterialTheme.shapes.medium) .clickable { uriHandler.openUri(it.uri) } .padding(horizontal = 16.dp, vertical = 8.dp), - horizontalAlignment = Alignment.CenterHorizontally + horizontalAlignment = Alignment.CenterHorizontally, ) { val name = stringResource(it.nameRes) val modifier = Modifier.size(48.dp) @@ -251,12 +251,12 @@ private fun LinkDisplay() { is LinkIcon.Resource -> Icon( painter = it.icon.res.toPainter(), contentDescription = name, - modifier = modifier + modifier = modifier, ) is LinkIcon.Icon -> Icon( imageVector = it.icon.icon, contentDescription = name, - modifier = modifier + modifier = modifier, ) } Text(name) @@ -267,19 +267,19 @@ private fun LinkDisplay() { Box( modifier = Modifier.clickable { uriHandler.openUri(it.uri) } .padding(horizontal = 16.dp, vertical = 8.dp) - .size(32.dp) + .size(32.dp), ) { val name = stringResource(it.nameRes) when (it.icon) { is LinkIcon.Resource -> Icon( painter = it.icon.res.toPainter(), contentDescription = name, - modifier = Modifier.fillMaxSize() + modifier = Modifier.fillMaxSize(), ) is LinkIcon.Icon -> Icon( imageVector = it.icon.icon, contentDescription = name, - modifier = Modifier.fillMaxSize() + modifier = Modifier.fillMaxSize(), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/LicensesContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/LicensesContent.kt index 26c42bdc..cd246b3c 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/LicensesContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/LicensesContent.kt @@ -45,12 +45,12 @@ fun LicensesContent() { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.open_source_licenses)) - } + }, ) { padding -> Box(Modifier.fillMaxSize().padding(padding)) { val libs = getLicenses() @@ -65,9 +65,9 @@ fun LicensesContent() { }, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) VerticalScrollbar( modifier = Modifier.align(Alignment.CenterEnd) @@ -76,11 +76,11 @@ fun LicensesContent() { .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) + WindowInsetsSides.Bottom, + ), + ), ), - adapter = rememberScrollbarAdapter(state) + adapter = rememberScrollbarAdapter(state), ) } else { LoadingScreen() diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/BottomNav.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/BottomNav.kt index 107da8cc..9d4ecce2 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/BottomNav.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/BottomNav.kt @@ -58,13 +58,13 @@ fun WithBottomNav(navigator: Navigator, content: @Composable () -> Unit) { val isBottomNavVisible = navigator.size <= 1 CompositionLocalProvider( BottomNavHeightLocal provides if (isBottomNavVisible) BottomNavHeight else 0.dp, - content = content + content = content, ) AnimatedVisibility( isBottomNavVisible, enter = slideInVertically(initialOffsetY = { it }), exit = slideOutVertically(targetOffsetY = { it }), - modifier = Modifier.align(Alignment.BottomCenter) + modifier = Modifier.align(Alignment.BottomCenter), ) { BottomNav(navigator) } @@ -93,17 +93,17 @@ fun BottomNav(navigator: Navigator) { Text( text = stringResource(it.textKey), maxLines = 1, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, ) }, alwaysShowLabel = true, modifier = Modifier .windowInsetsPadding( WindowInsets.navigationBars.only( - WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom - ) + WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom, + ), ) - .height(BottomNavHeight) + .height(BottomNavHeight), ) } } @@ -115,13 +115,13 @@ fun BottomNavigation( backgroundColor: Color = MaterialTheme.colors.primarySurface, contentColor: Color = contentColorFor(backgroundColor), elevation: Dp = BottomNavigationDefaults.Elevation, - content: @Composable RowScope.() -> Unit + content: @Composable RowScope.() -> Unit, ) { Surface( color = backgroundColor, contentColor = contentColor, elevation = elevation, - modifier = modifier + modifier = modifier, ) { Row( Modifier @@ -129,7 +129,7 @@ fun BottomNavigation( .defaultMinSize(minHeight = BottomNavHeight) .selectableGroup(), horizontalArrangement = Arrangement.SpaceBetween, - content = content + content = content, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/DownloadsExtraInfo.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/DownloadsExtraInfo.kt index b5cfc897..00dc737e 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/DownloadsExtraInfo.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/DownloadsExtraInfo.kt @@ -57,18 +57,18 @@ fun DownloadsExtraInfo() { Text( text, style = MaterialTheme.typography.body2, - color = LocalContentColor.current.copy(alpha = ContentAlpha.disabled) + color = LocalContentColor.current.copy(alpha = ContentAlpha.disabled), ) } else if (serviceStatus == WebsocketService.Status.STOPPED) { Box( Modifier.fillMaxWidth() .clip(MaterialTheme.shapes.medium) - .clickable(onClick = vm::restartDownloader) + .clickable(onClick = vm::restartDownloader), ) { Text( stringResource(MR.strings.downloads_stopped), style = MaterialTheme.typography.body2, - color = Color.Red.copy(alpha = ContentAlpha.disabled) + color = Color.Red.copy(alpha = ContentAlpha.disabled), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/LibraryUpdatesExtraInfo.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/LibraryUpdatesExtraInfo.kt index f2b609b0..f2456519 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/LibraryUpdatesExtraInfo.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/LibraryUpdatesExtraInfo.kt @@ -64,18 +64,18 @@ fun LibraryUpdatesExtraInfo() { Text( text, style = MaterialTheme.typography.body2, - color = LocalContentColor.current.copy(alpha = ContentAlpha.disabled) + color = LocalContentColor.current.copy(alpha = ContentAlpha.disabled), ) } else if (serviceStatus == WebsocketService.Status.STOPPED) { Box( Modifier.fillMaxWidth() .clip(MaterialTheme.shapes.medium) - .clickable(onClick = vm::restartLibraryUpdates) + .clickable(onClick = vm::restartLibraryUpdates), ) { Text( stringResource(MR.strings.downloads_stopped), style = MaterialTheme.typography.body2, - color = Color.Red.copy(alpha = ContentAlpha.disabled) + color = Color.Red.copy(alpha = ContentAlpha.disabled), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/LibraryUpdatesService.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/LibraryUpdatesService.kt index 03455e31..dcfd0182 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/LibraryUpdatesService.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/LibraryUpdatesService.kt @@ -13,5 +13,5 @@ import ca.gosyer.jui.uicore.vm.ContextWrapper internal expect fun startLibraryUpdatesService( contextWrapper: ContextWrapper, libraryUpdatesService: LibraryUpdateService, - actions: WebsocketService.Actions + actions: WebsocketService.Actions, ) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/LibraryUpdatesViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/LibraryUpdatesViewModel.kt index 6a35b773..2b979a27 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/LibraryUpdatesViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/LibraryUpdatesViewModel.kt @@ -21,7 +21,7 @@ import org.lighthousegames.logging.logging class LibraryUpdatesViewModel @Inject constructor( private val libraryUpdateService: LibraryUpdateService, private val contextWrapper: ContextWrapper, - @Assisted standalone: Boolean + @Assisted standalone: Boolean, ) : ViewModel(contextWrapper) { private val uiScope = if (standalone) { MainScope() diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/SideMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/SideMenu.kt index d3ac6806..97fb7775 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/SideMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/SideMenu.kt @@ -47,27 +47,27 @@ fun SideMenu(modifier: Modifier, controller: DisplayController, navigator: Navig Surface( Modifier.fillMaxHeight() .windowInsetsPadding( - WindowInsets.systemBars.only(WindowInsetsSides.Vertical + WindowInsetsSides.Start) + WindowInsets.systemBars.only(WindowInsetsSides.Vertical + WindowInsetsSides.Start), ) then modifier, - elevation = 2.dp + elevation = 2.dp, ) { Column( Modifier .fillMaxSize() .verticalScroll(rememberScrollState()) .padding(horizontal = 4.dp), - verticalArrangement = Arrangement.SpaceBetween + verticalArrangement = Arrangement.SpaceBetween, ) { Column { Row( Modifier.fillMaxWidth().height(60.dp), horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { Text( BuildKonfig.NAME, fontSize = 24.sp, - modifier = Modifier + modifier = Modifier, ) IconButton(controller::closeSideMenu) { Icon(Icons.Rounded.Close, contentDescription = null) @@ -77,7 +77,7 @@ fun SideMenu(modifier: Modifier, controller: DisplayController, navigator: Navig remember { TopLevelMenus.values().asList().dropLast(1) }.fastForEach { topLevelMenu -> SideMenuItem( topLevelMenu.isSelected(navigator), - topLevelMenu + topLevelMenu, ) { navigator replaceAll it } } } @@ -88,7 +88,7 @@ fun SideMenu(modifier: Modifier, controller: DisplayController, navigator: Navig remember { MoreMenus.values() }.forEach { topLevelMenu -> SideMenuItem( topLevelMenu.isSelected(navigator), - topLevelMenu + topLevelMenu, ) { navigator replaceAll it } } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/SideMenuItem.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/SideMenuItem.kt index 2777312e..a81c51fe 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/SideMenuItem.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/components/SideMenuItem.kt @@ -38,7 +38,7 @@ fun SideMenuItem(selected: Boolean, topLevelMenu: Menu, newRoot: (Screen) -> Uni topLevelMenu.selectedIcon, topLevelMenu.unselectedIcon, topLevelMenu.extraInfo, - newRoot + newRoot, ) } @@ -50,7 +50,7 @@ private fun SideMenuItem( selectedIcon: ImageVector, unselectedIcon: ImageVector, extraInfo: (@Composable () -> Unit)? = null, - onClick: (Screen) -> Unit + onClick: (Screen) -> Unit, ) { Card( Modifier.fillMaxWidth(), @@ -60,7 +60,7 @@ private fun SideMenuItem( MaterialTheme.colors.primary.copy(0.30F) }, elevation = 0.dp, - shape = RoundedCornerShape(8.dp) + shape = RoundedCornerShape(8.dp), ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -70,9 +70,9 @@ private fun SideMenuItem( onClick = { if (selected) return@clickable onClick(createScreen()) - } + }, // onMiddleClick = { onMiddleClick?.invoke() } todo - ) + ), ) { Spacer(Modifier.width(16.dp)) Icon( @@ -83,7 +83,7 @@ private fun SideMenuItem( }, contentDescription = text, modifier = Modifier.size(20.dp), - tint = MaterialTheme.colors.onSurface + tint = MaterialTheme.colors.onSurface, ) Spacer(Modifier.width(16.dp)) Column { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/more/components/MoreContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/more/components/MoreContent.kt index 922427bc..8c64e777 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/more/components/MoreContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/main/more/components/MoreContent.kt @@ -55,12 +55,12 @@ fun MoreContent() { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.location_more)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -69,16 +69,16 @@ fun MoreContent() { state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { item { Box(Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) { Image( painter = MR.images.icon.toPainter(), contentDescription = "icon", - modifier = Modifier.height(140.dp).padding(vertical = 8.dp) + modifier = Modifier.height(140.dp).padding(vertical = 8.dp), ) } } @@ -97,13 +97,13 @@ fun MoreContent() { navigator push it.createScreen() } .padding(horizontal = 16.dp, vertical = 4.dp), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { Icon( imageVector = it.unselectedIcon, contentDescription = stringResource(it.textKey), modifier = Modifier.size(26.dp), - tint = MaterialTheme.colors.onSurface + tint = MaterialTheme.colors.onSurface, ) Spacer(Modifier.width(24.dp)) Column { @@ -123,11 +123,11 @@ fun MoreContent() { .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) + WindowInsetsSides.Bottom, + ), + ), ), - adapter = rememberScrollbarAdapter(state) + adapter = rememberScrollbarAdapter(state), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/MangaScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/MangaScreen.kt index 3b88d418..b35b54ca 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/MangaScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/MangaScreen.kt @@ -57,7 +57,7 @@ class MangaScreen(private val mangaId: Long) : Screen { clearSelection = vm::clearSelection, downloadChapters = vm::downloadChapters, loadChapters = vm::loadChapters, - loadManga = vm::loadManga + loadManga = vm::loadManga, ) } } 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 3a68ea78..4f5ab4ea 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 @@ -76,7 +76,7 @@ class MangaScreenViewModel @Inject constructor( private val batchChapterDownload: BatchChapterDownload, uiPreferences: UiPreferences, contextWrapper: ContextWrapper, - @Assisted private val params: Params + @Assisted private val params: Params, ) : ViewModel(contextWrapper) { private val _manga = MutableStateFlow(null) val manga = _manga.asStateFlow() @@ -346,7 +346,7 @@ class MangaScreenViewModel @Inject constructor( batchChapterDownload.await( _chapters.value.filter { !it.chapter.read && it.downloadState.value == ChapterDownloadState.NotDownloaded } .map { it.chapter.id } - .takeLast(next) + .takeLast(next), ) } } @@ -355,7 +355,7 @@ class MangaScreenViewModel @Inject constructor( scope.launch { batchChapterDownload.await( _chapters.value.filter { !it.chapter.read && it.downloadState.value == ChapterDownloadState.NotDownloaded } - .map { it.chapter.id } + .map { it.chapter.id }, ) } } @@ -365,7 +365,7 @@ class MangaScreenViewModel @Inject constructor( batchChapterDownload.await( _chapters.value .filter { it.downloadState.value == ChapterDownloadState.NotDownloaded } - .map { it.chapter.id } + .map { it.chapter.id }, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/ChapterItem.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/ChapterItem.kt index 428a6776..a792bae9 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/ChapterItem.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/ChapterItem.kt @@ -51,7 +51,7 @@ expect fun Modifier.chapterItemModifier( unBookmarkChapter: (() -> Unit)?, markPreviousAsRead: () -> Unit, onSelectChapter: (() -> Unit)?, - onUnselectChapter: (() -> Unit)? + onUnselectChapter: (() -> Unit)?, ): Modifier @Composable @@ -68,7 +68,7 @@ fun ChapterItem( onClickStopDownload: (Int) -> Unit, onClickDeleteChapter: (Long) -> Unit, onSelectChapter: (Long) -> Unit, - onUnselectChapter: (Long) -> Unit + onUnselectChapter: (Long) -> Unit, ) { val chapter = chapterDownload.chapter val isSelected by chapterDownload.isSelected.collectAsState() @@ -85,9 +85,9 @@ fun ChapterItem( unBookmarkChapter = { unBookmarkChapter(chapter.id) }.takeIf { chapter.bookmarked }, markPreviousAsRead = { markPreviousAsRead(chapter.index) }, onSelectChapter = { onSelectChapter(chapter.id) }.takeUnless { isSelected }, - onUnselectChapter = { onUnselectChapter(chapter.id) }.takeIf { isSelected } + onUnselectChapter = { onUnselectChapter(chapter.id) }.takeIf { isSelected }, ) - .padding(4.dp) + .padding(4.dp), ) { val textColor = if (chapter.bookmarked && !chapter.read) { MaterialTheme.colors.primary @@ -96,10 +96,10 @@ fun ChapterItem( } Row( - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, ) { Column( - Modifier.padding(4.dp).width(this@BoxWithConstraints.maxWidth - 60.dp) + Modifier.padding(4.dp).width(this@BoxWithConstraints.maxWidth - 60.dp), ) { Row(verticalAlignment = Alignment.CenterVertically) { var textHeight by remember { mutableStateOf(0) } @@ -109,7 +109,7 @@ fun ChapterItem( contentDescription = stringResource(MR.strings.action_filter_bookmarked), modifier = Modifier .sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }), - tint = MaterialTheme.colors.primary + tint = MaterialTheme.colors.primary, ) Spacer(modifier = Modifier.width(2.dp)) } @@ -118,12 +118,12 @@ fun ChapterItem( maxLines = 1, style = MaterialTheme.typography.h6, color = textColor.copy( - alpha = if (chapter.read) ContentAlpha.disabled else ContentAlpha.high + alpha = if (chapter.read) ContentAlpha.disabled else ContentAlpha.high, ), overflow = TextOverflow.Ellipsis, onTextLayout = { textHeight = it.size.height - } + }, ) } val subtitleStr = buildAnnotatedString { @@ -135,8 +135,8 @@ fun ChapterItem( append( AnnotatedString( stringResource(MR.strings.page_progress, (chapter.lastPageRead + 1)), - SpanStyle(color = textColor.copy(alpha = ContentAlpha.disabled)) - ) + SpanStyle(color = textColor.copy(alpha = ContentAlpha.disabled)), + ), ) } if (!chapter.scanlator.isNullOrBlank()) { @@ -148,8 +148,8 @@ fun ChapterItem( subtitleStr, style = MaterialTheme.typography.body2, color = textColor.copy( - alpha = if (chapter.read) ContentAlpha.disabled else ContentAlpha.medium - ) + alpha = if (chapter.read) ContentAlpha.disabled else ContentAlpha.medium, + ), ) } @@ -157,7 +157,7 @@ fun ChapterItem( chapterDownload, { onClickDownload(it.index) }, { onClickStopDownload(it.index) }, - { onClickDeleteChapter(it.id) } + { onClickDeleteChapter(it.id) }, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaMenu.kt index efad17af..b8e0bc82 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaMenu.kt @@ -63,7 +63,7 @@ fun MangaItem(manga: Manga) { Column(horizontalAlignment = Alignment.CenterHorizontally) { Cover( manga, - Modifier.heightIn(120.dp, 300.dp) + Modifier.heightIn(120.dp, 300.dp), ) Spacer(Modifier.height(16.dp)) MangaInfo(manga) @@ -81,9 +81,9 @@ private fun Cover(manga: Manga, modifier: Modifier = Modifier) { errorModifier = modifier then Modifier .aspectRatio( ratio = mangaAspectRatio, - matchHeightConstraintsFirst = true + matchHeightConstraintsFirst = true, ), - filterQuality = FilterQuality.Medium + filterQuality = FilterQuality.Medium, ) } @@ -94,14 +94,14 @@ private fun MangaInfo(manga: Manga, modifier: Modifier = Modifier) { Text( text = manga.title, fontSize = 22.sp, - fontWeight = FontWeight.Bold + fontWeight = FontWeight.Bold, ) Spacer(Modifier.height(4.dp)) if (!manga.author.isNullOrEmpty()) { Text( text = manga.author!!, fontSize = 18.sp, - fontWeight = FontWeight.SemiBold + fontWeight = FontWeight.SemiBold, ) Spacer(Modifier.height(2.dp)) } @@ -109,7 +109,7 @@ private fun MangaInfo(manga: Manga, modifier: Modifier = Modifier) { Text( text = manga.artist!!, fontSize = 18.sp, - fontWeight = FontWeight.SemiBold + fontWeight = FontWeight.SemiBold, ) Spacer(Modifier.height(2.dp)) } @@ -117,7 +117,7 @@ private fun MangaInfo(manga: Manga, modifier: Modifier = Modifier) { Text( text = stringResource(manga.status.res) + " • " + sourceText, fontSize = 18.sp, - fontWeight = FontWeight.SemiBold + fontWeight = FontWeight.SemiBold, ) Spacer(Modifier.height(8.dp)) if (!manga.description.isNullOrEmpty()) { @@ -141,19 +141,19 @@ private fun Chip(text: String) { shape = RoundedCornerShape(50), modifier = Modifier.defaultMinSize(minHeight = 32.dp) .height(IntrinsicSize.Min), - contentColor = MaterialTheme.colors.onSurface.copy(alpha = 0.10F) + contentColor = MaterialTheme.colors.onSurface.copy(alpha = 0.10F), ) { Box( modifier = Modifier.padding(start = 8.dp, end = 6.dp) .fillMaxHeight(), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { Text( text = text, style = MaterialTheme.typography.body2, fontSize = 14.sp, color = MaterialTheme.colors.onSurface.copy(alpha = 0.85F), - maxLines = 1 + maxLines = 1, ) } } @@ -164,7 +164,7 @@ fun CategorySelectDialog( state: MaterialDialogState, categories: ImmutableList, oldCategories: ImmutableList, - onPositiveClick: (List, List) -> Unit + onPositiveClick: (List, List) -> Unit, ) { MaterialDialog( state, @@ -172,7 +172,7 @@ fun CategorySelectDialog( positiveButton(stringResource(MR.strings.action_ok)) negativeButton(stringResource(MR.strings.action_cancel)) }, - properties = getMaterialDialogProperties() + properties = getMaterialDialogProperties(), ) { title(stringResource(MR.strings.select_categories)) @@ -186,14 +186,14 @@ fun CategorySelectDialog( }.toSet(), onCheckedChange = { indexes -> onPositiveClick(indexes.map { categories[it] }, oldCategories) - } + }, ) Box(Modifier.matchParentSize().height(IntrinsicSize.Min)) { VerticalScrollbar( rememberScrollbarAdapter(listState), Modifier.align(Alignment.CenterEnd) .fillMaxHeight() - .scrollbarPadding() + .scrollbarPadding(), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaScreenContent.kt index 5cced256..ecd323c4 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/manga/components/MangaScreenContent.kt @@ -117,7 +117,7 @@ fun MangaScreenContent( clearSelection: () -> Unit, downloadChapters: () -> Unit, loadChapters: () -> Unit, - loadManga: () -> Unit + loadManga: () -> Unit, ) { val categoryDialogState = rememberMaterialDialogState() LaunchedEffect(Unit) { @@ -144,8 +144,8 @@ fun MangaScreenContent( } .windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { val navigator = LocalNavigator.current @@ -155,7 +155,7 @@ fun MangaScreenContent( if (inActionMode) { getActionModeActionItems( selectAll = selectAll, - invertSelection = invertSelection + invertSelection = invertSelection, ) } else { val uriHandler = LocalUriHandler.current @@ -173,7 +173,7 @@ fun MangaScreenContent( }, downloadNext = downloadNext, downloadUnread = downloadUnread, - downloadAll = downloadAll + downloadAll = downloadAll, ) } }, @@ -184,7 +184,7 @@ fun MangaScreenContent( navigator?.pop() } }, - closeIcon = if (inActionMode) Icons.Rounded.Close else ToolbarDefault + closeIcon = if (inActionMode) Icons.Rounded.Close else ToolbarDefault, ) }, bottomBar = { @@ -198,10 +198,10 @@ fun MangaScreenContent( unBookmarkChapter = { unBookmarkChapter(null) }, markPreviousAsRead = markPreviousRead, deleteChapter = { deleteDownload(null) }, - downloadChapters = downloadChapters - ) + downloadChapters = downloadChapters, + ), ) - } + }, ) { padding -> Box(Modifier.padding(padding)) { manga.let { manga -> @@ -213,9 +213,9 @@ fun MangaScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { item { MangaItem(manga) @@ -239,7 +239,7 @@ fun MangaScreenContent( onClickDeleteChapter = deleteDownload, onClickStopDownload = stopDownloadingChapter, onSelectChapter = onSelectChapter, - onUnselectChapter = onUnselectChapter + onUnselectChapter = onUnselectChapter, ) } } else if (!isLoading) { @@ -247,7 +247,7 @@ fun MangaScreenContent( ErrorScreen( stringResource(MR.strings.no_chapters_found), Modifier.height(400.dp).fillMaxWidth(), - retry = loadChapters + retry = loadChapters, ) } } @@ -259,11 +259,11 @@ fun MangaScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) + WindowInsetsSides.Bottom, + ), + ), ), - adapter = rememberScrollbarAdapter(state) + adapter = rememberScrollbarAdapter(state), ) } } else if (!isLoading) { @@ -292,20 +292,20 @@ private fun getActionItems( openInBrowser: () -> Unit, downloadNext: (Int) -> Unit, downloadUnread: () -> Unit, - downloadAll: () -> Unit + downloadAll: () -> Unit, ): ImmutableList { return listOfNotNull( ActionItem( name = stringResource(MR.strings.action_refresh_manga), icon = Icons.Rounded.Refresh, doAction = refreshManga, - enabled = refreshMangaEnabled + enabled = refreshMangaEnabled, ), if (categoryItemVisible) { ActionItem( name = stringResource(MR.strings.edit_categories), icon = Icons.Rounded.Label, - doAction = setCategories + doAction = setCategories, ) } else { null @@ -318,7 +318,7 @@ private fun getActionItems( Icons.Rounded.FavoriteBorder }, doAction = toggleFavorite, - enabled = favoritesButtonEnabled + enabled = favoritesButtonEnabled, ), ActionGroup( name = stringResource(MR.strings.action_download), @@ -326,32 +326,32 @@ private fun getActionItems( actions = listOf( ActionItem( name = stringResource(MR.strings.download_1), - doAction = { downloadNext(1) } + doAction = { downloadNext(1) }, ), ActionItem( name = stringResource(MR.strings.download_5), - doAction = { downloadNext(5) } + doAction = { downloadNext(5) }, ), ActionItem( name = stringResource(MR.strings.download_10), - doAction = { downloadNext(10) } + doAction = { downloadNext(10) }, ), ActionItem( name = stringResource(MR.strings.download_unread), - doAction = downloadUnread + doAction = downloadUnread, ), ActionItem( name = stringResource(MR.strings.download_all), - doAction = downloadAll - ) - ).toImmutableList() + doAction = downloadAll, + ), + ).toImmutableList(), ), ActionItem( name = stringResource(MR.strings.action_open_in_browser), icon = Icons.Rounded.Public, enabled = openInBrowserEnabled, - doAction = openInBrowser - ) + doAction = openInBrowser, + ), ).toImmutableList() } @@ -359,19 +359,19 @@ private fun getActionItems( @Stable private fun getActionModeActionItems( selectAll: () -> Unit, - invertSelection: () -> Unit + invertSelection: () -> Unit, ): ImmutableList { return listOf( ActionItem( name = stringResource(MR.strings.action_select_all), icon = Icons.Rounded.SelectAll, - doAction = selectAll + doAction = selectAll, ), ActionItem( name = stringResource(MR.strings.action_select_inverse), icon = Icons.Rounded.FlipToBack, - doAction = invertSelection - ) + doAction = invertSelection, + ), ).toImmutableList() } @@ -385,43 +385,43 @@ private fun getBottomActionItems( unBookmarkChapter: () -> Unit, markPreviousAsRead: (Int) -> Unit, deleteChapter: () -> Unit, - downloadChapters: () -> Unit + downloadChapters: () -> Unit, ): ImmutableList { return listOfNotNull( BottomActionItem( name = stringResource(MR.strings.action_bookmark), icon = Icons.Rounded.BookmarkAdd, - onClick = bookmarkChapter + onClick = bookmarkChapter, ).takeIf { selectedItems.fastAny { !it.chapter.bookmarked } }, BottomActionItem( name = stringResource(MR.strings.action_remove_bookmark), icon = Icons.Rounded.BookmarkRemove, - onClick = unBookmarkChapter + onClick = unBookmarkChapter, ).takeIf { selectedItems.fastAny { it.chapter.bookmarked } }, BottomActionItem( name = stringResource(MR.strings.action_mark_as_read), icon = Icons.Rounded.DoneAll, - onClick = markRead + onClick = markRead, ).takeIf { selectedItems.fastAny { !it.chapter.read } }, BottomActionItem( name = stringResource(MR.strings.action_mark_as_unread), icon = Icons.Rounded.RemoveDone, - onClick = markUnread + onClick = markUnread, ).takeIf { selectedItems.fastAny { it.chapter.read } }, BottomActionItem( name = stringResource(MR.strings.action_mark_previous_read), icon = JuiAssets.DonePrev, - onClick = { markPreviousAsRead(selectedItems.first().chapter.index) } + onClick = { markPreviousAsRead(selectedItems.first().chapter.index) }, ).takeIf { selectedItems.size == 1 }, BottomActionItem( name = stringResource(MR.strings.action_download), icon = Icons.Rounded.Download, - onClick = downloadChapters + onClick = downloadChapters, ).takeIf { selectedItems.fastAny { it.downloadState.value == ChapterDownloadState.NotDownloaded } }, BottomActionItem( name = stringResource(MR.strings.action_delete), icon = Icons.Rounded.Delete, - onClick = deleteChapter - ).takeIf { selectedItems.fastAny { it.downloadState.value == ChapterDownloadState.Downloaded } } + onClick = deleteChapter, + ).takeIf { selectedItems.fastAny { it.downloadState.value == ChapterDownloadState.Downloaded } }, ).toImmutableList() } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ChapterLoader.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ChapterLoader.kt index 34a21bed..bffabf09 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ChapterLoader.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ChapterLoader.kt @@ -25,7 +25,7 @@ class ChapterLoader( private val readerPreferences: ReaderPreferences, private val getChapterPage: GetChapterPage, private val chapterCache: DiskCache, - private val bitmapDecoderFactory: BitmapDecoderFactory + private val bitmapDecoderFactory: BitmapDecoderFactory, ) { fun loadChapter(chapter: ReaderChapter): StateFlow { if (chapterIsReady(chapter)) { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenu.kt index 4a111887..5b6ac7f1 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenu.kt @@ -102,7 +102,7 @@ import kotlinx.coroutines.launch expect class ReaderLauncher { fun launch( chapterIndex: Int, - mangaId: Long + mangaId: Long, ) @Composable @@ -116,7 +116,7 @@ expect fun rememberReaderLauncher(): ReaderLauncher fun ReaderMenu( chapterIndex: Int, mangaId: Long, - onCloseRequest: () -> Unit + onCloseRequest: () -> Unit, ) { val viewModels = LocalViewModels.current val vm = remember { viewModels.readerViewModel(ReaderMenuViewModel.Params(chapterIndex, mangaId)) } @@ -164,7 +164,7 @@ fun ReaderMenu( Key.Spacebar -> vm.navigate(Navigation.NEXT) else -> false } - } + }, ) { Crossfade(state to chapter) { (state, chapter) -> if (state is ReaderChapter.State.Loaded && chapter != null) { @@ -196,7 +196,7 @@ fun ReaderMenu( setSideMenuOpen = vm::setReaderSettingsMenuOpen, setMangaReaderMode = vm::setMangaReaderMode, movePrevChapter = vm::prevChapter, - moveNextChapter = vm::nextChapter + moveNextChapter = vm::nextChapter, ) } else { ThinReaderMenu( @@ -226,7 +226,7 @@ fun ReaderMenu( setMangaReaderMode = vm::setMangaReaderMode, movePrevChapter = vm::prevChapter, moveNextChapter = vm::nextChapter, - onCloseRequest = onCloseRequest + onCloseRequest = onCloseRequest, ) } } @@ -237,7 +237,7 @@ fun ReaderMenu( LoadingScreen( state is ReaderChapter.State.Wait || state is ReaderChapter.State.Loading, errorMessage = (state as? ReaderChapter.State.Error)?.error?.message, - retry = vm::init + retry = vm::init, ) } } @@ -276,20 +276,20 @@ fun WideReaderMenu( setSideMenuOpen: (Boolean) -> Unit, setMangaReaderMode: (String) -> Unit, movePrevChapter: () -> Unit, - moveNextChapter: () -> Unit + moveNextChapter: () -> Unit, ) { val sideMenuSize by animateDpAsState( targetValue = if (sideMenuOpen) { 260.dp } else { 0.dp - } + }, ) AnimatedVisibility( sideMenuOpen, enter = fadeIn() + slideInHorizontally(), - exit = fadeOut() + slideOutHorizontally() + exit = fadeOut() + slideOutHorizontally(), ) { ReaderSideMenu( chapter = chapter, @@ -303,12 +303,12 @@ fun WideReaderMenu( }, onSetReaderMode = setMangaReaderMode, onPrevChapterClicked = movePrevChapter, - onNextChapterClicked = moveNextChapter + onNextChapterClicked = moveNextChapter, ) } Box( - Modifier.padding(start = sideMenuSize).fillMaxSize() + Modifier.padding(start = sideMenuSize).fillMaxSize(), ) { ReaderLayout( pages = pages, @@ -326,7 +326,7 @@ fun WideReaderMenu( retry = retry, progress = progress, updateLastPageReadOffset = updateLastPageReadOffset, - requestPreloadChapter = requestPreloadChapter + requestPreloadChapter = requestPreloadChapter, ) SideMenuButton(sideMenuOpen, onOpenSideMenuClicked = { setSideMenuOpen(true) }) } @@ -360,10 +360,10 @@ fun ThinReaderMenu( setMangaReaderMode: (String) -> Unit, movePrevChapter: () -> Unit, moveNextChapter: () -> Unit, - onCloseRequest: () -> Unit + onCloseRequest: () -> Unit, ) { val sheetState = rememberModalBottomSheetState( - ModalBottomSheetValue.Hidden + ModalBottomSheetValue.Hidden, ) val scope = rememberCoroutineScope() BackHandler(sheetState.isVisible) { @@ -377,9 +377,9 @@ fun ThinReaderMenu( ReaderSheet( readerModes = readerModes, selectedMode = readerMode, - onSetReaderMode = setMangaReaderMode + onSetReaderMode = setMangaReaderMode, ) - } + }, ) { Box { ReaderLayout( @@ -398,13 +398,13 @@ fun ThinReaderMenu( retry = retry, progress = progress, updateLastPageReadOffset = updateLastPageReadOffset, - requestPreloadChapter = requestPreloadChapter + requestPreloadChapter = requestPreloadChapter, ) AnimatedVisibility( readerMenuOpen, enter = slideInVertically { -it }, exit = slideOutVertically { -it }, - modifier = Modifier.align(Alignment.TopCenter) + modifier = Modifier.align(Alignment.TopCenter), ) { Toolbar( chapter.chapter.name, @@ -419,9 +419,9 @@ fun ThinReaderMenu( Icons.Rounded.Public, doAction = { uriHandler.openUri( - chapter.chapter.realUrl ?: return@ActionItem + chapter.chapter.realUrl ?: return@ActionItem, ) - } + }, ) } else { null @@ -433,10 +433,10 @@ fun ThinReaderMenu( scope.launch { sheetState.show() } - } - ) + }, + ), ).toImmutableList() - } + }, ) } ReaderExpandBottomMenu( @@ -450,7 +450,7 @@ fun ThinReaderMenu( navigate = navigate, readerMenuOpen = readerMenuOpen, movePrevChapter = movePrevChapter, - moveNextChapter = moveNextChapter + moveNextChapter = moveNextChapter, ) } } @@ -473,7 +473,7 @@ fun ReaderLayout( retry: (ReaderPage) -> Unit, progress: (ReaderItem) -> Unit, updateLastPageReadOffset: (Int) -> Unit, - requestPreloadChapter: (ReaderChapter) -> Unit + requestPreloadChapter: (ReaderChapter) -> Unit, ) { val loadingModifier = Modifier.widthIn(max = 700.dp) .fillMaxWidth() @@ -483,12 +483,12 @@ fun ReaderLayout( if (navigationViewer != null) { it.navigationClickable( navigation = navigationViewer, - onClick = navigateTap + onClick = navigateTap, ) } else { it.clickable( interactionSource = remember { MutableInteractionSource() }, - indication = null + indication = null, ) { navigateTap(Navigation.MENU) } } } @@ -516,7 +516,7 @@ fun ReaderLayout( retry = retry, progress = progress, updateLastPageReadOffset = updateLastPageReadOffset, - requestPreloadChapter = requestPreloadChapter + requestPreloadChapter = requestPreloadChapter, ) } else { PagerReader( @@ -529,7 +529,7 @@ fun ReaderLayout( pageEmitterHolder = pageEmitterHolder, retry = retry, progress = progress, - requestPreloadChapter = requestPreloadChapter + requestPreloadChapter = requestPreloadChapter, ) } } @@ -539,7 +539,7 @@ fun SideMenuButton(sideMenuOpen: Boolean, onOpenSideMenuClicked: () -> Unit) { AnimatedVisibility( !sideMenuOpen, enter = fadeIn() + slideInHorizontally(), - exit = fadeOut() + slideOutHorizontally() + exit = fadeOut() + slideOutHorizontally(), ) { IconButton(onOpenSideMenuClicked) { Icon(Icons.Rounded.ChevronRight, null) @@ -558,7 +558,7 @@ fun ReaderImage( imageModifier: Modifier = Modifier.fillMaxSize(), loadingModifier: Modifier = imageModifier, contentScale: ContentScale = ContentScale.Fit, - retry: (Int) -> Unit + retry: (Int) -> Unit, ) { Crossfade(drawableHolder to status) { (drawableHolder, status) -> val decodeState = produceState(null, drawableHolder) { @@ -576,7 +576,7 @@ fun ReaderImage( modifier = imageModifier, contentDescription = null, contentScale = contentScale, - filterQuality = FilterQuality.High + filterQuality = FilterQuality.High, ) } else { LoadingScreen( @@ -594,7 +594,7 @@ fun ReaderImage( ReaderPage.ImageDecodeState.UnknownDecoder -> "Unknown decoder" ReaderPage.ImageDecodeState.FailedToGetSnapShot -> "Failed to get snapshot" else -> null - } + }, ) { retry(imageIndex) } } } @@ -604,7 +604,7 @@ fun ReaderImage( fun ChapterSeparator( previousChapter: ReaderChapter?, nextChapter: ReaderChapter?, - requestPreloadChapter: (ReaderChapter) -> Unit + requestPreloadChapter: (ReaderChapter) -> Unit, ) { Box(Modifier.fillMaxWidth().height(350.dp), contentAlignment = Alignment.Center) { Column(horizontalAlignment = Alignment.CenterHorizontally) { diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenuViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenuViewModel.kt index 486df22c..b4367caf 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenuViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderMenuViewModel.kt @@ -81,7 +81,7 @@ class ReaderMenuViewModel @Inject constructor( private val updateChapterMeta: UpdateChapterMeta, private val chapterCache: ChapterCache, contextWrapper: ContextWrapper, - @Assisted private val params: Params + @Assisted private val params: Params, ) : ViewModel(contextWrapper) { override val scope = MainScope() private val _manga = MutableStateFlow(null) @@ -152,7 +152,7 @@ class ReaderMenuViewModel @Inject constructor( readerPreferences = readerPreferences, getChapterPage = getChapterPage, chapterCache = chapterCache, - bitmapDecoderFactory = BitmapDecoderFactory(contextWrapper) + bitmapDecoderFactory = BitmapDecoderFactory(contextWrapper), ) init { @@ -304,7 +304,7 @@ class ReaderMenuViewModel @Inject constructor( private suspend fun initChapters( mangaId: Long, chapterIndex: Int, - fromMenuButton: Boolean = true + fromMenuButton: Boolean = true, ) { log.debug { "Loading chapter index $chapterIndex" } val (chapter, pages) = coroutineScope { @@ -318,7 +318,7 @@ class ReaderMenuViewModel @Inject constructor( val getAdjacentChapters = async { val chapters = getChapters.await( mangaId, - onError = { /* TODO: 2022-07-01 Error toast */ } + onError = { /* TODO: 2022-07-01 Error toast */ }, ).orEmpty() val nextChapter = async { @@ -384,7 +384,7 @@ class ReaderMenuViewModel @Inject constructor( _state.value = ReaderChapter.State.Error(it) log.warn(it) { "Error getting chapter $chapterIndex" } } - .singleOrNull() ?: return null + .singleOrNull() ?: return null, ) } @@ -405,7 +405,7 @@ class ReaderMenuViewModel @Inject constructor( @OptIn(DelicateCoroutinesApi::class) fun sendProgress( chapter: Chapter? = this.chapter.value?.chapter, - lastPageRead: Int = (currentPage.value as? ReaderPage)?.index ?: 0 + lastPageRead: Int = (currentPage.value as? ReaderPage)?.index ?: 0, ) { chapter ?: return if (chapter.read) return @@ -413,7 +413,7 @@ class ReaderMenuViewModel @Inject constructor( updateChapterLastPageRead.await( chapter, lastPageRead = lastPageRead, - onError = { toast(it.message.orEmpty()) } + onError = { toast(it.message.orEmpty()) }, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderSideMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderSideMenu.kt index f10032fb..14b1d110 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderSideMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/ReaderSideMenu.kt @@ -78,7 +78,7 @@ fun ReaderSideMenu( onCloseSideMenuClicked: () -> Unit, onSetReaderMode: (String) -> Unit, onPrevChapterClicked: () -> Unit, - onNextChapterClicked: () -> Unit + onNextChapterClicked: () -> Unit, ) { Surface(Modifier.fillMaxHeight().width(260.dp)) { Column(Modifier.fillMaxSize()) { @@ -88,7 +88,7 @@ fun ReaderSideMenu( ReaderModeSetting( readerModes = readerModes, selectedMode = selectedMode, - onSetReaderMode = onSetReaderMode + onSetReaderMode = onSetReaderMode, ) Spacer(Modifier.height(4.dp)) ReaderProgressSlider( @@ -96,21 +96,21 @@ fun ReaderSideMenu( currentPage = currentPage, pageCount = pageCount, onNewPageClicked = onNewPageClicked, - isRtL = false + isRtL = false, ) Spacer(Modifier.height(4.dp)) val uriHandler = LocalUriHandler.current TextButton( onClick = { uriHandler.openUri(chapter.chapter.realUrl ?: return@TextButton) }, enabled = chapter.chapter.realUrl != null, - modifier = Modifier.fillMaxWidth().padding(horizontal = 4.dp) + modifier = Modifier.fillMaxWidth().padding(horizontal = 4.dp), ) { Text(stringResource(MR.strings.action_open_in_browser)) } Spacer(Modifier.height(4.dp)) NavigateChapters( loadPrevChapter = onPrevChapterClicked, - loadNextChapter = onNextChapterClicked + loadNextChapter = onNextChapterClicked, ) } } @@ -128,13 +128,13 @@ fun ReaderExpandBottomMenu( navigate: (Int) -> Unit, readerMenuOpen: Boolean, movePrevChapter: () -> Unit, - moveNextChapter: () -> Unit + moveNextChapter: () -> Unit, ) { AnimatedVisibility( readerMenuOpen, enter = slideInVertically { it }, exit = slideOutVertically { it }, - modifier = modifier + modifier = modifier, ) { val isRtL = direction == Direction.Left AroundLayout( @@ -151,7 +151,7 @@ fun ReaderExpandBottomMenu( .aspectRatio(1F, true), shape = CircleShape, backgroundColor = MaterialTheme.colors.surface.copy(alpha = 0.5F), - enabled = enabled + enabled = enabled, ) { Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { Icon(Icons.Rounded.SkipPrevious, text) @@ -170,18 +170,18 @@ fun ReaderExpandBottomMenu( .aspectRatio(1F, true), shape = CircleShape, backgroundColor = MaterialTheme.colors.surface.copy(alpha = 0.5F), - enabled = enabled + enabled = enabled, ) { Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { Icon(Icons.Rounded.SkipNext, text) } } - } + }, ) { Card( modifier = Modifier.fillMaxSize().padding(it).padding(horizontal = 8.dp), shape = CircleShape, - backgroundColor = MaterialTheme.colors.surface.copy(alpha = 0.5F) + backgroundColor = MaterialTheme.colors.surface.copy(alpha = 0.5F), ) { AroundLayout( Modifier.padding(horizontal = 8.dp), @@ -204,7 +204,7 @@ fun ReaderExpandBottomMenu( }.toString() Text(text, fontSize = 15.sp) } - } + }, ) { paddingValues -> ReaderProgressSlider( modifier = Modifier.fillMaxWidth() @@ -214,7 +214,7 @@ fun ReaderExpandBottomMenu( currentPage = currentPage, pageCount = chapter.chapter.pageCount!!, onNewPageClicked = navigate, - isRtL = isRtL + isRtL = isRtL, ) } } @@ -226,7 +226,7 @@ fun ReaderExpandBottomMenu( fun ReaderSheet( readerModes: ImmutableList, selectedMode: String, - onSetReaderMode: (String) -> Unit + onSetReaderMode: (String) -> Unit, ) { Column(Modifier.fillMaxSize()) { ReaderModeSetting(readerModes, selectedMode, onSetReaderMode) @@ -244,14 +244,14 @@ fun ReaderModeSetting(readerModes: ImmutableList, selectedMode: String, .defaultMinSize(minHeight = 56.dp) .padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, ) { Text(stringResource(MR.strings.reader_mode), Modifier.weight(0.25f), maxLines = 2, fontSize = 14.sp) Spacer(Modifier.width(8.dp)) Spinner( modifier = Modifier.weight(0.75f), items = displayModes, - selectedItemIndex = selectedModeIndex + selectedItemIndex = selectedModeIndex, ) { onSetReaderMode(modes[it]) } @@ -276,11 +276,11 @@ private fun ReaderProgressSlider( currentPage: ReaderItem?, pageCount: Int, onNewPageClicked: (Int) -> Unit, - isRtL: Boolean + isRtL: Boolean, ) { val animatedProgress by animateFloatAsState( targetValue = pages.indexOf(currentPage).toFloat(), - animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec + animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec, ) var isValueChanging by remember { mutableStateOf(false) } Slider( @@ -300,7 +300,7 @@ private fun ReaderProgressSlider( } else { it } - } + }, ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt index 3ea75456..0f8f62da 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/loader/TachideskPageLoader.kt @@ -55,7 +55,7 @@ class TachideskPageLoader( readerPreferences: ReaderPreferences, private val getChapterPage: GetChapterPage, private val chapterCache: DiskCache, - private val bitmapDecoderFactory: BitmapDecoderFactory + private val bitmapDecoderFactory: BitmapDecoderFactory, ) : PageLoader() { val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default) @@ -64,7 +64,7 @@ class TachideskPageLoader( */ private val channel = PriorityChannel( scope = scope, - comparator = { i1, i2 -> i1.compareTo(i2) } + comparator = { i1, i2 -> i1.compareTo(i2) }, ) /** @@ -153,9 +153,9 @@ class TachideskPageLoader( ImageResult.Source( ImageRequest(Any()), source, - DataSource.Engine + DataSource.Engine, ), - Options() + Options(), ) if (decoder != null) { runCatching { decoder.decode() as DecodeResult.Bitmap } @@ -163,9 +163,9 @@ class TachideskPageLoader( ReaderPage.ImageDecodeState.Success( it.bitmap.asImageBitmap().also { page.bitmapInfo.value = ReaderPage.BitmapInfo( - IntSize(it.width, it.height) + IntSize(it.width, it.height), ) - } + }, ) } .getOrElse { @@ -218,9 +218,9 @@ class TachideskPageLoader( progress = MutableStateFlow(0.0F), status = MutableStateFlow(ReaderPage.Status.QUEUE), error = MutableStateFlow(null), - chapter = chapter + chapter = chapter, ) - } + }, ) } } @@ -261,7 +261,7 @@ class TachideskPageLoader( */ private class PriorityPage( val page: ReaderPage, - val priority: Int + val priority: Int, ) : Comparable { companion object { private val idGenerator = AtomicInt32(1) diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/MoveTo.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/MoveTo.kt index e7715986..1a2114ad 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/MoveTo.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/MoveTo.kt @@ -8,5 +8,5 @@ package ca.gosyer.jui.ui.reader.model enum class MoveTo { Previous, - Next + Next, } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ReaderPage.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ReaderPage.kt index 5d92dda0..1b9d77e8 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ReaderPage.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ReaderPage.kt @@ -20,13 +20,13 @@ data class ReaderPage( val progress: MutableStateFlow, val status: MutableStateFlow, val error: MutableStateFlow, - val chapter: ReaderChapter + val chapter: ReaderChapter, ) : ReaderItem() { enum class Status { QUEUE, WORKING, READY, - ERROR + ERROR, } @Immutable diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ReaderPageSeparator.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ReaderPageSeparator.kt index 8c6e408e..b19c024a 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ReaderPageSeparator.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ReaderPageSeparator.kt @@ -8,5 +8,5 @@ package ca.gosyer.jui.ui.reader.model data class ReaderPageSeparator( val previousChapter: ReaderChapter?, - val nextChapter: ReaderChapter? + val nextChapter: ReaderChapter?, ) : ReaderItem() diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ViewerChapters.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ViewerChapters.kt index 6d2ffab6..8210ed64 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ViewerChapters.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/model/ViewerChapters.kt @@ -9,7 +9,7 @@ package ca.gosyer.jui.ui.reader.model data class ViewerChapters( val currChapter: ReaderChapter?, val prevChapter: ReaderChapter?, - val nextChapter: ReaderChapter? + val nextChapter: ReaderChapter?, ) { fun recycle() { currChapter?.recycle() @@ -22,7 +22,7 @@ data class ViewerChapters( return ViewerChapters( nextChapter = currChapter, currChapter = prevChapter, - prevChapter = null + prevChapter = null, ) } @@ -31,7 +31,7 @@ data class ViewerChapters( return ViewerChapters( prevChapter = currChapter, currChapter = nextChapter, - nextChapter = null + nextChapter = null, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/EdgeNavigation.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/EdgeNavigation.kt index c7ab5d4c..8a42d409 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/EdgeNavigation.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/EdgeNavigation.kt @@ -25,15 +25,15 @@ class EdgeNavigation : ViewerNavigation() { override var regions: List = listOf( Region( rect = Rect(0, 0, 33, 100), - type = Navigation.NEXT + type = Navigation.NEXT, ), Region( rect = Rect(33, 66, 66, 100), - type = Navigation.PREV + type = Navigation.PREV, ), Region( rect = Rect(66, 0, 100, 100), - type = Navigation.NEXT - ) + type = Navigation.NEXT, + ), ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/KindlishNavigation.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/KindlishNavigation.kt index c9179160..f0f4f084 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/KindlishNavigation.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/KindlishNavigation.kt @@ -25,11 +25,11 @@ class KindlishNavigation : ViewerNavigation() { override var regions: List = listOf( Region( rect = Rect(33, 33, 100, 100), - type = Navigation.NEXT + type = Navigation.NEXT, ), Region( rect = Rect(0, 33, 33, 100), - type = Navigation.PREV - ) + type = Navigation.PREV, + ), ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/LNavigation.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/LNavigation.kt index d5a0a05e..b9bea9b7 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/LNavigation.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/LNavigation.kt @@ -25,19 +25,19 @@ open class LNavigation : ViewerNavigation() { override var regions: List = listOf( Region( rect = Rect(0, 33, 33, 66), - type = Navigation.PREV + type = Navigation.PREV, ), Region( rect = Rect(0, 0, 100, 33), - type = Navigation.PREV + type = Navigation.PREV, ), Region( rect = Rect(66, 33, 100, 66), - type = Navigation.NEXT + type = Navigation.NEXT, ), Region( rect = Rect(0, 66, 100, 100), - type = Navigation.NEXT - ) + type = Navigation.NEXT, + ), ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/NavigationClickable.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/NavigationClickable.kt index 95ff859a..cb1b63fb 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/NavigationClickable.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/NavigationClickable.kt @@ -26,18 +26,18 @@ import kotlinx.coroutines.flow.MutableStateFlow fun Modifier.navigationClickable( navigation: ViewerNavigation, - onClick: (Navigation) -> Unit = {} + onClick: (Navigation) -> Unit = {}, ) = composed( inspectorInfo = debugInspectorInfo { name = "navigationClickable" properties["navigation"] = navigation properties["onClick"] = onClick - } + }, ) { navigationClickable( navigation = navigation, interactionSource = remember { MutableInteractionSource() }, - onClick = onClick + onClick = onClick, ) } @@ -47,7 +47,7 @@ fun Modifier.navigationClickable( enabled: Boolean = true, onClickLabel: String? = null, role: Role? = null, - onClick: (Navigation) -> Unit + onClick: (Navigation) -> Unit, ): Modifier = composed( inspectorInfo = debugInspectorInfo { name = "navigationClickable" @@ -57,7 +57,7 @@ fun Modifier.navigationClickable( properties["role"] = role properties["onClick"] = onClick properties["interactionSource"] = interactionSource - } + }, ) { val offsetEvent = remember { MutableStateFlow(null) } val layoutSize = remember { MutableStateFlow(Size.Zero) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/RightAndLeftNavigation.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/RightAndLeftNavigation.kt index 7a0c3ba7..91d78748 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/RightAndLeftNavigation.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/RightAndLeftNavigation.kt @@ -25,11 +25,11 @@ class RightAndLeftNavigation : ViewerNavigation() { override var regions: List = listOf( Region( rect = Rect(0, 0, 33, 100), - type = Navigation.LEFT + type = Navigation.LEFT, ), Region( rect = Rect(66, 0, 100, 100), - type = Navigation.RIGHT - ) + type = Navigation.RIGHT, + ), ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/ViewerNavigation.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/ViewerNavigation.kt index daac1bfb..b93aa795 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/ViewerNavigation.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/navigation/ViewerNavigation.kt @@ -43,12 +43,12 @@ abstract class ViewerNavigation { data class Region( val rect: Rect, - val type: Navigation + val type: Navigation, ) { fun invert(invertMode: TappingInvertMode): Region { if (invertMode == TappingInvertMode.NONE) return this return this.copy( - rect = this.rect.invert(invertMode) + rect = this.rect.invert(invertMode), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Continuous.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Continuous.kt index 98560019..e0dfb348 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Continuous.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Continuous.kt @@ -64,7 +64,7 @@ fun ContinuousReader( retry: (ReaderPage) -> Unit, progress: (ReaderItem) -> Unit, updateLastPageReadOffset: (Int) -> Unit, - requestPreloadChapter: (ReaderChapter) -> Unit + requestPreloadChapter: (ReaderChapter) -> Unit, ) { BoxWithConstraints(modifier then Modifier.fillMaxSize()) { val state = rememberLazyListState(pages.indexOf(currentPage).coerceAtLeast(1), currentPageOffset) @@ -82,7 +82,7 @@ fun ContinuousReader( state.animateScrollBy( with(density) { by.toPx() - } + }, ) Unit } @@ -131,7 +131,7 @@ fun ContinuousReader( state = state, reverseLayout = direction == Direction.Up, horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier.fillMaxWidth() + modifier = Modifier.fillMaxWidth(), ) { items( modifier = Modifier.fillMaxWidth() @@ -141,7 +141,7 @@ fun ContinuousReader( loadingModifier = loadingModifier, pageContentScale = pageContentScale, retry = ::retry, - requestPreloadChapter = requestPreloadChapter + requestPreloadChapter = requestPreloadChapter, ) } VerticalScrollbar( @@ -149,7 +149,7 @@ fun ContinuousReader( .fillMaxHeight() .scrollbarPadding(), adapter = rememberScrollbarAdapter(state), - reverseLayout = direction == Direction.Up + reverseLayout = direction == Direction.Up, ) } false -> { @@ -157,7 +157,7 @@ fun ContinuousReader( state = state, reverseLayout = direction == Direction.Left, verticalAlignment = Alignment.CenterVertically, - modifier = Modifier.fillMaxHeight() + modifier = Modifier.fillMaxHeight(), ) { items( modifier = Modifier.fillMaxHeight() @@ -167,14 +167,14 @@ fun ContinuousReader( loadingModifier = loadingModifier, pageContentScale = pageContentScale, retry = ::retry, - requestPreloadChapter = requestPreloadChapter + requestPreloadChapter = requestPreloadChapter, ) } HorizontalScrollbar( modifier = Modifier.align(Alignment.BottomCenter) .fillMaxWidth(), adapter = rememberScrollbarAdapter(state), - reverseLayout = direction == Direction.Left + reverseLayout = direction == Direction.Left, ) } } @@ -188,7 +188,7 @@ private fun LazyListScope.items( loadingModifier: Modifier, pageContentScale: ContentScale, retry: (Int) -> Unit, - requestPreloadChapter: (ReaderChapter) -> Unit + requestPreloadChapter: (ReaderChapter) -> Unit, ) { items( pages, @@ -197,7 +197,7 @@ private fun LazyListScope.items( is ReaderPage -> it.chapter.chapter.index to it.index is ReaderPageSeparator -> it.previousChapter?.chapter?.index to it.nextChapter?.chapter?.index } - } + }, ) { image -> when (image) { is ReaderPage -> Box(modifier, contentAlignment = Alignment.Center) { @@ -211,13 +211,13 @@ private fun LazyListScope.items( imageModifier = imageModifier, loadingModifier = loadingModifier, contentScale = pageContentScale, - retry = retry + retry = retry, ) } is ReaderPageSeparator -> ChapterSeparator( previousChapter = image.previousChapter, nextChapter = image.nextChapter, - requestPreloadChapter = requestPreloadChapter + requestPreloadChapter = requestPreloadChapter, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Pager.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Pager.kt index 7ea3ecb4..b162ec32 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Pager.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/reader/viewer/Pager.kt @@ -42,7 +42,7 @@ fun PagerReader( pageEmitterHolder: StableHolder>, retry: (ReaderPage) -> Unit, progress: (ReaderItem) -> Unit, - requestPreloadChapter: (ReaderChapter) -> Unit + requestPreloadChapter: (ReaderChapter) -> Unit, ) { val state = rememberPagerState(initialPage = pages.indexOf(currentPage).coerceAtLeast(1)) val currentPageState = rememberUpdatedState(currentPage) @@ -95,7 +95,7 @@ fun PagerReader( is ReaderPageSeparator -> page.previousChapter?.chapter?.index to page.nextChapter?.chapter?.index else -> it } - } + }, ) { HandlePager( pages = pages, @@ -103,7 +103,7 @@ fun PagerReader( loadingModifier = loadingModifier, pageContentScale = pageContentScale, retry = ::retry, - requestPreloadChapter = requestPreloadChapter + requestPreloadChapter = requestPreloadChapter, ) } } else { @@ -118,7 +118,7 @@ fun PagerReader( is ReaderPageSeparator -> page.previousChapter?.chapter?.index to page.nextChapter?.chapter?.index else -> it } - } + }, ) { HandlePager( pages = pages, @@ -126,7 +126,7 @@ fun PagerReader( loadingModifier = loadingModifier, pageContentScale = pageContentScale, retry = ::retry, - requestPreloadChapter = requestPreloadChapter + requestPreloadChapter = requestPreloadChapter, ) } } @@ -139,7 +139,7 @@ fun HandlePager( loadingModifier: Modifier, pageContentScale: ContentScale, retry: (Int) -> Unit, - requestPreloadChapter: (ReaderChapter) -> Unit + requestPreloadChapter: (ReaderChapter) -> Unit, ) { when (val image = pages[page]) { is ReaderPage -> { @@ -152,13 +152,13 @@ fun HandlePager( error = image.error.collectAsState().value, loadingModifier = loadingModifier, retry = retry, - contentScale = pageContentScale + contentScale = pageContentScale, ) } is ReaderPageSeparator -> ChapterSeparator( previousChapter = image.previousChapter, nextChapter = image.nextChapter, - requestPreloadChapter = requestPreloadChapter + requestPreloadChapter = requestPreloadChapter, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAdvancedScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAdvancedScreen.kt index 9cdbe80d..cdf07866 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAdvancedScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAdvancedScreen.kt @@ -68,7 +68,7 @@ class SettingsAdvancedScreen : Screen { imageCacheSize = vm.imageCacheSize.collectAsState().value, clearImageCache = vm::clearImageCache, chapterCacheSize = vm.chapterCacheSize.collectAsState().value, - clearChapterCache = vm::clearChapterCache + clearChapterCache = vm::clearChapterCache, ) } } @@ -77,7 +77,7 @@ class SettingsAdvancedViewModel @Inject constructor( updatePreferences: UpdatePreferences, private val imageCache: ImageCache, private val chapterCache: ChapterCache, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { val updatesEnabled = updatePreferences.enabled().asStateFlow() @@ -117,17 +117,17 @@ fun SettingsAdvancedScreenContent( imageCacheSize: String, clearImageCache: () -> Unit, chapterCacheSize: String, - clearChapterCache: () -> Unit + clearChapterCache: () -> Unit, ) { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.settings_advanced_screen)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -136,9 +136,9 @@ fun SettingsAdvancedScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { item { SwitchPreference(preference = updatesEnabled, title = stringResource(MR.strings.update_checker)) @@ -150,14 +150,14 @@ fun SettingsAdvancedScreenContent( PreferenceRow( title = stringResource(MR.strings.clear_image_cache), subtitle = stringResource(MR.strings.clear_cache_sub, imageCacheSize), - onClick = clearImageCache + onClick = clearImageCache, ) } item { PreferenceRow( title = stringResource(MR.strings.clear_chapter_cache), subtitle = stringResource(MR.strings.clear_cache_sub, chapterCacheSize), - onClick = clearChapterCache + onClick = clearChapterCache, ) } } @@ -169,10 +169,10 @@ fun SettingsAdvancedScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAppearanceScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAppearanceScreen.kt index fdab0cf4..cdb23bea 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAppearanceScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsAppearanceScreen.kt @@ -103,14 +103,14 @@ class SettingsAppearanceScreen : Screen { darkTheme = vm.darkTheme, windowDecorations = vm.windowDecorations, customColors = colors, - customExtraColors = extraColors + customExtraColors = extraColors, ) } } class ThemesViewModel @Inject constructor( private val uiPreferences: UiPreferences, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { val themeMode = uiPreferences.themeMode().asStateFlow() @@ -137,7 +137,7 @@ fun SettingsAppearanceScreenContent( darkTheme: PreferenceMutableStateFlow, windowDecorations: PreferenceMutableStateFlow, customColors: Colors, - customExtraColors: ExtraColors + customExtraColors: ExtraColors, ) { val isLight = MaterialTheme.colors.isLight val themesForCurrentMode = remember(isLight) { @@ -149,12 +149,12 @@ fun SettingsAppearanceScreenContent( Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.settings_appearance_screen)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -163,9 +163,9 @@ fun SettingsAppearanceScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { item { ChoicePreference( @@ -173,15 +173,15 @@ fun SettingsAppearanceScreenContent( choices = persistentMapOf( ThemeMode.System to stringResource(MR.strings.theme_follow_system), ThemeMode.Light to stringResource(MR.strings.theme_light), - ThemeMode.Dark to stringResource(MR.strings.theme_dark) + ThemeMode.Dark to stringResource(MR.strings.theme_dark), ), - title = stringResource(MR.strings.theme) + title = stringResource(MR.strings.theme), ) } item { Text( stringResource(MR.strings.preset_themes), - modifier = Modifier.padding(start = 16.dp, top = 16.dp, bottom = 4.dp) + modifier = Modifier.padding(start = 16.dp, top = 16.dp, bottom = 4.dp), ) val lazyListState = rememberLazyListState() Box { @@ -191,21 +191,21 @@ fun SettingsAppearanceScreenContent( .animateContentSize() .padding(vertical = 8.dp), contentPadding = PaddingValues(horizontal = 8.dp), - horizontalArrangement = Arrangement.spacedBy(8.dp) + horizontalArrangement = Arrangement.spacedBy(8.dp), ) { items(themesForCurrentMode) { theme -> Column( modifier = Modifier .width(114.dp) - .padding(top = 8.dp) + .padding(top = 8.dp), ) { val isSelected = (isLight && currentLightTheme == theme.id) || (!isLight && currentDarkTheme == theme.id) MaterialTheme( - colors = if (isSelected) customColors else theme.colors + colors = if (isSelected) customColors else theme.colors, ) { ExtraColors.WithExtraColors( - if (isSelected) customExtraColors else theme.extraColors + if (isSelected) customExtraColors else theme.extraColors, ) { AppThemePreviewItem( selected = isSelected, @@ -214,7 +214,7 @@ fun SettingsAppearanceScreenContent( activeColors.primaryStateFlow.value = theme.colors.primary activeColors.secondaryStateFlow.value = theme.colors.secondary activeColors.tertiaryStateFlow.value = theme.extraColors.tertiary - } + }, ) } } @@ -228,7 +228,7 @@ fun SettingsAppearanceScreenContent( color = MaterialTheme.colors.onSurface, textAlign = TextAlign.Center, maxLines = 2, - style = MaterialTheme.typography.body2 + style = MaterialTheme.typography.body2, ) } } @@ -236,7 +236,7 @@ fun SettingsAppearanceScreenContent( HorizontalScrollbar( adapter = rememberScrollbarAdapter(lazyListState), modifier = Modifier.align(Alignment.BottomCenter) - .fillMaxWidth() + .fillMaxWidth(), ) } } @@ -245,7 +245,7 @@ fun SettingsAppearanceScreenContent( preference = activeColors.primaryStateFlow, title = stringResource(MR.strings.color_primary), subtitle = stringResource(MR.strings.color_primary_sub), - unsetColor = MaterialTheme.colors.primary + unsetColor = MaterialTheme.colors.primary, ) } item { @@ -253,7 +253,7 @@ fun SettingsAppearanceScreenContent( preference = activeColors.secondaryStateFlow, title = stringResource(MR.strings.color_secondary), subtitle = stringResource(MR.strings.color_secondary_sub), - unsetColor = MaterialTheme.colors.secondary + unsetColor = MaterialTheme.colors.secondary, ) } item { @@ -261,7 +261,7 @@ fun SettingsAppearanceScreenContent( preference = activeColors.tertiaryStateFlow, title = stringResource(MR.strings.color_tertiary), subtitle = stringResource(MR.strings.color_secondary_sub), - unsetColor = MaterialTheme.extraColors.tertiary + unsetColor = MaterialTheme.extraColors.tertiary, ) } if (showWindowDecorationsOption) { @@ -269,7 +269,7 @@ fun SettingsAppearanceScreenContent( SwitchPreference( windowDecorations, stringResource(MR.strings.window_decorations), - stringResource(MR.strings.window_decorations_sub) + stringResource(MR.strings.window_decorations_sub), ) } } @@ -282,10 +282,10 @@ fun SettingsAppearanceScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -294,7 +294,7 @@ fun SettingsAppearanceScreenContent( @Composable fun AppThemePreviewItem( selected: Boolean, - onClick: () -> Unit + onClick: () -> Unit, ) { val dividerColor = MaterialTheme.colors.onSurface.copy(alpha = 0.2F) Column( @@ -308,12 +308,12 @@ fun AppThemePreviewItem( } else { dividerColor }, - shape = RoundedCornerShape(17.dp) + shape = RoundedCornerShape(17.dp), ) .padding(4.dp) .clip(RoundedCornerShape(13.dp)) .background(MaterialTheme.colors.background) - .clickable(onClick = onClick) + .clickable(onClick = onClick), ) { // App Bar Row( @@ -321,7 +321,7 @@ fun AppThemePreviewItem( .fillMaxWidth() .height(40.dp) .padding(8.dp), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { Box( modifier = Modifier @@ -330,19 +330,19 @@ fun AppThemePreviewItem( .padding(end = 4.dp) .background( color = MaterialTheme.colors.onSurface, - shape = MaterialTheme.shapes.small - ) + shape = MaterialTheme.shapes.small, + ), ) Box( modifier = Modifier.weight(0.3f), - contentAlignment = Alignment.CenterEnd + contentAlignment = Alignment.CenterEnd, ) { if (selected) { Icon( imageVector = Icons.Filled.CheckCircle, contentDescription = null, - tint = MaterialTheme.colors.primary + tint = MaterialTheme.colors.primary, ) } } @@ -354,28 +354,28 @@ fun AppThemePreviewItem( .padding(start = 8.dp, top = 2.dp) .background( color = dividerColor, - shape = MaterialTheme.shapes.small + shape = MaterialTheme.shapes.small, ) .fillMaxWidth(0.5f) - .aspectRatio(mangaAspectRatio) + .aspectRatio(mangaAspectRatio), ) { Row( modifier = Modifier .padding(4.dp) .size(width = 24.dp, height = 16.dp) - .clip(RoundedCornerShape(5.dp)) + .clip(RoundedCornerShape(5.dp)), ) { Box( modifier = Modifier .fillMaxHeight() .width(12.dp) - .background(MaterialTheme.extraColors.tertiary) + .background(MaterialTheme.extraColors.tertiary), ) Box( modifier = Modifier .fillMaxHeight() .width(12.dp) - .background(MaterialTheme.colors.secondary) + .background(MaterialTheme.colors.secondary), ) } } @@ -385,10 +385,10 @@ fun AppThemePreviewItem( modifier = Modifier .fillMaxWidth() .weight(1f), - contentAlignment = Alignment.BottomCenter + contentAlignment = Alignment.BottomCenter, ) { Surface( - elevation = 3.dp + elevation = 3.dp, ) { Row( modifier = Modifier @@ -396,15 +396,15 @@ fun AppThemePreviewItem( .fillMaxWidth() .background(MaterialTheme.colors.primarySurface) .padding(horizontal = 8.dp), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { Box( modifier = Modifier .size(17.dp) .background( color = MaterialTheme.colors.primary, - shape = CircleShape - ) + shape = CircleShape, + ), ) Box( modifier = Modifier @@ -414,8 +414,8 @@ fun AppThemePreviewItem( .weight(1f) .background( color = MaterialTheme.colors.onSurface, - shape = MaterialTheme.shapes.small - ) + shape = MaterialTheme.shapes.small, + ), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBackupScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBackupScreen.kt index c8d93857..d9a48f65 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBackupScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBackupScreen.kt @@ -114,7 +114,7 @@ class SettingsBackupScreen : Screen { restoreBackup = vm::restoreBackup, stopRestore = vm::stopRestore, exportBackup = vm::exportBackup, - exportBackupFileFound = vm::exportBackupFileFound + exportBackupFileFound = vm::exportBackupFileFound, ) } } @@ -123,7 +123,7 @@ class SettingsBackupViewModel @Inject constructor( private val validateBackupFile: ValidateBackupFile, private val importBackupFile: ImportBackupFile, private val exportBackupFile: ExportBackupFile, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { private val _restoreStatus = MutableStateFlow(Status.Nothing) val restoreStatus = _restoreStatus.asStateFlow() @@ -173,7 +173,7 @@ class SettingsBackupViewModel @Inject constructor( onUpload { bytesSentTotal, contentLength -> _restoreStatus.value = Status.InProgress( (bytesSentTotal.toFloat() / contentLength) - .coerceAtMost(1.0F) + .coerceAtMost(1.0F), ) } } @@ -204,7 +204,7 @@ class SettingsBackupViewModel @Inject constructor( onDownload { bytesSentTotal, contentLength -> _creatingStatus.value = Status.InProgress( (bytesSentTotal.toFloat() / contentLength) - .coerceAtMost(0.99F) + .coerceAtMost(0.99F), ) } } @@ -281,7 +281,7 @@ private fun SettingsBackupScreenContent( restoreBackup: (Path) -> Unit, stopRestore: () -> Unit, exportBackup: () -> Unit, - exportBackupFileFound: (Sink) -> Unit + exportBackupFileFound: (Sink) -> Unit, ) { var backupFile by remember { mutableStateOf(null) } var missingSources: ImmutableList by remember { mutableStateOf(persistentListOf()) } @@ -306,12 +306,12 @@ private fun SettingsBackupScreenContent( Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.settings_backup_screen)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -320,15 +320,15 @@ private fun SettingsBackupScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { item { PreferenceFile( stringResource(MR.strings.backup_restore), stringResource(MR.strings.backup_restore_sub), - restoreStatus + restoreStatus, ) { fileChooser.launch("gz") } @@ -336,7 +336,7 @@ private fun SettingsBackupScreenContent( stringResource(MR.strings.backup_create), stringResource(MR.strings.backup_create_sub), creatingStatus, - exportBackup + exportBackup, ) } } @@ -348,10 +348,10 @@ private fun SettingsBackupScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -361,7 +361,7 @@ private fun SettingsBackupScreenContent( onPositiveClick = { restoreBackup(backupFile ?: return@MissingSourcesDialog) }, - onNegativeClick = stopRestore + onNegativeClick = stopRestore, ) } @@ -370,7 +370,7 @@ private fun MissingSourcesDialog( state: MaterialDialogState, missingSources: ImmutableList, onPositiveClick: () -> Unit, - onNegativeClick: () -> Unit + onNegativeClick: () -> Unit, ) { MaterialDialog( state, @@ -378,7 +378,7 @@ private fun MissingSourcesDialog( positiveButton(stringResource(MR.strings.action_ok), onClick = onPositiveClick) negativeButton(stringResource(MR.strings.action_cancel), onClick = onNegativeClick) }, - properties = getMaterialDialogProperties() + properties = getMaterialDialogProperties(), ) { title(stringResource(MR.strings.missing_sources)) Box { @@ -388,7 +388,7 @@ private fun MissingSourcesDialog( rememberScrollbarAdapter(listState), Modifier.align(Alignment.CenterEnd) .fillMaxHeight() - .scrollbarPadding() + .scrollbarPadding(), ) } } @@ -399,13 +399,13 @@ private fun PreferenceFile( title: String, subtitle: String, status: Status, - onClick: () -> Unit + onClick: () -> Unit, ) { PreferenceRow( title = title, onClick = onClick, enabled = status !is Status.InProgress, - subtitle = subtitle + subtitle = subtitle, ) { val modifier = Modifier.align(Alignment.Center) .size(24.dp) @@ -413,7 +413,7 @@ private fun PreferenceFile( if (status.progress != null && !status.progress.isNaN()) { CircularProgressIndicator( progress = status.progress, - modifier = modifier + modifier = modifier, ) } else { CircularProgressIndicator(modifier) @@ -424,12 +424,12 @@ private fun PreferenceFile( Icons.Rounded.Warning, contentDescription = null, modifier = modifier, - tint = Color.Red + tint = Color.Red, ) Status.Success -> Icon( Icons.Rounded.Check, contentDescription = null, - modifier = modifier + modifier = modifier, ) else -> Unit } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBrowseScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBrowseScreen.kt index 978abbc9..fa9cdcb7 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBrowseScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsBrowseScreen.kt @@ -49,12 +49,12 @@ fun SettingsBrowseScreenContent() { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.settings_browse_screen)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -63,9 +63,9 @@ fun SettingsBrowseScreenContent() { state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { } VerticalScrollbar( @@ -76,10 +76,10 @@ fun SettingsBrowseScreenContent() { .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsDownloadsScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsDownloadsScreen.kt index 8e0a18fa..c703983f 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsDownloadsScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsDownloadsScreen.kt @@ -49,12 +49,12 @@ fun SettingsDownloadsScreenContent() { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.settings_download_screen)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -63,9 +63,9 @@ fun SettingsDownloadsScreenContent() { state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { } VerticalScrollbar( @@ -76,10 +76,10 @@ fun SettingsDownloadsScreenContent() { .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } 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 49a29659..f7c252f5 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 @@ -74,7 +74,7 @@ class SettingsGeneralScreen : Screen { language = vm.language, languageChoices = vm.getLanguageChoices(), dateFormat = vm.dateFormat, - dateFormatChoices = vm.getDateChoices() + dateFormatChoices = vm.getDateChoices(), ) } } @@ -82,7 +82,7 @@ class SettingsGeneralScreen : Screen { class SettingsGeneralViewModel @Inject constructor( private val dateHandler: DateHandler, uiPreferences: UiPreferences, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { val startScreen = uiPreferences.startScreen().asStateFlow() @@ -98,7 +98,7 @@ class SettingsGeneralViewModel @Inject constructor( StartScreen.Library to stringResource(MR.strings.location_library), StartScreen.Updates to stringResource(MR.strings.location_updates), StartScreen.Sources to stringResource(MR.strings.location_sources), - StartScreen.Extensions to stringResource(MR.strings.location_extensions) + StartScreen.Extensions to stringResource(MR.strings.location_extensions), ) @Composable @@ -145,17 +145,17 @@ fun SettingsGeneralScreenContent( language: PreferenceMutableStateFlow, languageChoices: ImmutableMap, dateFormat: PreferenceMutableStateFlow, - dateFormatChoices: ImmutableMap + dateFormatChoices: ImmutableMap, ) { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.settings_general_screen)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -164,21 +164,21 @@ fun SettingsGeneralScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { item { ChoicePreference( preference = startScreen, title = stringResource(MR.strings.start_screen), - choices = startScreenChoices + choices = startScreenChoices, ) } item { SwitchPreference( preference = confirmExit, - title = stringResource(MR.strings.confirm_exit) + title = stringResource(MR.strings.confirm_exit), ) } item { @@ -188,14 +188,14 @@ fun SettingsGeneralScreenContent( ChoicePreference( preference = language, title = stringResource(MR.strings.language), - choices = languageChoices + choices = languageChoices, ) } item { ChoicePreference( preference = dateFormat, title = stringResource(MR.strings.date_format), - choices = dateFormatChoices + choices = dateFormatChoices, ) } } @@ -207,10 +207,10 @@ fun SettingsGeneralScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsLibraryScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsLibraryScreen.kt index 904efef0..42c3e71e 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsLibraryScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsLibraryScreen.kt @@ -88,7 +88,7 @@ class SettingsLibraryScreen : Screen { gridColumns = vm.gridColumns, gridSize = vm.gridSize, categoriesSize = vm.categories.collectAsState().value, - openCategoriesScreen = categoriesLauncher::open + openCategoriesScreen = categoriesLauncher::open, ) categoriesLauncher.CategoriesWindow() } @@ -97,7 +97,7 @@ class SettingsLibraryScreen : Screen { class SettingsLibraryViewModel @Inject constructor( libraryPreferences: LibraryPreferences, private val getCategories: GetCategories, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { val displayMode = libraryPreferences.displayMode().asStateFlow() @@ -132,17 +132,17 @@ fun SettingsLibraryScreenContent( gridSize: PreferenceMutableStateFlow, showAllCategory: PreferenceMutableStateFlow, categoriesSize: Int, - openCategoriesScreen: () -> Unit + openCategoriesScreen: () -> Unit, ) { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.settings_library_screen)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -151,15 +151,15 @@ fun SettingsLibraryScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { item { ChoicePreference( preference = displayMode, choices = displayModeChoices, - title = stringResource(MR.strings.display_mode) + title = stringResource(MR.strings.display_mode), ) } item { @@ -168,7 +168,7 @@ fun SettingsLibraryScreenContent( columnPreference = gridColumns, sizePreference = gridSize, title = stringResource(MR.strings.items_per_row), - enabled = displayModePref != DisplayMode.List + enabled = displayModePref != DisplayMode.List, ) } /*item { @@ -184,7 +184,7 @@ fun SettingsLibraryScreenContent( PreferenceRow( stringResource(MR.strings.location_categories), onClick = { openCategoriesScreen() }, - subtitle = categoriesSize.toString() + subtitle = categoriesSize.toString(), ) } } @@ -196,10 +196,10 @@ fun SettingsLibraryScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -210,7 +210,7 @@ private fun GridPreference( columnPreference: PreferenceMutableStateFlow, sizePreference: PreferenceMutableStateFlow, title: String, - enabled: Boolean + enabled: Boolean, ) { val columnPrefValue by columnPreference.collectAsState() val sizePrefValue by sizePreference.collectAsState() @@ -225,7 +225,7 @@ private fun GridPreference( onClick = { dialogState.show() }, - enabled = enabled + enabled = enabled, ) GridPrefDialog( state = dialogState, @@ -235,7 +235,7 @@ private fun GridPreference( onSelected = { columns, size -> columnPreference.value = columns sizePreference.value = size - } + }, ) } @@ -246,7 +246,7 @@ private fun GridPrefDialog( initialSize: Int, onCloseRequest: () -> Unit = {}, onSelected: (columns: Int, size: Int) -> Unit, - title: String + title: String, ) { var columns by remember(initialColumns) { mutableStateOf(initialColumns.toFloat()) } var size by remember(initialSize) { mutableStateOf(initialSize.toFloat()) } @@ -264,7 +264,7 @@ private fun GridPrefDialog( onCloseRequest = { state.hide() onCloseRequest() - } + }, ) { title(title) Column(Modifier.padding(horizontal = 8.dp)) { @@ -276,7 +276,7 @@ private fun GridPrefDialog( }, modifier = Modifier.fillMaxWidth(), valueRange = 0F..10F, - steps = 10 - 2 + steps = 10 - 2, ) val columnsInt = columns.roundToInt() val adaptive = columnsInt < 1 @@ -287,7 +287,7 @@ private fun GridPrefDialog( columnsInt.toString() }, color = LocalContentColor.current.copy(alpha = ContentAlpha.disabled), - fontSize = 12.sp + fontSize = 12.sp, ) AnimatedVisibility(adaptive) { @@ -301,14 +301,14 @@ private fun GridPrefDialog( }, modifier = Modifier.fillMaxWidth(), valueRange = 90F..300F, - steps = 21 - 2 + steps = 21 - 2, ) val sizeInt = size.roundToInt() val newSize = (10 - sizeInt % 10) + sizeInt Text( newSize.toString(), color = LocalContentColor.current.copy(alpha = ContentAlpha.disabled), - fontSize = 12.sp + fontSize = 12.sp, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsParentalControlsScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsParentalControlsScreen.kt index e6f43297..f195c3b6 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsParentalControlsScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsParentalControlsScreen.kt @@ -49,12 +49,12 @@ fun SettingsParentalControlsScreenContent() { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.settings_parental_control_screen)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -63,9 +63,9 @@ fun SettingsParentalControlsScreenContent() { state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { } VerticalScrollbar( @@ -76,10 +76,10 @@ fun SettingsParentalControlsScreenContent() { .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsReaderScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsReaderScreen.kt index 00f84f61..2d1a2f5d 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsReaderScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsReaderScreen.kt @@ -83,14 +83,14 @@ class SettingsReaderScreen : Screen { paddingChoices = vm.getPaddingChoices(), getMaxSizeChoices = vm::getMaxSizeChoices, imageScaleChoices = vm.getImageScaleChoices(), - navigationModeChoices = vm.getNavigationModeChoices() + navigationModeChoices = vm.getNavigationModeChoices(), ) } } class SettingsReaderViewModel @Inject constructor( readerPreferences: ReaderPreferences, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { val modes = readerPreferences.modes().asStateFlow() .map { @@ -101,7 +101,7 @@ class SettingsReaderViewModel @Inject constructor( val selectedMode = readerPreferences.mode().asStateIn(scope) private val _modeSettings = MutableStateFlow>>( - persistentListOf() + persistentListOf(), ) val modeSettings = _modeSettings.asStateFlow() @@ -124,7 +124,7 @@ class SettingsReaderViewModel @Inject constructor( 0 to MR.strings.page_padding_none.toPlatformString(), 8 to "8 Dp", 16 to "16 Dp", - 32 to "32 Dp" + 32 to "32 Dp", ).toImmutableMap() fun getMaxSizeChoices(direction: Direction) = if (direction == Direction.Right || direction == Direction.Left) { @@ -132,14 +132,14 @@ class SettingsReaderViewModel @Inject constructor( 0 to MR.strings.max_size_unrestricted.toPlatformString(), 700 to "700 Dp", 900 to "900 Dp", - 1100 to "1100 Dp" + 1100 to "1100 Dp", ) } else { mapOf( 0 to MR.strings.max_size_unrestricted.toPlatformString(), 500 to "500 Dp", 700 to "700 Dp", - 900 to "900 Dp" + 900 to "900 Dp", ) }.toImmutableMap() @@ -160,7 +160,7 @@ data class ReaderModePreference( val imageScale: PreferenceMutableStateFlow, val fitSize: PreferenceMutableStateFlow, val maxSize: PreferenceMutableStateFlow, - val navigationMode: PreferenceMutableStateFlow + val navigationMode: PreferenceMutableStateFlow, ) { constructor(scope: CoroutineScope, mode: String, readerPreferences: ReaderModePreferences) : this( @@ -173,7 +173,7 @@ data class ReaderModePreference( readerPreferences.imageScale().asStateIn(scope), readerPreferences.fitSize().asStateIn(scope), readerPreferences.maxSize().asStateIn(scope), - readerPreferences.navigationMode().asStateIn(scope) + readerPreferences.navigationMode().asStateIn(scope), ) } @@ -186,17 +186,17 @@ fun SettingsReaderScreenContent( paddingChoices: ImmutableMap, getMaxSizeChoices: (Direction) -> ImmutableMap, imageScaleChoices: ImmutableMap, - navigationModeChoices: ImmutableMap + navigationModeChoices: ImmutableMap, ) { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.settings_reader_screen)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -205,15 +205,15 @@ fun SettingsReaderScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { item { ChoicePreference( selectedMode, modes, - stringResource(MR.strings.reader_mode) + stringResource(MR.strings.reader_mode), ) } item { @@ -226,20 +226,20 @@ fun SettingsReaderScreenContent( it.direction, directionChoices, stringResource(MR.strings.direction), - enabled = !it.defaultMode + enabled = !it.defaultMode, ) SwitchPreference( it.continuous, stringResource(MR.strings.continuous), stringResource(MR.strings.continuous_sub), - enabled = !it.defaultMode + enabled = !it.defaultMode, ) val continuous by it.continuous.collectAsState() if (continuous) { ChoicePreference( it.padding, paddingChoices, - stringResource(MR.strings.page_padding) + stringResource(MR.strings.page_padding), ) val direction by it.direction.collectAsState() val (title, subtitle) = if (direction.isVertical) { @@ -250,37 +250,37 @@ fun SettingsReaderScreenContent( SwitchPreference( it.fitSize, title, - subtitle + subtitle, ) val maxSize by it.maxSize.collectAsState() val (maxSizeTitle, maxSizeSubtitle) = if (direction.isVertical) { stringResource(MR.strings.max_width) to stringResource( MR.strings.max_width_sub, - maxSize + maxSize, ) } else { stringResource(MR.strings.max_height) to stringResource( MR.strings.max_height_sub, - maxSize + maxSize, ) } ChoicePreference( it.maxSize, getMaxSizeChoices(direction), maxSizeTitle, - maxSizeSubtitle + maxSizeSubtitle, ) } else { ChoicePreference( it.imageScale, imageScaleChoices, - stringResource(MR.strings.image_scale) + stringResource(MR.strings.image_scale), ) } ChoicePreference( it.navigationMode, navigationModeChoices, - stringResource(MR.strings.navigation_mode) + stringResource(MR.strings.navigation_mode), ) } } @@ -297,10 +297,10 @@ fun SettingsReaderScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsScreen.kt index 97bac3c4..74953acb 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsScreen.kt @@ -62,12 +62,12 @@ fun SettingsScreenContent(navigator: Navigator) { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.location_settings)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -76,43 +76,43 @@ fun SettingsScreenContent(navigator: Navigator) { state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { item { PreferenceRow( title = stringResource(MR.strings.settings_general), icon = Icons.Rounded.Tune, - onClick = { navigator push SettingsGeneralScreen() } + onClick = { navigator push SettingsGeneralScreen() }, ) } item { PreferenceRow( title = stringResource(MR.strings.settings_appearance), icon = Icons.Rounded.Palette, - onClick = { navigator push SettingsAppearanceScreen() } + onClick = { navigator push SettingsAppearanceScreen() }, ) } item { PreferenceRow( title = stringResource(MR.strings.settings_server), icon = Icons.Rounded.Computer, - onClick = { navigator push SettingsServerScreen() } + onClick = { navigator push SettingsServerScreen() }, ) } item { PreferenceRow( title = stringResource(MR.strings.settings_library), icon = Icons.Rounded.CollectionsBookmark, - onClick = { navigator push SettingsLibraryScreen() } + onClick = { navigator push SettingsLibraryScreen() }, ) } item { PreferenceRow( title = stringResource(MR.strings.settings_reader), icon = Icons.Rounded.ChromeReaderMode, - onClick = { navigator push SettingsReaderScreen() } + onClick = { navigator push SettingsReaderScreen() }, ) } /*item { @@ -140,7 +140,7 @@ fun SettingsScreenContent(navigator: Navigator) { PreferenceRow( title = stringResource(MR.strings.settings_backup), icon = Icons.Rounded.Backup, - onClick = { navigator push SettingsBackupScreen() } + onClick = { navigator push SettingsBackupScreen() }, ) } /*item { @@ -161,7 +161,7 @@ fun SettingsScreenContent(navigator: Navigator) { PreferenceRow( title = stringResource(MR.strings.settings_advanced), icon = Icons.Rounded.Code, - onClick = { navigator push SettingsAdvancedScreen() } + onClick = { navigator push SettingsAdvancedScreen() }, ) } } @@ -173,10 +173,10 @@ fun SettingsScreenContent(navigator: Navigator) { .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsSecurityScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsSecurityScreen.kt index 62f1fe31..98311f06 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsSecurityScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsSecurityScreen.kt @@ -49,12 +49,12 @@ fun SettingsSecurityScreenContent() { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.settings_security_screen)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -63,9 +63,9 @@ fun SettingsSecurityScreenContent() { state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { } VerticalScrollbar( @@ -76,10 +76,10 @@ fun SettingsSecurityScreenContent() { .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsServerScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsServerScreen.kt index 3703ca8d..708dc34d 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsServerScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsServerScreen.kt @@ -79,7 +79,7 @@ class SettingsServerScreen : Screen { auth = connectionVM.auth, authChoices = connectionVM.getAuthChoices(), authUsername = connectionVM.authUsername, - authPassword = connectionVM.authPassword + authPassword = connectionVM.authPassword, ) } } @@ -90,7 +90,7 @@ expect fun getServerHostItems(viewModel: @Composable () -> SettingsServerHostVie class SettingsServerViewModel @Inject constructor( serverPreferences: ServerPreferences, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { val serverUrl = serverPreferences.server().asStateIn(scope) val serverPort = serverPreferences.port().asStringStateIn(scope) @@ -102,7 +102,7 @@ class SettingsServerViewModel @Inject constructor( fun getProxyChoices(): ImmutableMap = persistentMapOf( Proxy.NO_PROXY to stringResource(MR.strings.no_proxy), Proxy.HTTP_PROXY to stringResource(MR.strings.http_proxy), - Proxy.SOCKS_PROXY to stringResource(MR.strings.socks_proxy) + Proxy.SOCKS_PROXY to stringResource(MR.strings.socks_proxy), ) val httpHost = serverPreferences.proxyHttpHost().asStateIn(scope) @@ -116,7 +116,7 @@ class SettingsServerViewModel @Inject constructor( fun getAuthChoices(): ImmutableMap = persistentMapOf( Auth.NONE to stringResource(MR.strings.no_auth), Auth.BASIC to stringResource(MR.strings.basic_auth), - Auth.DIGEST to stringResource(MR.strings.digest_auth) + Auth.DIGEST to stringResource(MR.strings.digest_auth), ) val authUsername = serverPreferences.authUsername().asStateIn(scope) val authPassword = serverPreferences.authPassword().asStateIn(scope) @@ -145,17 +145,17 @@ fun SettingsServerScreenContent( auth: PreferenceMutableStateFlow, authChoices: ImmutableMap, authUsername: PreferenceMutableStateFlow, - authPassword: PreferenceMutableStateFlow + authPassword: PreferenceMutableStateFlow, ) { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.settings_server_screen)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -164,30 +164,30 @@ fun SettingsServerScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { serverHostItems() item { EditTextPreference( serverUrl, stringResource(MR.strings.server_url), - subtitle = serverUrl.collectAsState().value + subtitle = serverUrl.collectAsState().value, ) } item { EditTextPreference( serverPort, stringResource(MR.strings.server_port), - subtitle = serverPort.collectAsState().value + subtitle = serverPort.collectAsState().value, ) } item { EditTextPreference( serverPathPrefix, stringResource(MR.strings.server_path_prefix), - subtitle = stringResource(MR.strings.server_path_prefix_sub) + subtitle = stringResource(MR.strings.server_path_prefix_sub), ) } @@ -195,7 +195,7 @@ fun SettingsServerScreenContent( PreferenceRow( stringResource(MR.strings.server_preference_warning), Icons.Rounded.Warning, - subtitle = stringResource(MR.strings.server_preference_warning_sub) + subtitle = stringResource(MR.strings.server_preference_warning_sub), ) } item { @@ -208,14 +208,14 @@ fun SettingsServerScreenContent( EditTextPreference( httpHost, stringResource(MR.strings.http_proxy), - httpHost.collectAsState().value + httpHost.collectAsState().value, ) } item { EditTextPreference( httpPort, stringResource(MR.strings.http_port), - httpPort.collectAsState().value + httpPort.collectAsState().value, ) } } @@ -224,14 +224,14 @@ fun SettingsServerScreenContent( EditTextPreference( socksHost, stringResource(MR.strings.socks_proxy), - socksHost.collectAsState().value + socksHost.collectAsState().value, ) } item { EditTextPreference( socksPort, stringResource(MR.strings.socks_port), - socksPort.collectAsState().value + socksPort.collectAsState().value, ) } } @@ -247,7 +247,7 @@ fun SettingsServerScreenContent( EditTextPreference( authPassword, stringResource(MR.strings.auth_password), - visualTransformation = PasswordVisualTransformation() + visualTransformation = PasswordVisualTransformation(), ) } } @@ -260,10 +260,10 @@ fun SettingsServerScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsTrackingScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsTrackingScreen.kt index ba6802b3..c5e4daf1 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsTrackingScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/settings/SettingsTrackingScreen.kt @@ -49,12 +49,12 @@ fun SettingsTrackingScreenContent() { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.settings_tracking_screen)) - } + }, ) { Box(Modifier.padding(it)) { val state = rememberLazyListState() @@ -63,9 +63,9 @@ fun SettingsTrackingScreenContent() { state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { } VerticalScrollbar( @@ -76,10 +76,10 @@ fun SettingsTrackingScreenContent() { .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreen.kt index b42150a9..0f5cb52c 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreen.kt @@ -68,7 +68,7 @@ class SourceScreen(val source: Source, private val initialQuery: String? = null) resetFiltersClicked = { sourceVM.setUsingFilters(false) filterVM.resetFilters() - } + }, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreenViewModel.kt index 94c3a778..9b607f69 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/SourceScreenViewModel.kt @@ -42,7 +42,7 @@ class SourceScreenViewModel( private val getSourcePager: (GetMangaPage) -> SourcePager, contextWrapper: ContextWrapper, private val savedStateHandle: SavedStateHandle, - initialQuery: String? + initialQuery: String?, ) : ViewModel(contextWrapper) { @Inject constructor( @@ -54,7 +54,7 @@ class SourceScreenViewModel( getSourcePager: (GetMangaPage) -> SourcePager, contextWrapper: ContextWrapper, @Assisted savedStateHandle: SavedStateHandle, - @Assisted params: Params + @Assisted params: Params, ) : this( params.source, getLatestManga, @@ -65,7 +65,7 @@ class SourceScreenViewModel( getSourcePager, contextWrapper, savedStateHandle, - params.initialQuery + params.initialQuery, ) val displayMode = catalogPreferences.displayMode().stateIn(scope) @@ -115,7 +115,7 @@ class SourceScreenViewModel( sourceId = source.id, searchTerm = _query.value, page = page, - onError = { toast(it.message.orEmpty()) } + onError = { toast(it.message.orEmpty()) }, ) } } @@ -124,7 +124,7 @@ class SourceScreenViewModel( getLatestManga.await( source, page, - onError = { toast(it.message.orEmpty()) } + onError = { toast(it.message.orEmpty()) }, ) } } @@ -133,7 +133,7 @@ class SourceScreenViewModel( getPopularManga.await( source.id, page, - onError = { toast(it.message.orEmpty()) } + onError = { toast(it.message.orEmpty()) }, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaBadges.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaBadges.kt index d14f2085..748c3b90 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaBadges.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaBadges.kt @@ -21,7 +21,7 @@ import ca.gosyer.jui.uicore.resources.stringResource @Composable fun SourceMangaBadges( inLibrary: Boolean, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { if (!inLibrary) return @@ -30,7 +30,7 @@ fun SourceMangaBadges( text = stringResource(MR.strings.in_library), modifier = Modifier.background(MaterialTheme.colors.primary).then(BadgesInnerPadding), style = MaterialTheme.typography.caption, - color = MaterialTheme.colors.onPrimary + color = MaterialTheme.colors.onPrimary, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaComfortableGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaComfortableGrid.kt index 702d3c91..9fe29798 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaComfortableGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaComfortableGrid.kt @@ -53,7 +53,7 @@ fun SourceMangaComfortableGrid( gridSize: Int, onClickManga: (Long) -> Unit, hasNextPage: Boolean = false, - onLoadNextPage: () -> Unit + onLoadNextPage: () -> Unit, ) { Box { val state = rememberLazyGridState() @@ -68,9 +68,9 @@ fun SourceMangaComfortableGrid( modifier = Modifier.fillMaxSize().padding(4.dp), contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { itemsIndexed(mangas) { index, manga -> if (hasNextPage && index == mangas.lastIndex) { @@ -78,10 +78,10 @@ fun SourceMangaComfortableGrid( } SourceMangaComfortableGridItem( modifier = Modifier.clickable( - onClick = { onClickManga(manga.id) } + onClick = { onClickManga(manga.id) }, ), manga = manga, - inLibrary = manga.inLibrary + inLibrary = manga.inLibrary, ) } } @@ -93,10 +93,10 @@ fun SourceMangaComfortableGrid( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -105,13 +105,13 @@ fun SourceMangaComfortableGrid( private fun SourceMangaComfortableGridItem( modifier: Modifier, manga: Manga, - inLibrary: Boolean + inLibrary: Boolean, ) { Box( modifier = Modifier .padding(4.dp) .fillMaxWidth() - .clip(MaterialTheme.shapes.medium) then modifier + .clip(MaterialTheme.shapes.medium) then modifier, ) { Column { ImageLoaderImage( @@ -122,7 +122,7 @@ private fun SourceMangaComfortableGridItem( .aspectRatio(mangaAspectRatio) .clip(MaterialTheme.shapes.medium), contentScale = ContentScale.Crop, - filterQuality = FilterQuality.Medium + filterQuality = FilterQuality.Medium, ) Text( text = manga.title, @@ -131,12 +131,12 @@ private fun SourceMangaComfortableGridItem( maxLines = 2, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(vertical = 4.dp, horizontal = 4.dp), - style = MaterialTheme.typography.subtitle2 + style = MaterialTheme.typography.subtitle2, ) } SourceMangaBadges( inLibrary = inLibrary, - modifier = Modifier.padding(4.dp) + modifier = Modifier.padding(4.dp), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaCompactGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaCompactGrid.kt index caf6f5bb..04c49ee3 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaCompactGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaCompactGrid.kt @@ -57,7 +57,7 @@ fun SourceMangaCompactGrid( gridSize: Int, onClickManga: (Long) -> Unit, hasNextPage: Boolean = false, - onLoadNextPage: () -> Unit + onLoadNextPage: () -> Unit, ) { Box { val state = rememberLazyGridState() @@ -72,9 +72,9 @@ fun SourceMangaCompactGrid( modifier = Modifier.fillMaxSize().padding(4.dp), contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { itemsIndexed(mangas) { index, manga -> if (hasNextPage && index == mangas.lastIndex) { @@ -82,10 +82,10 @@ fun SourceMangaCompactGrid( } SourceMangaCompactGridItem( modifier = Modifier.clickable( - onClick = { onClickManga(manga.id) } + onClick = { onClickManga(manga.id) }, ), manga = manga, - inLibrary = manga.inLibrary + inLibrary = manga.inLibrary, ) } } @@ -97,10 +97,10 @@ fun SourceMangaCompactGrid( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -109,20 +109,20 @@ fun SourceMangaCompactGrid( private fun SourceMangaCompactGridItem( modifier: Modifier, manga: Manga, - inLibrary: Boolean + inLibrary: Boolean, ) { Box( modifier = Modifier.padding(4.dp) .fillMaxWidth() .aspectRatio(mangaAspectRatio) - .clip(MaterialTheme.shapes.medium) then modifier + .clip(MaterialTheme.shapes.medium) then modifier, ) { ImageLoaderImage( manga, manga.title, modifier = Modifier.fillMaxSize(), contentScale = ContentScale.Crop, - filterQuality = FilterQuality.Medium + filterQuality = FilterQuality.Medium, ) Box( modifier = Modifier @@ -130,12 +130,12 @@ private fun SourceMangaCompactGridItem( .background( Brush.verticalGradient( 0f to Color.Transparent, - 1f to Color(0xAA000000) - ) + 1f to Color(0xAA000000), + ), ) .fillMaxHeight(0.33f) .fillMaxWidth() - .align(Alignment.BottomCenter) + .align(Alignment.BottomCenter), ) Text( modifier = Modifier @@ -147,17 +147,17 @@ private fun SourceMangaCompactGridItem( color = Color.White, shadow = Shadow( color = Color.Black, - blurRadius = 4f - ) + blurRadius = 4f, + ), ), fontSize = 12.sp, lineHeight = 18.sp, maxLines = 2, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, ) SourceMangaBadges( inLibrary = inLibrary, - modifier = Modifier.padding(4.dp) + modifier = Modifier.padding(4.dp), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaList.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaList.kt index 89a6807b..b8e2ed46 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaList.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceMangaList.kt @@ -45,7 +45,7 @@ fun SourceMangaList( mangas: ImmutableList, onClickManga: (Long) -> Unit, hasNextPage: Boolean = false, - onLoadNextPage: () -> Unit + onLoadNextPage: () -> Unit, ) { Box { val state = rememberLazyListState() @@ -54,9 +54,9 @@ fun SourceMangaList( modifier = Modifier.fillMaxSize(), contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { itemsIndexed(mangas) { index, manga -> if (hasNextPage && index == mangas.lastIndex) { @@ -64,10 +64,10 @@ fun SourceMangaList( } MangaListItem( modifier = Modifier.clickable( - onClick = { onClickManga(manga.id) } + onClick = { onClickManga(manga.id) }, ), manga = manga, - inLibrary = manga.inLibrary + inLibrary = manga.inLibrary, ) } } @@ -79,10 +79,10 @@ fun SourceMangaList( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -91,25 +91,25 @@ fun SourceMangaList( private fun MangaListItem( modifier: Modifier, manga: Manga, - inLibrary: Boolean + inLibrary: Boolean, ) { MangaListItem( modifier = modifier then Modifier .requiredHeight(56.dp) - .padding(horizontal = 16.dp) + .padding(horizontal = 16.dp), ) { MangaListItemImage( modifier = Modifier .size(40.dp) .clip(MaterialTheme.shapes.medium), data = manga, - contentDescription = manga.title + contentDescription = manga.title, ) MangaListItemTitle( modifier = Modifier .weight(1f) .padding(horizontal = 16.dp), - text = manga.title + text = manga.title, ) SourceMangaBadges(inLibrary) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceScreenContent.kt index 5334aa94..735e7983 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/components/SourceScreenContent.kt @@ -93,7 +93,7 @@ fun SourceScreenContent( showingFilters: Boolean, showFilterButton: Boolean, setShowingFilters: (Boolean) -> Unit, - resetFiltersClicked: () -> Unit + resetFiltersClicked: () -> Unit, ) { BackHandler { onCloseSourceTabClick(source) @@ -129,7 +129,7 @@ fun SourceScreenContent( showFilterButton = showFilterButton, setShowingFilters = setShowingFilters, onSelectDisplayMode = onSelectDisplayMode, - resetFiltersClicked = resetFiltersClicked + resetFiltersClicked = resetFiltersClicked, ) } else { SourceThinScreenContent( @@ -156,7 +156,7 @@ fun SourceScreenContent( showFilterButton = showFilterButton, setShowingFilters = setShowingFilters, onSelectDisplayMode = onSelectDisplayMode, - resetFiltersClicked = resetFiltersClicked + resetFiltersClicked = resetFiltersClicked, ) } } @@ -188,13 +188,13 @@ private fun SourceWideScreenContent( showFilterButton: Boolean, setShowingFilters: (Boolean) -> Unit, onSelectDisplayMode: (DisplayMode) -> Unit, - resetFiltersClicked: () -> Unit + resetFiltersClicked: () -> Unit, ) { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { SourceToolbar( @@ -210,9 +210,9 @@ private fun SourceWideScreenContent( showingFilters = showingFilters, onClickMode = setMode, onToggleFiltersClick = setShowingFilters, - onSelectDisplayMode = onSelectDisplayMode + onSelectDisplayMode = onSelectDisplayMode, ) - } + }, ) { padding -> Box(Modifier.padding(padding)) { MangaTable( @@ -223,7 +223,7 @@ private fun SourceWideScreenContent( isLoading = loading, hasNextPage = hasNextPage, onLoadNextPage = loadNextPage, - onMangaClick = onMangaClick + onMangaClick = onMangaClick, ) if (showingFilters && !isLatest) { Box( @@ -233,14 +233,14 @@ private fun SourceWideScreenContent( setShowingFilters(false) } } - } + }, ) } AnimatedVisibility( showingFilters && !isLatest, enter = fadeIn() + slideInHorizontally(initialOffsetX = { it * 2 }), exit = fadeOut() + slideOutHorizontally(targetOffsetX = { it * 2 }), - modifier = Modifier.align(Alignment.TopEnd) + modifier = Modifier.align(Alignment.TopEnd), ) { SourceFiltersMenu( modifier = Modifier.width(360.dp), @@ -250,7 +250,7 @@ private fun SourceWideScreenContent( setShowingFilters(false) submitSearch() }, - resetFiltersClicked = resetFiltersClicked + resetFiltersClicked = resetFiltersClicked, ) } } @@ -283,7 +283,7 @@ private fun SourceThinScreenContent( showFilterButton: Boolean, setShowingFilters: (Boolean) -> Unit, onSelectDisplayMode: (DisplayMode) -> Unit, - resetFiltersClicked: () -> Unit + resetFiltersClicked: () -> Unit, ) { val bottomSheetState = rememberModalBottomSheetState( ModalBottomSheetValue.Hidden, @@ -291,10 +291,11 @@ private fun SourceThinScreenContent( when (it) { ModalBottomSheetValue.Hidden -> setShowingFilters(false) ModalBottomSheetValue.Expanded, - ModalBottomSheetValue.HalfExpanded -> setShowingFilters(true) + ModalBottomSheetValue.HalfExpanded, + -> setShowingFilters(true) } true - } + }, ) LaunchedEffect(showingFilters) { if (showingFilters) { @@ -306,8 +307,8 @@ private fun SourceThinScreenContent( Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { SourceToolbar( @@ -323,9 +324,9 @@ private fun SourceThinScreenContent( showingFilters = showingFilters, onClickMode = setMode, onToggleFiltersClick = setShowingFilters, - onSelectDisplayMode = onSelectDisplayMode + onSelectDisplayMode = onSelectDisplayMode, ) - } + }, ) { padding -> ModalBottomSheetLayout( sheetState = bottomSheetState, @@ -335,9 +336,9 @@ private fun SourceThinScreenContent( modifier = Modifier.windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) + WindowInsetsSides.Bottom, + ), + ), ), filters = filters, onSearchClicked = { @@ -345,9 +346,9 @@ private fun SourceThinScreenContent( setShowingFilters(false) submitSearch() }, - resetFiltersClicked = resetFiltersClicked + resetFiltersClicked = resetFiltersClicked, ) - } + }, ) { Box { MangaTable( @@ -358,7 +359,7 @@ private fun SourceThinScreenContent( isLoading = loading, hasNextPage = hasNextPage, onLoadNextPage = loadNextPage, - onMangaClick = onMangaClick + onMangaClick = onMangaClick, ) if (showingFilters && !isLatest) { Box( @@ -368,7 +369,7 @@ private fun SourceThinScreenContent( setShowingFilters(false) } } - } + }, ) } if (showFilterButton && !isLatest) { @@ -382,7 +383,7 @@ private fun SourceThinScreenContent( icon = { Icon( Icons.Rounded.FilterList, - stringResource(MR.strings.action_filter) + stringResource(MR.strings.action_filter), ) }, modifier = Modifier.align(Alignment.BottomEnd) @@ -390,10 +391,10 @@ private fun SourceThinScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -415,7 +416,7 @@ fun SourceToolbar( showingFilters: Boolean, onClickMode: (Boolean) -> Unit, onToggleFiltersClick: (Boolean) -> Unit, - onSelectDisplayMode: (DisplayMode) -> Unit + onSelectDisplayMode: (DisplayMode) -> Unit, ) { Toolbar( source.name, @@ -431,7 +432,7 @@ fun SourceToolbar( DisplayModeSelect( isVisible = displayModeSelectOpen, onSelectDisplayMode = onSelectDisplayMode, - onDismissRequest = { displayModeSelectOpen = false } + onDismissRequest = { displayModeSelectOpen = false }, ) getActionItems( isConfigurable = source.isConfigurable, @@ -447,9 +448,9 @@ fun SourceToolbar( onClickMode = { onClickMode(!isLatest) }, - openDisplayModeSelect = { displayModeSelectOpen = true } + openDisplayModeSelect = { displayModeSelectOpen = true }, ) - } + }, ) } @@ -457,11 +458,11 @@ fun SourceToolbar( fun DisplayModeSelect( isVisible: Boolean, onSelectDisplayMode: (DisplayMode) -> Unit, - onDismissRequest: () -> Unit + onDismissRequest: () -> Unit, ) { DropdownMenu( isVisible, - onDismissRequest + onDismissRequest, ) { val list = DisplayMode.values().toList() - DisplayMode.CoverOnlyGrid list.fastForEach { @@ -469,7 +470,7 @@ fun DisplayModeSelect( onClick = { onSelectDisplayMode(it) onDismissRequest() - } + }, ) { Text(stringResource(it.res)) } @@ -486,7 +487,7 @@ private fun MangaTable( isLoading: Boolean = false, hasNextPage: Boolean = false, onLoadNextPage: () -> Unit, - onMangaClick: (Long) -> Unit + onMangaClick: (Long) -> Unit, ) { if (isLoading || mangas.isEmpty()) { LoadingScreen(isLoading) @@ -498,7 +499,7 @@ private fun MangaTable( gridSize = gridSize, onClickManga = onMangaClick, hasNextPage = hasNextPage, - onLoadNextPage = onLoadNextPage + onLoadNextPage = onLoadNextPage, ) DisplayMode.ComfortableGrid -> SourceMangaComfortableGrid( mangas = mangas, @@ -506,13 +507,13 @@ private fun MangaTable( gridSize = gridSize, onClickManga = onMangaClick, hasNextPage = hasNextPage, - onLoadNextPage = onLoadNextPage + onLoadNextPage = onLoadNextPage, ) DisplayMode.List -> SourceMangaList( mangas = mangas, onClickManga = onMangaClick, hasNextPage = hasNextPage, - onLoadNextPage = onLoadNextPage + onLoadNextPage = onLoadNextPage, ) else -> Box {} } @@ -529,7 +530,7 @@ private fun getActionItems( showFilterButton: Boolean, onToggleFiltersClick: () -> Unit, onClickMode: () -> Unit, - openDisplayModeSelect: () -> Unit + openDisplayModeSelect: () -> Unit, ): ImmutableList { return listOfNotNull( if (showFilterButton) { @@ -537,7 +538,7 @@ private fun getActionItems( name = stringResource(MR.strings.action_filter), icon = Icons.Rounded.FilterList, doAction = onToggleFiltersClick, - enabled = !isLatest + enabled = !isLatest, ) } else { null @@ -549,14 +550,14 @@ private fun getActionItems( MR.strings.move_to_browse } else { MR.strings.move_to_latest - } + }, ), icon = if (isLatest) { Icons.Rounded.Explore } else { Icons.Rounded.NewReleases }, - doAction = onClickMode + doAction = onClickMode, ) } else { null @@ -564,16 +565,16 @@ private fun getActionItems( ActionItem( name = stringResource(MR.strings.display_mode), icon = Icons.Rounded.ViewModule, - doAction = openDisplayModeSelect + doAction = openDisplayModeSelect, ), if (isConfigurable) { ActionItem( name = stringResource(MR.strings.location_settings), icon = Icons.Rounded.Settings, - doAction = onSourceSettingsClick + doAction = onSourceSettingsClick, ) } else { null - } + }, ).toImmutableList() } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersMenu.kt index c1e5c84d..56e9c6cf 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersMenu.kt @@ -76,7 +76,7 @@ fun SourceFiltersMenu( modifier: Modifier, filters: ImmutableList>, onSearchClicked: () -> Unit, - resetFiltersClicked: () -> Unit + resetFiltersClicked: () -> Unit, ) { Surface(elevation = 1.dp, modifier = modifier then Modifier.fillMaxSize()) { Column(Modifier.fillMaxSize()) { @@ -84,7 +84,7 @@ fun SourceFiltersMenu( Row( Modifier.height(56.dp).fillMaxWidth().padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, ) { TextButton(resetFiltersClicked) { Text(stringResource(MR.strings.reset_filters)) @@ -112,7 +112,7 @@ fun SourceFiltersMenu( rememberScrollbarAdapter(scrollState), Modifier.align(Alignment.CenterEnd) .fillMaxHeight() - .scrollbarPadding() + .scrollbarPadding(), ) } } @@ -137,14 +137,14 @@ fun SourceFiltersView<*, *>.toView(startExpanded: Boolean = false, onExpandChang fun SourceFilterAction( name: String, onClick: () -> Unit, - action: @Composable () -> Unit + action: @Composable () -> Unit, ) { Row( Modifier.fillMaxWidth().defaultMinSize(minHeight = 56.dp) .clickable(onClick = onClick) .padding(horizontal = 16.dp) .height(IntrinsicSize.Min), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { action() Box(Modifier.padding(horizontal = 16.dp).weight(1f)) { @@ -152,7 +152,7 @@ fun SourceFilterAction( text = name, overflow = TextOverflow.Ellipsis, maxLines = 1, - style = MaterialTheme.typography.subtitle1 + style = MaterialTheme.typography.subtitle1, ) } } @@ -166,7 +166,7 @@ fun GroupView(group: SourceFiltersView.Group, startExpanded: Boolean, onExpandCh startExpanded = startExpanded, onExpandedChanged = { onExpandChanged?.invoke(it, group.index) - } + }, ) { state.fastForEach { it.toView() @@ -182,7 +182,7 @@ fun CheckboxView(checkBox: SourceFiltersView.CheckBox) { onClick = { checkBox.updateState(!state) }, action = { Checkbox(checked = state, onCheckedChange = null) - } + }, ) } @@ -194,7 +194,7 @@ fun HeaderView(header: SourceFiltersView.Header) { fontWeight = FontWeight.Bold, color = LocalContentColor.current.copy(alpha = ContentAlpha.disabled), maxLines = 1, - style = MaterialTheme.typography.subtitle1 + style = MaterialTheme.typography.subtitle1, ) } } @@ -205,21 +205,21 @@ fun SelectView(select: SourceFiltersView.Select) { Row( Modifier.fillMaxWidth().defaultMinSize(minHeight = 56.dp) .padding(horizontal = 16.dp), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { Text( text = select.name, overflow = TextOverflow.Ellipsis, maxLines = 1, style = MaterialTheme.typography.subtitle1, - modifier = Modifier.weight(1f) + modifier = Modifier.weight(1f), ) Spinner( modifier = Modifier.weight(1f), // TODO: 2022-05-06 Remove it.values when we hit server version 0.7.0 items = select.filter.let { it.displayValues ?: it.values.map(Any::toString) }, selectedItemIndex = state, - onSelectItem = select::updateState + onSelectItem = select::updateState, ) } } @@ -242,15 +242,15 @@ fun SortRow(name: String, selected: Boolean, asc: Boolean, onClick: () -> Unit) targetValue = if (rotation > 360 - rotation) { -(360 - rotation) } else rotation, animationSpec = tween( durationMillis = 500, // rotation is retrieved with this frequency - easing = LinearEasing - ) + easing = LinearEasing, + ), ) Icon( imageVector = Icons.Rounded.ArrowUpward, contentDescription = null, modifier = Modifier.rotate(angle), - tint = MaterialTheme.colors.primary + tint = MaterialTheme.colors.primary, ) } else { Box(Modifier.size(24.dp)) @@ -266,14 +266,14 @@ fun SortView(sort: SourceFiltersView.Sort, startExpanded: Boolean, onExpandChang startExpanded = startExpanded, onExpandedChanged = { onExpandChanged?.invoke(it, sort.index) - } + }, ) { Column(Modifier.fillMaxWidth()) { sort.filter.values.fastForEachIndexed { index, name -> SortRow( name = name, selected = state?.index == index, - asc = state?.ascending ?: false + asc = state?.ascending ?: false, ) { sort.updateState( value = SortFilter.Selection( @@ -282,8 +282,8 @@ fun SortView(sort: SourceFiltersView.Sort, startExpanded: Boolean, onExpandChang state?.ascending?.not() ?: false } else { false - } - ) + }, + ), ) } } @@ -301,7 +301,7 @@ fun TextView(text: SourceFiltersView.Text) { "" } else { state - } + }, ) } val interactionSource = remember { MutableInteractionSource() } @@ -323,7 +323,7 @@ fun TextView(text: SourceFiltersView.Text) { { Text(placeholderText) } } else { null - } + }, ) } @@ -338,7 +338,7 @@ fun TriStateView(triState: SourceFiltersView.TriState) { 0 -> 1 1 -> 2 else -> 0 - } + }, ) }, action = { @@ -348,8 +348,8 @@ fun TriStateView(triState: SourceFiltersView.TriState) { 2 -> ToggleableState.Indeterminate else -> ToggleableState.Off }, - onClick = null + onClick = null, ) - } + }, ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersViewModel.kt index 428cb258..cb29c4e4 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/SourceFiltersViewModel.kt @@ -35,20 +35,20 @@ class SourceFiltersViewModel( private val getFilterList: GetFilterList, private val setSourceFilter: SetSourceFilter, contextWrapper: ContextWrapper, - private val savedStateHandle: SavedStateHandle + private val savedStateHandle: SavedStateHandle, ) : ViewModel(contextWrapper) { @Inject constructor( getFilterList: GetFilterList, setSourceFilter: SetSourceFilter, contextWrapper: ContextWrapper, @Assisted savedStateHandle: SavedStateHandle, - @Assisted params: Params + @Assisted params: Params, ) : this( params.sourceId, getFilterList, setSourceFilter, contextWrapper, - savedStateHandle + savedStateHandle, ) private val _loading = MutableStateFlow(true) @@ -81,7 +81,7 @@ class SourceFiltersViewModel( filterIndex = filter.index, childFilterIndex = childFilter.index, filter = it, - onError = { toast(it.message.orEmpty()) } + onError = { toast(it.message.orEmpty()) }, ) getFilters() } @@ -94,7 +94,7 @@ class SourceFiltersViewModel( sourceId = sourceId, filterIndex = filter.index, filter = it, - onError = { toast(it.message.orEmpty()) } + onError = { toast(it.message.orEmpty()) }, ) getFilters() } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/model/SourceFiltersView.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/model/SourceFiltersView.kt index da1582ff..460abccc 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/model/SourceFiltersView.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/browse/filter/model/SourceFiltersView.kt @@ -31,7 +31,7 @@ sealed class SourceFiltersView { override val index: Int, override val name: String, override val filter: CheckBoxFilter.CheckBoxProps, - private val _state: MutableStateFlow = MutableStateFlow(filter.state) + private val _state: MutableStateFlow = MutableStateFlow(filter.state), ) : SourceFiltersView() { override val state: StateFlow = _state.asStateFlow() override fun updateState(value: Boolean) { @@ -40,14 +40,14 @@ sealed class SourceFiltersView { internal constructor(index: Int, filter: CheckBoxFilter) : this( index, filter.filter.name, - filter.filter + filter.filter, ) } data class Header internal constructor( override val index: Int, override val name: String, - override val filter: HeaderFilter.HeaderProps + override val filter: HeaderFilter.HeaderProps, ) : SourceFiltersView() { override val state: StateFlow = MutableStateFlow(filter.state).asStateFlow() override fun updateState(value: Any) { @@ -56,13 +56,13 @@ sealed class SourceFiltersView { internal constructor(index: Int, filter: HeaderFilter) : this( index, filter.filter.name, - filter.filter + filter.filter, ) } data class Separator internal constructor( override val index: Int, override val name: String, - override val filter: SeparatorFilter.SeparatorProps + override val filter: SeparatorFilter.SeparatorProps, ) : SourceFiltersView() { override val state: StateFlow = MutableStateFlow(filter.state).asStateFlow() override fun updateState(value: Any) { @@ -71,14 +71,14 @@ sealed class SourceFiltersView { internal constructor(index: Int, filter: SeparatorFilter) : this( index, filter.filter.name, - filter.filter + filter.filter, ) } data class Text internal constructor( override val index: Int, override val name: String, - override val filter: TextFilter.TextProps + override val filter: TextFilter.TextProps, ) : SourceFiltersView() { private val _state = MutableStateFlow(filter.state) override val state: StateFlow = _state.asStateFlow() @@ -88,7 +88,7 @@ sealed class SourceFiltersView { internal constructor(index: Int, preference: TextFilter) : this( index, preference.filter.name, - preference.filter + preference.filter, ) } @@ -96,7 +96,7 @@ sealed class SourceFiltersView { override val index: Int, override val name: String, override val filter: TriStateFilter.TriStateProps, - private val _state: MutableStateFlow = MutableStateFlow(filter.state) + private val _state: MutableStateFlow = MutableStateFlow(filter.state), ) : SourceFiltersView() { override val state: StateFlow = _state.asStateFlow() override fun updateState(value: Int) { @@ -105,7 +105,7 @@ sealed class SourceFiltersView { internal constructor(index: Int, filter: TriStateFilter) : this( index, filter.filter.name, - filter.filter + filter.filter, ) } @@ -113,7 +113,7 @@ sealed class SourceFiltersView { override val index: Int, override val name: String, override val filter: SelectFilter.SelectProps, - private val _state: MutableStateFlow = MutableStateFlow(filter.state) + private val _state: MutableStateFlow = MutableStateFlow(filter.state), ) : SourceFiltersView() { override val state: StateFlow = _state.asStateFlow() override fun updateState(value: Int) { @@ -122,14 +122,14 @@ sealed class SourceFiltersView { internal constructor(index: Int, filter: SelectFilter) : this( index, filter.filter.name, - filter.filter + filter.filter, ) } data class Sort internal constructor( override val index: Int, override val name: String, override val filter: SortFilter.SortProps, - private val _state: MutableStateFlow = MutableStateFlow(filter.state) + private val _state: MutableStateFlow = MutableStateFlow(filter.state), ) : SourceFiltersView() { override val state: StateFlow = _state.asStateFlow() override fun updateState(value: SortFilter.Selection?) { @@ -138,19 +138,19 @@ sealed class SourceFiltersView { internal constructor(index: Int, filter: SortFilter) : this( index, filter.filter.name, - filter.filter + filter.filter, ) } data class Group internal constructor( override val index: Int, override val name: String, - override val filter: GroupFilter.GroupProps + override val filter: GroupFilter.GroupProps, ) : SourceFiltersView>>() { override val state: StateFlow>> = MutableStateFlow( filter.state.mapIndexed { itemIndex, sourceFilter -> SourceFiltersView(itemIndex, sourceFilter) - } + }, ).asStateFlow() override fun updateState(value: List>) { // NO-OP @@ -158,7 +158,7 @@ sealed class SourceFiltersView { internal constructor(index: Int, filter: GroupFilter) : this( index, filter.filter.name, - filter.filter + filter.filter, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/components/SourcesMenu.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/components/SourcesMenu.kt index 58406aaf..05d2385c 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/components/SourcesMenu.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/components/SourcesMenu.kt @@ -57,7 +57,7 @@ import kotlinx.collections.immutable.ImmutableList expect fun Modifier.sourceSideMenuItem( onSourceTabClick: () -> Unit, - onSourceCloseTabClick: () -> Unit + onSourceCloseTabClick: () -> Unit, ): Modifier @Composable @@ -66,7 +66,7 @@ fun SourcesMenu() { BoxWithConstraints { if (maxWidth > 720.dp) { SourcesNavigator( - homeScreenHolder + homeScreenHolder, ) { navigator -> Row { SourcesSideMenu( @@ -80,7 +80,7 @@ fun SourcesMenu() { }, onCloseSourceTabClick = { navigator.remove(it.source) - } + }, ) CurrentSource() @@ -98,7 +98,7 @@ fun SourcesMenu() { fun SourcesSideMenu( sourceTabs: ImmutableList, onSourceTabClick: (SourceNavigatorScreen) -> Unit, - onCloseSourceTabClick: (SourceNavigatorScreen.SourceScreen) -> Unit + onCloseSourceTabClick: (SourceNavigatorScreen.SourceScreen) -> Unit, ) { Surface(elevation = 1.dp) { Box { @@ -108,9 +108,9 @@ fun SourcesSideMenu( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { items(sourceTabs) { screen -> TooltipArea( @@ -118,7 +118,7 @@ fun SourcesSideMenu( Surface( modifier = Modifier.shadow(4.dp), shape = RoundedCornerShape(4.dp), - elevation = 4.dp + elevation = 4.dp, ) { Text( when (screen) { @@ -126,14 +126,14 @@ fun SourcesSideMenu( SourceNavigatorScreen.SearchScreen -> stringResource(MR.strings.location_global_search) is SourceNavigatorScreen.SourceScreen -> screen.source.name }, - modifier = Modifier.padding(10.dp) + modifier = Modifier.padding(10.dp), ) } }, modifier = Modifier.size(64.dp), tooltipPlacement = CursorPoint( - offset = DpOffset(0.dp, 16.dp) - ) + offset = DpOffset(0.dp, 16.dp), + ), ) { Box(Modifier.fillMaxSize()) { val modifier = Modifier @@ -145,7 +145,7 @@ fun SourcesSideMenu( if (screen is SourceNavigatorScreen.SourceScreen) { onCloseSourceTabClick(screen) } - } + }, ) .requiredSize(50.dp) .align(Alignment.Center) @@ -153,19 +153,19 @@ fun SourcesSideMenu( SourceNavigatorScreen.HomeScreen -> Icon( imageVector = Icons.Rounded.Home, contentDescription = stringResource(MR.strings.sources_home), - modifier = modifier + modifier = modifier, ) SourceNavigatorScreen.SearchScreen -> Icon( imageVector = Icons.Rounded.Search, contentDescription = stringResource(MR.strings.location_global_search), - modifier = modifier + modifier = modifier, ) is SourceNavigatorScreen.SourceScreen -> Box(Modifier.align(Alignment.Center)) { ImageLoaderImage( data = screen.source, contentDescription = screen.source.displayName, modifier = modifier, - filterQuality = FilterQuality.Medium + filterQuality = FilterQuality.Medium, ) } } @@ -181,10 +181,10 @@ fun SourcesSideMenu( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/components/SourcesNavigator.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/components/SourcesNavigator.kt index 98b7c303..0361e28b 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/components/SourcesNavigator.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/components/SourcesNavigator.kt @@ -37,15 +37,15 @@ val LocalSourcesNavigator: ProvidableCompositionLocal = @Composable fun SourcesNavigator( homeScreenHolder: StableHolder, - content: SourcesNavigatorContent = { CurrentSource() } + content: SourcesNavigatorContent = { CurrentSource() }, ) { Navigator( homeScreenHolder.item, onBackPressed = null, disposeBehavior = NavigatorDisposeBehavior( disposeSteps = false, - disposeNestedNavigators = false - ) + disposeNestedNavigators = false, + ), ) { navigator -> val sourcesNavigator = rememberNavigator(navigator, homeScreenHolder.item) @@ -67,7 +67,7 @@ private val disposableEvents: Set = @Composable private fun rememberNavigator( parent: Navigator, - homeScreen: SourceHomeScreen + homeScreen: SourceHomeScreen, ): SourcesNavigator { return rememberSaveable(saver = navigatorSaver(parent, homeScreen)) { SourcesNavigator(parent, homeScreen) @@ -76,7 +76,7 @@ private fun rememberNavigator( private fun navigatorSaver( parent: Navigator, - homeScreen: SourceHomeScreen + homeScreen: SourceHomeScreen, ): Saver = mapSaver( save = { navigator -> navigator.screens.mapKeys { it.toString() } }, @@ -86,14 +86,14 @@ private fun navigatorSaver( homeScreen, SnapshotStateMap().also { map -> map.putAll(items.map { it.key.toLong() to (it.value as Screen) }) - } + }, ) - } + }, ) @Composable private fun SourceNavigatorDisposableEffect( - navigator: SourcesNavigator + navigator: SourcesNavigator, ) { val currentScreen = navigator.current @@ -122,7 +122,7 @@ class SourcesNavigator internal constructor( private val navigator: Navigator, homeScreen: SourceHomeScreen, val screens: SnapshotStateMap = SnapshotStateMap() - .also { it[-1] = homeScreen } + .also { it[-1] = homeScreen }, ) { fun remove(source: Source) { @@ -148,7 +148,7 @@ class SourcesNavigator internal constructor( fun saveableState( key: String, screen: Screen, - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { navigator.saveableState(key, screen, content) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/GlobalSearchScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/GlobalSearchScreen.kt index 88422f4f..7a9d22fe 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/GlobalSearchScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/GlobalSearchScreen.kt @@ -43,7 +43,7 @@ class GlobalSearchScreen(private val initialQuery: String) : BaseScreen() { }, onMangaClick = { navigator push MangaScreen(it.id) - } + }, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/GlobalSearchViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/GlobalSearchViewModel.kt index 4452ece1..2c8c74bc 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/GlobalSearchViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/GlobalSearchViewModel.kt @@ -49,7 +49,7 @@ class GlobalSearchViewModel @Inject constructor( catalogPreferences: CatalogPreferences, contextWrapper: ContextWrapper, @Assisted private val savedStateHandle: SavedStateHandle, - @Assisted params: Params + @Assisted params: Params, ) : ViewModel(contextWrapper) { private val _query by savedStateHandle.getStateFlow { params.initialQuery } val query = _query.asStateFlow() @@ -84,7 +84,7 @@ class GlobalSearchViewModel @Inject constructor( compareBy(String.CASE_INSENSITIVE_ORDER) { it.lang } .thenBy(String.CASE_INSENSITIVE_ORDER) { it.name - } + }, ) _isLoading.value = false } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaComfortableGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaComfortableGrid.kt index 4b4c6389..9c823200 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaComfortableGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaComfortableGrid.kt @@ -32,13 +32,13 @@ import ca.gosyer.jui.uicore.image.ImageLoaderImage fun GlobalSearchMangaComfortableGridItem( modifier: Modifier, manga: Manga, - inLibrary: Boolean + inLibrary: Boolean, ) { Box( modifier = Modifier .padding(4.dp) .width((mangaAspectRatio * 200.dp)) - .clip(MaterialTheme.shapes.medium) then modifier + .clip(MaterialTheme.shapes.medium) then modifier, ) { Column { ImageLoaderImage( @@ -49,7 +49,7 @@ fun GlobalSearchMangaComfortableGridItem( .aspectRatio(mangaAspectRatio, true) .clip(MaterialTheme.shapes.medium), contentScale = ContentScale.Crop, - filterQuality = FilterQuality.Medium + filterQuality = FilterQuality.Medium, ) Text( text = manga.title, @@ -58,12 +58,12 @@ fun GlobalSearchMangaComfortableGridItem( maxLines = 2, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(vertical = 4.dp, horizontal = 4.dp), - style = MaterialTheme.typography.subtitle2 + style = MaterialTheme.typography.subtitle2, ) } SourceMangaBadges( inLibrary = inLibrary, - modifier = Modifier.padding(4.dp) + modifier = Modifier.padding(4.dp), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaCompactGrid.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaCompactGrid.kt index 625c96a7..6d763007 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaCompactGrid.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchMangaCompactGrid.kt @@ -38,20 +38,20 @@ import ca.gosyer.jui.uicore.image.ImageLoaderImage fun GlobalSearchMangaCompactGridItem( modifier: Modifier, manga: Manga, - inLibrary: Boolean + inLibrary: Boolean, ) { Box( modifier = Modifier.padding(4.dp) .height(200.dp) .aspectRatio(mangaAspectRatio, true) - .clip(MaterialTheme.shapes.medium) then modifier + .clip(MaterialTheme.shapes.medium) then modifier, ) { ImageLoaderImage( manga, manga.title, modifier = Modifier.fillMaxSize(), contentScale = ContentScale.Crop, - filterQuality = FilterQuality.Medium + filterQuality = FilterQuality.Medium, ) Box( modifier = Modifier @@ -59,12 +59,12 @@ fun GlobalSearchMangaCompactGridItem( .background( Brush.verticalGradient( 0f to Color.Transparent, - 1f to Color(0xAA000000) - ) + 1f to Color(0xAA000000), + ), ) .fillMaxHeight(0.33f) .fillMaxWidth() - .align(Alignment.BottomCenter) + .align(Alignment.BottomCenter), ) Text( modifier = Modifier @@ -76,17 +76,17 @@ fun GlobalSearchMangaCompactGridItem( color = Color.White, shadow = Shadow( color = Color.Black, - blurRadius = 4f - ) + blurRadius = 4f, + ), ), fontSize = 12.sp, lineHeight = 18.sp, maxLines = 2, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, ) SourceMangaBadges( inLibrary = inLibrary, - modifier = Modifier.padding(4.dp) + modifier = Modifier.padding(4.dp), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchScreenContent.kt index 06453791..621f0bb1 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/globalsearch/components/GlobalSearchScreenContent.kt @@ -69,22 +69,22 @@ fun GlobalSearchScreenContent( setQuery: (String) -> Unit, submitSearch: (String) -> Unit, onSourceClick: (Source) -> Unit, - onMangaClick: (Manga) -> Unit + onMangaClick: (Manga) -> Unit, ) { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar( name = stringResource(MR.strings.location_global_search), searchText = query, search = setQuery, - searchSubmit = { submitSearch(query) } + searchSubmit = { submitSearch(query) }, ) - } + }, ) { padding -> Box(Modifier.padding(padding)) { val state = rememberLazyListState() @@ -108,9 +108,9 @@ fun GlobalSearchScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { items(sourcesSuccess) { GlobalSearchItem( @@ -118,7 +118,7 @@ fun GlobalSearchScreenContent( search = results[it.id] ?: Search.Searching, displayMode = displayMode, onSourceClick = onSourceClick, - onMangaClick = onMangaClick + onMangaClick = onMangaClick, ) } items(loadingSources) { @@ -127,7 +127,7 @@ fun GlobalSearchScreenContent( search = results[it.id] ?: Search.Searching, displayMode = displayMode, onSourceClick = onSourceClick, - onMangaClick = onMangaClick + onMangaClick = onMangaClick, ) } items(failedSources) { @@ -136,7 +136,7 @@ fun GlobalSearchScreenContent( search = results[it.id] ?: Search.Searching, displayMode = displayMode, onSourceClick = onSourceClick, - onMangaClick = onMangaClick + onMangaClick = onMangaClick, ) } } @@ -147,11 +147,11 @@ fun GlobalSearchScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) + WindowInsetsSides.Bottom, + ), + ), ), - adapter = rememberScrollbarAdapter(state) + adapter = rememberScrollbarAdapter(state), ) } } @@ -163,7 +163,7 @@ fun GlobalSearchItem( search: Search, displayMode: DisplayMode, onSourceClick: (Source) -> Unit, - onMangaClick: (Manga) -> Unit + onMangaClick: (Manga) -> Unit, ) { Column { Row( @@ -171,18 +171,18 @@ fun GlobalSearchItem( .clickable { onSourceClick(source) } .padding(vertical = 8.dp, horizontal = 16.dp), horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { Column { Text( source.name, maxLines = 1, - fontSize = 16.sp + fontSize = 16.sp, ) Text( localeToString(source.displayLang), maxLines = 1, - fontSize = 12.sp + fontSize = 12.sp, ) } Icon(Icons.Rounded.ArrowForward, stringResource(MR.strings.action_search)) @@ -200,7 +200,7 @@ fun GlobalSearchItem( Modifier .fillMaxWidth() .padding(vertical = 8.dp, horizontal = 16.dp), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { val state = rememberLazyListState() LazyRow(Modifier.fillMaxSize(), state) { @@ -209,13 +209,13 @@ fun GlobalSearchItem( GlobalSearchMangaComfortableGridItem( Modifier.clickable { onMangaClick(it) }, it, - it.inLibrary + it.inLibrary, ) } else { GlobalSearchMangaCompactGridItem( Modifier.clickable { onMangaClick(it) }, it, - it.inLibrary + it.inLibrary, ) } } @@ -223,7 +223,7 @@ fun GlobalSearchItem( HorizontalScrollbar( rememberScrollbarAdapter(state), Modifier.align(Alignment.BottomCenter) - .fillMaxWidth() + .fillMaxWidth(), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/SourceHomeScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/SourceHomeScreen.kt index 9c122979..9020a12e 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/SourceHomeScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/SourceHomeScreen.kt @@ -41,7 +41,7 @@ class SourceHomeScreen : BaseScreen() { { sourcesNavigator.search(it) } } else { { navigator push GlobalSearchScreen(it) } - } + }, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/SourceHomeScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/SourceHomeScreenViewModel.kt index b651fe49..d4ae4885 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/SourceHomeScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/SourceHomeScreenViewModel.kt @@ -38,7 +38,7 @@ class SourceHomeScreenViewModel @Inject constructor( private val getSourceList: GetSourceList, catalogPreferences: CatalogPreferences, contextWrapper: ContextWrapper, - @Assisted private val savedStateHandle: SavedStateHandle + @Assisted private val savedStateHandle: SavedStateHandle, ) : ViewModel(contextWrapper) { private val _isLoading = MutableStateFlow(true) val isLoading = _isLoading.asStateFlow() @@ -78,7 +78,7 @@ class SourceHomeScreenViewModel @Inject constructor( other -> 3 else -> 2 } - }.thenBy(String.CASE_INSENSITIVE_ORDER, Pair::first) + }.thenBy(String.CASE_INSENSITIVE_ORDER, Pair::first), ) .flatMap { (key, value) -> listOf(SourceUI.Header(key)) + value diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/components/SourceHomeScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/components/SourceHomeScreenContent.kt index 8037274a..089b9ef8 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/components/SourceHomeScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/home/components/SourceHomeScreenContent.kt @@ -84,23 +84,23 @@ fun SourceHomeScreenContent( setEnabledLanguages: (Set) -> Unit, query: String, setQuery: (String) -> Unit, - submitSearch: (String) -> Unit + submitSearch: (String) -> Unit, ) { val languageDialogState = rememberMaterialDialogState() Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { SourceHomeScreenToolbar( openEnabledLanguagesClick = languageDialogState::show, query = query, setQuery = setQuery, - submitSearch = submitSearch + submitSearch = submitSearch, ) - } + }, ) { padding -> if (sources.isEmpty()) { LoadingScreen(isLoading) @@ -122,13 +122,13 @@ fun SourceHomeScreenToolbar( openEnabledLanguagesClick: () -> Unit, query: String, setQuery: (String) -> Unit, - submitSearch: (String) -> Unit + submitSearch: (String) -> Unit, ) { Toolbar( stringResource(MR.strings.location_sources), actions = { getActionItems( - openEnabledLanguagesClick = openEnabledLanguagesClick + openEnabledLanguagesClick = openEnabledLanguagesClick, ) }, searchText = query, @@ -137,14 +137,14 @@ fun SourceHomeScreenToolbar( if (query.isNotBlank()) { submitSearch(query) } - } + }, ) } @Composable fun WideSourcesMenu( sources: ImmutableList, - onAddSource: (Source) -> Unit + onAddSource: (Source) -> Unit, ) { Box { val state = rememberLazyGridState() @@ -155,9 +155,9 @@ fun WideSourcesMenu( modifier = Modifier.fillMaxSize(), contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { items( sources, @@ -178,16 +178,16 @@ fun WideSourcesMenu( is SourceUI.Header -> GridItemSpan(maxLineSpan) is SourceUI.SourceItem -> GridItemSpan(1) } - } + }, ) { sourceUI -> when (sourceUI) { is SourceUI.Header -> Text( sourceUI.header, - modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp) + modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp), ) is SourceUI.SourceItem -> WideSourceItem( sourceUI, - onSourceClicked = onAddSource + onSourceClicked = onAddSource, ) } } @@ -199,11 +199,11 @@ fun WideSourcesMenu( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) + WindowInsetsSides.Bottom, + ), + ), ), - adapter = rememberVerticalScrollbarAdapter(state, cells) + adapter = rememberVerticalScrollbarAdapter(state, cells), ) } } @@ -211,7 +211,7 @@ fun WideSourcesMenu( @Composable fun WideSourceItem( sourceItem: SourceUI.SourceItem, - onSourceClicked: (Source) -> Unit + onSourceClicked: (Source) -> Unit, ) { val source = sourceItem.source TooltipArea( @@ -219,31 +219,31 @@ fun WideSourceItem( Surface( modifier = Modifier.shadow(4.dp), shape = RoundedCornerShape(4.dp), - elevation = 4.dp + elevation = 4.dp, ) { Text(source.name, modifier = Modifier.padding(10.dp)) } - } + }, ) { Column( Modifier.padding(8.dp) .clickable { onSourceClicked(source) }, - horizontalAlignment = Alignment.CenterHorizontally + horizontalAlignment = Alignment.CenterHorizontally, ) { ImageLoaderImage( data = source, contentDescription = source.displayName, modifier = Modifier.size(96.dp), - filterQuality = FilterQuality.Medium + filterQuality = FilterQuality.Medium, ) Spacer(Modifier.height(4.dp)) Text( source.name, color = MaterialTheme.colors.onBackground, maxLines = 2, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, ) } } @@ -252,7 +252,7 @@ fun WideSourceItem( @Composable fun ThinSourcesMenu( sources: ImmutableList, - onAddSource: (Source) -> Unit + onAddSource: (Source) -> Unit, ) { Box { val state = rememberLazyListState() @@ -261,9 +261,9 @@ fun ThinSourcesMenu( modifier = Modifier.fillMaxSize(), contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { items( sources, @@ -278,16 +278,16 @@ fun ThinSourcesMenu( is SourceUI.Header -> it.header is SourceUI.SourceItem -> it.source.id } - } + }, ) { sourceUI -> when (sourceUI) { is SourceUI.Header -> Text( sourceUI.header, - modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp) + modifier = Modifier.padding(horizontal = 16.dp, vertical = 4.dp), ) is SourceUI.SourceItem -> ThinSourceItem( sourceUI, - onSourceClicked = onAddSource + onSourceClicked = onAddSource, ) } } @@ -299,11 +299,11 @@ fun ThinSourcesMenu( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) + WindowInsetsSides.Bottom, + ), + ), ), - adapter = rememberScrollbarAdapter(state) + adapter = rememberScrollbarAdapter(state), ) } } @@ -311,7 +311,7 @@ fun ThinSourcesMenu( @Composable fun ThinSourceItem( sourceItem: SourceUI.SourceItem, - onSourceClicked: (Source) -> Unit + onSourceClicked: (Source) -> Unit, ) { val source = sourceItem.source Row( @@ -319,14 +319,14 @@ fun ThinSourceItem( .height(64.dp) .clickable(onClick = { onSourceClicked(source) }) .padding(horizontal = 16.dp, vertical = 8.dp), - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { ImageLoaderImage( source, source.displayName, Modifier.fillMaxHeight() .aspectRatio(1F, true), - filterQuality = FilterQuality.Medium + filterQuality = FilterQuality.Medium, ) Spacer(Modifier.width(8.dp)) Column { @@ -335,14 +335,14 @@ fun ThinSourceItem( color = MaterialTheme.colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis, - fontSize = 14.sp + fontSize = 14.sp, ) Text( localeToString(source.displayLang), color = MaterialTheme.colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis, - fontSize = 12.sp + fontSize = 12.sp, ) } } @@ -351,13 +351,13 @@ fun ThinSourceItem( @Composable @Stable private fun getActionItems( - openEnabledLanguagesClick: () -> Unit + openEnabledLanguagesClick: () -> Unit, ): ImmutableList { return persistentListOf( ActionItem( stringResource(MR.strings.enabled_languages), Icons.Rounded.Translate, - doAction = openEnabledLanguagesClick - ) + doAction = openEnabledLanguagesClick, + ), ).toImmutableList() } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/SourceSettingsScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/SourceSettingsScreen.kt index 092c069b..59731b94 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/SourceSettingsScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/SourceSettingsScreen.kt @@ -24,7 +24,7 @@ class SourceSettingsScreen(private val sourceId: Long) : Screen { sourceSettingsViewModel(SourceSettingsScreenViewModel.Params(sourceId)) } SourceSettingsScreenContent( - settings = vm.sourceSettings.collectAsState().value + settings = vm.sourceSettings.collectAsState().value, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/SourceSettingsScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/SourceSettingsScreenViewModel.kt index 7fabc377..20a166e4 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/SourceSettingsScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/SourceSettingsScreenViewModel.kt @@ -32,7 +32,7 @@ class SourceSettingsScreenViewModel @Inject constructor( private val getSourceSettings: GetSourceSettings, private val setSourceSetting: SetSourceSetting, contextWrapper: ContextWrapper, - @Assisted private val params: Params + @Assisted private val params: Params, ) : ViewModel(contextWrapper) { private val _loading = MutableStateFlow(true) val loading = _loading.asStateFlow() @@ -52,7 +52,7 @@ class SourceSettingsScreenViewModel @Inject constructor( sourceId = params.sourceId, settingIndex = setting.index, setting = it, - onError = { toast(it.message.orEmpty()) } + onError = { toast(it.message.orEmpty()) }, ) getSourceSettings() } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/components/SourceSettingsScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/components/SourceSettingsScreenContent.kt index ca73557e..7305af0c 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/components/SourceSettingsScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/components/SourceSettingsScreenContent.kt @@ -60,17 +60,17 @@ import kotlinx.collections.immutable.ImmutableList @Composable fun SourceSettingsScreenContent( - settings: ImmutableList> + settings: ImmutableList>, ) { Scaffold( modifier = Modifier.windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { Toolbar(stringResource(MR.strings.location_settings)) - } + }, ) { padding -> Box(Modifier.padding(padding)) { val state = rememberLazyListState() @@ -79,9 +79,9 @@ fun SourceSettingsScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { items(settings, { it.props.hashCode() }) { @Suppress("UNCHECKED_CAST") @@ -109,10 +109,10 @@ fun SourceSettingsScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -139,7 +139,7 @@ private fun TwoStatePreference(twoState: TwoState, checkbox: Boolean) { } else { Switch(checked = state, onCheckedChange = null) } - } + }, ) } @@ -160,14 +160,14 @@ private fun ListPreference(list: List) { subtitle = subtitle, onClick = { dialogState.show() - } + }, ) ChoiceDialog( dialogState, list.getOptions(), state, onSelected = list::updateState, - title = title + title = title, ) } @@ -189,14 +189,14 @@ private fun MultiSelectPreference(multiSelect: MultiSelect) { subtitle = subtitle, onClick = { dialogState.show() - } + }, ) MultiSelectDialog( dialogState, multiSelect.getOptions(), state, onFinished = multiSelect::updateState, - title = dialogTitle + title = dialogTitle, ) } @@ -215,7 +215,7 @@ private fun EditTextPreference(editText: EditText) { PreferenceRow( title, subtitle = subtitle, - onClick = dialogState::show + onClick = dialogState::show, ) MaterialDialog( dialogState, @@ -223,7 +223,7 @@ private fun EditTextPreference(editText: EditText) { positiveButton(stringResource(MR.strings.action_ok)) negativeButton(stringResource(MR.strings.action_cancel)) }, - properties = getMaterialDialogProperties() + properties = getMaterialDialogProperties(), ) { title(editText.dialogTitle ?: BuildKonfig.NAME) if (editText.dialogMessage != null) { @@ -233,7 +233,7 @@ private fun EditTextPreference(editText: EditText) { label = "", textFieldStyle = TextFieldStyle.Outlined, onInput = { editText.updateState(it) }, - modifier = Modifier.keyboardHandler() + modifier = Modifier.keyboardHandler(), ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/model/SourceSettingsView.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/model/SourceSettingsView.kt index a8d62445..f798d8cc 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/model/SourceSettingsView.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/sources/settings/model/SourceSettingsView.kt @@ -40,8 +40,8 @@ sealed class SourceSettingsView { private val _state: MutableStateFlow = MutableStateFlow( props.currentValue ?: props.defaultValue - ?: false - ) + ?: false, + ), ) : SourceSettingsView() { override val state: StateFlow = _state.asStateFlow() override fun updateState(value: Boolean) { @@ -53,13 +53,13 @@ sealed class SourceSettingsView { override val index: Int, override val title: String?, override val subtitle: String?, - override val props: TwoStateProps + override val props: TwoStateProps, ) : TwoState(props) { internal constructor(index: Int, preference: CheckBoxPreference) : this( index, preference.props.title, preference.props.summary, - preference.props + preference.props, ) } @@ -67,13 +67,13 @@ sealed class SourceSettingsView { override val index: Int, override val title: String?, override val subtitle: String?, - override val props: TwoStateProps + override val props: TwoStateProps, ) : TwoState(props) { internal constructor(index: Int, preference: SwitchPreference) : this( index, preference.props.title, preference.props.summary, - preference.props + preference.props, ) } @@ -81,10 +81,10 @@ sealed class SourceSettingsView { override val index: Int, override val title: String?, override val subtitle: String?, - override val props: ListPreference.ListProps + override val props: ListPreference.ListProps, ) : SourceSettingsView() { private val _state = MutableStateFlow( - props.currentValue ?: props.defaultValue ?: "0" + props.currentValue ?: props.defaultValue ?: "0", ) override val state: StateFlow = _state.asStateFlow() override fun updateState(value: String) { @@ -94,7 +94,7 @@ sealed class SourceSettingsView { index, preference.props.title, preference.props.summary, - preference.props + preference.props, ) override val summary: String? @@ -109,10 +109,10 @@ sealed class SourceSettingsView { override val index: Int, override val title: String?, override val subtitle: String?, - override val props: MultiSelectListPreference.MultiSelectListProps + override val props: MultiSelectListPreference.MultiSelectListProps, ) : SourceSettingsView?>() { private val _state = MutableStateFlow( - props.currentValue?.toImmutableList() ?: props.defaultValue?.toImmutableList() + props.currentValue?.toImmutableList() ?: props.defaultValue?.toImmutableList(), ) override val state: StateFlow?> = _state.asStateFlow() override fun updateState(value: ImmutableList?) { @@ -122,7 +122,7 @@ sealed class SourceSettingsView { index, preference.props.title, preference.props.summary, - preference.props + preference.props, ) fun getOptions() = props.entryValues.mapIndexed { index, s -> @@ -144,7 +144,7 @@ sealed class SourceSettingsView { override val subtitle: String?, val dialogTitle: String?, val dialogMessage: String?, - override val props: EditTextPreference.EditTextProps + override val props: EditTextPreference.EditTextProps, ) : SourceSettingsView() { private val _state = MutableStateFlow(props.currentValue ?: props.defaultValue.orEmpty()) override val state: StateFlow = _state.asStateFlow() @@ -157,7 +157,7 @@ sealed class SourceSettingsView { preference.props.summary, preference.props.dialogTitle, preference.props.dialogMessage, - preference.props + preference.props, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/UpdatesScreen.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/UpdatesScreen.kt index 97a4c9e9..e9604de0 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/UpdatesScreen.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/UpdatesScreen.kt @@ -50,7 +50,7 @@ class UpdatesScreen : Screen { clearSelection = vm::clearSelection, onUpdateLibrary = vm::updateLibrary, updateWebsocketStatus = updatesVM.serviceStatus.collectAsState().value, - restartLibraryUpdates = updatesVM::restartLibraryUpdates + restartLibraryUpdates = updatesVM::restartLibraryUpdates, ) readerLauncher.Reader() } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/UpdatesScreenViewModel.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/UpdatesScreenViewModel.kt index 79d71c0d..283f955c 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/UpdatesScreenViewModel.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/UpdatesScreenViewModel.kt @@ -49,7 +49,7 @@ class UpdatesScreenViewModel @Inject constructor( private val batchChapterDownload: BatchChapterDownload, private val updateLibrary: UpdateLibrary, private val updatesPager: UpdatesPager, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { private val _isLoading = MutableStateFlow(true) @@ -83,7 +83,7 @@ class UpdatesScreenViewModel @Inject constructor( }, onError = { toast(it.message.orEmpty()) - } + }, ) updates .map { updates -> @@ -109,7 +109,7 @@ class UpdatesScreenViewModel @Inject constructor( updatesPager.loadNextPage( onError = { toast(it.message.orEmpty()) - } + }, ) } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/components/UpdatesItem.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/components/UpdatesItem.kt index fd05480c..b97f613f 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/components/UpdatesItem.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/components/UpdatesItem.kt @@ -40,7 +40,7 @@ expect fun Modifier.updatesItemModifier( bookmarkChapter: (() -> Unit)?, unBookmarkChapter: (() -> Unit)?, onSelectChapter: (() -> Unit)?, - onUnselectChapter: (() -> Unit)? + onUnselectChapter: (() -> Unit)?, ): Modifier @Composable @@ -56,7 +56,7 @@ fun UpdatesItem( onClickCover: () -> Unit, onClickDownload: (Chapter) -> Unit, onClickDeleteDownload: (Chapter) -> Unit, - onClickStopDownload: (Chapter) -> Unit + onClickStopDownload: (Chapter) -> Unit, ) { val manga = chapterDownloadItem.manga!! val chapter = chapterDownloadItem.chapter @@ -73,11 +73,11 @@ fun UpdatesItem( bookmarkChapter = { bookmarkChapter(chapter.id) }.takeUnless { chapter.bookmarked }, unBookmarkChapter = { unBookmarkChapter(chapter.id) }.takeIf { chapter.bookmarked }, onSelectChapter = { onSelectChapter(chapter.id) }.takeUnless { isSelected }, - onUnselectChapter = { onUnselectChapter(chapter.id) }.takeIf { isSelected } + onUnselectChapter = { onUnselectChapter(chapter.id) }.takeIf { isSelected }, ) .height(96.dp) .fillMaxWidth() - .padding(end = 4.dp) + .padding(end = 4.dp), ) { MangaListItemImage( modifier = Modifier @@ -87,30 +87,30 @@ fun UpdatesItem( .clip(MaterialTheme.shapes.medium) .clickable { onClickCover() }, data = manga, - contentDescription = manga.title + contentDescription = manga.title, ) val textColor = if (chapter.bookmarked && !chapter.read) { MaterialTheme.colors.primary } else { MaterialTheme.colors.onSurface.copy( - alpha = if (chapter.read) ContentAlpha.disabled else ContentAlpha.medium + alpha = if (chapter.read) ContentAlpha.disabled else ContentAlpha.medium, ) } MangaListItemColumn( modifier = Modifier .weight(1f) .padding(start = 16.dp) - .alpha(alpha) + .alpha(alpha), ) { MangaListItemTitle( text = manga.title, bookmarked = chapter.bookmarked, fontWeight = FontWeight.SemiBold, - textColor = textColor + textColor = textColor, ) MangaListItemSubtitle( text = chapter.name, - textColor = textColor + textColor = textColor, ) } @@ -118,7 +118,7 @@ fun UpdatesItem( chapterDownloadItem, onClickDownload, onClickStopDownload, - onClickDeleteDownload + onClickDeleteDownload, ) } } diff --git a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/components/UpdatesScreenContent.kt b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/components/UpdatesScreenContent.kt index 610cadf6..d81274d6 100644 --- a/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/components/UpdatesScreenContent.kt +++ b/presentation/src/commonMain/kotlin/ca/gosyer/jui/ui/updates/components/UpdatesScreenContent.kt @@ -93,7 +93,7 @@ fun UpdatesScreenContent( clearSelection: () -> Unit, onUpdateLibrary: () -> Unit, updateWebsocketStatus: WebsocketService.Status, - restartLibraryUpdates: () -> Unit + restartLibraryUpdates: () -> Unit, ) { BackHandler(inActionMode) { clearSelection() @@ -111,8 +111,8 @@ fun UpdatesScreenContent( } .windowInsetsPadding( WindowInsets.statusBars.add( - WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal) - ) + WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal), + ), ), topBar = { val navigator = LocalNavigator.current @@ -122,13 +122,13 @@ fun UpdatesScreenContent( if (inActionMode) { getActionModeActionItems( selectAll = selectAll, - invertSelection = invertSelection + invertSelection = invertSelection, ) } else { getActionItems( onUpdateLibrary, updateWebsocketStatus, - restartLibraryUpdates // todo set null if wide screen + restartLibraryUpdates, // todo set null if wide screen ) } }, @@ -139,7 +139,7 @@ fun UpdatesScreenContent( navigator?.pop() } }, - closeIcon = if (inActionMode) Icons.Rounded.Close else ToolbarDefault + closeIcon = if (inActionMode) Icons.Rounded.Close else ToolbarDefault, ) }, bottomBar = { @@ -152,10 +152,10 @@ fun UpdatesScreenContent( bookmarkChapter = { bookmarkChapter(null) }, unBookmarkChapter = { unBookmarkChapter(null) }, deleteChapter = { deleteDownloadedChapter(null) }, - downloadChapters = { downloadChapter(null) } - ) + downloadChapters = { downloadChapter(null) }, + ), ) - } + }, ) { if (isLoading || updates.isEmpty()) { LoadingScreen(isLoading) @@ -167,9 +167,9 @@ fun UpdatesScreenContent( state = state, contentPadding = WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ).asPaddingValues() + WindowInsetsSides.Bottom, + ), + ).asPaddingValues(), ) { itemsIndexed(updates) { index, item -> LaunchedEffect(Unit) { @@ -181,7 +181,7 @@ fun UpdatesScreenContent( is UpdatesUI.Header -> Text( text = item.date, modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp), - fontWeight = FontWeight.Medium + fontWeight = FontWeight.Medium, ) is UpdatesUI.Item -> { val manga = item.chapterDownloadItem.manga!! @@ -202,7 +202,7 @@ fun UpdatesScreenContent( onClickCover = { openManga(manga.id) }, onClickDownload = downloadChapter, onClickDeleteDownload = deleteDownloadedChapter, - onClickStopDownload = stopDownloadingChapter + onClickStopDownload = stopDownloadingChapter, ) } } @@ -216,10 +216,10 @@ fun UpdatesScreenContent( .windowInsetsPadding( WindowInsets.bottomNav.add( WindowInsets.navigationBars.only( - WindowInsetsSides.Bottom - ) - ) - ) + WindowInsetsSides.Bottom, + ), + ), + ), ) } } @@ -231,23 +231,23 @@ fun UpdatesScreenContent( private fun getActionItems( onUpdateLibrary: () -> Unit, updateWebsocketStatus: WebsocketService.Status? = null, - restartLibraryUpdates: (() -> Unit)? = null + restartLibraryUpdates: (() -> Unit)? = null, ): ImmutableList { return listOfNotNull( ActionItem( name = stringResource(MR.strings.action_update_library), icon = Icons.Rounded.Refresh, - doAction = onUpdateLibrary + doAction = onUpdateLibrary, ), if (updateWebsocketStatus == WebsocketService.Status.STOPPED && restartLibraryUpdates != null) { ActionItem( name = stringResource(MR.strings.action_restart_library), overflowMode = OverflowMode.ALWAYS_OVERFLOW, - doAction = restartLibraryUpdates + doAction = restartLibraryUpdates, ) } else { null - } + }, ).toImmutableList() } @@ -255,19 +255,19 @@ private fun getActionItems( @Stable private fun getActionModeActionItems( selectAll: () -> Unit, - invertSelection: () -> Unit + invertSelection: () -> Unit, ): ImmutableList { return listOf( ActionItem( name = stringResource(MR.strings.action_select_all), icon = Icons.Rounded.SelectAll, - doAction = selectAll + doAction = selectAll, ), ActionItem( name = stringResource(MR.strings.action_select_inverse), icon = Icons.Rounded.FlipToBack, - doAction = invertSelection - ) + doAction = invertSelection, + ), ).toImmutableList() } @@ -280,38 +280,38 @@ private fun getBottomActionItems( bookmarkChapter: () -> Unit, unBookmarkChapter: () -> Unit, deleteChapter: () -> Unit, - downloadChapters: () -> Unit + downloadChapters: () -> Unit, ): ImmutableList { return listOfNotNull( BottomActionItem( name = stringResource(MR.strings.action_bookmark), icon = Icons.Rounded.BookmarkAdd, - onClick = bookmarkChapter + onClick = bookmarkChapter, ).takeIf { selectedItems.fastAny { !it.chapter.bookmarked } }, BottomActionItem( name = stringResource(MR.strings.action_remove_bookmark), icon = Icons.Rounded.BookmarkRemove, - onClick = unBookmarkChapter + onClick = unBookmarkChapter, ).takeIf { selectedItems.fastAny { it.chapter.bookmarked } }, BottomActionItem( name = stringResource(MR.strings.action_mark_as_read), icon = Icons.Rounded.DoneAll, - onClick = markRead + onClick = markRead, ).takeIf { selectedItems.fastAny { !it.chapter.read } }, BottomActionItem( name = stringResource(MR.strings.action_mark_as_unread), icon = Icons.Rounded.RemoveDone, - onClick = markUnread + onClick = markUnread, ).takeIf { selectedItems.fastAny { it.chapter.read } }, BottomActionItem( name = stringResource(MR.strings.action_download), icon = Icons.Rounded.Download, - onClick = downloadChapters + onClick = downloadChapters, ).takeIf { selectedItems.fastAny { it.downloadState.value == ChapterDownloadState.NotDownloaded } }, BottomActionItem( name = stringResource(MR.strings.action_delete), icon = Icons.Rounded.Delete, - onClick = deleteChapter - ).takeIf { selectedItems.fastAny { it.downloadState.value == ChapterDownloadState.Downloaded } } + onClick = deleteChapter, + ).takeIf { selectedItems.fastAny { it.downloadState.value == ChapterDownloadState.Downloaded } }, ).toImmutableList() } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/DesktopViewModelComponent.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/DesktopViewModelComponent.kt index 230cc504..c7510657 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/DesktopViewModelComponent.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/DesktopViewModelComponent.kt @@ -23,7 +23,7 @@ actual interface ViewModelComponent : SharedViewModelComponent { @Composable actual inline fun Screen.realStateViewModel( tag: String?, - crossinline factory: @DisallowComposableCalls ViewModelComponent.(SavedStateHandle) -> VM + crossinline factory: @DisallowComposableCalls ViewModelComponent.(SavedStateHandle) -> VM, ): VM { val viewModelFactory = LocalViewModels.current val savedStateHandle = rememberSaveable { SavedStateHandle() } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/components/DesktopTooltipArea.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/components/DesktopTooltipArea.kt index 46e295d6..94c8a531 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/components/DesktopTooltipArea.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/components/DesktopTooltipArea.kt @@ -23,13 +23,13 @@ internal actual fun RealTooltipArea( modifier: Modifier, delayMillis: Int, tooltipPlacement: TooltipPlacement, - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { androidx.compose.foundation.TooltipArea( tooltip, modifier, delayMillis, tooltipPlacement, - content + content, ) } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/file/DesktopFileSaver.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/file/DesktopFileSaver.kt index 878e2a94..e84a4f1d 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/file/DesktopFileSaver.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/file/DesktopFileSaver.kt @@ -19,7 +19,7 @@ actual class FileSaver( private val onFileSelected: (Sink) -> Unit, private val onCancel: () -> Unit, private val onError: () -> Unit, - private val scope: CoroutineScope + private val scope: CoroutineScope, ) { private val fileChooser = JFileChooser() .apply { @@ -43,7 +43,7 @@ actual class FileSaver( internal actual fun realRememberFileSaver( onFileSelected: (Sink) -> Unit, onCancel: () -> Unit, - onError: () -> Unit + onError: () -> Unit, ): FileSaver { val coroutineScope = rememberCoroutineScope() return remember { FileSaver(onFileSelected, onCancel, onError, coroutineScope) } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/navigation/ActionIcon.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/navigation/ActionIcon.kt index 58771b58..955a2994 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/navigation/ActionIcon.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/navigation/ActionIcon.kt @@ -21,7 +21,7 @@ actual fun ActionIcon(onClick: () -> Unit, contentDescription: String, icon: Ima BoxWithTooltipSurface( { Text(contentDescription, modifier = Modifier.padding(10.dp)) - } + }, ) { IconButton(onClick = onClick) { Icon(icon, contentDescription) diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/state/DesktopSavedStateHandle.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/state/DesktopSavedStateHandle.kt index 1bd5685d..21e5eb00 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/state/DesktopSavedStateHandle.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/state/DesktopSavedStateHandle.kt @@ -33,7 +33,7 @@ actual class SavedStateHandle { actual fun getStateFlow( key: String, - initialValue: T + initialValue: T, ): StateFlow { @Suppress("UNCHECKED_CAST") // If a flow exists we should just return it, and since it is a StateFlow and a value must diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/theme/ThemeScrollbarStyle.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/theme/ThemeScrollbarStyle.kt index c1004263..4d13b676 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/theme/ThemeScrollbarStyle.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/base/theme/ThemeScrollbarStyle.kt @@ -22,7 +22,7 @@ actual object ThemeScrollbarStyle { shape = MaterialTheme.shapes.small, hoverDurationMillis = 300, unhoverColor = MaterialTheme.colors.onSurface.copy(alpha = 0.30f), - hoverColor = MaterialTheme.colors.onSurface.copy(alpha = 0.70f) + hoverColor = MaterialTheme.colors.onSurface.copy(alpha = 0.70f), ) } } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesWindow.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesWindow.kt index eb4347b6..a8ddfb26 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesWindow.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/categories/CategoriesWindow.kt @@ -30,7 +30,7 @@ actual class CategoriesLauncher(private val notifyFinished: () -> Unit) { Window( onCloseRequest = { isOpen = false }, title = "${BuildKonfig.NAME} - Categories", - icon = painterResource("icon.png") + icon = painterResource("icon.png"), ) { Navigator(remember { CategoriesScreen(notifyFinished) }) } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/downloads/DesktopDownloadService.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/downloads/DesktopDownloadService.kt index ff4bc794..0314c1a0 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/downloads/DesktopDownloadService.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/downloads/DesktopDownloadService.kt @@ -13,7 +13,7 @@ import ca.gosyer.jui.uicore.vm.ContextWrapper internal actual fun startDownloadService( contextWrapper: ContextWrapper, downloadService: DownloadService, - actions: WebsocketService.Actions + actions: WebsocketService.Actions, ) { downloadService.init() } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/library/components/DesktopLibraryGrid.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/library/components/DesktopLibraryGrid.kt index cfd0df71..977a30b0 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/library/components/DesktopLibraryGrid.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/library/components/DesktopLibraryGrid.kt @@ -17,21 +17,21 @@ import ca.gosyer.jui.uicore.resources.stringResource actual fun Modifier.libraryMangaModifier( onClickManga: () -> Unit, - onClickRemoveManga: () -> Unit + onClickRemoveManga: () -> Unit, ): Modifier = this .onClick(onClick = onClickManga) .onRightClickContextMenu( items = { getContextItems(onClickRemoveManga) - } + }, ) @Composable @Stable private fun getContextItems( - onClickRemoveManga: () -> Unit + onClickRemoveManga: () -> Unit, ): List { return listOf( - ContextMenuItem(stringResource(MR.strings.action_remove_favorite), onClickRemoveManga) + ContextMenuItem(stringResource(MR.strings.action_remove_favorite), onClickRemoveManga), ) } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/DesktopLicenses.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/DesktopLicenses.kt index 613c944f..629a3ed9 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/DesktopLicenses.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/DesktopLicenses.kt @@ -16,7 +16,7 @@ import com.mikepenz.aboutlibraries.Libs @Composable actual fun getLicenses(): Libs? { val libs by produceState( - null + null, ) { withIOContext { val json = MR.files.aboutlibraries.readText() diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/DesktopLibraryUpdatesService.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/DesktopLibraryUpdatesService.kt index bdf7b6bb..f3dc8dbe 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/DesktopLibraryUpdatesService.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/DesktopLibraryUpdatesService.kt @@ -13,7 +13,7 @@ import ca.gosyer.jui.uicore.vm.ContextWrapper internal actual fun startLibraryUpdatesService( contextWrapper: ContextWrapper, libraryUpdatesService: LibraryUpdateService, - actions: WebsocketService.Actions + actions: WebsocketService.Actions, ) { libraryUpdatesService.init() } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/Tray.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/Tray.kt index 68ee9b76..89c15f15 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/Tray.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/Tray.kt @@ -32,7 +32,7 @@ fun ApplicationScope.Tray(icon: StableHolder) { tooltip = BuildKonfig.NAME, menu = { Item(MR.strings.action_close.localized(), onClick = ::exitApplication) - } + }, ) LaunchedEffect(Unit) { @@ -42,8 +42,8 @@ fun ApplicationScope.Tray(icon: StableHolder) { Notification( MR.strings.new_update_title.localized(), MR.strings.new_update_message.localized(Locale.getDefault(), it.release.version), - Notification.Type.Info - ) + Notification.Type.Info, + ), ) } } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/TrayViewModel.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/TrayViewModel.kt index 45936d84..6a574f6a 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/TrayViewModel.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/main/components/TrayViewModel.kt @@ -20,7 +20,7 @@ import org.lighthousegames.logging.logging class TrayViewModel @Inject constructor( updateChecker: UpdateChecker, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { override val scope = MainScope() diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/manga/components/DesktopChapterItem.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/manga/components/DesktopChapterItem.kt index 4c30aabd..425d2990 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/manga/components/DesktopChapterItem.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/manga/components/DesktopChapterItem.kt @@ -24,15 +24,15 @@ actual fun Modifier.chapterItemModifier( unBookmarkChapter: (() -> Unit)?, markPreviousAsRead: () -> Unit, onSelectChapter: (() -> Unit)?, - onUnselectChapter: (() -> Unit)? + onUnselectChapter: (() -> Unit)?, ): Modifier = this .onClick( onClick = onClick, - onLongClick = onSelectChapter + onLongClick = onSelectChapter, ) .onClick( onClick = onSelectChapter ?: onUnselectChapter ?: {}, - keyboardModifiers = { isCtrlPressed } + keyboardModifiers = { isCtrlPressed }, ) .onRightClickContextMenu( items = { @@ -41,9 +41,9 @@ actual fun Modifier.chapterItemModifier( markUnread = markUnread, bookmarkChapter = bookmarkChapter, unBookmarkChapter = unBookmarkChapter, - markPreviousAsRead = markPreviousAsRead + markPreviousAsRead = markPreviousAsRead, ) - } + }, ) @Composable @@ -53,13 +53,13 @@ private fun getContextItems( markUnread: (() -> Unit)?, bookmarkChapter: (() -> Unit)?, unBookmarkChapter: (() -> Unit)?, - markPreviousAsRead: () -> Unit + markPreviousAsRead: () -> Unit, ): List { return listOfNotNull( if (bookmarkChapter != null) ContextMenuItem(stringResource(MR.strings.action_bookmark), bookmarkChapter) else null, if (unBookmarkChapter != null) ContextMenuItem(stringResource(MR.strings.action_remove_bookmark), unBookmarkChapter) else null, if (markRead != null) ContextMenuItem(stringResource(MR.strings.action_mark_as_read), markRead) else null, if (markUnread != null) ContextMenuItem(stringResource(MR.strings.action_mark_as_unread), markUnread) else null, - ContextMenuItem(stringResource(MR.strings.action_mark_previous_read), markPreviousAsRead) + ContextMenuItem(stringResource(MR.strings.action_mark_previous_read), markPreviousAsRead), ) } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/reader/DesktopReaderMenu.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/reader/DesktopReaderMenu.kt index dff03958..d0852750 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/reader/DesktopReaderMenu.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/reader/DesktopReaderMenu.kt @@ -29,7 +29,7 @@ actual class ReaderLauncher { actual fun launch( chapterIndex: Int, - mangaId: Long + mangaId: Long, ) { isOpen = chapterIndex to mangaId } @@ -42,7 +42,7 @@ actual class ReaderLauncher { isOpen?.let { (chapterIndex, mangaId) -> launchApplication { val windowState = rememberWindowState( - position = WindowPosition.Aligned(Alignment.Center) + position = WindowPosition.Aligned(Alignment.Center), ) val icon = painterResource("icon.png") CompositionLocalProvider(localParams) { @@ -50,12 +50,12 @@ actual class ReaderLauncher { onCloseRequest = ::exitApplication, title = "${BuildKonfig.NAME} - Reader", icon = icon, - state = windowState + state = windowState, ) { ReaderMenu( chapterIndex = chapterIndex, mangaId = mangaId, - onCloseRequest = ::exitApplication + onCloseRequest = ::exitApplication, ) } } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/settings/DesktopSettingsServerScreen.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/settings/DesktopSettingsServerScreen.kt index 8ceb8f27..0d18b068 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/settings/DesktopSettingsServerScreen.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/settings/DesktopSettingsServerScreen.kt @@ -67,7 +67,7 @@ actual fun getServerHostItems(viewModel: @Composable () -> SettingsServerHostVie openInBrowserEnabled = serverVm.openInBrowserEnabled, basicAuthEnabled = serverVm.basicAuthEnabled, basicAuthUsername = serverVm.basicAuthUsername, - basicAuthPassword = serverVm.basicAuthPassword + basicAuthPassword = serverVm.basicAuthPassword, ) } } @@ -76,7 +76,7 @@ actual class SettingsServerHostViewModel @Inject constructor( serverPreferences: ServerPreferences, serverHostPreferences: ServerHostPreferences, private val serverService: ServerService, - contextWrapper: ContextWrapper + contextWrapper: ContextWrapper, ) : ViewModel(contextWrapper) { val host = serverHostPreferences.host().asStateIn(scope) val ip = serverHostPreferences.ip().asStateIn(scope) @@ -154,7 +154,7 @@ fun LazyListScope.ServerHostItems( openInBrowserEnabled: PreferenceMutableStateFlow, basicAuthEnabled: PreferenceMutableStateFlow, basicAuthUsername: PreferenceMutableStateFlow, - basicAuthPassword: PreferenceMutableStateFlow + basicAuthPassword: PreferenceMutableStateFlow, ) { item { SwitchPreference(preference = host, title = stringResource(MR.strings.host_server)) @@ -164,7 +164,7 @@ fun LazyListScope.ServerHostItems( PreferenceRow( stringResource(MR.strings.host_settings), Icons.Rounded.Info, - subtitle = stringResource(MR.strings.host_settings_sub) + subtitle = stringResource(MR.strings.host_settings_sub), ) } item { @@ -173,7 +173,7 @@ fun LazyListScope.ServerHostItems( preference = ip, title = stringResource(MR.strings.host_ip), subtitle = stringResource(MR.strings.host_ip_sub, ipValue), - changeListener = serverSettingChanged + changeListener = serverSettingChanged, ) } item { @@ -182,14 +182,14 @@ fun LazyListScope.ServerHostItems( preference = port, title = stringResource(MR.strings.host_port), subtitle = stringResource(MR.strings.host_port_sub, portValue), - changeListener = serverSettingChanged + changeListener = serverSettingChanged, ) } item { SwitchPreference( preference = socksProxyEnabled, title = stringResource(MR.strings.host_socks_enabled), - changeListener = serverSettingChanged + changeListener = serverSettingChanged, ) } item { @@ -198,7 +198,7 @@ fun LazyListScope.ServerHostItems( preference = socksProxyHost, title = stringResource(MR.strings.host_socks_host), subtitle = stringResource(MR.strings.host_socks_host_sub, proxyHost), - changeListener = serverSettingChanged + changeListener = serverSettingChanged, ) } item { @@ -207,7 +207,7 @@ fun LazyListScope.ServerHostItems( preference = socksProxyPort, title = stringResource(MR.strings.host_socks_port), subtitle = stringResource(MR.strings.host_socks_port_sub, proxyPort), - changeListener = serverSettingChanged + changeListener = serverSettingChanged, ) } item { @@ -215,7 +215,7 @@ fun LazyListScope.ServerHostItems( preference = debugLogsEnabled, title = stringResource(MR.strings.host_debug_logging), subtitle = stringResource(MR.strings.host_debug_logging_sub), - changeListener = serverSettingChanged + changeListener = serverSettingChanged, ) } item { @@ -223,7 +223,7 @@ fun LazyListScope.ServerHostItems( preference = systemTrayEnabled, title = stringResource(MR.strings.host_system_tray), subtitle = stringResource(MR.strings.host_system_tray_sub), - changeListener = serverSettingChanged + changeListener = serverSettingChanged, ) } item { @@ -244,7 +244,7 @@ fun LazyListScope.ServerHostItems( onLongClick = { downloadPath.value = "" serverSettingChanged() - } + }, ) } item { @@ -252,7 +252,7 @@ fun LazyListScope.ServerHostItems( preference = downloadAsCbz, title = stringResource(MR.strings.host_download_as_cbz), subtitle = stringResource(MR.strings.host_download_as_cbz_sub), - changeListener = serverSettingChanged + changeListener = serverSettingChanged, ) } item { @@ -260,7 +260,7 @@ fun LazyListScope.ServerHostItems( preference = webUIEnabled, title = stringResource(MR.strings.host_webui), subtitle = stringResource(MR.strings.host_webui_sub), - changeListener = serverSettingChanged + changeListener = serverSettingChanged, ) } item { @@ -270,7 +270,7 @@ fun LazyListScope.ServerHostItems( title = stringResource(MR.strings.host_open_in_browser), subtitle = stringResource(MR.strings.host_open_in_browser_sub), changeListener = serverSettingChanged, - enabled = webUIEnabledValue + enabled = webUIEnabledValue, ) } item { @@ -278,7 +278,7 @@ fun LazyListScope.ServerHostItems( preference = basicAuthEnabled, title = stringResource(MR.strings.basic_auth), subtitle = stringResource(MR.strings.host_basic_auth_sub), - changeListener = serverSettingChanged + changeListener = serverSettingChanged, ) } item { @@ -286,7 +286,7 @@ fun LazyListScope.ServerHostItems( preference = basicAuthUsername, title = stringResource(MR.strings.host_basic_auth_username), changeListener = serverSettingChanged, - enabled = basicAuthEnabledValue + enabled = basicAuthEnabledValue, ) } item { @@ -295,7 +295,7 @@ fun LazyListScope.ServerHostItems( title = stringResource(MR.strings.host_basic_auth_password), changeListener = serverSettingChanged, visualTransformation = PasswordVisualTransformation(), - enabled = basicAuthEnabledValue + enabled = basicAuthEnabledValue, ) } } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/sources/components/DesktopSourcesMenu.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/sources/components/DesktopSourcesMenu.kt index 2e6c2d47..fcca9438 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/sources/components/DesktopSourcesMenu.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/sources/components/DesktopSourcesMenu.kt @@ -13,13 +13,13 @@ import androidx.compose.ui.input.pointer.PointerButton actual fun Modifier.sourceSideMenuItem( onSourceTabClick: () -> Unit, - onSourceCloseTabClick: () -> Unit + onSourceCloseTabClick: () -> Unit, ): Modifier = this .onClick( matcher = PointerMatcher.mouse(PointerButton.Primary), - onClick = onSourceTabClick + onClick = onSourceTabClick, ) .onClick( matcher = PointerMatcher.mouse(PointerButton.Tertiary), - onClick = onSourceCloseTabClick + onClick = onSourceCloseTabClick, ) diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/updates/components/DesktopUpdatesItem.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/updates/components/DesktopUpdatesItem.kt index 02dcb60a..a568db90 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/updates/components/DesktopUpdatesItem.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/updates/components/DesktopUpdatesItem.kt @@ -23,15 +23,15 @@ actual fun Modifier.updatesItemModifier( bookmarkChapter: (() -> Unit)?, unBookmarkChapter: (() -> Unit)?, onSelectChapter: (() -> Unit)?, - onUnselectChapter: (() -> Unit)? + onUnselectChapter: (() -> Unit)?, ): Modifier = this .onClick( onClick = onClick, - onLongClick = onSelectChapter + onLongClick = onSelectChapter, ) .onClick( onClick = onSelectChapter ?: onUnselectChapter ?: {}, - keyboardModifiers = { isCtrlPressed } + keyboardModifiers = { isCtrlPressed }, ) .onRightClickContextMenu( items = { @@ -39,9 +39,9 @@ actual fun Modifier.updatesItemModifier( markRead = markRead, markUnread = markUnread, bookmarkChapter = bookmarkChapter, - unBookmarkChapter = unBookmarkChapter + unBookmarkChapter = unBookmarkChapter, ) - } + }, ) @Composable @@ -50,12 +50,12 @@ private fun getContextItems( markRead: (() -> Unit)?, markUnread: (() -> Unit)?, bookmarkChapter: (() -> Unit)?, - unBookmarkChapter: (() -> Unit)? + unBookmarkChapter: (() -> Unit)?, ): List { return listOfNotNull( if (bookmarkChapter != null) ContextMenuItem(stringResource(MR.strings.action_bookmark), bookmarkChapter) else null, if (unBookmarkChapter != null) ContextMenuItem(stringResource(MR.strings.action_remove_bookmark), unBookmarkChapter) else null, if (markRead != null) ContextMenuItem(stringResource(MR.strings.action_mark_as_read), markRead) else null, - if (markUnread != null) ContextMenuItem(stringResource(MR.strings.action_mark_as_unread), markUnread) else null + if (markUnread != null) ContextMenuItem(stringResource(MR.strings.action_mark_as_unread), markUnread) else null, ) } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/Theme.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/Theme.kt index 87c656dd..8e3b0d02 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/Theme.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/Theme.kt @@ -31,7 +31,7 @@ fun ThemedWindow( alwaysOnTop: Boolean = false, onPreviewKeyEvent: (KeyEvent) -> Boolean = { false }, onKeyEvent: (KeyEvent) -> Boolean = { false }, - content: @Composable FrameWindowScope.() -> Unit = { } + content: @Composable FrameWindowScope.() -> Unit = { }, ) { Window( onCloseRequest = onCloseRequest, @@ -46,7 +46,7 @@ fun ThemedWindow( focusable = focusable, alwaysOnTop = alwaysOnTop, onPreviewKeyEvent = onPreviewKeyEvent, - onKeyEvent = onKeyEvent + onKeyEvent = onKeyEvent, ) { AppTheme { content() diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/WindowGet.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/WindowGet.kt index fdac856c..4a831462 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/WindowGet.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/compose/WindowGet.kt @@ -15,7 +15,7 @@ import ca.gosyer.jui.domain.ui.model.WindowSettings data class WindowGet( val offset: WindowPosition, val size: DpSize, - val placement: WindowPlacement + val placement: WindowPlacement, ) { companion object { fun from(windowSettings: WindowSettings): WindowGet { @@ -25,13 +25,13 @@ data class WindowGet( return WindowGet( WindowPosition.PlatformDefault, DpSize(800.dp, 600.dp), - WindowPlacement.Maximized + WindowPlacement.Maximized, ) } else if (fullscreen == true) { return WindowGet( WindowPosition.PlatformDefault, DpSize(800.dp, 600.dp), - WindowPlacement.Fullscreen + WindowPlacement.Fullscreen, ) } @@ -44,7 +44,7 @@ data class WindowGet( WindowGet( offset, size, - WindowPlacement.Floating + WindowPlacement.Floating, ) } } diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/lang/CoroutineExtensions.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/lang/CoroutineExtensions.kt index 71421a36..6b3126b4 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/lang/CoroutineExtensions.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/lang/CoroutineExtensions.kt @@ -14,5 +14,5 @@ import kotlinx.coroutines.GlobalScope @DelicateCoroutinesApi fun launchApplication( - content: @Composable (ApplicationScope.() -> Unit) + content: @Composable (ApplicationScope.() -> Unit), ) = GlobalScope.launchApplication(content) diff --git a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/system/File.kt b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/system/File.kt index 42ff3606..2fa60a3a 100644 --- a/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/system/File.kt +++ b/presentation/src/desktopMain/kotlin/ca/gosyer/jui/ui/util/system/File.kt @@ -18,7 +18,7 @@ fun filePicker( vararg extensions: String, onCancel: () -> Unit = {}, onError: () -> Unit = {}, - onApprove: (Path) -> Unit + onApprove: (Path) -> Unit, ) = fileChooser( saving = false, selectFolders = false, @@ -27,20 +27,20 @@ fun filePicker( onError = onError, onApprove = onApprove, defaultFileName = "", - extensions = extensions + extensions = extensions, ) fun folderPicker( onCancel: () -> Unit = {}, onError: () -> Unit = {}, - onApprove: (Path) -> Unit + onApprove: (Path) -> Unit, ) = fileChooser( saving = false, selectFolders = true, selectFiles = false, onCancel = onCancel, onError = onError, - onApprove = onApprove + onApprove = onApprove, ) fun fileSaver( @@ -48,7 +48,7 @@ fun fileSaver( extension: String, onCancel: () -> Unit = {}, onError: () -> Unit = {}, - onApprove: (Path) -> Unit + onApprove: (Path) -> Unit, ) = fileChooser( saving = true, selectFolders = false, @@ -57,7 +57,7 @@ fun fileSaver( onError = onError, onApprove = onApprove, defaultFileName = defaultFileName, - extension + extension, ) /** @@ -77,7 +77,7 @@ private fun fileChooser( onError: () -> Unit = {}, onApprove: (Path) -> Unit, defaultFileName: String = "", - vararg extensions: String + vararg extensions: String, ) = launchUI { val fileChooser = JFileChooser() .apply { diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/IosViewModelComponent.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/IosViewModelComponent.kt index e1266648..bba06d20 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/IosViewModelComponent.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/IosViewModelComponent.kt @@ -20,7 +20,7 @@ actual interface ViewModelComponent : SharedViewModelComponent @Composable actual inline fun Screen.realStateViewModel( tag: String?, - crossinline factory: @DisallowComposableCalls ViewModelComponent.(SavedStateHandle) -> VM + crossinline factory: @DisallowComposableCalls ViewModelComponent.(SavedStateHandle) -> VM, ): VM { val viewModelFactory = LocalViewModels.current val savedStateHandle = rememberSaveable { SavedStateHandle() } diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/components/IosTooltipArea.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/components/IosTooltipArea.kt index 1fb4940c..c35d5e0b 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/components/IosTooltipArea.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/components/IosTooltipArea.kt @@ -18,13 +18,13 @@ actual interface TooltipPlacement actual class CursorPointImpl actual constructor( offset: DpOffset, alignment: Alignment, - windowMargin: Dp + windowMargin: Dp, ) : TooltipPlacement actual class ComponentRectImpl actual constructor( anchor: Alignment, alignment: Alignment, - offset: DpOffset + offset: DpOffset, ) : TooltipPlacement @Composable @@ -33,7 +33,7 @@ internal actual fun RealTooltipArea( modifier: Modifier, delayMillis: Int, tooltipPlacement: TooltipPlacement, - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { Box(Modifier) { content() diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/file/IosFileSaver.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/file/IosFileSaver.kt index cb7e48d8..529231b3 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/file/IosFileSaver.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/file/IosFileSaver.kt @@ -13,7 +13,7 @@ import okio.Sink actual class FileSaver( private val onFileSelected: (Sink) -> Unit, private val onCancel: () -> Unit, - private val onError: () -> Unit + private val onError: () -> Unit, ) { actual fun save(name: String) { TODO() @@ -24,7 +24,7 @@ actual class FileSaver( internal actual fun realRememberFileSaver( onFileSelected: (Sink) -> Unit, onCancel: () -> Unit, - onError: () -> Unit + onError: () -> Unit, ): FileSaver { return remember { FileSaver(onFileSelected, onCancel, onError) } } diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/image/IosImageLoaderBuilder.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/image/IosImageLoaderBuilder.kt index 4543b989..ed5a3148 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/image/IosImageLoaderBuilder.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/image/IosImageLoaderBuilder.kt @@ -36,7 +36,7 @@ private fun getCacheDir(): String { NSUserDomainMask, null, true, - null + null, )!!.path.orEmpty() } diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/state/IosSavedStateHandle.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/state/IosSavedStateHandle.kt index 1bd5685d..21e5eb00 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/state/IosSavedStateHandle.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/base/state/IosSavedStateHandle.kt @@ -33,7 +33,7 @@ actual class SavedStateHandle { actual fun getStateFlow( key: String, - initialValue: T + initialValue: T, ): StateFlow { @Suppress("UNCHECKED_CAST") // If a flow exists we should just return it, and since it is a StateFlow and a value must diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/downloads/IosDownloadService.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/downloads/IosDownloadService.kt index ff4bc794..0314c1a0 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/downloads/IosDownloadService.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/downloads/IosDownloadService.kt @@ -13,7 +13,7 @@ import ca.gosyer.jui.uicore.vm.ContextWrapper internal actual fun startDownloadService( contextWrapper: ContextWrapper, downloadService: DownloadService, - actions: WebsocketService.Actions + actions: WebsocketService.Actions, ) { downloadService.init() } diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/library/components/IosLibraryGrid.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/library/components/IosLibraryGrid.kt index d5f87165..d516f822 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/library/components/IosLibraryGrid.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/library/components/IosLibraryGrid.kt @@ -21,21 +21,21 @@ import ca.gosyer.jui.uicore.resources.stringResource actual fun Modifier.libraryMangaModifier( onClickManga: () -> Unit, - onClickRemoveManga: () -> Unit + onClickRemoveManga: () -> Unit, ): Modifier = composed { var expanded by remember { mutableStateOf(false) } DropdownMenu( expanded, - onDismissRequest = { expanded = false } + onDismissRequest = { expanded = false }, ) { listOf( - stringResource(MR.strings.action_remove_favorite) to onClickRemoveManga + stringResource(MR.strings.action_remove_favorite) to onClickRemoveManga, ).forEach { (label, onClick) -> DropdownMenuItem( onClick = { expanded = false onClick() - } + }, ) { Text(text = label) } @@ -46,6 +46,6 @@ actual fun Modifier.libraryMangaModifier( onClick = { onClickManga() }, onLongClick = { expanded = true - } + }, ) } diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/IosLicenses.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/IosLicenses.kt index 613c944f..629a3ed9 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/IosLicenses.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/main/about/licenses/components/IosLicenses.kt @@ -16,7 +16,7 @@ import com.mikepenz.aboutlibraries.Libs @Composable actual fun getLicenses(): Libs? { val libs by produceState( - null + null, ) { withIOContext { val json = MR.files.aboutlibraries.readText() diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/main/components/IosLibraryUpdatesService.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/main/components/IosLibraryUpdatesService.kt index bdf7b6bb..f3dc8dbe 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/main/components/IosLibraryUpdatesService.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/main/components/IosLibraryUpdatesService.kt @@ -13,7 +13,7 @@ import ca.gosyer.jui.uicore.vm.ContextWrapper internal actual fun startLibraryUpdatesService( contextWrapper: ContextWrapper, libraryUpdatesService: LibraryUpdateService, - actions: WebsocketService.Actions + actions: WebsocketService.Actions, ) { libraryUpdatesService.init() } diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/manga/components/IosChapterItem.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/manga/components/IosChapterItem.kt index 17d90f07..d45c8c95 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/manga/components/IosChapterItem.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/manga/components/IosChapterItem.kt @@ -17,8 +17,8 @@ actual fun Modifier.chapterItemModifier( unBookmarkChapter: (() -> Unit)?, markPreviousAsRead: () -> Unit, onSelectChapter: (() -> Unit)?, - onUnselectChapter: (() -> Unit)? + onUnselectChapter: (() -> Unit)?, ): Modifier = combinedClickable( onClick = onUnselectChapter ?: onClick, - onLongClick = onSelectChapter + onLongClick = onSelectChapter, ) diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/reader/IosReaderMenu.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/reader/IosReaderMenu.kt index fce851af..025608fa 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/reader/IosReaderMenu.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/reader/IosReaderMenu.kt @@ -21,7 +21,7 @@ class ReaderScreen(val chapterIndex: Int, val mangaId: Long) : Screen { ReaderMenu( chapterIndex, mangaId, - navigator::pop + navigator::pop, ) } } @@ -30,7 +30,7 @@ actual class ReaderLauncher(private val navigator: Navigator?) { actual fun launch( chapterIndex: Int, - mangaId: Long + mangaId: Long, ) { navigator?.push(ReaderScreen(chapterIndex, mangaId)) } diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/sources/components/IosSourcesMenu.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/sources/components/IosSourcesMenu.kt index 60cacfaf..ec473745 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/sources/components/IosSourcesMenu.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/sources/components/IosSourcesMenu.kt @@ -11,7 +11,7 @@ import androidx.compose.ui.Modifier actual fun Modifier.sourceSideMenuItem( onSourceTabClick: () -> Unit, - onSourceCloseTabClick: () -> Unit + onSourceCloseTabClick: () -> Unit, ): Modifier = clickable( - onClick = onSourceTabClick + onClick = onSourceTabClick, ) diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/updates/components/IosUpdatesItem.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/updates/components/IosUpdatesItem.kt index cfc27fb2..f5f23e0d 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/updates/components/IosUpdatesItem.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/updates/components/IosUpdatesItem.kt @@ -16,8 +16,8 @@ actual fun Modifier.updatesItemModifier( bookmarkChapter: (() -> Unit)?, unBookmarkChapter: (() -> Unit)?, onSelectChapter: (() -> Unit)?, - onUnselectChapter: (() -> Unit)? + onUnselectChapter: (() -> Unit)?, ): Modifier = combinedClickable( onClick = onUnselectChapter ?: onClick, - onLongClick = onSelectChapter + onLongClick = onSelectChapter, ) diff --git a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/util/lang/StringFormat.kt b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/util/lang/StringFormat.kt index 5ca3fb1e..56706c9d 100644 --- a/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/util/lang/StringFormat.kt +++ b/presentation/src/iosMain/kotlin/ca/gosyer/jui/ui/util/lang/StringFormat.kt @@ -30,7 +30,7 @@ actual fun stringFormat(string: String, vararg args: Any?): String { args[2], args[3], args[4], - args[5] + args[5], ) 7 -> NSString.stringWithFormat( objcFormat, @@ -40,7 +40,7 @@ actual fun stringFormat(string: String, vararg args: Any?): String { args[3], args[4], args[5], - args[6] + args[6], ) 8 -> NSString.stringWithFormat( objcFormat, @@ -51,7 +51,7 @@ actual fun stringFormat(string: String, vararg args: Any?): String { args[4], args[5], args[6], - args[7] + args[7], ) 9 -> NSString.stringWithFormat( objcFormat, @@ -63,7 +63,7 @@ actual fun stringFormat(string: String, vararg args: Any?): String { args[5], args[6], args[7], - args[8] + args[8], ) else -> throw IllegalArgumentException("can't handle more then 9 arguments now") } diff --git a/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidBottomActionMenu.kt b/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidBottomActionMenu.kt index a49a90fa..8032ee29 100644 --- a/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidBottomActionMenu.kt +++ b/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidBottomActionMenu.kt @@ -15,12 +15,12 @@ import androidx.compose.ui.composed actual fun Modifier.buttonModifier( onClick: () -> Unit, - onHintClick: () -> Unit + onHintClick: () -> Unit, ): Modifier = composed { combinedClickable( interactionSource = remember { MutableInteractionSource() }, indication = rememberRipple(bounded = false), onLongClick = onHintClick, - onClick = onClick + onClick = onClick, ) } diff --git a/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidDropDownMenu.kt b/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidDropDownMenu.kt index 3105f462..09cf30d6 100644 --- a/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidDropDownMenu.kt +++ b/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidDropDownMenu.kt @@ -24,14 +24,14 @@ internal actual fun RealDropdownMenu( modifier: Modifier, offset: DpOffset, properties: PopupProperties, - content: @Composable ColumnScope.() -> Unit + content: @Composable ColumnScope.() -> Unit, ) = androidx.compose.material.DropdownMenu( expanded = expanded, onDismissRequest = onDismissRequest, properties = properties.toAndroidProperties(), modifier = modifier, offset = offset, - content = content + content = content, ) @Composable @@ -41,14 +41,14 @@ internal actual fun RealDropdownMenuItem( enabled: Boolean, contentPadding: PaddingValues, interactionSource: MutableInteractionSource, - content: @Composable RowScope.() -> Unit + content: @Composable RowScope.() -> Unit, ) = androidx.compose.material.DropdownMenuItem( onClick = onClick, modifier = modifier, enabled = enabled, contentPadding = contentPadding, interactionSource = interactionSource, - content = content + content = content, ) @Stable @@ -59,7 +59,7 @@ fun PopupProperties.toAndroidProperties() = AndroidPopupProperties( securePolicy = securePolicy.toAndroidSecureFlagPolicy(), excludeFromSystemGesture = excludeFromSystemGesture, clippingEnabled = clippingEnabled, - usePlatformDefaultWidth = usePlatformDefaultWidth + usePlatformDefaultWidth = usePlatformDefaultWidth, ) @Stable diff --git a/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidScrollbar.kt b/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidScrollbar.kt index 1aa5b490..e5f9f881 100644 --- a/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidScrollbar.kt +++ b/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/components/AndroidScrollbar.kt @@ -68,7 +68,7 @@ internal actual fun RealVerticalScrollbar( modifier: Modifier, reverseLayout: Boolean, style: ScrollbarStyle, - interactionSource: MutableInteractionSource + interactionSource: MutableInteractionSource, ) { val scrollbarModifier = when (adapter) { is ScrollStateScrollbarAdapter -> { @@ -91,7 +91,7 @@ internal actual fun RealHorizontalScrollbar( modifier: Modifier, reverseLayout: Boolean, style: ScrollbarStyle, - interactionSource: MutableInteractionSource + interactionSource: MutableInteractionSource, ) { val scrollbarModifier = when (adapter) { is ScrollStateScrollbarAdapter -> { @@ -107,7 +107,7 @@ internal actual fun RealHorizontalScrollbar( @Composable actual fun rememberScrollbarAdapter( - scrollState: ScrollState + scrollState: ScrollState, ): ScrollbarAdapter { return remember(scrollState) { ScrollStateScrollbarAdapter(scrollState) @@ -116,7 +116,7 @@ actual fun rememberScrollbarAdapter( @Composable actual fun rememberScrollbarAdapter( - scrollState: LazyListState + scrollState: LazyListState, ): ScrollbarAdapter { return remember(scrollState) { LazyListStateScrollbarAdapter(scrollState) @@ -127,7 +127,7 @@ actual fun rememberScrollbarAdapter( internal actual fun realRememberVerticalScrollbarAdapter( scrollState: LazyGridState, gridCells: GridCells, - arrangement: Arrangement.Vertical? + arrangement: Arrangement.Vertical?, ): ScrollbarAdapter { return remember(scrollState, gridCells) { LazyGridStateScrollbarAdapter(scrollState, gridCells, arrangement?.spacing ?: Dp.Hairline) @@ -138,7 +138,7 @@ internal actual fun realRememberVerticalScrollbarAdapter( internal actual fun realRememberHorizontalScrollbarAdapter( scrollState: LazyGridState, gridCells: GridCells, - arrangement: Arrangement.Horizontal? + arrangement: Arrangement.Horizontal?, ): ScrollbarAdapter { return remember(scrollState, gridCells) { LazyGridStateScrollbarAdapter(scrollState, gridCells, arrangement?.spacing ?: Dp.Hairline) @@ -152,11 +152,11 @@ actual fun Modifier.scrollbarPadding() = this private fun Modifier.drawScrollbar( state: ScrollState, orientation: Orientation, - reverseScrolling: Boolean + reverseScrolling: Boolean, ): Modifier = drawScrollbar( orientation = orientation, reverseScrolling = reverseScrolling, - scrollFlow = snapshotFlow { state.isScrollInProgress } + scrollFlow = snapshotFlow { state.isScrollInProgress }, ) { reverseDirection, atEnd, thickness, color, alpha -> val showScrollbar = state.maxValue > 0 val canvasSize = if (orientation == Orientation.Horizontal) size.width else size.height @@ -172,7 +172,7 @@ private fun Modifier.drawScrollbar( color = color, alpha = alpha, thumbSize = thumbSize, - startOffset = startOffset + startOffset = startOffset, ) onDrawWithContent { drawContent() @@ -183,11 +183,11 @@ private fun Modifier.drawScrollbar( private fun Modifier.drawScrollbar( state: LazyListState, orientation: Orientation, - reverseScrolling: Boolean + reverseScrolling: Boolean, ): Modifier = drawScrollbar( orientation, reverseScrolling, - snapshotFlow { state.isScrollInProgress } + snapshotFlow { state.isScrollInProgress }, ) { reverseDirection, atEnd, thickness, color, alpha -> val layoutInfo = state.layoutInfo val viewportSize = layoutInfo.viewportEndOffset - layoutInfo.viewportStartOffset @@ -216,7 +216,7 @@ private fun Modifier.drawScrollbar( color = color, alpha = alpha, thumbSize = thumbSize, - startOffset = startOffset + startOffset = startOffset, ) onDrawWithContent { drawContent() @@ -229,11 +229,11 @@ private fun Modifier.drawScrollbar( gridCells: GridCells, spacing: Dp, orientation: Orientation, - reverseScrolling: Boolean + reverseScrolling: Boolean, ): Modifier = drawScrollbar( orientation, reverseScrolling, - snapshotFlow { state.isScrollInProgress } + snapshotFlow { state.isScrollInProgress }, ) { reverseDirection, atEnd, thickness, color, alpha -> val layoutInfo = state.layoutInfo val viewportSize = layoutInfo.viewportEndOffset - layoutInfo.viewportStartOffset @@ -242,7 +242,7 @@ private fun Modifier.drawScrollbar( val itemsSize = items.chunked( with(gridCells) { calculateCrossAxisCellSizes(viewportSize, spacing.roundToPx()).size - } + }, ).sumOf { it.fastMaxBy { it.size.height }?.size?.height ?: 0 } val showScrollbar = items.size < layoutInfo.totalItemsCount || itemsSize > viewportSize val estimatedItemSize = if (items.isEmpty()) 0f else itemsSize.toFloat() / items.size @@ -267,7 +267,7 @@ private fun Modifier.drawScrollbar( color = color, alpha = alpha, thumbSize = thumbSize, - startOffset = startOffset + startOffset = startOffset, ) onDrawWithContent { drawContent() @@ -284,17 +284,17 @@ private fun CacheDrawScope.onDrawScrollbar( color: Color, alpha: Float, thumbSize: Float, - startOffset: Float + startOffset: Float, ): DrawScope.() -> Unit { val topLeft = if (orientation == Orientation.Horizontal) { Offset( if (reverseDirection) size.width - startOffset - thumbSize else startOffset, - if (atEnd) size.height - thickness else 0f + if (atEnd) size.height - thickness else 0f, ) } else { Offset( if (atEnd) size.width - thickness else 0f, - if (reverseDirection) size.height - startOffset - thumbSize else startOffset + if (reverseDirection) size.height - startOffset - thumbSize else startOffset, ) } val size = if (orientation == Orientation.Horizontal) { @@ -309,7 +309,7 @@ private fun CacheDrawScope.onDrawScrollbar( color = color, topLeft = topLeft, size = size, - alpha = alpha + alpha = alpha, ) } } @@ -324,8 +324,8 @@ private fun Modifier.drawScrollbar( atEnd: Boolean, thickness: Float, color: Color, - alpha: Float - ) -> DrawResult + alpha: Float, + ) -> DrawResult, ): Modifier = composed { val isScrollInProgress by scrollFlow.collectAsState(initial = false) val alpha = remember { Animatable(0f) } @@ -357,5 +357,5 @@ private fun Modifier.drawScrollbar( private val Thickness = 4.dp private val FadeOutAnimationSpec = tween( - durationMillis = ViewConfiguration.getScrollBarFadeDuration() + durationMillis = ViewConfiguration.getScrollBarFadeDuration(), ) diff --git a/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/resources/AndroidFileResource.kt b/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/resources/AndroidFileResource.kt index 2bb0a029..25e183a2 100644 --- a/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/resources/AndroidFileResource.kt +++ b/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/resources/AndroidFileResource.kt @@ -26,7 +26,7 @@ actual fun FileResource.readTextAsync(): State { return produceState( null, this.rawResId, - context + context, ) { withIOContext { value = readText(context) diff --git a/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/vm/ContextWrapper.kt b/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/vm/ContextWrapper.kt index cac0f71c..5e759e37 100644 --- a/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/vm/ContextWrapper.kt +++ b/ui-core/src/androidMain/kotlin/ca/gosyer/jui/uicore/vm/ContextWrapper.kt @@ -30,7 +30,7 @@ actual class ContextWrapper @Inject constructor(context: Context) : ContextWrapp when (length) { Length.SHORT -> Toast.LENGTH_SHORT Length.LONG -> Toast.LENGTH_LONG - } + }, ).show() } } diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/AroundLayout.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/AroundLayout.kt index a9a61a4f..25e9f0ae 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/AroundLayout.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/AroundLayout.kt @@ -19,7 +19,7 @@ fun AroundLayout( modifier: Modifier = Modifier, startLayout: @Composable () -> Unit, endLayout: @Composable () -> Unit, - content: @Composable (PaddingValues) -> Unit + content: @Composable (PaddingValues) -> Unit, ) { SubcomposeLayout(modifier) { constraints -> val layoutWidth = constraints.maxWidth diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Badges.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Badges.kt index c4a6f2c2..0db23896 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Badges.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Badges.kt @@ -19,7 +19,7 @@ import androidx.compose.ui.unit.dp fun BadgeGroup( modifier: Modifier = Modifier, shape: Shape = MaterialTheme.shapes.small, - content: @Composable RowScope.() -> Unit + content: @Composable RowScope.() -> Unit, ) { Row(modifier = modifier.clip(shape)) { content() @@ -31,7 +31,7 @@ fun Badge( text: String, color: Color = MaterialTheme.colors.secondary, textColor: Color = MaterialTheme.colors.onSecondary, - shape: Shape = RectangleShape + shape: Shape = RectangleShape, ) { Text( text = text, @@ -42,6 +42,6 @@ fun Badge( color = textColor, fontWeight = FontWeight.Medium, maxLines = 1, - style = MaterialTheme.typography.caption + style = MaterialTheme.typography.caption, ) } diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/BottomActionMenu.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/BottomActionMenu.kt index 3a4a7fa1..7d71e5ca 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/BottomActionMenu.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/BottomActionMenu.kt @@ -53,25 +53,25 @@ import kotlin.time.Duration.Companion.seconds data class BottomActionItem( val name: String, val icon: ImageVector, - val onClick: () -> Unit + val onClick: () -> Unit, ) @Composable fun BottomActionMenu( visible: Boolean, modifier: Modifier = Modifier, - items: ImmutableList + items: ImmutableList, ) { AnimatedVisibility( visible = visible, enter = expandVertically(expandFrom = Alignment.Bottom), - exit = shrinkVertically(shrinkTowards = Alignment.Bottom) + exit = shrinkVertically(shrinkTowards = Alignment.Bottom), ) { val scope = rememberCoroutineScope() Surface( modifier = modifier, shape = MaterialTheme.shapes.large.copy(bottomEnd = ZeroCornerSize, bottomStart = ZeroCornerSize), - elevation = 3.dp + elevation = 3.dp, ) { val haptic = LocalHapticFeedback.current var confirm by remember { mutableStateOf(null) } @@ -88,7 +88,7 @@ fun BottomActionMenu( Row( modifier = Modifier .padding(WindowInsets.navigationBars.only(WindowInsetsSides.Bottom).asPaddingValues()) - .padding(horizontal = 8.dp, vertical = 12.dp) + .padding(horizontal = 8.dp, vertical = 12.dp), ) { items.forEachIndexed { index, item -> Button( @@ -96,7 +96,7 @@ fun BottomActionMenu( icon = item.icon, toConfirm = confirm == index, onLongClick = { onLongClickItem(index) }, - onClick = item.onClick + onClick = item.onClick, ) } } @@ -106,7 +106,7 @@ fun BottomActionMenu( expect fun Modifier.buttonModifier( onClick: () -> Unit, - onHintClick: () -> Unit + onHintClick: () -> Unit, ): Modifier @Composable @@ -116,7 +116,7 @@ private fun RowScope.Button( toConfirm: Boolean, onLongClick: () -> Unit, onClick: () -> Unit, - content: (@Composable () -> Unit)? = null + content: (@Composable () -> Unit)? = null, ) { val animatedWeight by animateFloatAsState(if (toConfirm) 2f else 1f) Column( @@ -125,25 +125,25 @@ private fun RowScope.Button( .weight(animatedWeight) .buttonModifier( onHintClick = onLongClick, - onClick = onClick + onClick = onClick, ), verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally + horizontalAlignment = Alignment.CenterHorizontally, ) { Icon( imageVector = icon, - contentDescription = title + contentDescription = title, ) AnimatedVisibility( visible = toConfirm, enter = expandVertically(expandFrom = Alignment.Top) + fadeIn(), - exit = shrinkVertically(shrinkTowards = Alignment.Top) + fadeOut() + exit = shrinkVertically(shrinkTowards = Alignment.Top) + fadeOut(), ) { Text( text = title, overflow = TextOverflow.Visible, maxLines = 1, - style = MaterialTheme.typography.overline + style = MaterialTheme.typography.overline, ) } content?.invoke() diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/DropDownMenu.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/DropDownMenu.kt index 9d0ca33b..7c7f845f 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/DropDownMenu.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/DropDownMenu.kt @@ -41,7 +41,7 @@ enum class SecureFlagPolicy { * No [WindowManager.LayoutParams.FLAG_SECURE] will be set on the window that is using this * policy. */ - SecureOff + SecureOff, } @Immutable @@ -53,7 +53,7 @@ data class PopupProperties @ExperimentalComposeUiApi constructor( val excludeFromSystemGesture: Boolean = true, val clippingEnabled: Boolean = true, @property:ExperimentalComposeUiApi - val usePlatformDefaultWidth: Boolean = false + val usePlatformDefaultWidth: Boolean = false, ) @Composable @@ -63,7 +63,7 @@ internal expect fun RealDropdownMenu( modifier: Modifier, offset: DpOffset, properties: PopupProperties, - content: @Composable ColumnScope.() -> Unit + content: @Composable ColumnScope.() -> Unit, ) @Composable @@ -73,7 +73,7 @@ fun DropdownMenu( modifier: Modifier = Modifier, offset: DpOffset = DpOffset(0.dp, 0.dp), properties: PopupProperties = PopupProperties(focusable = true), - content: @Composable ColumnScope.() -> Unit + content: @Composable ColumnScope.() -> Unit, ) = RealDropdownMenu(expanded, onDismissRequest, modifier, offset, properties, content) @Composable @@ -83,7 +83,7 @@ internal expect fun RealDropdownMenuItem( enabled: Boolean, contentPadding: PaddingValues, interactionSource: MutableInteractionSource, - content: @Composable RowScope.() -> Unit + content: @Composable RowScope.() -> Unit, ) @Composable @@ -93,5 +93,5 @@ fun DropdownMenuItem( enabled: Boolean = true, contentPadding: PaddingValues = MenuDefaults.DropdownMenuItemContentPadding, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - content: @Composable RowScope.() -> Unit + content: @Composable RowScope.() -> Unit, ) = RealDropdownMenuItem(onClick, modifier, enabled, contentPadding, interactionSource, content) diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/DropdownIconButton.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/DropdownIconButton.kt index 000840f8..dbb7d940 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/DropdownIconButton.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/DropdownIconButton.kt @@ -30,7 +30,7 @@ import androidx.compose.ui.unit.dp fun DropdownIconButton( key: Any? = Unit, dropdownItems: @Composable ColumnScope.() -> Unit, - content: @Composable BoxScope.() -> Unit + content: @Composable BoxScope.() -> Unit, ) { var showMenu by remember(key) { mutableStateOf(false) } var offset by remember(key) { mutableStateOf(DpOffset(0.dp, 0.dp)) } @@ -38,14 +38,14 @@ fun DropdownIconButton( expanded = showMenu, onDismissRequest = { showMenu = false }, offset = offset, - content = dropdownItems + content = dropdownItems, ) Box( modifier = Modifier.size(48.dp) .clickable( remember { MutableInteractionSource() }, role = Role.Button, - indication = rememberRipple(bounded = false, radius = 24.dp) + indication = rememberRipple(bounded = false, radius = 24.dp), ) { showMenu = true } @@ -53,6 +53,6 @@ fun DropdownIconButton( offset = it.positionInWindow().let { DpOffset(it.x.dp, it.y.dp) } }, contentAlignment = Alignment.Center, - content = content + content = content, ) } diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/ErrorScreen.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/ErrorScreen.kt index bd94517f..79409921 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/ErrorScreen.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/ErrorScreen.kt @@ -26,7 +26,7 @@ fun ErrorScreen( errorMessage: String? = null, modifier: Modifier = Modifier, retryMessage: String = stringResource(MR.strings.action_retry), - retry: (() -> Unit)? = null + retry: (() -> Unit)? = null, ) { Box(modifier then Modifier.fillMaxSize()) { Column(modifier = Modifier.align(Alignment.Center), horizontalAlignment = Alignment.CenterHorizontally) { @@ -35,7 +35,7 @@ fun ErrorScreen( text = errorFace, fontSize = 36.sp, color = MaterialTheme.colors.onBackground, - maxLines = 1 + maxLines = 1, ) if (errorMessage != null) { Text(errorMessage, color = MaterialTheme.colors.onBackground) @@ -55,7 +55,7 @@ private val ERROR_FACES = arrayOf( "ಥ_ಥ", "(˘・_・˘)", "(; ̄Д ̄)", - "(・Д・。" + "(・Д・。", ) fun getRandomErrorFace(): String { diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/KeyboardHandler.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/KeyboardHandler.kt index d5a890ac..0384861c 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/KeyboardHandler.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/KeyboardHandler.kt @@ -19,7 +19,7 @@ import androidx.compose.ui.platform.LocalFocusManager fun Modifier.keyboardHandler( singleLine: Boolean = false, enterAction: ((FocusManager) -> Unit)? = null, - action: (FocusManager) -> Unit = { it.moveFocus(FocusDirection.Down) } + action: (FocusManager) -> Unit = { it.moveFocus(FocusDirection.Down) }, ) = composed { val focusManager = LocalFocusManager.current Modifier.onPreviewKeyEvent { diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/LoadingScreen.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/LoadingScreen.kt index ca588683..a50999ba 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/LoadingScreen.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/LoadingScreen.kt @@ -27,7 +27,7 @@ fun LoadingScreen( progress: Float = 0.0F, errorMessage: String? = null, retryMessage: String = stringResource(MR.strings.action_retry), - retry: (() -> Unit)? = null + retry: (() -> Unit)? = null, ) { Crossfade(isLoading, modifier) { BoxWithConstraints(Modifier.fillMaxSize()) { @@ -35,7 +35,7 @@ fun LoadingScreen( if (progress != 0.0F && !progress.isNaN()) { val animatedProgress by animateFloatAsState( targetValue = progress, - animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec + animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec, ) CircularProgressIndicator(animatedProgress, Modifier.align(Alignment.Center)) } else { diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Manga.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Manga.kt index 2ebabbff..c794e81f 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Manga.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Manga.kt @@ -36,10 +36,10 @@ import ca.gosyer.jui.uicore.image.ImageLoaderImage fun MangaGridItem( title: String, data: Any, - onClick: () -> Unit = {} + onClick: () -> Unit = {}, ) { val fontStyle = LocalTextStyle.current.merge( - TextStyle(letterSpacing = 0.sp, fontFamily = FontFamily.SansSerif, fontSize = 14.sp) + TextStyle(letterSpacing = 0.sp, fontFamily = FontFamily.SansSerif, fontSize = 14.sp), ) Surface( @@ -49,7 +49,7 @@ fun MangaGridItem( .aspectRatio(mangaAspectRatio) .padding(8.dp), elevation = 4.dp, - shape = RoundedCornerShape(4.dp) + shape = RoundedCornerShape(4.dp), ) { Box(modifier = Modifier.fillMaxSize()) { ImageLoaderImage(data, title, contentScale = ContentScale.Crop, filterQuality = FilterQuality.Medium) @@ -62,7 +62,7 @@ fun MangaGridItem( overflow = TextOverflow.Ellipsis, modifier = Modifier.wrapContentHeight(Alignment.CenterVertically) .align(Alignment.BottomStart) - .padding(8.dp) + .padding(8.dp), ) } } @@ -75,7 +75,7 @@ private val shadowGradient = Modifier.drawWithCache { 0.75f to Color.Transparent, 1.0f to Color(0xAA000000), start = Offset(0f, 0f), - end = Offset(0f, size.height) + end = Offset(0f, size.height), ) onDrawBehind { drawRect(gradient) diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/MangaListItem.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/MangaListItem.kt index b0dadd42..e18acc95 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/MangaListItem.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/MangaListItem.kt @@ -39,11 +39,11 @@ import ca.gosyer.jui.uicore.resources.stringResource @Composable fun MangaListItem( modifier: Modifier = Modifier, - content: @Composable RowScope.() -> Unit + content: @Composable RowScope.() -> Unit, ) { Row( modifier = modifier, - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { content() } @@ -53,24 +53,24 @@ fun MangaListItem( fun MangaListItemImage( modifier: Modifier = Modifier, data: Any, - contentDescription: String + contentDescription: String, ) { ImageLoaderImage( data, contentDescription = contentDescription, modifier = modifier, contentScale = ContentScale.Crop, - filterQuality = FilterQuality.Medium + filterQuality = FilterQuality.Medium, ) } @Composable fun MangaListItemColumn( modifier: Modifier = Modifier, - content: @Composable ColumnScope.() -> Unit + content: @Composable ColumnScope.() -> Unit, ) { Column( - modifier = modifier + modifier = modifier, ) { content() } @@ -83,7 +83,7 @@ fun MangaListItemTitle( bookmarked: Boolean = false, maxLines: Int = 1, fontWeight: FontWeight = FontWeight.Normal, - textColor: Color = Color.Unspecified + textColor: Color = Color.Unspecified, ) { Row(verticalAlignment = Alignment.CenterVertically) { var textHeight by remember { mutableStateOf(0) } @@ -93,7 +93,7 @@ fun MangaListItemTitle( contentDescription = stringResource(MR.strings.action_filter_bookmarked), modifier = Modifier .sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }), - tint = MaterialTheme.colors.primary + tint = MaterialTheme.colors.primary, ) Spacer(modifier = Modifier.width(2.dp)) } @@ -107,7 +107,7 @@ fun MangaListItemTitle( color = textColor, onTextLayout = { textHeight = it.size.height - } + }, ) } } @@ -116,7 +116,7 @@ fun MangaListItemTitle( fun MangaListItemSubtitle( modifier: Modifier = Modifier, text: String, - textColor: Color = Color.Unspecified + textColor: Color = Color.Unspecified, ) { Text( modifier = modifier, @@ -124,6 +124,6 @@ fun MangaListItemSubtitle( color = textColor, maxLines = 1, overflow = TextOverflow.Ellipsis, - style = MaterialTheme.typography.body1 + style = MaterialTheme.typography.body1, ) } diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Scrollbar.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Scrollbar.kt index 8a25bb12..589aed70 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Scrollbar.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Scrollbar.kt @@ -29,7 +29,7 @@ internal expect fun RealVerticalScrollbar( modifier: Modifier, reverseLayout: Boolean, style: ScrollbarStyle, - interactionSource: MutableInteractionSource + interactionSource: MutableInteractionSource, ) @Composable @@ -38,7 +38,7 @@ internal expect fun RealHorizontalScrollbar( modifier: Modifier, reverseLayout: Boolean, style: ScrollbarStyle, - interactionSource: MutableInteractionSource + interactionSource: MutableInteractionSource, ) @Composable @@ -47,7 +47,7 @@ fun VerticalScrollbar( modifier: Modifier = Modifier, reverseLayout: Boolean = false, style: ScrollbarStyle = LocalScrollbarStyle.current, - interactionSource: MutableInteractionSource = remember { MutableInteractionSource() } + interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, ) = RealVerticalScrollbar(adapter, modifier, reverseLayout, style, interactionSource) @Composable @@ -56,53 +56,53 @@ fun HorizontalScrollbar( modifier: Modifier = Modifier, reverseLayout: Boolean = false, style: ScrollbarStyle = LocalScrollbarStyle.current, - interactionSource: MutableInteractionSource = remember { MutableInteractionSource() } + interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, ) = RealHorizontalScrollbar(adapter, modifier, reverseLayout, style, interactionSource) @Composable expect fun rememberScrollbarAdapter( - scrollState: ScrollState + scrollState: ScrollState, ): ScrollbarAdapter @Composable expect fun rememberScrollbarAdapter( - scrollState: LazyListState + scrollState: LazyListState, ): ScrollbarAdapter @Composable fun rememberVerticalScrollbarAdapter( scrollState: LazyGridState, gridCells: GridCells, - arrangement: Arrangement.Vertical? = null + arrangement: Arrangement.Vertical? = null, ): ScrollbarAdapter = realRememberVerticalScrollbarAdapter( scrollState, gridCells, - arrangement + arrangement, ) @Composable fun rememberHorizontalScrollbarAdapter( scrollState: LazyGridState, gridCells: GridCells, - arrangement: Arrangement.Horizontal? = null + arrangement: Arrangement.Horizontal? = null, ): ScrollbarAdapter = realRememberHorizontalScrollbarAdapter( scrollState, gridCells, - arrangement + arrangement, ) @Composable internal expect fun realRememberVerticalScrollbarAdapter( scrollState: LazyGridState, gridCells: GridCells, - arrangement: Arrangement.Vertical? + arrangement: Arrangement.Vertical?, ): ScrollbarAdapter @Composable internal expect fun realRememberHorizontalScrollbarAdapter( scrollState: LazyGridState, gridCells: GridCells, - arrangement: Arrangement.Horizontal? + arrangement: Arrangement.Horizontal?, ): ScrollbarAdapter expect fun Modifier.scrollbarPadding(): Modifier diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Spinner.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Spinner.kt index fc894a8c..0a961253 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Spinner.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/components/Spinner.kt @@ -37,13 +37,13 @@ fun Spinner(modifier: Modifier, items: List, selectedItemIndex: Int, onS Box( modifier then Modifier.border(1.dp, MaterialTheme.colors.primary, shape) .clip(shape) - .clickable { expanded = true } + .clickable { expanded = true }, ) { Row( modifier = Modifier.fillMaxWidth() .padding(16.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, ) { Text(text = items[selectedItemIndex], modifier = Modifier.padding(end = 8.dp), fontSize = 12.sp) Icon(imageVector = Icons.Filled.ArrowDropDown, contentDescription = null) @@ -51,14 +51,14 @@ fun Spinner(modifier: Modifier, items: List, selectedItemIndex: Int, onS DropdownMenu( expanded = expanded, onDismissRequest = { expanded = false }, - modifier = Modifier.align(Alignment.CenterEnd) + modifier = Modifier.align(Alignment.CenterEnd), ) { items.forEachIndexed { index, item -> DropdownMenuItem( onClick = { expanded = false onSelectItem(index) - } + }, ) { Text(text = item) } diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/icons/juiassets/DonePrev.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/icons/juiassets/DonePrev.kt index f8eff2b3..9a81e6d5 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/icons/juiassets/DonePrev.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/icons/juiassets/DonePrev.kt @@ -21,7 +21,7 @@ public val JuiAssets.DonePrev: ImageVector defaultWidth = 24.0.dp, defaultHeight = 24.0.dp, viewportWidth = 24.0f, - viewportHeight = 24.0f + viewportHeight = 24.0f, ).apply { path( fill = SolidColor(Color(0xFF000000)), @@ -30,7 +30,7 @@ public val JuiAssets.DonePrev: ImageVector strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, - pathFillType = NonZero + pathFillType = NonZero, ) { moveTo(9.0f, 16.2f) lineTo(4.8f, 12.0f) @@ -48,7 +48,7 @@ public val JuiAssets.DonePrev: ImageVector strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f, - pathFillType = NonZero + pathFillType = NonZero, ) { moveTo(22.0f, 18.0f) lineToRelative(-3.0f, 0.0f) diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/image/ImageLoaderImage.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/image/ImageLoaderImage.kt index 7d6ad663..efe41a82 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/image/ImageLoaderImage.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/image/ImageLoaderImage.kt @@ -45,7 +45,7 @@ private val log = logging() private enum class ImageLoaderImageState { Loading, Success, - Failure + Failure, } @Composable @@ -69,25 +69,25 @@ fun ImageLoaderImage( Box( modifier = errorModifier then Modifier.fillMaxSize() .background(Color(0x1F888888)), - contentAlignment = Alignment.Center + contentAlignment = Alignment.Center, ) { Icon( Icons.Rounded.BrokenImage, contentDescription = null, tint = Color(0x1F888888), - modifier = Modifier.size(24.dp) + modifier = Modifier.size(24.dp), ) } }, contentAlignment: Alignment = Alignment.Center, - animationSpec: FiniteAnimationSpec? = tween() + animationSpec: FiniteAnimationSpec? = tween(), ) { key(data) { val request = remember { ImageRequest(data) } val painter = rememberAsyncImagePainter( request, contentScale = contentScale, - filterQuality = filterQuality + filterQuality = filterQuality, ) val progress = remember { mutableStateOf(-1F) } @@ -123,7 +123,7 @@ fun ImageLoaderImage( alignment = alignment, contentScale = contentScale, alpha = alpha, - colorFilter = colorFilter + colorFilter = colorFilter, ) ImageLoaderImageState.Failure -> { if (onFailure != null) { @@ -142,7 +142,7 @@ fun ImageLoaderImage( alignment = alignment, contentScale = contentScale, alpha = alpha, - colorFilter = colorFilter + colorFilter = colorFilter, ) } } diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/pager/Pager.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/pager/Pager.kt index 8d85a6a6..a27153d0 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/pager/Pager.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/pager/Pager.kt @@ -49,7 +49,7 @@ fun VerticalPager( horizontalAlignment: Alignment.Horizontal = Alignment.CenterHorizontally, userScrollEnabled: Boolean = true, reverseLayout: Boolean = false, - content: @Composable BoxScope.(page: Int) -> Unit + content: @Composable BoxScope.(page: Int) -> Unit, ) { Pager( count = count, @@ -61,7 +61,7 @@ fun VerticalPager( horizontalAlignment = horizontalAlignment, userScrollEnabled = userScrollEnabled, reverseLayout = reverseLayout, - content = content + content = content, ) } @@ -75,7 +75,7 @@ fun HorizontalPager( verticalAlignment: Alignment.Vertical = Alignment.CenterVertically, userScrollEnabled: Boolean = true, reverseLayout: Boolean = false, - content: @Composable BoxScope.(page: Int) -> Unit + content: @Composable BoxScope.(page: Int) -> Unit, ) { Pager( count = count, @@ -87,7 +87,7 @@ fun HorizontalPager( verticalAlignment = verticalAlignment, userScrollEnabled = userScrollEnabled, reverseLayout = reverseLayout, - content = content + content = content, ) } @@ -103,7 +103,7 @@ private fun Pager( reverseLayout: Boolean, verticalAlignment: Alignment.Vertical = Alignment.CenterVertically, horizontalAlignment: Alignment.Horizontal = Alignment.CenterHorizontally, - content: @Composable BoxScope.(page: Int) -> Unit + content: @Composable BoxScope.(page: Int) -> Unit, ) { LaunchedEffect(count) { state.updateCurrentPageBasedOnLazyListState() @@ -124,16 +124,16 @@ private fun Pager( verticalArrangement = Arrangement.aligned(verticalAlignment), userScrollEnabled = userScrollEnabled, reverseLayout = reverseLayout, - flingBehavior = rememberLazyListSnapFlingBehavior(lazyListState = state.lazyListState) + flingBehavior = rememberLazyListSnapFlingBehavior(lazyListState = state.lazyListState), ) { items( count = count, - key = key + key = key, ) { page -> Box( modifier = Modifier .fillParentMaxHeight() - .wrapContentSize() + .wrapContentSize(), ) { content(this, page) } @@ -148,16 +148,16 @@ private fun Pager( horizontalArrangement = Arrangement.aligned(horizontalAlignment), userScrollEnabled = userScrollEnabled, reverseLayout = reverseLayout, - flingBehavior = rememberLazyListSnapFlingBehavior(lazyListState = state.lazyListState) + flingBehavior = rememberLazyListSnapFlingBehavior(lazyListState = state.lazyListState), ) { items( count = count, - key = key + key = key, ) { page -> Box( modifier = Modifier .fillParentMaxWidth() - .wrapContentSize() + .wrapContentSize(), ) { content(this, page) } @@ -168,14 +168,14 @@ private fun Pager( @Composable fun rememberPagerState( - initialPage: Int = 0 + initialPage: Int = 0, ) = rememberSaveable(saver = PagerState.Saver) { PagerState(currentPage = initialPage) } @Stable class PagerState( - currentPage: Int = 0 + currentPage: Int = 0, ) { init { check(currentPage >= 0) { "currentPage cannot be less than zero" } } @@ -198,7 +198,7 @@ class PagerState( val start = maxOf(it.offset, 0) val end = minOf( it.offset + it.size, - layoutInfo.viewportEndOffset - layoutInfo.afterContentPadding + layoutInfo.viewportEndOffset - layoutInfo.afterContentPadding, ) end - start } @@ -222,7 +222,7 @@ class PagerState( companion object { val Saver: Saver = listSaver( save = { listOf(it.currentPage) }, - restore = { PagerState(it[0]) } + restore = { PagerState(it[0]) }, ) } } @@ -232,7 +232,7 @@ private fun lazyListSnapLayoutInfoProvider( lazyListState: LazyListState, positionInLayout: (layoutSize: Float, itemSize: Float) -> Float = { layoutSize, itemSize -> layoutSize / 2f - itemSize / 2f - } + }, ) = object : SnapLayoutInfoProvider { private val layoutInfo: LazyListLayoutInfo @@ -281,7 +281,7 @@ private fun rememberLazyListSnapFlingBehavior(lazyListState: LazyListState): Fli private fun calculateDistanceToDesiredSnapPosition( layoutInfo: LazyListLayoutInfo, item: LazyListItemInfo, - positionInLayout: (layoutSize: Float, itemSize: Float) -> Float + positionInLayout: (layoutSize: Float, itemSize: Float) -> Float, ): Float { val containerSize = with(layoutInfo) { singleAxisViewportSize - beforeContentPadding - afterContentPadding } diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/prefs/ColorPreference.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/prefs/ColorPreference.kt index 778725cd..c47bfce5 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/prefs/ColorPreference.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/prefs/ColorPreference.kt @@ -17,7 +17,7 @@ import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn class ColorPreference( - private val preference: Preference + private val preference: Preference, ) : Preference { override fun key(): String { diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/prefs/PreferenceMutableState.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/prefs/PreferenceMutableState.kt index 2417e5de..c67174c9 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/prefs/PreferenceMutableState.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/prefs/PreferenceMutableState.kt @@ -15,7 +15,7 @@ import kotlinx.coroutines.flow.onEach class PreferenceMutableStateFlow( private val preference: Preference, scope: CoroutineScope, - private val state: MutableStateFlow = MutableStateFlow(preference.get()) + private val state: MutableStateFlow = MutableStateFlow(preference.get()), ) : MutableStateFlow by state { init { diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/theme/ExtraColors.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/theme/ExtraColors.kt index 6802c629..6a46ce21 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/theme/ExtraColors.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/theme/ExtraColors.kt @@ -20,7 +20,7 @@ import androidx.compose.ui.graphics.Color @Stable class ExtraColors( tertiary: Color, - onTertiary: Color + onTertiary: Color, ) { var tertiary by mutableStateOf(tertiary, structuralEqualityPolicy()) internal set @@ -29,10 +29,10 @@ class ExtraColors( fun copy( tertiary: Color = this.tertiary, - onTertiary: Color = this.onTertiary + onTertiary: Color = this.onTertiary, ): ExtraColors = ExtraColors( tertiary, - onTertiary + onTertiary, ) override fun toString(): String { @@ -47,7 +47,7 @@ class ExtraColors( fun WithExtraColors(extraColors: ExtraColors, content: @Composable () -> Unit) { CompositionLocalProvider( LocalExtraColors provides extraColors, - content = content + content = content, ) } } diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/theme/RandomColors.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/theme/RandomColors.kt index ee541a0d..3dee8b9e 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/theme/RandomColors.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/theme/RandomColors.kt @@ -28,7 +28,7 @@ object RandomColors { Color(0xffffd54f), Color(0xffffb74d), Color(0xffa1887f), - Color(0xff90a4ae) + Color(0xff90a4ae), ) fun get(key: Any): Color { diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/theme/Themes.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/theme/Themes.kt index 540c38d3..19012b6e 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/theme/Themes.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/theme/Themes.kt @@ -17,7 +17,7 @@ data class Theme( val id: Int, val titleRes: StringResource, val colors: Colors, - val extraColors: ExtraColors + val extraColors: ExtraColors, ) fun tachiyomiLightColors( @@ -32,7 +32,7 @@ fun tachiyomiLightColors( onSecondary: Color = Color.White, onBackground: Color = Color(0xFF1B1B1E), onSurface: Color = Color(0xFF1B1B1E), - onError: Color = Color.White + onError: Color = Color.White, ) = lightColors( primary = primary, primaryVariant = primaryVariant, @@ -45,7 +45,7 @@ fun tachiyomiLightColors( onSecondary = onSecondary, onBackground = onBackground, onSurface = onSurface, - onError = onError + onError = onError, ) fun tachiyomiDarkColors( @@ -60,7 +60,7 @@ fun tachiyomiDarkColors( onSecondary: Color = Color(0xFF002C71), onBackground: Color = Color(0xFFE4E2E6), onSurface: Color = Color(0xFFE4E2E6), - onError: Color = Color.White + onError: Color = Color.White, ) = darkColors( primary = primary, primaryVariant = primaryVariant, @@ -73,15 +73,15 @@ fun tachiyomiDarkColors( onSecondary = onSecondary, onBackground = onBackground, onSurface = onSurface, - onError = onError + onError = onError, ) fun extraColors( tertiary: Color = Color(0xFF006E17), - onTertiary: Color = Color.White + onTertiary: Color = Color.White, ) = ExtraColors( tertiary = tertiary, - onTertiary = onTertiary + onTertiary = onTertiary, ) /* Theme Template @@ -115,7 +115,7 @@ val themes = listOf( 1, MR.strings.theme_default, tachiyomiLightColors(), - extraColors() + extraColors(), ), // Tachiyomi 0.x legacy blue theme Theme( @@ -127,9 +127,9 @@ val themes = listOf( onPrimary = Color.White, secondary = Color(0xFF2979FF), secondaryVariant = Color(0xFF2979FF), - onSecondary = Color.White + onSecondary = Color.White, ), - extraColors() + extraColors(), ), // Tachiyomi 0.x dark theme Theme( @@ -138,8 +138,8 @@ val themes = listOf( tachiyomiDarkColors(), extraColors( tertiary = Color(0xFF7ADC77), - onTertiary = Color(0xFF003907) - ) + onTertiary = Color(0xFF003907), + ), ), // AMOLED theme Theme( @@ -149,9 +149,9 @@ val themes = listOf( primary = Color.Black, onPrimary = Color.White, background = Color.Black, - surface = Color.Black + surface = Color.Black, ), - extraColors() + extraColors(), ), /** * Green Apple theme @@ -168,11 +168,11 @@ val themes = listOf( background = Color(0xFFFBFDF7), surface = Color(0xFFFBFDF7), onBackground = Color(0xFF1A1C19), - onSurface = Color(0xFF1A1C19) + onSurface = Color(0xFF1A1C19), ), extraColors( - tertiary = Color(0xFFB91D22) - ) + tertiary = Color(0xFFB91D22), + ), ), Theme( 6, @@ -187,12 +187,12 @@ val themes = listOf( onPrimary = Color(0xFF003915), onSecondary = Color(0xFF003915), onBackground = Color(0xFFE1E3DD), - onSurface = Color(0xFFE1E3DD) + onSurface = Color(0xFFE1E3DD), ), extraColors( tertiary = Color(0xFFFFB3AA), - onTertiary = Color(0xFF680006) - ) + onTertiary = Color(0xFF680006), + ), ), /** * Lavender theme @@ -211,12 +211,12 @@ val themes = listOf( onPrimary = Color(0xFFEDE2FF), onSecondary = Color(0xFFEDE2FF), onBackground = Color(0xFF1B1B22), - onSurface = Color(0xFF1B1B22) + onSurface = Color(0xFF1B1B22), ), extraColors( tertiary = Color(0xFFEDE2FF), - onTertiary = Color(0xFF7B46AF) - ) + onTertiary = Color(0xFF7B46AF), + ), ), Theme( 8, @@ -231,12 +231,12 @@ val themes = listOf( onPrimary = Color(0xFF111129), onSecondary = Color(0xFF111129), onBackground = Color(0xFFDEE8FF), - onSurface = Color(0xFFDEE8FF) + onSurface = Color(0xFFDEE8FF), ), extraColors( tertiary = Color(0xFF5E25E1), - onTertiary = Color(0xFFE8E8E8) - ) + onTertiary = Color(0xFFE8E8E8), + ), ), /** * Midnight Dusk theme @@ -253,11 +253,11 @@ val themes = listOf( background = Color(0xFFFFFBFF), surface = Color(0xFFFFFBFF), onBackground = Color(0xFF1C1B1F), - onSurface = Color(0xFF1C1B1F) + onSurface = Color(0xFF1C1B1F), ), extraColors( - tertiary = Color(0xFF006638) - ) + tertiary = Color(0xFF006638), + ), ), Theme( 10, @@ -272,11 +272,11 @@ val themes = listOf( onPrimary = Color(0xFFFFFFFF), onSecondary = Color(0xFFFFFFFF), onBackground = Color(0xFFE5E1E5), - onSurface = Color(0xFFE5E1E5) + onSurface = Color(0xFFE5E1E5), ), extraColors( - tertiary = Color(0xFF55971C) - ) + tertiary = Color(0xFF55971C), + ), ), /** * Strawberry Daiquiri theme @@ -293,11 +293,11 @@ val themes = listOf( background = Color(0xFFFCFCFC), surface = Color(0xFFFCFCFC), onBackground = Color(0xFF201A1A), - onSurface = Color(0xFF201A1A) + onSurface = Color(0xFF201A1A), ), extraColors( - tertiary = Color(0xFF775930) - ) + tertiary = Color(0xFF775930), + ), ), Theme( 12, @@ -312,12 +312,12 @@ val themes = listOf( onPrimary = Color(0xFF67001B), onSecondary = Color(0xFF67001B), onBackground = Color(0xFFECDFDF), - onSurface = Color(0xFFECDFDF) + onSurface = Color(0xFFECDFDF), ), extraColors( tertiary = Color(0xFFE8C08E), - onTertiary = Color(0xFF432C06) - ) + onTertiary = Color(0xFF432C06), + ), ), /** * Strawberry Tako theme @@ -336,12 +336,12 @@ val themes = listOf( onPrimary = Color(0xFFF3B375), onSecondary = Color(0xFFF3B375), onBackground = Color(0xFF1B1B22), - onSurface = Color(0xFF1B1B22) + onSurface = Color(0xFF1B1B22), ), extraColors( tertiary = Color(0xFFF3B375), - onTertiary = Color(0xFF574360) - ) + onTertiary = Color(0xFF574360), + ), ), Theme( 14, @@ -356,12 +356,12 @@ val themes = listOf( onPrimary = Color(0xFF38294E), onSecondary = Color(0xFF38294E), onBackground = Color(0xFFE3E0F2), - onSurface = Color(0xFFE3E0F2) + onSurface = Color(0xFFE3E0F2), ), extraColors( tertiary = Color(0xFF66577E), - onTertiary = Color(0xFFF3B375) - ) + onTertiary = Color(0xFFF3B375), + ), ), /** * Teal & Turquoise theme @@ -377,12 +377,12 @@ val themes = listOf( background = Color(0xFFFAFAFA), surface = Color(0xFFFAFAFA), onBackground = Color(0xFF050505), - onSurface = Color(0xFF050505) + onSurface = Color(0xFF050505), ), extraColors( tertiary = Color(0xFFFF7F7F), - onTertiary = Color.Black - ) + onTertiary = Color.Black, + ), ), Theme( 16, @@ -397,11 +397,11 @@ val themes = listOf( onPrimary = Color.Black, onSecondary = Color.Black, onBackground = Color(0xFFDFDEDA), - onSurface = Color(0xFFDFDEDA) + onSurface = Color(0xFFDFDEDA), ), extraColors( - tertiary = Color(0xFFBF1F2F) - ) + tertiary = Color(0xFFBF1F2F), + ), ), /** * Tidal Wave theme @@ -418,12 +418,12 @@ val themes = listOf( background = Color(0xFFFDFBFF), surface = Color(0xFFFDFBFF), onBackground = Color(0xFF001C3b), - onSurface = Color(0xFF001C3b) + onSurface = Color(0xFF001C3b), ), extraColors( tertiary = Color(0xFF92F7BC), - onTertiary = Color(0xFF001C3B) - ) + onTertiary = Color(0xFF001C3B), + ), ), Theme( 18, @@ -438,12 +438,12 @@ val themes = listOf( onPrimary = Color(0xFF003544), onSecondary = Color(0xFF003544), onBackground = Color(0xFFD5E3FF), - onSurface = Color(0xFFD5E3FF) + onSurface = Color(0xFFD5E3FF), ), extraColors( tertiary = Color(0xFF004D61), - onTertiary = Color(0xFF001C3B) - ) + onTertiary = Color(0xFF001C3B), + ), ), /** * Yin & Yang theme @@ -462,12 +462,12 @@ val themes = listOf( onPrimary = Color.White, onSecondary = Color.White, onBackground = Color(0xFF222222), - onSurface = Color(0xFF222222) + onSurface = Color(0xFF222222), ), extraColors( tertiary = Color.White, - onTertiary = Color.Black - ) + onTertiary = Color.Black, + ), ), Theme( 20, @@ -482,12 +482,12 @@ val themes = listOf( onPrimary = Color(0xFF5A5A5A), onSecondary = Color(0xFF5A5A5A), onBackground = Color(0xFFE6E6E6), - onSurface = Color(0xFFE6E6E6) + onSurface = Color(0xFFE6E6E6), ), extraColors( tertiary = Color.Black, - onTertiary = Color.White - ) + onTertiary = Color.White, + ), ), /** * Yotsuba theme @@ -504,11 +504,11 @@ val themes = listOf( background = Color(0xFFFCFCFC), surface = Color(0xFFFCFCFC), onBackground = Color(0xFF211A18), - onSurface = Color(0xFF211A18) + onSurface = Color(0xFF211A18), ), extraColors( - tertiary = Color(0xFF6B5E2F) - ) + tertiary = Color(0xFF6B5E2F), + ), ), Theme( 22, @@ -523,11 +523,11 @@ val themes = listOf( onPrimary = Color(0xFF5F1600), onSecondary = Color(0xFF5F1600), onBackground = Color(0xFFEDE0DD), - onSurface = Color(0xFFEDE0DD) + onSurface = Color(0xFFEDE0DD), ), extraColors( tertiary = Color(0xFFD7C68D), - onTertiary = Color(0xFF3A2F05) - ) - ) + onTertiary = Color(0xFF3A2F05), + ), + ), ) diff --git a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/vm/ContextWrapper.kt b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/vm/ContextWrapper.kt index f230ab08..f788fe19 100644 --- a/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/vm/ContextWrapper.kt +++ b/ui-core/src/commonMain/kotlin/ca/gosyer/jui/uicore/vm/ContextWrapper.kt @@ -15,5 +15,5 @@ expect class ContextWrapper { } enum class Length { SHORT, - LONG + LONG, } diff --git a/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/BoxWithTooltipSurface.kt b/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/BoxWithTooltipSurface.kt index d70a6a3d..18fea889 100644 --- a/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/BoxWithTooltipSurface.kt +++ b/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/BoxWithTooltipSurface.kt @@ -22,9 +22,9 @@ fun BoxWithTooltipSurface( modifier: Modifier = Modifier, delayMillis: Int = 500, tooltipPlacement: TooltipPlacement = TooltipPlacement.CursorPoint( - offset = DpOffset(0.dp, 16.dp) + offset = DpOffset(0.dp, 16.dp), ), - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { TooltipArea( { @@ -32,12 +32,12 @@ fun BoxWithTooltipSurface( modifier = Modifier.shadow(4.dp), shape = RoundedCornerShape(4.dp), elevation = 4.dp, - content = tooltip + content = tooltip, ) }, modifier, delayMillis, tooltipPlacement, - content + content, ) } diff --git a/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/DesktopBottomActionMenu.kt b/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/DesktopBottomActionMenu.kt index b05515a1..fbfb9515 100644 --- a/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/DesktopBottomActionMenu.kt +++ b/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/DesktopBottomActionMenu.kt @@ -22,7 +22,7 @@ import kotlin.time.Duration.Companion.seconds actual fun Modifier.buttonModifier( onClick: () -> Unit, - onHintClick: () -> Unit + onHintClick: () -> Unit, ): Modifier = composed { val interactionSource = remember { MutableInteractionSource() } LaunchedEffect(interactionSource) { diff --git a/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/DesktopDropDownMenu.kt b/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/DesktopDropDownMenu.kt index f35fd1e7..6cfb2e3c 100644 --- a/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/DesktopDropDownMenu.kt +++ b/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/DesktopDropDownMenu.kt @@ -21,14 +21,14 @@ internal actual fun RealDropdownMenu( modifier: Modifier, offset: DpOffset, properties: PopupProperties, - content: @Composable ColumnScope.() -> Unit + content: @Composable ColumnScope.() -> Unit, ) = androidx.compose.material.DropdownMenu( expanded = expanded, onDismissRequest = onDismissRequest, focusable = properties.focusable, modifier = modifier, offset = offset, - content = content + content = content, ) @Composable @@ -38,12 +38,12 @@ internal actual fun RealDropdownMenuItem( enabled: Boolean, contentPadding: PaddingValues, interactionSource: MutableInteractionSource, - content: @Composable RowScope.() -> Unit + content: @Composable RowScope.() -> Unit, ) = androidx.compose.material.DropdownMenuItem( onClick = onClick, modifier = modifier, enabled = enabled, contentPadding = contentPadding, interactionSource = interactionSource, - content = content + content = content, ) diff --git a/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/DesktopScrollbar.kt b/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/DesktopScrollbar.kt index 6480acd6..54f7a059 100644 --- a/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/DesktopScrollbar.kt +++ b/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/DesktopScrollbar.kt @@ -39,13 +39,13 @@ internal actual fun RealVerticalScrollbar( modifier: Modifier, reverseLayout: Boolean, style: ScrollbarStyle, - interactionSource: MutableInteractionSource + interactionSource: MutableInteractionSource, ) = androidx.compose.foundation.VerticalScrollbar( adapter, modifier, reverseLayout, style, - interactionSource + interactionSource, ) @Composable @@ -54,25 +54,25 @@ internal actual fun RealHorizontalScrollbar( modifier: Modifier, reverseLayout: Boolean, style: ScrollbarStyle, - interactionSource: MutableInteractionSource + interactionSource: MutableInteractionSource, ) = androidx.compose.foundation.HorizontalScrollbar( adapter, modifier, reverseLayout, style, - interactionSource + interactionSource, ) @Composable actual fun rememberScrollbarAdapter( - scrollState: ScrollState + scrollState: ScrollState, ): ScrollbarAdapter { return androidx.compose.foundation.rememberScrollbarAdapter(scrollState) } @Composable actual fun rememberScrollbarAdapter( - scrollState: LazyListState + scrollState: LazyListState, ): ScrollbarAdapter { return androidx.compose.foundation.rememberScrollbarAdapter(scrollState) } @@ -81,7 +81,7 @@ actual fun rememberScrollbarAdapter( internal actual fun realRememberVerticalScrollbarAdapter( scrollState: LazyGridState, gridCells: GridCells, - arrangement: Arrangement.Vertical? + arrangement: Arrangement.Vertical?, ): ScrollbarAdapter { val density = LocalDensity.current return remember(scrollState, gridCells, density, arrangement) { @@ -93,7 +93,7 @@ internal actual fun realRememberVerticalScrollbarAdapter( internal actual fun realRememberHorizontalScrollbarAdapter( scrollState: LazyGridState, gridCells: GridCells, - arrangement: Arrangement.Horizontal? + arrangement: Arrangement.Horizontal?, ): ScrollbarAdapter { val density = LocalDensity.current return remember(scrollState, gridCells, density, arrangement) { @@ -106,7 +106,7 @@ class GridScrollbarAdapter( private val scrollState: LazyGridState, private val gridCells: GridCells, private val density: Density, - private val spacing: Dp + private val spacing: Dp, ) : ScrollbarAdapter { override val scrollOffset: Float get() = (scrollState.firstVisibleItemIndex / itemsPerRow).coerceAtLeast(0) * averageItemSize + scrollState.firstVisibleItemScrollOffset @@ -155,7 +155,7 @@ class GridScrollbarAdapter( with(density) { calculateCrossAxisCellSizes(containerSize, spacing.roundToPx()).size } - } + }, ) .coerceAtLeast(0) .coerceAtMost(itemCount - 1) @@ -184,7 +184,7 @@ class GridScrollbarAdapter( with(density) { calculateCrossAxisCellSizes( (scrollState.layoutInfo.viewportEndOffset - scrollState.layoutInfo.viewportStartOffset), - spacing.roundToPx() + spacing.roundToPx(), ).size } } diff --git a/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/MouseClickable.kt b/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/MouseClickable.kt index 8c8c2586..8c3cab5d 100644 --- a/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/MouseClickable.kt +++ b/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/components/MouseClickable.kt @@ -23,19 +23,19 @@ import androidx.compose.ui.input.pointer.PointerButton fun Modifier.onRightClickContextMenu( items: @Composable () -> List, - enabled: Boolean = true + enabled: Boolean = true, ) = composed { var expanded by remember { mutableStateOf(false) } CursorDropdownMenu( expanded, - onDismissRequest = { expanded = false } + onDismissRequest = { expanded = false }, ) { items().forEach { item -> DropdownMenuItem( onClick = { expanded = false item.onClick() - } + }, ) { Text(text = item.label) } @@ -44,6 +44,6 @@ fun Modifier.onRightClickContextMenu( Modifier.onClick( enabled = enabled, matcher = PointerMatcher.mouse(PointerButton.Secondary), - onClick = { expanded = true } + onClick = { expanded = true }, ) } diff --git a/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/resources/DesktopFileResource.kt b/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/resources/DesktopFileResource.kt index 430e2dab..b89f30a6 100644 --- a/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/resources/DesktopFileResource.kt +++ b/ui-core/src/desktopMain/kotlin/ca/gosyer/jui/uicore/resources/DesktopFileResource.kt @@ -21,7 +21,7 @@ actual fun FileResource.rememberReadText(): String = remember { @Composable actual fun FileResource.readTextAsync(): State = produceState( null, - this.filePath + this.filePath, ) { withIOContext { value = readText() diff --git a/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/components/IosBottomActionMenu.kt b/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/components/IosBottomActionMenu.kt index a49a90fa..8032ee29 100644 --- a/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/components/IosBottomActionMenu.kt +++ b/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/components/IosBottomActionMenu.kt @@ -15,12 +15,12 @@ import androidx.compose.ui.composed actual fun Modifier.buttonModifier( onClick: () -> Unit, - onHintClick: () -> Unit + onHintClick: () -> Unit, ): Modifier = composed { combinedClickable( interactionSource = remember { MutableInteractionSource() }, indication = rememberRipple(bounded = false), onLongClick = onHintClick, - onClick = onClick + onClick = onClick, ) } diff --git a/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/components/IosDropDownMenu.kt b/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/components/IosDropDownMenu.kt index 1b6286a3..a76260c9 100644 --- a/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/components/IosDropDownMenu.kt +++ b/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/components/IosDropDownMenu.kt @@ -21,7 +21,7 @@ internal actual fun RealDropdownMenu( modifier: Modifier, offset: DpOffset, properties: PopupProperties, - content: @Composable ColumnScope.() -> Unit + content: @Composable ColumnScope.() -> Unit, ) = Unit/* TODO androidx.compose.material.DropdownMenu( expanded = expanded, onDismissRequest = onDismissRequest, @@ -38,7 +38,7 @@ internal actual fun RealDropdownMenuItem( enabled: Boolean, contentPadding: PaddingValues, interactionSource: MutableInteractionSource, - content: @Composable RowScope.() -> Unit + content: @Composable RowScope.() -> Unit, ) = Unit/* TODO androidx.compose.material.DropdownMenuItem( onClick = onClick, modifier = modifier, diff --git a/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/components/IosScrollbar.kt b/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/components/IosScrollbar.kt index d00d7c96..229d0776 100644 --- a/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/components/IosScrollbar.kt +++ b/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/components/IosScrollbar.kt @@ -67,7 +67,7 @@ internal actual fun RealVerticalScrollbar( modifier: Modifier, reverseLayout: Boolean, style: ScrollbarStyle, - interactionSource: MutableInteractionSource + interactionSource: MutableInteractionSource, ) { val scrollbarModifier = when (adapter) { is ScrollStateScrollbarAdapter -> { @@ -90,7 +90,7 @@ internal actual fun RealHorizontalScrollbar( modifier: Modifier, reverseLayout: Boolean, style: ScrollbarStyle, - interactionSource: MutableInteractionSource + interactionSource: MutableInteractionSource, ) { val scrollbarModifier = when (adapter) { is ScrollStateScrollbarAdapter -> { @@ -106,7 +106,7 @@ internal actual fun RealHorizontalScrollbar( @Composable actual fun rememberScrollbarAdapter( - scrollState: ScrollState + scrollState: ScrollState, ): ScrollbarAdapter { return remember(scrollState) { ScrollStateScrollbarAdapter(scrollState) @@ -115,7 +115,7 @@ actual fun rememberScrollbarAdapter( @Composable actual fun rememberScrollbarAdapter( - scrollState: LazyListState + scrollState: LazyListState, ): ScrollbarAdapter { return remember(scrollState) { LazyListStateScrollbarAdapter(scrollState) @@ -126,7 +126,7 @@ actual fun rememberScrollbarAdapter( internal actual fun realRememberVerticalScrollbarAdapter( scrollState: LazyGridState, gridCells: GridCells, - arrangement: Arrangement.Vertical? + arrangement: Arrangement.Vertical?, ): ScrollbarAdapter { return remember(scrollState, gridCells) { LazyGridStateScrollbarAdapter(scrollState, gridCells, arrangement?.spacing ?: Dp.Hairline) @@ -137,7 +137,7 @@ internal actual fun realRememberVerticalScrollbarAdapter( internal actual fun realRememberHorizontalScrollbarAdapter( scrollState: LazyGridState, gridCells: GridCells, - arrangement: Arrangement.Horizontal? + arrangement: Arrangement.Horizontal?, ): ScrollbarAdapter { return remember(scrollState, gridCells) { LazyGridStateScrollbarAdapter(scrollState, gridCells, arrangement?.spacing ?: Dp.Hairline) @@ -151,11 +151,11 @@ actual fun Modifier.scrollbarPadding() = this private fun Modifier.drawScrollbar( state: ScrollState, orientation: Orientation, - reverseScrolling: Boolean + reverseScrolling: Boolean, ): Modifier = drawScrollbar( orientation = orientation, reverseScrolling = reverseScrolling, - scrollFlow = snapshotFlow { state.isScrollInProgress } + scrollFlow = snapshotFlow { state.isScrollInProgress }, ) { reverseDirection, atEnd, thickness, color, alpha -> val showScrollbar = state.maxValue > 0 val canvasSize = if (orientation == Orientation.Horizontal) size.width else size.height @@ -171,7 +171,7 @@ private fun Modifier.drawScrollbar( color = color, alpha = alpha, thumbSize = thumbSize, - startOffset = startOffset + startOffset = startOffset, ) onDrawWithContent { drawContent() @@ -182,11 +182,11 @@ private fun Modifier.drawScrollbar( private fun Modifier.drawScrollbar( state: LazyListState, orientation: Orientation, - reverseScrolling: Boolean + reverseScrolling: Boolean, ): Modifier = drawScrollbar( orientation, reverseScrolling, - snapshotFlow { state.isScrollInProgress } + snapshotFlow { state.isScrollInProgress }, ) { reverseDirection, atEnd, thickness, color, alpha -> val layoutInfo = state.layoutInfo val viewportSize = layoutInfo.viewportEndOffset - layoutInfo.viewportStartOffset @@ -215,7 +215,7 @@ private fun Modifier.drawScrollbar( color = color, alpha = alpha, thumbSize = thumbSize, - startOffset = startOffset + startOffset = startOffset, ) onDrawWithContent { drawContent() @@ -228,11 +228,11 @@ private fun Modifier.drawScrollbar( gridCells: GridCells, spacing: Dp, orientation: Orientation, - reverseScrolling: Boolean + reverseScrolling: Boolean, ): Modifier = drawScrollbar( orientation, reverseScrolling, - snapshotFlow { state.isScrollInProgress } + snapshotFlow { state.isScrollInProgress }, ) { reverseDirection, atEnd, thickness, color, alpha -> val layoutInfo = state.layoutInfo val viewportSize = layoutInfo.viewportEndOffset - layoutInfo.viewportStartOffset @@ -241,7 +241,7 @@ private fun Modifier.drawScrollbar( val itemsSize = items.chunked( with(gridCells) { calculateCrossAxisCellSizes(viewportSize, spacing.roundToPx()).size - } + }, ).sumOf { it.fastMaxBy { it.size.height }?.size?.height ?: 0 } val showScrollbar = items.size < layoutInfo.totalItemsCount || itemsSize > viewportSize val estimatedItemSize = if (items.isEmpty()) 0f else itemsSize.toFloat() / items.size @@ -266,7 +266,7 @@ private fun Modifier.drawScrollbar( color = color, alpha = alpha, thumbSize = thumbSize, - startOffset = startOffset + startOffset = startOffset, ) onDrawWithContent { drawContent() @@ -283,17 +283,17 @@ private fun CacheDrawScope.onDrawScrollbar( color: Color, alpha: Float, thumbSize: Float, - startOffset: Float + startOffset: Float, ): DrawScope.() -> Unit { val topLeft = if (orientation == Orientation.Horizontal) { Offset( if (reverseDirection) size.width - startOffset - thumbSize else startOffset, - if (atEnd) size.height - thickness else 0f + if (atEnd) size.height - thickness else 0f, ) } else { Offset( if (atEnd) size.width - thickness else 0f, - if (reverseDirection) size.height - startOffset - thumbSize else startOffset + if (reverseDirection) size.height - startOffset - thumbSize else startOffset, ) } val size = if (orientation == Orientation.Horizontal) { @@ -308,7 +308,7 @@ private fun CacheDrawScope.onDrawScrollbar( color = color, topLeft = topLeft, size = size, - alpha = alpha + alpha = alpha, ) } } @@ -323,8 +323,8 @@ private fun Modifier.drawScrollbar( atEnd: Boolean, thickness: Float, color: Color, - alpha: Float - ) -> DrawResult + alpha: Float, + ) -> DrawResult, ): Modifier = composed { val isScrollInProgress by scrollFlow.collectAsState(initial = false) val alpha = remember { Animatable(0f) } @@ -356,5 +356,5 @@ private fun Modifier.drawScrollbar( private val Thickness = 4.dp private val FadeOutAnimationSpec = tween( - durationMillis = 300 + durationMillis = 300, ) diff --git a/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/resources/IosFileResource.kt b/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/resources/IosFileResource.kt index d8e86787..572e70b6 100644 --- a/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/resources/IosFileResource.kt +++ b/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/resources/IosFileResource.kt @@ -21,7 +21,7 @@ actual fun FileResource.rememberReadText(): String = remember { @Composable actual fun FileResource.readTextAsync(): State = produceState( null, - this.path + this.path, ) { withIOContext { value = readText() diff --git a/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/resources/IosImageResource.kt b/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/resources/IosImageResource.kt index cf79973f..8d527e82 100644 --- a/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/resources/IosImageResource.kt +++ b/ui-core/src/iosMain/kotlin/ca/gosyer/jui/uicore/resources/IosImageResource.kt @@ -70,6 +70,6 @@ private fun UIImage.toSkiaImage(): Image? { return Image.makeRaster( imageInfo = ImageInfo(width = width, height = height, colorType = ColorType.RGBA_8888, alphaType = alphaType), bytes = byteArray, - rowBytes = bytesPerRow.toInt() + rowBytes = bytesPerRow.toInt(), ) }