Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
59cbdba
chore: add widgetsOnboardingHintDismissed flag
jvsena42 Feb 18, 2026
7256873
feat: update HomeUiState with new fields
jvsena42 Feb 18, 2026
7c813a3
feat: update HomeViewModel with page tracking and hint logic
jvsena42 Feb 18, 2026
49fabc5
chore: simplify ActivityListSimple
jvsena42 Feb 18, 2026
c81eb53
chore: add string resources and drawable
jvsena42 Feb 18, 2026
764a92f
feat: restructure HomeScreen with VerticalPager
jvsena42 Feb 18, 2026
0dc1ddb
feat: change SuggestionCard to use aspectRatio instead of fixed size
jvsena42 Feb 18, 2026
f58a288
feat: convert suggestion list into a grid
jvsena42 Feb 18, 2026
6db1be5
feat: add Suggestions entry to AddWidgetsScreen
jvsena42 Feb 18, 2026
7cf6cd1
feat: create SuggestionsPreviewScreen and wire navigation
jvsena42 Feb 18, 2026
f59d13c
chore: lint
jvsena42 Feb 18, 2026
634af1d
feat: replace autogenerated icons
jvsena42 Feb 19, 2026
b134eb0
feat: make suggestions a widget type
jvsena42 Feb 19, 2026
eb3a667
fix: check for pending transfer on showEmptyState
jvsena42 Feb 23, 2026
c315002
Merge branch 'master' into feat/home-redesign
jvsena42 Feb 23, 2026
63d4e38
fix: replace icon with image
jvsena42 Feb 23, 2026
bd60dbc
fix: implement Headline24 style
jvsena42 Feb 23, 2026
2d0ca86
fix: accent tag
jvsena42 Feb 23, 2026
10b1da1
feat: image padding
jvsena42 Feb 23, 2026
6689065
Merge remote-tracking branch 'origin/feat/home-redesign' into feat/ho…
jvsena42 Feb 23, 2026
907df7d
fix: bottom padding
jvsena42 Feb 23, 2026
ce97fcc
fix: cards alignment
jvsena42 Feb 23, 2026
e91c097
fix: close suggestion icon color
jvsena42 Feb 23, 2026
169df7b
fix: show all padding
jvsena42 Feb 23, 2026
767d5cd
fix: update show all label
jvsena42 Feb 23, 2026
9dc135c
fix: TabBar height
jvsena42 Feb 23, 2026
ad0ab3e
fix: TabBar bottom padding
jvsena42 Feb 23, 2026
1d91ee0
fix: remove empty state bottom padding
jvsena42 Feb 23, 2026
37180db
fix: support icon height
jvsena42 Feb 23, 2026
adf2779
feat: update default widgets set
jvsena42 Feb 23, 2026
6b3b144
feat: icon edit widget
jvsena42 Feb 23, 2026
37c4985
fix: drawer icon color
jvsena42 Feb 23, 2026
bbed759
fix: remove unnecessary spacer
jvsena42 Feb 23, 2026
8a97b12
fix: icon color
jvsena42 Feb 23, 2026
4744405
Merge branch 'master' into feat/home-redesign
jvsena42 Mar 4, 2026
b963072
feat: display balances section on empty state
jvsena42 Mar 4, 2026
29a1278
feat: default widgets
jvsena42 Mar 4, 2026
8793e70
fix: onboarding hint text and alightment
jvsena42 Mar 4, 2026
12784ed
chore: add immutable annotation
jvsena42 Mar 4, 2026
ee63974
chore: add stable annotation annotation
jvsena42 Mar 4, 2026
bade558
refactor: remove navController from inner composables to improve stab…
jvsena42 Mar 4, 2026
5e3ff4b
chore: add immutability annotation
jvsena42 Mar 4, 2026
40bea4c
chore: add more preview cases
jvsena42 Mar 4, 2026
86f3368
fix: initial page state
jvsena42 Mar 4, 2026
4044a1e
chore: match preview with default widgets
jvsena42 Mar 4, 2026
cb1107c
fix: match home screen paddings to ios
jvsena42 Mar 4, 2026
7535f59
fix: roolback balance header space
jvsena42 Mar 4, 2026
789344e
fix: rollback space
jvsena42 Mar 4, 2026
08d5105
fix: divider color
jvsena42 Mar 4, 2026
7691b95
fix: match letter spacing with ios
jvsena42 Mar 4, 2026
5889531
fix: prefix font weight
jvsena42 Mar 4, 2026
65b1ade
fix: skip last spacer
jvsena42 Mar 4, 2026
1d49b6e
fix: reimport icons with padding
jvsena42 Mar 4, 2026
c54654b
fix: suggestions order
jvsena42 Mar 5, 2026
9d3e149
fix: suggestion title padding
jvsena42 Mar 5, 2026
37c0fc3
fix: card dimensions
jvsena42 Mar 5, 2026
7b5f739
fix: reimport image
jvsena42 Mar 5, 2026
34e7a8a
fix: BlockCard.kt styles
jvsena42 Mar 5, 2026
8fa9f50
fix: banner padding
jvsena42 Mar 5, 2026
9f57678
fix: banner icon size
jvsena42 Mar 5, 2026
66f0a9b
merge: master into feat/home-redesign
jvsena42 Mar 5, 2026
bf6b9f3
fix: match spacing with figma
jvsena42 Mar 5, 2026
f013116
fix: preserve widget order during edit mode
jvsena42 Mar 5, 2026
0ccd103
chore: lint
jvsena42 Mar 5, 2026
5f284a9
fix: remove spacer
jvsena42 Mar 5, 2026
027cbac
chore: lint
jvsena42 Mar 5, 2026
f41a2f1
chore: lint
jvsena42 Mar 5, 2026
119a5f1
fix: restore FillHeight
jvsena42 Mar 5, 2026
7aaab3f
fix: remove news from default
jvsena42 Mar 5, 2026
86bc245
fix: hide empty state when no balance but has previous txs
jvsena42 Mar 5, 2026
52f701e
Merge branch 'master' into feat/home-redesign
jvsena42 Mar 5, 2026
2b2ba57
fet: implement disabled widgets UI on add widget screen
jvsena42 Mar 5, 2026
9d03353
feat: implement disabled widgets UI on add widget screen
jvsena42 Mar 5, 2026
8c961eb
Merge remote-tracking branch 'origin/feat/home-redesign' into feat/ho…
jvsena42 Mar 5, 2026
83f0338
fix: replace hardcoded width with line breaking
jvsena42 Mar 5, 2026
1cdc5cf
fix: update widgets state when deleting
jvsena42 Mar 5, 2026
b79df49
fix: always add a new widget on the last position
jvsena42 Mar 5, 2026
8df6412
fix: disable edit mode when adding a widget
jvsena42 Mar 5, 2026
f38c8d1
feat: reduce vertical pager swipe threshold
jvsena42 Mar 5, 2026
3bf9028
chore: lint
jvsena42 Mar 8, 2026
5d86631
fix: widget editing background
jvsena42 Mar 8, 2026
2f1b501
fix: remove alpha
jvsena42 Mar 8, 2026
96da0ab
fix: move drag detection to WidgetActionDrag long press
jvsena42 Mar 8, 2026
1275700
fix: isDragging style
jvsena42 Mar 8, 2026
b238bd3
fix: fetch widgets earlier
jvsena42 Mar 8, 2026
bc7fd23
fix: don't uppercase the time of banner text
jvsena42 Mar 8, 2026
c9f6ee3
fix: scroll gestures leaking to home trough back stack
jvsena42 Mar 9, 2026
f36d404
Merge branch 'master' into feat/home-redesign
jvsena42 Mar 9, 2026
8a570a5
feat: remove icon add
jvsena42 Mar 9, 2026
6e380ad
update test id
piotr-iohk Mar 9, 2026
0990e9a
fix: implement blockPointerInputPassthrough to prevent pointer events…
jvsena42 Mar 9, 2026
e934bea
Merge remote-tracking branch 'origin/feat/home-redesign' into feat/ho…
jvsena42 Mar 9, 2026
9be38b6
fix: remove the isDragging altha
jvsena42 Mar 9, 2026
8e9e827
fix: disable pager when editing widgets
jvsena42 Mar 9, 2026
e799afb
fix: parallelize widget refresh
jvsena42 Mar 9, 2026
57bfe6e
fix: stiffen pager snap animation to prevent midway stop
jvsena42 Mar 10, 2026
eade2c5
Merge branch 'master' into feat/home-redesign
jvsena42 Mar 10, 2026
4163a76
chore: lint
jvsena42 Mar 10, 2026
a3dfce0
chore: make composable private
jvsena42 Mar 10, 2026
9896fe1
fix: skip calculator and suggestions update
jvsena42 Mar 10, 2026
03db7fb
fix: add defensive validation for drag coroutine
jvsena42 Mar 10, 2026
2e36100
Merge branch 'master' into feat/home-redesign
jvsena42 Mar 10, 2026
501f6ec
Merge branch 'master' into feat/home-redesign
jvsena42 Mar 12, 2026
11a559c
fix: typo
jvsena42 Mar 12, 2026
5c080ca
refactor: replace Spacer with VerticalSpacer
jvsena42 Mar 12, 2026
538b212
chore: lint
jvsena42 Mar 12, 2026
247c8f3
chore: reduce getActivities calls and uiState race condition scenario
jvsena42 Mar 12, 2026
7cca77b
chore: remove curly braces
jvsena42 Mar 13, 2026
9f235ed
refactor: replace hardcoded animation duration
jvsena42 Mar 13, 2026
4ee61f3
chore: remove curly braces
jvsena42 Mar 13, 2026
6e55259
chore: update preview annotation
jvsena42 Mar 13, 2026
f95809c
refactor: reorder params
jvsena42 Mar 13, 2026
49899a5
refactor: reorder params
jvsena42 Mar 13, 2026
ce66c05
refactor: remove uppercase from Headline20
jvsena42 Mar 13, 2026
2856601
refactor: extract SecondaryDisplay
jvsena42 Mar 13, 2026
b686030
refactor: extract suggestion methods in HomeViewModel
jvsena42 Mar 13, 2026
a307bed
refactor: extract spaceToNewline() String extension
jvsena42 Mar 13, 2026
5b91d76
refactor: replace LocalConfiguration.screenHeightDp with LocalWindowInfo
jvsena42 Mar 13, 2026
476fecf
refactor: extract bottom spacer height
jvsena42 Mar 13, 2026
ab0eaca
fix: back nav from Widget Settings returns to wrong state
jvsena42 Mar 13, 2026
6c17f40
fix: change "Show All" button top padding from 2.dp to 16.dp to match…
jvsena42 Mar 13, 2026
5df901f
fix: add .imePadding
jvsena42 Mar 13, 2026
c1c59db
fix: sync state on refresh receive state
jvsena42 Mar 13, 2026
118cee3
fix: call onLeftHome() when home screen is paused instead of when it …
jvsena42 Mar 13, 2026
ca347a0
fix: add a retry mechanism (retryShouldShowReceivedSheet) that retrie…
jvsena42 Mar 13, 2026
248234d
fix: reduce pager scroll threshold to make it more fluid
jvsena42 Mar 13, 2026
dad2b52
chore: lint
jvsena42 Mar 13, 2026
81c003d
fix: enable predictive back on all activity screen
jvsena42 Mar 13, 2026
9e8e427
Merge branch 'master' into feat/home-redesign
jvsena42 Mar 13, 2026
0e33a58
chore: add tablet preview
jvsena42 Mar 13, 2026
27f4016
Merge remote-tracking branch 'origin/feat/home-redesign' into feat/ho…
jvsena42 Mar 13, 2026
af22d4c
feat: add dark gradient at the bottom of widgets pages
jvsena42 Mar 13, 2026
5b7a2a0
fix: move imePadding to parent composable
jvsena42 Mar 13, 2026
e4edb6d
refactor: use haze effect
jvsena42 Mar 13, 2026
905bc7d
fix: restore StiffnessMedium to fix stuck scroll
jvsena42 Mar 13, 2026
dc2f3e8
Merge branch 'master' into feat/home-redesign
jvsena42 Mar 13, 2026
41a6868
fix: match edit behaviour with iOS
jvsena42 Mar 16, 2026
2e6a1e8
fix: improve widgets rendering by separating suggestions and others i…
jvsena42 Mar 16, 2026
25aa461
Merge branch 'master' into feat/home-redesign
jvsena42 Mar 16, 2026
45da477
Merge branch 'master' into feat/home-redesign
jvsena42 Mar 16, 2026
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 @@ -124,6 +124,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
12 changes: 8 additions & 4 deletions app/src/main/java/to/bitkit/data/WidgetsStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ class WidgetsStore @Inject constructor(
if (store.data.first().widgets.map { it.type }.contains(type)) return

store.updateData { data ->
data.copy(widgets = (data.widgets + WidgetWithPosition(type = type)).sortedBy { it.position })
val nextPosition = (data.widgets.maxOfOrNull { it.position } ?: -1) + 1
data.copy(
widgets = (data.widgets + WidgetWithPosition(type = type, position = nextPosition))
.sortedBy { it.position }
)
}
}

