Skip to content

Commit

Permalink
[1.222.*] Pre-release merge (#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
tramline-github[bot] authored Aug 7, 2024
2 parents c97247c + 11a3c83 commit 08fe1c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package dev.sasikanth.rss.reader.reader.ui

import androidx.compose.ui.unit.LayoutDirection
import twine.shared.generated.resources.Res

object ReaderHTML {
Expand All @@ -26,9 +25,7 @@ object ReaderHTML {
feedName: String,
feedHomePageLink: String,
feedIcon: String,
publishedAt: String,
locale: String,
direction: LayoutDirection
publishedAt: String
): String {
val readabilityJS = readFile("readability.js")
val readerJS = readFile("main.js")
Expand All @@ -44,8 +41,9 @@ object ReaderHTML {
)

// language=HTML
@Suppress("HtmlRequiredLangAttribute")
return """
<html lang="$locale" dir="${direction.name}">
<html dir='auto'>
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.text.intl.Locale
import androidx.compose.ui.unit.dp
import com.multiplatform.webview.jsbridge.rememberWebViewJsBridge
import com.multiplatform.webview.web.LoadingState
Expand Down Expand Up @@ -238,7 +236,6 @@ internal fun ReaderScreen(
this.supportZoom = false
}

val layoutDirection = LocalLayoutDirection.current
LaunchedEffect(state.content) {
withContext(dispatchersProvider.io) {
val htmlTemplate =
Expand All @@ -247,9 +244,7 @@ internal fun ReaderScreen(
feedName = state.feed!!.name,
feedHomePageLink = state.feed!!.homepageLink,
feedIcon = state.feed!!.icon,
publishedAt = state.publishedAt!!,
locale = Locale.current.toLanguageTag(),
direction = layoutDirection
publishedAt = state.publishedAt!!
)

navigator.loadHtml(htmlTemplate, state.link)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.LineHeightStyle
import androidx.compose.ui.text.style.TextDirection
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import dev.sasikanth.rss.reader.utils.toSp
Expand All @@ -32,7 +33,12 @@ expect fun createDefaultTextStyle(): TextStyle
private val figmaLineHeightStyle =
LineHeightStyle(alignment = LineHeightStyle.Alignment.Center, trim = LineHeightStyle.Trim.None)

@Stable private val defaultTextStyle = createDefaultTextStyle()
@Stable
private val defaultTextStyle =
createDefaultTextStyle()
.copy(
textDirection = TextDirection.ContentOrLtr,
)

internal fun typography(fontFamily: FontFamily) =
Typography(
Expand All @@ -42,7 +48,7 @@ internal fun typography(fontFamily: FontFamily) =
fontWeight = FontWeight.Normal,
fontSize = 57.sp,
lineHeight = 64.sp,
lineHeightStyle = figmaLineHeightStyle
lineHeightStyle = figmaLineHeightStyle,
),
displayMedium =
defaultTextStyle.copy(
Expand Down

0 comments on commit 08fe1c4

Please sign in to comment.