Skip to content
Draft
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
1 change: 1 addition & 0 deletions app/src/main/java/to/bitkit/data/SettingsStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ data class SettingsData(
val backupWarningIgnoredMillis: Long = 0,
val notificationsIgnoredMillis: Long = 0,
val balanceWarningTimes: Int = 0,
val widgetsOnboardingHintDismissed: Boolean = false,
val coinSelectAuto: Boolean = true,
val coinSelectPreference: CoinSelectionPreference = CoinSelectionPreference.BranchAndBound,
val electrumServer: String = Env.electrumServerUrl,
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/to/bitkit/models/WidgetType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,9 @@ enum class WidgetType(
WEATHER(
iconRes = R.drawable.widget_cloud,
title = R.string.widgets__weather__name
),
SUGGESTIONS(
iconRes = R.drawable.widget_suggestions,
title = R.string.widgets__suggestions__name,
)
}
12 changes: 8 additions & 4 deletions app/src/main/java/to/bitkit/repositories/WidgetsRepo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class WidgetsRepo @Inject constructor(

private fun updateWidgetJobs(enabledWidgetTypes: Set<WidgetType>) {
val widgetTypesWithServices = WidgetType.entries.filter {
it != WidgetType.CALCULATOR
it != WidgetType.CALCULATOR && it != WidgetType.SUGGESTIONS
}

widgetTypesWithServices.forEach { widgetType ->
Expand Down Expand Up @@ -138,7 +138,9 @@ class WidgetsRepo @Inject constructor(
}
}

WidgetType.CALCULATOR -> throw NotImplementedError("Calculator widget doesn't need a service")
WidgetType.CALCULATOR,
WidgetType.SUGGESTIONS,
-> throw NotImplementedError("Widget doesn't need a service")
}

widgetJobs[widgetType] = job
Expand Down Expand Up @@ -226,8 +228,10 @@ class WidgetsRepo @Inject constructor(
widgetsStore.updateBlock(block)
}

WidgetType.CALCULATOR -> {
throw NotImplementedError("Calculator widget doesn't need a service")
WidgetType.CALCULATOR,
WidgetType.SUGGESTIONS,
-> {
throw NotImplementedError("Widget doesn't need a service")
}

WidgetType.FACTS -> updateWidget(factsService) { facts ->
Expand Down
16 changes: 15 additions & 1 deletion app/src/main/java/to/bitkit/ui/ContentView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ import to.bitkit.ui.screens.wallets.activity.TagSelectorSheet
import to.bitkit.ui.screens.wallets.receive.ReceiveSheet
import to.bitkit.ui.screens.wallets.suggestion.BuyIntroScreen
import to.bitkit.ui.screens.widgets.AddWidgetsScreen
import to.bitkit.ui.screens.widgets.suggestions.SuggestionsPreviewScreen
import to.bitkit.ui.screens.widgets.suggestions.SuggestionsViewModel
import to.bitkit.ui.screens.widgets.WidgetsIntroScreen
import to.bitkit.ui.screens.widgets.blocks.BlocksEditScreen
import to.bitkit.ui.screens.widgets.blocks.BlocksPreviewScreen
Expand Down Expand Up @@ -1393,10 +1395,19 @@ private fun NavGraphBuilder.widgets(
WidgetType.NEWS -> navController.navigate(Routes.HeadlinesPreview)
WidgetType.PRICE -> navController.navigate(Routes.PricePreview)
WidgetType.WEATHER -> navController.navigate(Routes.WeatherPreview)
WidgetType.SUGGESTIONS -> navController.navigate(Routes.SuggestionsPreview)
}
},
fiatSymbol = LocalCurrencies.current.currencySymbol,
onBackCLick = { navController.popBackStack() }
onBackCLick = { navController.popBackStack() },
)
}
composableWithDefaultTransitions<Routes.SuggestionsPreview> {
val viewModel = hiltViewModel<SuggestionsViewModel>()
SuggestionsPreviewScreen(
suggestionsViewModel = viewModel,
onClose = { navController.navigateToHome() },
onBack = { navController.popBackStack() },
)
}
composableWithDefaultTransitions<Routes.CalculatorPreview> {
Expand Down Expand Up @@ -1981,6 +1992,9 @@ sealed interface Routes {
@Serializable
data object AddWidget : Routes

@Serializable
data object SuggestionsPreview : Routes

@Serializable
data object Headlines : Routes

Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/to/bitkit/ui/components/SuggestionCard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
Expand Down Expand Up @@ -54,7 +55,6 @@ fun SuggestionCard(
description: String,
@DrawableRes icon: Int,
onClose: (() -> Unit)? = null,
size: Int = 152,
disableGlow: Boolean = false,
captionColor: Color = Colors.White64,
onClick: () -> Unit,
Expand All @@ -75,7 +75,8 @@ fun SuggestionCard(

Box(
modifier = modifier
.size(size.dp)
.fillMaxWidth()
.aspectRatio(1f)
.clip(ShapeDefaults.Large)
.then(
if (isDismissible || disableGlow) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ import to.bitkit.ui.theme.AppThemeSurface
import to.bitkit.ui.theme.Colors
import to.bitkit.ui.theme.Shapes

private const val SHOP_CARD_SIZE = 164

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ShopDiscoverScreen(
Expand Down Expand Up @@ -128,7 +126,7 @@ private fun ShopTabContent(
description = stringResource(R.string.other__shop__discover__gift_cards__description),
icon = R.drawable.gift,
captionColor = Colors.Gray1,
size = SHOP_CARD_SIZE,

disableGlow = true,
onClick = {
navigateWebView("gift-cards", title)
Expand All @@ -142,7 +140,7 @@ private fun ShopTabContent(
description = stringResource(R.string.other__shop__discover__esims__description),
icon = R.drawable.globe,
captionColor = Colors.Gray1,
size = SHOP_CARD_SIZE,

disableGlow = true,
onClick = {
navigateWebView("esims", title2)
Expand All @@ -163,7 +161,7 @@ private fun ShopTabContent(
description = stringResource(R.string.other__shop__discover__refill__description),
icon = R.drawable.phone,
captionColor = Colors.Gray1,
size = SHOP_CARD_SIZE,

disableGlow = true,
onClick = {
navigateWebView("refill", title)
Expand All @@ -176,7 +174,7 @@ private fun ShopTabContent(
title = title2,
description = stringResource(R.string.other__shop__discover__travel__description),
icon = R.drawable.rocket_2,
size = SHOP_CARD_SIZE,

disableGlow = true,
captionColor = Colors.Gray1,
onClick = {
Expand Down
Loading
Loading