Skip to content

Commit

Permalink
[1.119.*] Pre-release merge (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
tramline-github[bot] authored Apr 10, 2024
2 parents 522af54 + 3600f79 commit e4d0804
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,8 @@ class AppPresenter(
navigation.push(Config.Reader(postLink))
} else {
linkHandler.openLink(postLink)
rssRepository.updatePostReadStatus(read = true, link = postLink)
}

rssRepository.updatePostReadStatus(read = true, link = postLink)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ sealed interface ReaderEvent {
data object TogglePostBookmark : ReaderEvent

data object ArticleShortcutClicked : ReaderEvent

data object MarkPostAsRead : ReaderEvent
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.arkivanov.decompose.ComponentContext
import com.arkivanov.essenty.instancekeeper.InstanceKeeper
import com.arkivanov.essenty.instancekeeper.getOrCreate
import com.arkivanov.essenty.lifecycle.doOnCreate
import com.arkivanov.essenty.lifecycle.doOnDestroy
import dev.sasikanth.readability.Readability
import dev.sasikanth.rss.reader.core.network.post.PostSourceFetcher
import dev.sasikanth.rss.reader.reader.ReaderState.PostMode.Idle
Expand Down Expand Up @@ -70,6 +71,7 @@ class ReaderPresenter(

init {
lifecycle.doOnCreate { presenterInstance.dispatch(ReaderEvent.Init(postLink)) }
lifecycle.doOnDestroy { presenterInstance.dispatch(ReaderEvent.MarkPostAsRead) }
}

internal val state = presenterInstance.state
Expand Down Expand Up @@ -110,9 +112,14 @@ class ReaderPresenter(
}
ReaderEvent.TogglePostBookmark -> togglePostBookmark(postLink)
ReaderEvent.ArticleShortcutClicked -> articleShortcutClicked()
ReaderEvent.MarkPostAsRead -> markPostAsRead(postLink)
}
}

private fun markPostAsRead(postLink: String) {
coroutineScope.launch { rssRepository.updatePostReadStatus(read = true, link = postLink) }
}

private fun togglePostBookmark(postLink: String) {
coroutineScope.launch {
val isBookmarked = state.value.isBookmarked ?: false
Expand Down

0 comments on commit e4d0804

Please sign in to comment.