fix(about/license): Use Bundle

This commit is contained in:
Ahmad Ansori Palembani 2024-07-31 10:28:14 +07:00
parent 6c93deacca
commit c95c364c0c
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 16 additions and 8 deletions

View file

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.ui.more package eu.kanade.tachiyomi.ui.more
import android.os.Bundle
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
@ -22,13 +23,13 @@ import yokai.presentation.AppBarType
import yokai.presentation.YokaiScaffold import yokai.presentation.YokaiScaffold
import yokai.presentation.component.ToolTipButton import yokai.presentation.component.ToolTipButton
class AboutLibraryLicenseController( class AboutLibraryLicenseController(private val bundle: Bundle) : BaseComposeController(bundle) {
private val name: String,
private val website: String?,
private val license: String,
) : BaseComposeController() {
@Composable @Composable
override fun ScreenContent() { override fun ScreenContent() {
val name = bundle.getString(LIBRARY_NAME) ?: throw RuntimeException("Missing library name")
val website = bundle.getString(LIBRARY_WEBSITE)
val license = bundle.getString(LIBRARY_LICENSE) ?: throw RuntimeException("Missing library license")
val uriHandler = LocalUriHandler.current val uriHandler = LocalUriHandler.current
YokaiScaffold( YokaiScaffold(
@ -71,3 +72,7 @@ class AboutLibraryLicenseController(
) )
} }
} }
const val LIBRARY_NAME = "aboutLibraries__LibraryName"
const val LIBRARY_WEBSITE = "aboutLibraries__LibraryWebsite"
const val LIBRARY_LICENSE = "aboutLibraries__LibraryLicense"

View file

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.ui.more package eu.kanade.tachiyomi.ui.more
import android.os.Bundle
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@ -28,9 +29,11 @@ class AboutLicenseController : BaseComposeController() {
onLibraryClick = { onLibraryClick = {
router.pushController( router.pushController(
AboutLibraryLicenseController( AboutLibraryLicenseController(
it.name, Bundle().apply {
it.website, this.putString(LIBRARY_NAME, it.name)
it.licenses.firstOrNull()?.htmlReadyLicenseContent.orEmpty(), it.website?.let { website -> this.putString(LIBRARY_WEBSITE, website) }
this.putString(LIBRARY_LICENSE, it.licenses.firstOrNull()?.htmlReadyLicenseContent.orEmpty())
}
).withFadeTransaction(), ).withFadeTransaction(),
) )
} }