Skip to content

Commit e90488a

Browse files
Rajan MauryaRajan Maurya
authored andcommitted
feat(search-record): Phase C Wave 4 — Search Record end-to-end Store5 migration
End-to-end migration of the Search Record feature to the kmp-project-template Store5 architecture. This is Wave 4 of Phase C — the second read-only feature wave (after Wave 3: search). Search Record is purely local (no network / Ktorfit), querying ClientDaoHelper directly via SearchRecordLocalDataSource. Data (core/data): - Relocated SearchRecordRepository to com.mifos.core.data.searchrecord - Relocated SearchRecordLocalDataSource(+Impl) to com.mifos.core.data.searchrecord.local - Relocated SearchRecordRepositoryImpl to com.mifos.core.data.searchrecord.impl - Repository now returns Flow<List<GenericSearchRecord>> — dropped the Result<T> wrapper and its catch-map-failure scaffold; errors flow through the standard Flow.catch in the VM - RepositoryModule imports updated to new packages Feature (feature/search-record): - Restructured to {ui, di, navigation} subpackages (VM + Screen + State moved under ui/) - SearchRecordViewModel switched from com.mifos.core.ui.util.BaseViewModel (legacy) to com.mifos.core.ui.store.BaseViewModel (typealias to template.core.base.ui.viewmodel.BaseViewModel) - SearchRecordState owns screenState: ScreenState<List<GenericSearchRecord>> (replaces the bespoke DialogState.Loading/Error sealed type + searchRecords + isNoResultsFound triple) - displayTitle moved from hardcoded "Address"/"Identifiers" strings in the VM to a StringResource derived from RecordType, rendered via stringResource in the Screen - SearchRecordScreen uses ScreenContent — Loading / Empty / Error / Content rendered through framework slots; custom empty slot distinguishes "initial blank query" from "no results for entered query" - MifosAlertDialog raw-error-message rendering removed; ScreenState.Error is rendered through ScreenContent's default error slot - Navigation split: SearchRecordRoute.kt (@serializable) + Navigation builder - @Preview functions (Content / Loading / NoResults / Error) via PreviewParameterProvider - gradle deps: projects.core.data + projects.core.ui only (dropped projects.core.common + projects.core.domain + projects.core.model — the chain is transitively available via core.data + core.ui api())
1 parent f0dba38 commit e90488a

13 files changed

Lines changed: 252 additions & 293 deletions

File tree

core/data/src/commonMain/kotlin/com/mifos/core/data/di/RepositoryModule.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
package com.mifos.core.data.di
1111

1212
import com.mifos.core.common.network.MifosDispatchers
13-
import com.mifos.core.data.datasource.SearchRecordLocalDataSource
14-
import com.mifos.core.data.datasource.SearchRecordLocalDataSourceImpl
1513
import com.mifos.core.data.activate.ActivateRepository
1614
import com.mifos.core.data.activate.impl.ActivateRepositoryImpl
15+
import com.mifos.core.data.searchrecord.SearchRecordRepository
16+
import com.mifos.core.data.searchrecord.impl.SearchRecordRepositoryImpl
17+
import com.mifos.core.data.searchrecord.local.SearchRecordLocalDataSource
18+
import com.mifos.core.data.searchrecord.local.SearchRecordLocalDataSourceImpl
1719
import com.mifos.core.data.repository.AmountTransferRepository
1820
import com.mifos.core.data.repository.AppLockRepository
1921
import com.mifos.core.data.repository.CenterDetailsRepository
@@ -67,7 +69,6 @@ import com.mifos.core.data.repository.SavingsAccountRepository
6769
import com.mifos.core.data.repository.SavingsAccountSummaryRepository
6870
import com.mifos.core.data.repository.SavingsAccountTransactionReceiptRepository
6971
import com.mifos.core.data.repository.SavingsAccountTransactionRepository
70-
import com.mifos.core.data.repository.SearchRecordRepository
7172
import com.mifos.core.data.search.SearchRepository
7273
import com.mifos.core.data.search.impl.SearchRepositoryImpl
7374
import com.mifos.core.data.repository.ShareAccountRepository
@@ -136,7 +137,6 @@ import com.mifos.core.data.repositoryImp.SavingsAccountRepositoryImp
136137
import com.mifos.core.data.repositoryImp.SavingsAccountSummaryRepositoryImp
137138
import com.mifos.core.data.repositoryImp.SavingsAccountTransactionReceiptRepositoryImpl
138139
import com.mifos.core.data.repositoryImp.SavingsAccountTransactionRepositoryImp
139-
import com.mifos.core.data.repositoryImp.SearchRecordRepositoryImpl
140140
import com.mifos.core.data.repositoryImp.ShareAccountRepositoryImpl
141141
import com.mifos.core.data.repositoryImp.SignatureRepositoryImp
142142
import com.mifos.core.data.repositoryImp.SurveyListRepositoryImp

core/data/src/commonMain/kotlin/com/mifos/core/data/repository/SearchRecordRepository.kt renamed to core/data/src/commonMain/kotlin/com/mifos/core/data/searchrecord/SearchRecordRepository.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
99
*/
10-
package com.mifos.core.data.repository
10+
package com.mifos.core.data.searchrecord
1111

1212
import com.mifos.core.model.objects.searchrecord.GenericSearchRecord
1313
import com.mifos.core.model.objects.searchrecord.RecordType
@@ -17,5 +17,5 @@ interface SearchRecordRepository {
1717
fun searchRecords(
1818
recordType: RecordType,
1919
query: String,
20-
): Flow<Result<List<GenericSearchRecord>>>
20+
): Flow<List<GenericSearchRecord>>
2121
}

