Skip to content

Commit 5bf4927

Browse files
committed
refactor: update kotlinx date time version & created constant for file
1 parent 727983f commit 5bf4927

File tree

16 files changed

+34
-41
lines changed

16 files changed

+34
-41
lines changed

core/common/src/commonMain/kotlin/org/mifos/mobile/core/common/DateHelper.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import kotlinx.datetime.isoDayNumber
2525
import kotlinx.datetime.minus
2626
import kotlinx.datetime.toLocalDateTime
2727
import kotlin.time.Duration.Companion.days
28+
import kotlin.time.ExperimentalTime
2829

2930
@Suppress("TooManyFunctions")
3031
@OptIn(FormatStringsInDatetimeFormats::class)
@@ -162,6 +163,7 @@ object DateHelper {
162163

163164
private val monthNumberToAbbreviation = monthMap.entries.associate { (k, v) -> v to k }
164165

166+
@OptIn(ExperimentalTime::class)
165167
fun getDateAsLongFromList(integersOfDate: List<Int>?): Long? {
166168
if (integersOfDate == null) return null
167169
val dateStr = getDateAsString(integersOfDate)

core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/component/MifosProgressIndicator.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ import io.github.alexzhirkevich.compottie.rememberLottiePainter
2828
import mifos_mobile.core.ui.generated.resources.Res
2929
import org.jetbrains.compose.ui.tooling.preview.Preview
3030
import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme
31+
import org.mifos.mobile.core.ui.utils.LottieConstants
3132

3233
@Composable
3334
fun MifosProgressIndicator(
3435
modifier: Modifier = Modifier.fillMaxSize(),
3536
) {
3637
val composition by rememberLottieComposition {
3738
LottieCompositionSpec.JsonString(
38-
Res.readBytes("files/loading_animation.json").decodeToString(),
39+
Res.readBytes(LottieConstants.LOADING_ANIMATION).decodeToString(),
3940
)
4041
}
4142
val progress by animateLottieCompositionAsState(composition)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md
9+
*/
10+
package org.mifos.mobile.core.ui.utils
11+
12+
object LottieConstants {
13+
const val LOADING_ANIMATION = "files/loading_animation.json"
14+
}

core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/PresentOrFutureSelectableDates.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,19 @@ package org.mifos.mobile.core.ui.utils
1111

1212
import androidx.compose.material3.ExperimentalMaterial3Api
1313
import androidx.compose.material3.SelectableDates
14+
import kotlinx.datetime.Clock
1415
import kotlinx.datetime.TimeZone
1516
import kotlinx.datetime.toLocalDateTime
16-
import kotlin.time.Clock
17-
import kotlin.time.ExperimentalTime
1817

1918
@OptIn(ExperimentalMaterial3Api::class)
2019
object PresentOrFutureSelectableDates : SelectableDates {
2120

22-
@OptIn(ExperimentalTime::class)
2321
@ExperimentalMaterial3Api
2422
override fun isSelectableDate(utcTimeMillis: Long): Boolean {
2523
val currentTimeMillis = Clock.System.now().toEpochMilliseconds()
2624
return utcTimeMillis >= currentTimeMillis
2725
}
2826

29-
@OptIn(ExperimentalTime::class)
3027
override fun isSelectableYear(year: Int): Boolean {
3128
val currentYear = Clock.System.now()
3229
.toLocalDateTime(TimeZone.currentSystemDefault())

feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/accountTransactions/TransactionViewModel.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import kotlinx.coroutines.flow.distinctUntilChanged
1717
import kotlinx.coroutines.flow.map
1818
import kotlinx.coroutines.flow.update
1919
import kotlinx.coroutines.launch
20+
import kotlinx.datetime.Clock
2021
import kotlinx.datetime.DateTimeUnit
2122
import kotlinx.datetime.LocalDate
2223
import kotlinx.datetime.TimeZone
@@ -50,8 +51,6 @@ import org.mifos.mobile.feature.accounts.model.TransactionCheckboxStatus
5051
import org.mifos.mobile.feature.accounts.model.TransactionFilterType
5152
import org.mifos.mobile.feature.accounts.utils.StatusUtils
5253
import kotlin.collections.map
53-
import kotlin.time.Clock
54-
import kotlin.time.ExperimentalTime
5554

5655
/**
5756
* ViewModel for managing the state and logic of the account transactions screen.
@@ -453,7 +452,6 @@ internal class AccountsTransactionViewModel(
453452
* @param selectedFilters A list of [TransactionCheckboxStatus] representing the active checkbox filters.
454453
* @return A map of filtered transactions grouped by date.
455454
*/
456-
@OptIn(ExperimentalTime::class)
457455
internal fun applyTransactionFilters(
458456
selectedFilters: List<TransactionCheckboxStatus>,
459457
): Map<String, List<UiTransaction>> {

feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/accounts/AccountsViewModel.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ package org.mifos.mobile.feature.accounts.accounts
1212
import androidx.lifecycle.SavedStateHandle
1313
import androidx.navigation.toRoute
1414
import kotlinx.coroutines.flow.update
15+
import kotlinx.datetime.Clock
1516
import org.jetbrains.compose.resources.StringResource
1617
import org.mifos.mobile.core.common.Constants
1718
import org.mifos.mobile.core.model.enums.AccountType
1819
import org.mifos.mobile.core.ui.utils.BaseViewModel
1920
import org.mifos.mobile.feature.accounts.model.CheckboxStatus
2021
import org.mifos.mobile.feature.accounts.model.FilterType
2122
import org.mifos.mobile.feature.accounts.utils.StatusUtils
22-
import kotlin.time.Clock
23-
import kotlin.time.ExperimentalTime
2423

2524
/**
2625
* ViewModel responsible for managing the account screen state,
@@ -41,7 +40,6 @@ internal class AccountsViewModel(
4140
observeAccountTypeAndInitCheckboxes()
4241
}
4342

44-
@OptIn(ExperimentalTime::class)
4543
override fun handleAction(action: AccountsAction) {
4644
when (action) {
4745
is AccountsAction.SetCheckboxFilterList -> {
@@ -114,7 +112,6 @@ internal class AccountsViewModel(
114112
* Applies the selected checkboxes as filters, sets refresh signal,
115113
* and dismisses the filter dialog.
116114
*/
117-
@OptIn(ExperimentalTime::class)
118115
private fun handleConfirmFilterDialog() {
119116
val selectedFilters = state.checkboxOptions.filter { it.isChecked }
120117

@@ -206,7 +203,6 @@ internal class AccountsViewModel(
206203
* current account type, and refresh signals.
207204
*/
208205
internal data class AccountsState
209-
@OptIn(ExperimentalTime::class)
210206
constructor(
211207
val isRefreshing: Boolean = false,
212208

feature/auth/src/commonMain/kotlin/org/mifos/mobile/feature/auth/uploadId/UploadIdScreen.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import androidx.compose.ui.Modifier
4646
import androidx.compose.ui.text.input.ImeAction
4747
import androidx.compose.ui.text.input.KeyboardType
4848
import androidx.lifecycle.compose.collectAsStateWithLifecycle
49+
import kotlinx.datetime.Clock
4950
import mifos_mobile.feature.auth.generated.resources.Res
5051
import mifos_mobile.feature.auth.generated.resources.feature_common_submit
5152
import mifos_mobile.feature.auth.generated.resources.feature_upload_id_cancel
@@ -75,8 +76,6 @@ import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme
7576
import org.mifos.mobile.core.designsystem.theme.MifosTypography
7677
import org.mifos.mobile.core.ui.component.MifosPoweredCard
7778
import org.mifos.mobile.core.ui.utils.EventsEffect
78-
import kotlin.time.Clock
79-
import kotlin.time.ExperimentalTime
8079

8180
@Composable
8281
internal fun UploadIdScreen(
@@ -181,7 +180,7 @@ internal fun UploadIdScreenContent(
181180
}
182181
}
183182

184-
@OptIn(ExperimentalMaterial3Api::class, ExperimentalTime::class)
183+
@OptIn(ExperimentalMaterial3Api::class)
185184
@Composable
186185
internal fun InputForm(
187186
state: UploadIdUiState,

feature/loan-account/src/commonMain/kotlin/org/mifos/mobile/feature/loanaccount/component/RepaymentPeriodCard.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import androidx.compose.ui.Modifier
3131
import androidx.compose.ui.draw.clip
3232
import androidx.compose.ui.graphics.Color
3333
import androidx.compose.ui.unit.dp
34+
import kotlinx.datetime.Clock
3435
import mifos_mobile.feature.loan_account.generated.resources.Res
3536
import mifos_mobile.feature.loan_account.generated.resources.feature_loan_due
3637
import mifos_mobile.feature.loan_account.generated.resources.feature_loan_installment_number
@@ -46,10 +47,7 @@ import org.mifos.mobile.core.designsystem.theme.AppColors
4647
import org.mifos.mobile.core.designsystem.theme.DesignToken
4748
import org.mifos.mobile.core.designsystem.theme.MifosTypography
4849
import org.mifos.mobile.core.model.entity.accounts.loan.Periods
49-
import kotlin.time.Clock
50-
import kotlin.time.ExperimentalTime
5150

52-
@OptIn(ExperimentalTime::class)
5351
@Composable
5452
fun RepaymentScheduleItem(
5553
period: Periods,

feature/loan-application/src/commonMain/kotlin/org/mifos/mobile/feature/loan/application/confirmDetails/ConfirmDetailsScreen.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import org.mifos.mobile.core.ui.component.MifosPoweredCard
4141
import org.mifos.mobile.core.ui.component.MifosProgressIndicator
4242
import org.mifos.mobile.core.ui.component.MifosProgressIndicatorOverlay
4343
import org.mifos.mobile.core.ui.utils.EventsEffect
44-
import kotlin.time.ExperimentalTime
4544

4645
@Composable
4746
internal fun ConfirmDetailsScreen(
@@ -84,7 +83,7 @@ internal fun ConfirmDetailsScreen(
8483
)
8584
}
8685

87-
@OptIn(ExperimentalMaterial3Api::class, ExperimentalTime::class)
86+
@OptIn(ExperimentalMaterial3Api::class)
8887
@Composable
8988
internal fun ConfirmDetailsDialog(
9089
dialogState: ConfirmDetailsDialogState?,

feature/loan-application/src/commonMain/kotlin/org/mifos/mobile/feature/loan/application/loanApplication/LoanApplyScreen.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import androidx.compose.ui.Modifier
3636
import androidx.compose.ui.text.input.ImeAction
3737
import androidx.compose.ui.text.input.KeyboardType
3838
import androidx.lifecycle.compose.collectAsStateWithLifecycle
39+
import kotlinx.datetime.Clock
3940
import mifos_mobile.feature.loan_application.generated.resources.Res
4041
import mifos_mobile.feature.loan_application.generated.resources.feature_apply_loan_button_cancel
4142
import mifos_mobile.feature.loan_application.generated.resources.feature_apply_loan_button_continue
@@ -63,8 +64,6 @@ import org.mifos.mobile.core.ui.component.MifosOutlineDropdown
6364
import org.mifos.mobile.core.ui.component.MifosPoweredCard
6465
import org.mifos.mobile.core.ui.component.MifosProgressIndicator
6566
import org.mifos.mobile.core.ui.utils.EventsEffect
66-
import kotlin.time.Clock
67-
import kotlin.time.ExperimentalTime
6867

6968
@Composable
7069
internal fun LoanApplyScreen(
@@ -107,7 +106,7 @@ internal fun LoanApplyScreen(
107106
)
108107
}
109108

110-
@OptIn(ExperimentalMaterial3Api::class, ExperimentalTime::class)
109+
@OptIn(ExperimentalMaterial3Api::class)
111110
@Composable
112111
internal fun LoanAccountDialog(
113112
state: LoanApplicationState,

0 commit comments

Comments
 (0)