Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Fix #3432 Recurring expenses spawn at UTC timing instead of local time (
Browse files Browse the repository at this point in the history
#3570)

* Fixes #3432 : recurring expenses not spawn at local time

* Fixes #3432 : refactor the code as per the requested changes

* Fixes #3432 : refactor code
  • Loading branch information
Mushfiq1060 authored Sep 30, 2024
1 parent 2d487c2 commit da86ec6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.ivy.wallet.domain.action.viewmodel.home

import com.ivy.base.time.TimeProvider
import com.ivy.data.model.Transaction
import com.ivy.frp.action.FPAction
import com.ivy.frp.lambda
import com.ivy.frp.then
import com.ivy.legacy.utils.dateNowUTC
import com.ivy.wallet.domain.action.account.AccountByIdAct
import com.ivy.wallet.domain.action.exchange.ExchangeAct
import com.ivy.wallet.domain.action.exchange.actInput
Expand All @@ -22,14 +22,15 @@ import javax.inject.Inject
class DueTrnsInfoAct @Inject constructor(
private val dueTrnsAct: DueTrnsAct,
private val accountByIdAct: AccountByIdAct,
private val exchangeAct: ExchangeAct
private val exchangeAct: ExchangeAct,
private val timeProvider: TimeProvider
) : FPAction<DueTrnsInfoAct.Input, DueTrnsInfoAct.Output>() {

override suspend fun Input.compose(): suspend () -> Output =
suspend {
range
} then dueTrnsAct then { trns ->
val dateNow = dateNowUTC()
val dateNow = timeProvider.localDateNow()
trns.filter {
this.dueFilter(it, dateNow)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.ivy.data.model.IntervalType
import com.ivy.design.api.LocalTimeProvider
import com.ivy.design.l0_system.UI
import com.ivy.design.l0_system.style
import com.ivy.legacy.IvyWalletCtx
Expand All @@ -47,7 +48,6 @@ import com.ivy.legacy.utils.hideKeyboard
import com.ivy.legacy.utils.onScreenStart
import com.ivy.design.utils.thenIf
import com.ivy.legacy.utils.rememberInteractionSource
import com.ivy.legacy.utils.timeNowUTC
import com.ivy.ui.R
import com.ivy.wallet.ui.theme.Gradient
import com.ivy.wallet.ui.theme.GradientIvy
Expand Down Expand Up @@ -80,8 +80,9 @@ fun BoxWithConstraintsScope.RecurringRuleModal(
dismiss: () -> Unit,
onRuleChanged: (LocalDateTime, oneTime: Boolean, Int?, IntervalType?) -> Unit,
) {
val timeProvider = LocalTimeProvider.current
var startDate by remember(modal) {
mutableStateOf(modal?.initialStartDate ?: timeNowUTC())
mutableStateOf(modal?.initialStartDate ?: timeProvider.localNow())
}
var oneTime by remember(modal) {
mutableStateOf(modal?.initialOneTime ?: false)
Expand Down

0 comments on commit da86ec6

Please sign in to comment.