Expand All @@ -160,9 +164,9 @@ class WidgetsStore @Inject constructor(
@Serializable
data class WidgetsData(
val widgets: List<WidgetWithPosition> = listOf(
WidgetWithPosition(type = WidgetType.PRICE, position = 0),
WidgetWithPosition(type = WidgetType.BLOCK, position = 1),
WidgetWithPosition(type = WidgetType.NEWS, position = 2),
WidgetWithPosition(type = WidgetType.SUGGESTIONS, position = 0),
WidgetWithPosition(type = WidgetType.PRICE, position = 1),
WidgetWithPosition(type = WidgetType.BLOCK, position = 2),
),
val headlinePreferences: HeadlinePreferences = HeadlinePreferences(),
val factsPreferences: FactsPreferences = FactsPreferences(),
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/to/bitkit/data/dto/price/PriceDTO.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package to.bitkit.data.dto.price

import androidx.compose.runtime.Stable
import kotlinx.serialization.Serializable

@Stable
@Serializable
data class PriceDTO(
val widgets: List<PriceWidgetData>,
@Stable val widgets: List<PriceWidgetData>,
val source: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,24 @@ class NotifyPaymentReceivedHandler @Inject constructor(
if (command.event.details.amountSats <= 0) return false

delay(DELAY_FOR_ACTIVITY_SYNC_MS)
val shouldShowSheet = activityRepo.shouldShowReceivedSheet(
val shouldShowSheet = retryShouldShowReceivedSheet(
command.event.txid,
command.event.details.amountSats.toULong()
command.event.details.amountSats.toULong(),
)
if (shouldShowSheet) {
activityRepo.markOnchainActivityAsSeen(command.event.txid)
}
return shouldShowSheet
}

private suspend fun retryShouldShowReceivedSheet(txid: String, amountSats: ULong): Boolean {
repeat(MAX_RETRIES) {
if (activityRepo.shouldShowReceivedSheet(txid, amountSats)) return true
delay(RETRY_DELAY_MS)
}
return activityRepo.shouldShowReceivedSheet(txid, amountSats)
}

private fun buildSheetDetails(command: NotifyPaymentReceived.Command) = NewTransactionSheetDetails(
type = when (command) {
is NotifyPaymentReceived.Command.Lightning -> NewTransactionSheetType.LIGHTNING
Expand Down Expand Up @@ -128,5 +136,7 @@ class NotifyPaymentReceivedHandler @Inject constructor(
* the transaction before checking for RBF replacement or channel closure.
*/
private const val DELAY_FOR_ACTIVITY_SYNC_MS = 500L
private const val RETRY_DELAY_MS = 300L
private const val MAX_RETRIES = 3
}
}
2 changes: 2 additions & 0 deletions app/src/main/java/to/bitkit/ext/String.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ fun String.truncate(length: Int): String {

fun String.removeSpaces() = this.filterNot { it.isWhitespace() }

fun String.spaceToNewline() = replace(" ", "\n")

fun String.toLongOrDefault(defaultValue: Long = 0): Long = toLongOrNull() ?: defaultValue

/**
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/to/bitkit/models/BalanceState.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package to.bitkit.models

import androidx.compose.runtime.Immutable
import kotlinx.serialization.Serializable

@Immutable
@Serializable
data class BalanceState(
val totalOnchainSats: ULong = 0uL,
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,
)
}
2 changes: 2 additions & 0 deletions app/src/main/java/to/bitkit/models/WidgetWithPosition.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package to.bitkit.models

import androidx.compose.runtime.Immutable
import kotlinx.serialization.Serializable

@Immutable
@Serializable
data class WidgetWithPosition(
val type: WidgetType,
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/to/bitkit/models/widget/ArticleModel.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package to.bitkit.models.widget

import androidx.compose.runtime.Immutable
import kotlinx.serialization.Serializable
import to.bitkit.data.dto.ArticleDTO
import to.bitkit.ext.toRelativeTimeString
Expand All @@ -12,6 +13,7 @@ import kotlin.time.ExperimentalTime

private const val TAG = "ArticleModel"

@Immutable
@Serializable
data class ArticleModel(
val title: String,
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/to/bitkit/models/widget/BlockModel.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package to.bitkit.models.widget

import androidx.compose.runtime.Immutable
import kotlinx.serialization.Serializable
import to.bitkit.data.dto.BlockDTO
import to.bitkit.ext.toDateUTC
import to.bitkit.ext.toTimeUTC

@Immutable
@Serializable
data class BlockModel(
val height: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package to.bitkit.models.widget

import androidx.compose.runtime.Immutable
import kotlinx.serialization.Serializable

@Immutable
@Serializable
data class BlocksPreferences(
val showBlock: Boolean = true,
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/to/bitkit/models/widget/FactsPreferences.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package to.bitkit.models.widget

import androidx.compose.runtime.Immutable
import kotlinx.serialization.Serializable

@Immutable
@Serializable
data class FactsPreferences(
val showSource: Boolean = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package to.bitkit.models.widget

import androidx.compose.runtime.Immutable
import kotlinx.serialization.Serializable

@Immutable
@Serializable
data class HeadlinePreferences(
val showTime: Boolean = true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package to.bitkit.models.widget

import androidx.compose.runtime.Stable
import kotlinx.serialization.Serializable
import to.bitkit.data.dto.price.GraphPeriod
import to.bitkit.data.dto.price.TradingPair

@Stable
@Serializable
data class PricePreferences(
val enabledPairs: List<TradingPair> = listOf(
@Stable val enabledPairs: List<TradingPair> = listOf(
TradingPair.BTC_USD
),
val period: GraphPeriod? = GraphPeriod.ONE_DAY,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package to.bitkit.models.widget

import androidx.compose.runtime.Immutable
import kotlinx.serialization.Serializable

@Immutable
@Serializable
data class WeatherPreferences(
val showTitle: Boolean = true,
Expand Down
54 changes: 41 additions & 13 deletions app/src/main/java/to/bitkit/repositories/WidgetsRepo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@ import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import to.bitkit.data.SettingsStore
import to.bitkit.data.WidgetsData
import to.bitkit.data.WidgetsStore
import to.bitkit.data.dto.ArticleDTO
import to.bitkit.data.dto.BlockDTO
import to.bitkit.data.dto.WeatherDTO
import to.bitkit.data.dto.price.PriceDTO
import to.bitkit.data.widgets.BlocksService
import to.bitkit.data.widgets.FactsService
import to.bitkit.data.widgets.NewsService
Expand Down Expand Up @@ -52,14 +60,30 @@ class WidgetsRepo @Inject constructor(
private val repoScope = CoroutineScope(bgDispatcher + SupervisorJob())
private val widgetJobs = ConcurrentHashMap<WidgetType, Job>()

val widgetsDataFlow = widgetsStore.data
val widgetsDataFlow: StateFlow<WidgetsData> = widgetsStore.data
.stateIn(repoScope, SharingStarted.Eagerly, WidgetsData())

val showWidgetTitles = settingsStore.data.map { it.showWidgetTitles }

val articlesFlow = widgetsStore.articlesFlow
val factsFlow = widgetsStore.factsFlow
val blocksFlow = widgetsStore.blocksFlow
val weatherFlow = widgetsStore.weatherFlow
val priceFlow = widgetsStore.priceFlow
val articlesFlow: StateFlow<List<ArticleDTO>> = widgetsDataFlow
.map { it.articles }
.stateIn(repoScope, SharingStarted.Eagerly, emptyList())

val factsFlow: StateFlow<List<String>> = widgetsDataFlow
.map { it.facts }
.stateIn(repoScope, SharingStarted.Eagerly, emptyList())

val blocksFlow: StateFlow<BlockDTO?> = widgetsDataFlow
.map { it.block }
.stateIn(repoScope, SharingStarted.Eagerly, null)

val weatherFlow: StateFlow<WeatherDTO?> = widgetsDataFlow
.map { it.weather }
.stateIn(repoScope, SharingStarted.Eagerly, null)

val priceFlow: StateFlow<PriceDTO?> = widgetsDataFlow
.map { it.price }
.stateIn(repoScope, SharingStarted.Eagerly, null)

private val _refreshStates = MutableStateFlow(
WidgetType.entries.associateWith { false }
Expand All @@ -84,7 +108,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 +162,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 @@ -200,8 +226,10 @@ class WidgetsRepo @Inject constructor(
}

suspend fun refreshEnabledWidgets() = withContext(bgDispatcher) {
widgetsDataFlow.first().widgets.forEach {
refreshWidget(it.type)
coroutineScope {
widgetsDataFlow.first().widgets
.filter { it.type != WidgetType.CALCULATOR && it.type != WidgetType.SUGGESTIONS }
.forEach { launch { refreshWidget(it.type) } }
}
}

Expand All @@ -226,9 +254,9 @@ 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 ->
widgetsStore.updateFacts(facts)
Expand Down
24 changes: 19 additions & 5 deletions app/src/main/java/to/bitkit/ui/ContentView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ import to.bitkit.ui.screens.widgets.headlines.HeadlinesViewModel
import to.bitkit.ui.screens.widgets.price.PriceEditScreen
import to.bitkit.ui.screens.widgets.price.PricePreviewScreen
import to.bitkit.ui.screens.widgets.price.PriceViewModel
import to.bitkit.ui.screens.widgets.suggestions.SuggestionsPreviewScreen
import to.bitkit.ui.screens.widgets.suggestions.SuggestionsViewModel
import to.bitkit.ui.screens.widgets.weather.WeatherEditScreen
import to.bitkit.ui.screens.widgets.weather.WeatherPreviewScreen
import to.bitkit.ui.screens.widgets.weather.WeatherViewModel
Expand Down Expand Up @@ -842,10 +844,7 @@ private fun NavGraphBuilder.allActivity(
composableWithDefaultTransitions<Routes.AllActivity> {
AllActivityScreen(
viewModel = activityListViewModel,
onBack = {
activityListViewModel.clearFilters()
navController.navigateToHome()
},
onBack = { navController.popBackStack() },
onActivityItemClick = { id -> navController.navigateToActivityItem(id) },
)
}
Expand Down Expand Up @@ -1325,6 +1324,7 @@ private fun NavGraphBuilder.widgets(
)
}
composableWithDefaultTransitions<Routes.AddWidget> {
val showWidgets by settingsViewModel.showWidgets.collectAsStateWithLifecycle()
AddWidgetsScreen(
onWidgetSelected = { widgetType ->
when (widgetType) {
Expand All @@ -1334,10 +1334,21 @@ private fun NavGraphBuilder.widgets(
WidgetType.NEWS -> navController.navigateTo(Routes.HeadlinesPreview)
WidgetType.PRICE -> navController.navigateTo(Routes.PricePreview)
WidgetType.WEATHER -> navController.navigateTo(Routes.WeatherPreview)
WidgetType.SUGGESTIONS -> navController.navigateTo(Routes.SuggestionsPreview)
}
},
fiatSymbol = LocalCurrencies.current.currencySymbol,
onBackCLick = { navController.popBackStack() }
onBackClick = { navController.popBackStack() },
showWidgets = showWidgets,
onEnableInSettingsClick = { navController.navigate(Routes.WidgetsSettings) },
)
}
composableWithDefaultTransitions<Routes.SuggestionsPreview> {
val viewModel = hiltViewModel<SuggestionsViewModel>()
SuggestionsPreviewScreen(
suggestionsViewModel = viewModel,
onClose = { navController.navigateToHome() },
onBack = { navController.popBackStack() },
)
}
composableWithDefaultTransitions<Routes.CalculatorPreview> {
Expand Down Expand Up @@ -1839,6 +1850,9 @@ sealed interface Routes {
@Serializable
data object AddWidget : Routes

@Serializable
data object SuggestionsPreview : Routes

@Serializable
data object Headlines : Routes

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/to/bitkit/ui/components/ActivityBanner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredHeight
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.Icon
Expand Down Expand Up @@ -161,7 +162,8 @@ fun ActivityBanner(
Icon(
painter = painterResource(icon),
contentDescription = null,
tint = gradientColor
tint = gradientColor,
modifier = Modifier.size(20.dp)
)

Headline20(
Expand Down
Loading
Loading