From a0806181c67dbfbca498a41725c14aad7ae500e3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 02:48:35 +0000 Subject: [PATCH 1/4] Update dependency org.kobjects.ktxml:core to v0.2.4 (#590) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7ff5776c6..2ad8a015c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -41,7 +41,7 @@ okio = "3.9.0" paging = "3.3.0-alpha02-0.5.1" stately = "2.0.7" xmlutil = "0.86.3" -ktxml = "0.2.3" +ktxml = "0.2.4" uri = "0.0.18" webview = "1.9.8" uuid = "0.8.4" From 77355e5767c1ce9e2a0c023c21f839f4bb2b50e2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 09:58:26 +0530 Subject: [PATCH 2/4] Update dependency androidx.appcompat:appcompat to v1.7.0 (#591) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2ad8a015c..669695665 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,7 +16,7 @@ kotlinx_serialization_json = "1.6.3" decompose = "3.0.0" essenty = "2.0.0" androidx_activity = "1.9.0" -androidx_appcompat = "1.6.1" +androidx_appcompat = "1.7.0" androidx_core = "1.13.1" androidx_collection = "1.4.0" androidx_test_runner = "1.5.2" From ca81eb35a3a8ff3a5abd0491328f3e6279dd0c5b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 09:58:39 +0530 Subject: [PATCH 3/4] Update dependency gradle to v8.8 (#592) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23a4..a4413138c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 1aa94a426..b740cf133 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. From aedd651cd01ed9458a6f2380c03f07c1da3ccad7 Mon Sep 17 00:00:00 2001 From: "tramline-github[bot]" <98346001+tramline-github[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 11:04:52 +0530 Subject: [PATCH 4/4] Run reader view parsing in the background thread (#595) Co-authored-by: Sasikanth Miriyampalli --- .../dev/sasikanth/rss/reader/app/App.kt | 8 +++- .../rss/reader/reader/ui/ReaderHTML.kt | 5 +-- .../rss/reader/reader/ui/ReaderScreen.kt | 43 ++++++++++++------- 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/app/App.kt b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/app/App.kt index ad2483415..4e59cd126 100644 --- a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/app/App.kt +++ b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/app/App.kt @@ -49,6 +49,7 @@ import dev.sasikanth.rss.reader.search.ui.SearchScreen import dev.sasikanth.rss.reader.settings.ui.SettingsScreen import dev.sasikanth.rss.reader.share.LocalShareHandler import dev.sasikanth.rss.reader.share.ShareHandler +import dev.sasikanth.rss.reader.util.DispatchersProvider import dev.sasikanth.rss.reader.utils.LocalWindowSizeClass import me.tatarka.inject.annotations.Inject @@ -62,6 +63,7 @@ fun App( shareHandler: ShareHandler, linkHandler: LinkHandler, imageLoader: ImageLoader, + dispatchersProvider: DispatchersProvider, ) { setSingletonImageLoaderFactory { imageLoader } @@ -109,7 +111,11 @@ fun App( AboutScreen(aboutPresenter = screen.presenter, modifier = fillMaxSizeModifier) } is Screen.Reader -> { - ReaderScreen(presenter = screen.presenter, modifier = fillMaxSizeModifier) + ReaderScreen( + presenter = screen.presenter, + dispatchersProvider = dispatchersProvider, + modifier = fillMaxSizeModifier + ) } is Screen.AddFeed -> { AddFeedScreen(presenter = screen.presenter, modifier = fillMaxSizeModifier) diff --git a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/reader/ui/ReaderHTML.kt b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/reader/ui/ReaderHTML.kt index f8d646a6a..a45494c12 100644 --- a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/reader/ui/ReaderHTML.kt +++ b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/reader/ui/ReaderHTML.kt @@ -16,9 +16,6 @@ package dev.sasikanth.rss.reader.reader.ui -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.IO -import kotlinx.coroutines.withContext import twine.shared.generated.resources.Res object ReaderHTML { @@ -89,6 +86,6 @@ object ReaderHTML { } private suspend fun readFile(fileName: String): String { - return withContext(Dispatchers.IO) { Res.readBytes("files/reader/$fileName").decodeToString() } + return Res.readBytes("files/reader/$fileName").decodeToString() } } diff --git a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/reader/ui/ReaderScreen.kt b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/reader/ui/ReaderScreen.kt index 63e8ee61b..8ca78bf13 100644 --- a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/reader/ui/ReaderScreen.kt +++ b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/reader/ui/ReaderScreen.kt @@ -68,11 +68,17 @@ import dev.sasikanth.rss.reader.resources.icons.TwineIcons import dev.sasikanth.rss.reader.resources.icons.Website import dev.sasikanth.rss.reader.share.LocalShareHandler import dev.sasikanth.rss.reader.ui.AppTheme +import dev.sasikanth.rss.reader.util.DispatchersProvider import dev.sasikanth.rss.reader.utils.asJSString import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext @Composable -internal fun ReaderScreen(presenter: ReaderPresenter, modifier: Modifier = Modifier) { +internal fun ReaderScreen( + presenter: ReaderPresenter, + dispatchersProvider: DispatchersProvider, + modifier: Modifier = Modifier +) { val state by presenter.state.collectAsState() val coroutineScope = rememberCoroutineScope() val linkHandler = LocalLinkHandler.current @@ -229,25 +235,30 @@ internal fun ReaderScreen(presenter: ReaderPresenter, modifier: Modifier = Modif } LaunchedEffect(state.content) { - val html = - ReaderHTML.create( - title = state.title!!, - feedName = state.feed!!.name, - feedHomePageLink = state.feed!!.homepageLink, - publishedAt = state.publishedAt!!, - ) + withContext(dispatchersProvider.io) { + val htmlTemplate = + ReaderHTML.create( + title = state.title!!, + feedName = state.feed!!.name, + feedHomePageLink = state.feed!!.homepageLink, + publishedAt = state.publishedAt!!, + ) - navigator.loadHtml(html, state.link) + navigator.loadHtml(htmlTemplate, state.link) + } } LaunchedEffect(webViewState.loadingState) { - if ( - webViewState.loadingState == LoadingState.Finished && !state.content.isNullOrBlank() - ) { - navigator.evaluateJavaScript( - script = - "renderReaderView(${state.link.asJSString}, ${state.content.asJSString}, ${colors.asJSString})" - ) + withContext(dispatchersProvider.io) { + val hasHtmlTemplateLoaded = + webViewState.loadingState == LoadingState.Finished && !state.content.isNullOrBlank() + + if (hasHtmlTemplateLoaded) { + navigator.evaluateJavaScript( + script = + "renderReaderView(${state.link.asJSString}, ${state.content.asJSString}, ${colors.asJSString})" + ) + } } }