@@ -164,6 +164,7 @@ fun HomeScreen(
164164 composable<HomeRoutes .Home > {
165165 val homeViewModel: HomeViewModel = hiltViewModel()
166166 val suggestions by homeViewModel.suggestions.collectAsStateWithLifecycle()
167+ val showWidgets by homeViewModel.showWidgets.collectAsStateWithLifecycle(initialValue = true )
167168 val context = LocalContext .current
168169 val hasSeenTransferIntro by settingsViewModel.hasSeenTransferIntro.collectAsStateWithLifecycle()
169170 val hasSeenShopIntro by settingsViewModel.hasSeenShopIntro.collectAsStateWithLifecycle()
@@ -174,6 +175,7 @@ fun HomeScreen(
174175
175176 HomeContentView (
176177 uiState = uiState,
178+ showWidgets = showWidgets,
177179 article = article,
178180 suggestions = suggestions,
179181 rootNavController = rootNavController,
@@ -325,6 +327,7 @@ fun HomeScreen(
325327private fun HomeContentView (
326328 uiState : MainUiState ,
327329 article : ArticleModel ? ,
330+ showWidgets : Boolean ,
328331 suggestions : List <Suggestion >,
329332 onRemoveSuggestion : (Suggestion ) -> Unit ,
330333 onClickSuggestion : (Suggestion ) -> Unit ,
@@ -423,35 +426,41 @@ private fun HomeContentView(
423426 }
424427 }
425428 }
426- Spacer (modifier = Modifier .height(32 .dp))
427- Text13Up (stringResource(R .string.widgets__widgets), color = Colors .White64 ) // TODO check widgets visibility from settings
428429
429- Column (modifier = Modifier .fillMaxWidth()) { // TODO IMPLEMENT DRAGABLE IN OTHER PR
430- Spacer (modifier = Modifier .height(16 .dp))
430+ if (showWidgets) {
431+ Spacer (modifier = Modifier .height(32 .dp))
432+ Text13Up (
433+ stringResource(R .string.widgets__widgets),
434+ color = Colors .White64
435+ )
431436
432- article?.let {
433- HeadlineCard ( // TODO CHECK PREFERENCES
434- modifier = Modifier .fillMaxWidth(),
435- headline = article.title,
436- time = article.timeAgo,
437- source = article.publisher,
438- link = article.link
439- )
437+ Column (modifier = Modifier .fillMaxWidth()) { // TODO IMPLEMENT DRAGABLE IN OTHER PR
438+ Spacer (modifier = Modifier .height(16 .dp))
439+
440+ article?.let {
441+ HeadlineCard ( // TODO CHECK PREFERENCES
442+ modifier = Modifier .fillMaxWidth(),
443+ headline = article.title,
444+ time = article.timeAgo,
445+ source = article.publisher,
446+ link = article.link
447+ )
448+ }
440449 }
450+ Spacer (modifier = Modifier .height(32 .dp))
451+ TertiaryButton (
452+ text = stringResource(R .string.widgets__add),
453+ icon = {
454+ Icon (
455+ painter = painterResource(R .drawable.ic_plus),
456+ contentDescription = null ,
457+ tint = Colors .White80
458+ )
459+ },
460+ onClick = onClickAddWidget
461+ )
441462 }
442463 Spacer (modifier = Modifier .height(32 .dp))
443- TertiaryButton (
444- text = stringResource(R .string.widgets__add),
445- icon = {
446- Icon (
447- painter = painterResource(R .drawable.ic_plus),
448- contentDescription = null ,
449- tint = Colors .White80
450- )
451- },
452- onClick = onClickAddWidget
453- )
454- Spacer (modifier = Modifier .height(32 .dp))
455464 Text13Up (stringResource(R .string.wallet__activity), color = Colors .White64 )
456465 Spacer (modifier = Modifier .height(16 .dp))
457466 val activity = activityListViewModel ? : return @Column
@@ -532,7 +541,8 @@ private fun HomeContentViewPreview() {
532541 onClickSuggestion = {},
533542 onRemoveSuggestion = {},
534543 onClickAddWidget = {},
535- article = null
544+ article = null ,
545+ showWidgets = true ,
536546 )
537547 }
538548}
0 commit comments