core/data/src/commonMain/kotlin/com/mifos/core/data/repositoryImp/SearchRecordRepositoryImpl.kt renamed to core/data/src/commonMain/kotlin/com/mifos/core/data/searchrecord/impl/SearchRecordRepositoryImpl.kt

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@
77
*
88
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
99
*/
10-
package com.mifos.core.data.repositoryImp
10+
package com.mifos.core.data.searchrecord.impl
1111

12-
import com.mifos.core.data.datasource.SearchRecordLocalDataSource
13-
import com.mifos.core.data.repository.SearchRecordRepository
12+
import com.mifos.core.data.searchrecord.SearchRecordRepository
13+
import com.mifos.core.data.searchrecord.local.SearchRecordLocalDataSource
1414
import com.mifos.core.model.objects.searchrecord.GenericSearchRecord
1515
import com.mifos.core.model.objects.searchrecord.RecordType
16-
import kotlinx.coroutines.CancellationException
1716
import kotlinx.coroutines.flow.Flow
18-
import kotlinx.coroutines.flow.catch
19-
import kotlinx.coroutines.flow.map
2017

2118
class SearchRecordRepositoryImpl(
2219
private val localDataSource: SearchRecordLocalDataSource,
@@ -25,11 +22,5 @@ class SearchRecordRepositoryImpl(
2522
override fun searchRecords(
2623
recordType: RecordType,
2724
query: String,
28-
): Flow<Result<List<GenericSearchRecord>>> =
29-
localDataSource.searchRecords(recordType, query)
30-
.map { Result.success(it) }
31-
.catch { e ->
32-
if (e is CancellationException) throw e
33-
emit(Result.failure(e))
34-
}
25+
): Flow<List<GenericSearchRecord>> = localDataSource.searchRecords(recordType, query)
3526
}

core/data/src/commonMain/kotlin/com/mifos/core/data/datasource/SearchRecordLocalDataSource.kt renamed to core/data/src/commonMain/kotlin/com/mifos/core/data/searchrecord/local/SearchRecordLocalDataSource.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
99
*/
10-
package com.mifos.core.data.datasource
10+
package com.mifos.core.data.searchrecord.local
1111

1212
import com.mifos.core.model.objects.searchrecord.GenericSearchRecord
1313
import com.mifos.core.model.objects.searchrecord.RecordType

core/data/src/commonMain/kotlin/com/mifos/core/data/datasource/SearchRecordLocalDataSourceImpl.kt renamed to core/data/src/commonMain/kotlin/com/mifos/core/data/searchrecord/local/SearchRecordLocalDataSourceImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* See https://github.com/openMF/mifos-x-field-officer-app/blob/master/LICENSE.md
99
*/
10-
package com.mifos.core.data.datasource
10+
package com.mifos.core.data.searchrecord.local
1111

1212
import com.mifos.core.common.utils.Constants
1313
import com.mifos.core.model.objects.searchrecord.GenericSearchRecord

feature/search-record/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ kotlin {
2323
implementation(compose.components.resources)
2424
implementation(compose.components.uiToolingPreview)
2525
implementation(compose.ui)
26-
implementation(projects.core.common)
27-
implementation(projects.core.domain)
28-
implementation(projects.core.model)
26+
implementation(projects.core.data)
27+
implementation(projects.core.ui)
2928
implementation(libs.kotlinx.serialization.json)
3029
}
3130
}

feature/search-record/src/commonMain/kotlin/com/mifos/feature/searchrecord/SearchRecordViewModel.kt

Lines changed: 0 additions & 168 deletions
This file was deleted.

feature/search-record/src/commonMain/kotlin/com/mifos/feature/searchrecord/di/SearchRecordModule.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
package com.mifos.feature.searchrecord.di
1111

12-
import com.mifos.feature.searchrecord.SearchRecordViewModel
12+
import com.mifos.feature.searchrecord.ui.SearchRecordViewModel
1313
import org.koin.core.module.dsl.viewModelOf
1414
import org.koin.dsl.module
1515

feature/search-record/src/commonMain/kotlin/com/mifos/feature/searchrecord/navigation/SearchRecordNavigation.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2025 Mifos Initiative
2+
* Copyright 2026 Mifos Initiative
33
*
44
* This Source Code Form is subject to the terms of the Mozilla Public
55
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -13,13 +13,7 @@ import androidx.navigation.NavController
1313
import androidx.navigation.NavGraphBuilder
1414
import androidx.navigation.compose.composable
1515
import com.mifos.core.model.objects.searchrecord.GenericSearchRecord
16-
import com.mifos.feature.searchrecord.SearchRecordScreen
17-
import kotlinx.serialization.Serializable
18-
19-
@Serializable
20-
data class SearchRecordRoute(
21-
val type: String,
22-
)
16+
import com.mifos.feature.searchrecord.ui.SearchRecordScreen
2317

2418
fun NavGraphBuilder.searchRecordNavigation(
2519
onBackClick: () -> Unit,
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright 2026 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/mifos-x-field-officer-app/blob/master/LICENSE.md
9+
*/
10+
package com.mifos.feature.searchrecord.navigation
11+
12+
import kotlinx.serialization.Serializable
13+
14+
@Serializable
15+
data class SearchRecordRoute(
16+
val type: String,
17+
)

0 commit comments

Comments
 (0)