Skip to content

Commit

Permalink
improvement: Always show New item button, even if Premium is not yet …
Browse files Browse the repository at this point in the history
…active
  • Loading branch information
AChep committed Jan 11, 2025
1 parent 46fbab6 commit d21badc
Showing 1 changed file with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import com.artemchep.keyguard.feature.decorator.ItemDecoratorTitle
import com.artemchep.keyguard.feature.duplicates.list.createCipherSelectionFlow
import com.artemchep.keyguard.feature.filter.CipherFiltersRoute
import com.artemchep.keyguard.feature.generator.history.mapLatestScoped
import com.artemchep.keyguard.feature.home.settings.subscriptions.SubscriptionsSettingsRoute
import com.artemchep.keyguard.feature.home.vault.VaultRoute
import com.artemchep.keyguard.feature.home.vault.add.AddRoute
import com.artemchep.keyguard.feature.home.vault.add.LeAddRoute
Expand Down Expand Up @@ -1628,8 +1629,30 @@ fun vaultListScreenState(
canWrite && itemIds.isEmpty()
},
) { state, canWrite ->
// If the paywall is active, then replace actions with
// a link to the paywall. This is needed because too
// many users think that the app doesn't support adding
// new items.
//
// That's a bit unfortunate tho, because I'd like to
// keep the interface clean and hide stuff that is not
// active.
if (!canWrite && state.primaryActions.isNotEmpty()) {
val primaryActions = listOf(
FlatItemAction(
title = TextHolder.Res(Res.string.settings_subscriptions_header_title),
onClick = {
val intent = NavigationIntent.NavigateToRoute(SubscriptionsSettingsRoute)
navigate(intent)
},
)
)
return@combine state.copy(
primaryActions = primaryActions,
)
}
state.copy(
primaryActions = state.primaryActions.takeIf { canWrite }.orEmpty(),
primaryActions = state.primaryActions,
)
}.combine(actionsFlow) { state, actions ->
state.copy(
Expand Down

0 comments on commit d21badc

Please sign in to comment.