diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/Routes.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/Routes.kt index e94e29581..d84b0b1cc 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/Routes.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/Routes.kt @@ -45,7 +45,7 @@ sealed class Route( hasNewItems = { accountViewModel, cache, context -> homeHasNewItems(accountViewModel, cache, context) }, buildScreen = { accountViewModel, _, navController -> { backStackEntry -> - HomeScreen(accountViewModel, navController, backStackEntry.arguments?.getBoolean("forceRefresh", false)) + HomeScreen(accountViewModel, navController, backStackEntry.arguments?.getBoolean("forceRefresh", false) ?: false) } } ) @@ -56,7 +56,7 @@ sealed class Route( arguments = listOf(navArgument("forceRefresh") { type = NavType.BoolType; defaultValue = false }), buildScreen = { acc, _, navController -> { backStackEntry -> - SearchScreen(acc, navController, backStackEntry.arguments?.getBoolean("forceRefresh", false)) + SearchScreen(acc, navController, backStackEntry.arguments?.getBoolean("forceRefresh", false) ?: false) } } ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedView.kt index bca089f1e..af98fe35c 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedView.kt @@ -42,11 +42,11 @@ fun FeedView( navController: NavController, routeForLastRead: String?, scrollStateKey: String? = null, - forceRefresh: Boolean? = false + forceRefresh: Boolean = false ) { val feedState by viewModel.feedContent.collectAsState() - var refreshing by remember { mutableStateOf(forceRefresh!!) } + var refreshing by remember { mutableStateOf(forceRefresh) } val refresh = { refreshing = true; viewModel.refresh(); refreshing = false } val pullRefreshState = rememberPullRefreshState(refreshing, onRefresh = refresh) @@ -77,7 +77,7 @@ fun FeedView( accountViewModel, navController, scrollStateKey, - forceRefresh!! + forceRefresh ) } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HomeScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HomeScreen.kt index 0e80382ec..203684542 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HomeScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HomeScreen.kt @@ -39,7 +39,7 @@ import kotlinx.coroutines.launch @OptIn(ExperimentalPagerApi::class) @Composable -fun HomeScreen(accountViewModel: AccountViewModel, navController: NavController, forceRefresh: Boolean? = false) { +fun HomeScreen(accountViewModel: AccountViewModel, navController: NavController, forceRefresh: Boolean = false) { val accountState by accountViewModel.accountLiveData.observeAsState() val account = accountState?.account ?: return diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/SearchScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/SearchScreen.kt index f74e4f553..c4dbfaab3 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/SearchScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/SearchScreen.kt @@ -79,7 +79,7 @@ import kotlinx.coroutines.withContext import kotlinx.coroutines.channels.Channel as CoroutineChannel @Composable -fun SearchScreen(accountViewModel: AccountViewModel, navController: NavController, forceRefresh: Boolean? = false) { +fun SearchScreen(accountViewModel: AccountViewModel, navController: NavController, forceRefresh: Boolean = false) { val accountState by accountViewModel.accountLiveData.observeAsState() val account = accountState?.account ?: return