From 08b5c5e0f5fb128ebb2d4d01383deea0f02dee4d Mon Sep 17 00:00:00 2001 From: Ash Date: Sat, 30 Apr 2022 17:51:18 +0800 Subject: [PATCH] Fix opposite starred and unread descriptions --- .github/workflows/build_pull_request.yaml | 20 +++++++++++++++++++ .../ui/page/home/feeds/FeedsViewModel.kt | 8 +++----- 2 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/build_pull_request.yaml diff --git a/.github/workflows/build_pull_request.yaml b/.github/workflows/build_pull_request.yaml new file mode 100644 index 0000000..e87bad9 --- /dev/null +++ b/.github/workflows/build_pull_request.yaml @@ -0,0 +1,20 @@ +name: "Build Pull Request" +on: pull_request + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + distribution: temurin + java-version: 11 + + - uses: gradle/gradle-build-action@v2 + - run: gradle assembleRelease + + - uses: actions/upload-artifact@v3 + with: + name: ${{ github.sha }} + path: app/build/outputs/apk/release/*.apk \ No newline at end of file diff --git a/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsViewModel.kt b/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsViewModel.kt index 541b890..39cc5bf 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsViewModel.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsViewModel.kt @@ -102,15 +102,13 @@ class FeedsViewModel @Inject constructor( } } groupWithFeedList - }.onStart { - }.onEach { groupWithFeedList -> _viewState.update { it.copy( importantCount = groupWithFeedList.sumOf { it.group.important ?: 0 }.run { when { - isStarred -> stringsRepository.getString(R.string.unread_desc, this) - isUnread -> stringsRepository.getString(R.string.starred_desc, this) + isStarred -> stringsRepository.getString(R.string.starred_desc, this) + isUnread -> stringsRepository.getString(R.string.unread_desc, this) else -> stringsRepository.getString(R.string.all_desc, this) } }, @@ -118,7 +116,7 @@ class FeedsViewModel @Inject constructor( feedsVisible = List(groupWithFeedList.size, init = { true }) ) } - }.catch() { + }.catch { Log.e("RLog", "catch in articleRepository.pullFeeds(): ${it.message}") }.flowOn(Dispatchers.Default).collect() }