From 8626a55fe4ee2fa5f61e6d4a2a8e0c7e3752cd25 Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 18 Oct 2023 22:50:09 -0400 Subject: [PATCH] Make text clickable when removing item from tracker --- .../tachiyomi/data/track/shikimori/ShikimoriApi.kt | 9 +++++---- .../tachiyomi/ui/manga/track/TrackInfoDialog.kt | 11 +++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt index 5df7fc941..8e9033607 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/shikimori/ShikimoriApi.kt @@ -1,5 +1,6 @@ package eu.kanade.tachiyomi.data.track.shikimori +import android.net.Uri import androidx.core.net.toUri import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.track.model.TrackSearch @@ -37,12 +38,12 @@ class ShikimoriApi( private val authClient = client.newBuilder().addInterceptor(interceptor).build() - suspend fun addLibManga(track: Track, user_id: String): Track { + suspend fun addLibManga(track: Track, userId: String): Track { return withIOContext { with(json) { val payload = buildJsonObject { putJsonObject("user_rate") { - put("user_id", user_id) + put("user_id", userId) put("target_id", track.media_id) put("target_type", "Manga") put("chapters", track.last_chapter_read.toInt()) @@ -65,7 +66,7 @@ class ShikimoriApi( } } - suspend fun updateLibManga(track: Track, user_id: String): Track = addLibManga(track, user_id) + suspend fun updateLibManga(track: Track, userId: String): Track = addLibManga(track, userId) suspend fun deleteLibManga(track: Track): Track { return withIOContext { @@ -201,7 +202,7 @@ class ShikimoriApi( private const val redirectUrl = "tachiyomi://shikimori-auth" - fun authUrl() = loginUrl.toUri().buildUpon() + fun authUrl(): Uri = loginUrl.toUri().buildUpon() .appendQueryParameter("client_id", clientId) .appendQueryParameter("redirect_uri", redirectUrl) .appendQueryParameter("response_type", "code") diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt index 6c811b7ad..1eb97b760 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.manga.track import android.app.Application import android.content.Context +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -759,8 +760,14 @@ private data class TrackerRemoveScreen( text = stringResource(R.string.track_delete_text, serviceName), ) if (sm.isDeletable()) { - Row(verticalAlignment = Alignment.CenterVertically) { - Checkbox(checked = removeRemoteTrack, onCheckedChange = { removeRemoteTrack = it }) + val onChange = { removeRemoteTrack = !removeRemoteTrack } + Row( + modifier = Modifier + .fillMaxWidth() + .clickable(onClick = onChange), + verticalAlignment = Alignment.CenterVertically, + ) { + Checkbox(checked = removeRemoteTrack, onCheckedChange = { onChange() }) Text(text = stringResource(R.string.track_delete_remote_text, serviceName)) } }