Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@ fun NavigationState.toEntries(
entryProvider: (NavKey) -> NavEntry<NavKey>,
): SnapshotStateList<NavEntry<NavKey>> {
val decoratedEntries = subStacks.mapValues { (_, stack) ->

val decorators = listOf(
rememberSaveableStateHolderNavEntryDecorator<NavKey>(),
rememberViewModelStoreNavEntryDecorator<NavKey>(),
rememberViewModelStoreNavEntryDecorator<NavKey>(
removeViewModelStoreOnPop = { true }
),
)

rememberDecoratedNavEntries(
backStack = stack,
entryDecorators = decorators,
Expand All @@ -100,3 +104,4 @@ fun NavigationState.toEntries(
.flatMap { decoratedEntries[it] ?: emptyList() }
.toMutableStateList()
}

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.google.samples.apps.nowinandroid.feature.topic.impl

import android.util.Log
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.google.samples.apps.nowinandroid.core.common.result.Result
Expand Down Expand Up @@ -46,6 +47,7 @@ class TopicViewModel @AssistedInject constructor(
userNewsResourceRepository: UserNewsResourceRepository,
@Assisted val topicId: String,
) : ViewModel() {

val topicUiState: StateFlow<TopicUiState> = topicUiState(
topicId = topicId,
userDataRepository = userDataRepository,
Expand All @@ -71,6 +73,7 @@ class TopicViewModel @AssistedInject constructor(
fun followTopicToggle(followed: Boolean) {
viewModelScope.launch {
userDataRepository.setTopicIdFollowed(topicId, followed)

}
}

Expand All @@ -86,6 +89,7 @@ class TopicViewModel @AssistedInject constructor(
}
}


@AssistedFactory
interface Factory {
fun create(
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
accompanist = "0.37.0"
androidDesugarJdkLibs = "2.1.4"
# AGP and tools should be updated together
androidGradlePlugin = "9.0.0"
androidTools = "32.0.0"
androidGradlePlugin = "9.0.1"
androidTools = "32.0.1"
androidxActivity = "1.9.3"
androidxAppCompat = "1.7.0"
androidxBrowser = "1.8.0"
Expand Down