Skip to content

Commit

Permalink
[1.87.*] Pre-release merge (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
tramline-github[bot] authored Mar 2, 2024
2 parents d7d071d + d881559 commit 303b112
Show file tree
Hide file tree
Showing 15 changed files with 856 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class FeedParser(private val dispatchersProvider: DispatchersProvider) {

internal const val TAG_TITLE = "title"
internal const val TAG_LINK = "link"
internal const val TAG_URL = "url"
internal const val TAG_DESCRIPTION = "description"
internal const val TAG_ENCLOSURE = "enclosure"
internal const val TAG_CONTENT_ENCODED = "content:encoded"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import dev.sasikanth.rss.reader.core.network.parser.FeedParser.Companion.TAG_PUB
import dev.sasikanth.rss.reader.core.network.parser.FeedParser.Companion.TAG_RSS_CHANNEL
import dev.sasikanth.rss.reader.core.network.parser.FeedParser.Companion.TAG_RSS_ITEM
import dev.sasikanth.rss.reader.core.network.parser.FeedParser.Companion.TAG_TITLE
import dev.sasikanth.rss.reader.core.network.parser.FeedParser.Companion.TAG_URL
import dev.sasikanth.rss.reader.util.dateStringToEpochMillis
import io.ktor.http.Url
import kotlinx.datetime.Clock
Expand Down Expand Up @@ -114,7 +115,7 @@ internal object RssContentParser : ContentParser() {
name == TAG_TITLE -> {
title = readTagText(name, parser)
}
name == TAG_LINK -> {
link.isNullOrBlank() && (name == TAG_LINK || name == TAG_URL) -> {
link = readTagText(name, parser)
}
name == TAG_ENCLOSURE && link.isNullOrBlank() -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* Copyright 2024 Sasikanth Miriyampalli
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dev.sasikanth.rss.reader.resources.icons

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.EvenOdd
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp

val TwineIcons.NewTag: ImageVector
get() {
if (newTag != null) {
return newTag!!
}
newTag =
Builder(
name = "NewTag",
defaultWidth = 24.0.dp,
defaultHeight = 24.0.dp,
viewportWidth = 24.0f,
viewportHeight = 24.0f
)
.apply {
path(
fill = SolidColor(Color(0xFF000000)),
stroke = null,
strokeLineWidth = 0.0f,
strokeLineCap = Butt,
strokeLineJoin = Miter,
strokeLineMiter = 4.0f,
pathFillType = EvenOdd
) {
moveTo(5.0f, 6.0f)
curveTo(5.0f, 5.4477f, 5.4477f, 5.0f, 6.0f, 5.0f)
horizontalLineTo(11.3551f)
curveTo(11.7529f, 5.0f, 12.1344f, 5.158f, 12.4157f, 5.4393f)
lineTo(19.7087f, 12.7323f)
curveTo(20.0992f, 13.1228f, 20.0992f, 13.756f, 19.7087f, 14.1465f)
lineTo(18.9734f, 14.8818f)
curveTo(18.5829f, 15.2723f, 18.5829f, 15.9055f, 18.9734f, 16.296f)
curveTo(19.364f, 16.6865f, 19.9971f, 16.6865f, 20.3876f, 16.296f)
lineTo(21.1229f, 15.5607f)
curveTo(22.2945f, 14.3892f, 22.2945f, 12.4897f, 21.1229f, 11.3181f)
lineTo(13.8299f, 4.0251f)
curveTo(13.1736f, 3.3688f, 12.2833f, 3.0f, 11.3551f, 3.0f)
horizontalLineTo(6.0f)
curveTo(4.3431f, 3.0f, 3.0f, 4.3432f, 3.0f, 6.0f)
verticalLineTo(11.3551f)
curveTo(3.0f, 12.2833f, 3.3688f, 13.1736f, 4.0251f, 13.8299f)
lineTo(5.8905f, 15.6953f)
curveTo(6.281f, 16.0858f, 6.9142f, 16.0858f, 7.3047f, 15.6953f)
curveTo(7.6952f, 15.3048f, 7.6952f, 14.6716f, 7.3047f, 14.2811f)
lineTo(5.4393f, 12.4157f)
curveTo(5.158f, 12.1344f, 5.0f, 11.7529f, 5.0f, 11.3551f)
verticalLineTo(6.0f)
close()
moveTo(9.3f, 8.0f)
curveTo(9.3f, 8.718f, 8.718f, 9.3f, 8.0f, 9.3f)
curveTo(7.282f, 9.3f, 6.7f, 8.718f, 6.7f, 8.0f)
curveTo(6.7f, 7.282f, 7.282f, 6.7f, 8.0f, 6.7f)
curveTo(8.718f, 6.7f, 9.3f, 7.282f, 9.3f, 8.0f)
close()
moveTo(13.0f, 14.0f)
curveTo(13.5523f, 14.0f, 14.0f, 14.4477f, 14.0f, 15.0f)
verticalLineTo(18.0f)
horizontalLineTo(17.0f)
curveTo(17.5523f, 18.0f, 18.0f, 18.4477f, 18.0f, 19.0f)
curveTo(18.0f, 19.5523f, 17.5523f, 20.0f, 17.0f, 20.0f)
horizontalLineTo(14.0f)
verticalLineTo(23.0f)
curveTo(14.0f, 23.5523f, 13.5523f, 24.0f, 13.0f, 24.0f)
curveTo(12.4477f, 24.0f, 12.0f, 23.5523f, 12.0f, 23.0f)
verticalLineTo(20.0f)
horizontalLineTo(9.0f)
curveTo(8.4477f, 20.0f, 8.0f, 19.5523f, 8.0f, 19.0f)
curveTo(8.0f, 18.4477f, 8.4477f, 18.0f, 9.0f, 18.0f)
horizontalLineTo(12.0f)
verticalLineTo(15.0f)
curveTo(12.0f, 14.4477f, 12.4477f, 14.0f, 13.0f, 14.0f)
close()
}
}
.build()
return newTag!!
}

private var newTag: ImageVector? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
* Copyright 2024 Sasikanth Miriyampalli
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dev.sasikanth.rss.reader.resources.icons

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType.Companion.EvenOdd
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp

val TwineIcons.Tag: ImageVector
get() {
if (tag != null) {
return tag!!
}
tag =
Builder(
name = "Tag",
defaultWidth = 24.0.dp,
defaultHeight = 24.0.dp,
viewportWidth = 24.0f,
viewportHeight = 24.0f
)
.apply {
path(
fill = SolidColor(Color(0xFF000000)),
stroke = null,
strokeLineWidth = 0.0f,
strokeLineCap = Butt,
strokeLineJoin = Miter,
strokeLineMiter = 4.0f,
pathFillType = EvenOdd
) {
moveTo(6.0f, 5.0f)
curveTo(5.4477f, 5.0f, 5.0f, 5.4477f, 5.0f, 6.0f)
verticalLineTo(11.3551f)
curveTo(5.0f, 11.7529f, 5.158f, 12.1344f, 5.4393f, 12.4157f)
lineTo(12.7323f, 19.7087f)
curveTo(13.1228f, 20.0992f, 13.756f, 20.0992f, 14.1465f, 19.7087f)
lineTo(19.7087f, 14.1465f)
curveTo(20.0992f, 13.756f, 20.0992f, 13.1228f, 19.7087f, 12.7323f)
lineTo(12.4157f, 5.4393f)
curveTo(12.1344f, 5.158f, 11.7529f, 5.0f, 11.3551f, 5.0f)
horizontalLineTo(6.0f)
close()
moveTo(3.0f, 6.0f)
curveTo(3.0f, 4.3432f, 4.3431f, 3.0f, 6.0f, 3.0f)
horizontalLineTo(11.3551f)
curveTo(12.2833f, 3.0f, 13.1736f, 3.3688f, 13.8299f, 4.0251f)
lineTo(21.1229f, 11.3181f)
curveTo(22.2945f, 12.4897f, 22.2945f, 14.3892f, 21.1229f, 15.5607f)
lineTo(15.5607f, 21.1229f)
curveTo(14.3892f, 22.2945f, 12.4897f, 22.2945f, 11.3181f, 21.1229f)
lineTo(4.0251f, 13.8299f)
curveTo(3.3688f, 13.1736f, 3.0f, 12.2833f, 3.0f, 11.3551f)
verticalLineTo(6.0f)
close()
}
path(
fill = SolidColor(Color(0xFF000000)),
stroke = null,
strokeLineWidth = 0.0f,
strokeLineCap = Butt,
strokeLineJoin = Miter,
strokeLineMiter = 4.0f,
pathFillType = NonZero
) {
moveTo(9.3f, 7.9999f)
curveTo(9.3f, 8.7179f, 8.718f, 9.2999f, 8.0f, 9.2999f)
curveTo(7.282f, 9.2999f, 6.7f, 8.7179f, 6.7f, 7.9999f)
curveTo(6.7f, 7.282f, 7.282f, 6.7f, 8.0f, 6.7f)
curveTo(8.718f, 6.7f, 9.3f, 7.282f, 9.3f, 7.9999f)
close()
}
}
.build()
return tag!!
}

private var tag: ImageVector? = null
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,13 @@ val EnTwineStrings =
delete = "Delete",
removeFeedDesc = { "Do you want to remove \"${it}\"?" },
alwaysFetchSourceArticle = "Always fetch source article in Reading View",
getFeedInfo = "Get Info"
getFeedInfo = "Get Info",
newTag = "New tag",
tags = "Tags",
addTagTitle = "Add tag",
tagNameHint = "Name",
tagSaveButton = "Save",
deleteTagTitle = "Delete tag?",
deleteTagDesc =
"Tag will be deleted and removed from all the assigned feeds. Your feeds won't be deleted"
)
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,14 @@ data class TwineStrings(
val delete: String,
val removeFeedDesc: (String) -> String,
val alwaysFetchSourceArticle: String,
val getFeedInfo: String
val getFeedInfo: String,
val newTag: String,
val tags: String,
val addTagTitle: String,
val tagNameHint: String,
val tagSaveButton: String,
val deleteTagTitle: String,
val deleteTagDesc: String,
)

object Locales {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,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.tags.ui.TagsScreen
import dev.sasikanth.rss.reader.utils.LocalWindowSizeClass
import me.tatarka.inject.annotations.Inject

Expand Down Expand Up @@ -104,6 +105,9 @@ fun App(
is Screen.Reader -> {
ReaderScreen(presenter = screen.presenter, modifier = fillMaxSizeModifier)
}
is Screen.Tags -> {
TagsScreen(tagsPresenter = screen.presenter, modifier = fillMaxSizeModifier)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import dev.sasikanth.rss.reader.repository.RssRepository
import dev.sasikanth.rss.reader.repository.SettingsRepository
import dev.sasikanth.rss.reader.search.SearchPresentFactory
import dev.sasikanth.rss.reader.settings.SettingsPresenterFactory
import dev.sasikanth.rss.reader.tags.TagsPresenterFactory
import dev.sasikanth.rss.reader.util.DispatchersProvider
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob
Expand All @@ -65,6 +66,7 @@ class AppPresenter(
private val aboutPresenter: AboutPresenterFactory,
private val readerPresenter: ReaderPresenterFactory,
private val feedPresenter: FeedPresenterFactory,
private val tagsPresenter: TagsPresenterFactory,
private val lastUpdatedAt: LastUpdatedAt,
private val rssRepository: RssRepository,
private val settingsRepository: SettingsRepository,
Expand Down Expand Up @@ -163,6 +165,16 @@ class AppPresenter(
presenter = readerPresenter(config.postLink, componentContext) { navigation.pop() }
)
}
is Config.Tags -> {
Screen.Tags(
presenter =
tagsPresenter(
componentContext,
) {
navigation.pop()
}
)
}
}

private fun openPost(postLink: String) {
Expand Down Expand Up @@ -216,6 +228,8 @@ class AppPresenter(
@Serializable data object About : Config

@Serializable data class Reader(val postLink: String) : Config

@Serializable data object Tags : Config
}

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import dev.sasikanth.rss.reader.home.HomePresenter
import dev.sasikanth.rss.reader.reader.ReaderPresenter
import dev.sasikanth.rss.reader.search.SearchPresenter
import dev.sasikanth.rss.reader.settings.SettingsPresenter
import dev.sasikanth.rss.reader.tags.TagsPresenter

internal sealed interface Screen {
class Home(val presenter: HomePresenter) : Screen
Expand All @@ -34,4 +35,6 @@ internal sealed interface Screen {
class About(val presenter: AboutPresenter) : Screen

class Reader(val presenter: ReaderPresenter) : Screen

class Tags(val presenter: TagsPresenter) : Screen
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class TagRepository(
}
}

// TODO: Remove assigned tags from feeds as well
suspend fun deleteTag(id: Uuid) = withContext(dispatchersProvider.io) { tagQueries.deleteTag(id) }

suspend fun updatedTag(label: String, id: Uuid) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2024 Sasikanth Miriyampalli
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package dev.sasikanth.rss.reader.tags

import com.benasher44.uuid.Uuid

sealed interface TagsEvent {

data object Init : TagsEvent

data class CreateTag(val label: String) : TagsEvent

data object BackClicked : TagsEvent

data class OnTagNameChanged(val tagId: Uuid, val label: String) : TagsEvent

data class OnDeleteTag(val tagId: Uuid) : TagsEvent
}
Loading

0 comments on commit 303b112

Please sign in to comment.