Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.221.*] Pre-release merge #696

Merged
merged 3 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Steps to reproduce the behavior:
**Screenshots**
If applicable, add screenshots to help explain your problem.


**Feed Information**
Links to the feed that are having this issue

**Device Information**
- Device: [e.g. Pixel 7]
- OS: [e.g. Android 13]
Expand Down
13 changes: 13 additions & 0 deletions shared/src/commonMain/composeResources/files/reader/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,25 @@ figcaption {
font-size: 14px;
line-height: 1.6;
}
.row {
display: flex;
justify-content: center;
align-items: center;
}
.column {
margin-left: 16px;
flex: 1;
}
.caption {
font-size: 12px;
}
.feedName {
margin-bottom: 8px;
}
.feedIcon {
width: 32px;
height: auto;
}
img, figure, video, div, object {
max-width: 100%;
height: auto !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import dev.sasikanth.rss.reader.utils.getTodayStartInstant
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.MutableStateFlow
Expand Down Expand Up @@ -273,7 +272,6 @@ class HomePresenter(
}
}

@OptIn(FlowPreview::class)
private fun init() {
combine(observableActiveSource.activeSource, settingsRepository.postsType) {
activeSource,
Expand All @@ -286,6 +284,7 @@ class HomePresenter(
it.copy(
activeSource = activeSource,
postsType = postsType,
loadingState = HomeLoadingState.Loading,
featuredPosts = null,
posts = null
)
Expand Down Expand Up @@ -339,6 +338,7 @@ class HomePresenter(
NTuple4(activeSource, postsAfter, unreadOnly, featuredPostsIds)
}
}
.onEach { _state.update { it.copy(loadingState = HomeLoadingState.Idle) } }
.distinctUntilChanged()
.onEach { (activeSource, postsAfter, unreadOnly, featuredPostsIds) ->
val posts =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredHeight
import androidx.compose.foundation.layout.requiredSize
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.rememberScrollState
Expand Down Expand Up @@ -182,7 +180,7 @@ internal fun HomeScreen(
)
},
body = { paddingValues ->
Box {
Box(modifier = Modifier.fillMaxSize()) {
when {
hasFeeds == null || (posts == null || featuredPosts == null) -> {
// no-op
Expand Down Expand Up @@ -223,9 +221,7 @@ internal fun HomeScreen(
PullRefreshIndicator(
refreshing = state.isRefreshing,
state = swipeRefreshState,
modifier =
Modifier.windowInsetsPadding(WindowInsets.statusBars)
.align(Alignment.TopCenter)
modifier = Modifier.padding(paddingValues).align(Alignment.TopCenter)
)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ object ReaderHTML {
title: String,
feedName: String,
feedHomePageLink: String,
feedIcon: String,
publishedAt: String,
locale: String,
direction: LayoutDirection
Expand All @@ -37,6 +38,7 @@ object ReaderHTML {
postMetadata(
feedName = feedName,
feedHomePageLink = feedHomePageLink,
feedIcon = feedIcon,
publishedAt = publishedAt,
hasTitle = title.isNotBlank()
)
Expand Down Expand Up @@ -69,6 +71,7 @@ object ReaderHTML {
private fun postMetadata(
feedName: String,
feedHomePageLink: String,
feedIcon: String,
publishedAt: String,
hasTitle: Boolean,
): String {
Expand All @@ -77,10 +80,16 @@ object ReaderHTML {
appendLine("<hr class=\"top-divider\">")
}

// language=HTML
appendLine(
"""
<div class ="feedName"><a href='$feedHomePageLink'>$feedName</a></div>
<div class="caption">$publishedAt</div>
<div class="row">
<img class="feedIcon" src="$feedIcon" alt="Feed Icon">
<div class="column">
<div class ="feedName"><a href='$feedHomePageLink'>$feedName</a></div>
<div class="caption">$publishedAt</div>
</div>
</div>
<hr class="top-divider">
"""
.trimIndent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ internal fun ReaderScreen(
title = state.title!!,
feedName = state.feed!!.name,
feedHomePageLink = state.feed!!.homepageLink,
feedIcon = state.feed!!.icon,
publishedAt = state.publishedAt!!,
locale = Locale.current.toLanguageTag(),
direction = layoutDirection
Expand Down