Skip to content

feat : Center migrated to CMP #2391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jun 8, 2025
Merged
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
2 changes: 2 additions & 0 deletions cmp-android/dependencies/demoDebugRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ androidx.navigation:navigation-runtime-ktx:2.8.4
androidx.navigation:navigation-runtime:2.8.4
androidx.paging:paging-common-android:3.3.6
androidx.paging:paging-common:3.3.6
androidx.paging:paging-compose-android:3.3.5
androidx.paging:paging-compose:3.3.5
androidx.performance:performance-annotation-android:1.0.0-alpha01
androidx.performance:performance-annotation:1.0.0-alpha01
androidx.profileinstaller:profileinstaller:1.4.1
Expand Down
2 changes: 2 additions & 0 deletions cmp-android/dependencies/demoReleaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ androidx.navigation:navigation-runtime-ktx:2.8.4
androidx.navigation:navigation-runtime:2.8.4
androidx.paging:paging-common-android:3.3.6
androidx.paging:paging-common:3.3.6
androidx.paging:paging-compose-android:3.3.5
androidx.paging:paging-compose:3.3.5
androidx.performance:performance-annotation-android:1.0.0-alpha01
androidx.performance:performance-annotation:1.0.0-alpha01
androidx.profileinstaller:profileinstaller:1.4.1
Expand Down
2 changes: 2 additions & 0 deletions cmp-android/dependencies/prodDebugRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ androidx.navigation:navigation-runtime-ktx:2.8.4
androidx.navigation:navigation-runtime:2.8.4
androidx.paging:paging-common-android:3.3.6
androidx.paging:paging-common:3.3.6
androidx.paging:paging-compose-android:3.3.5
androidx.paging:paging-compose:3.3.5
androidx.performance:performance-annotation-android:1.0.0-alpha01
androidx.performance:performance-annotation:1.0.0-alpha01
androidx.profileinstaller:profileinstaller:1.4.1
Expand Down
2 changes: 2 additions & 0 deletions cmp-android/dependencies/prodReleaseRuntimeClasspath.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ androidx.navigation:navigation-runtime-ktx:2.8.4
androidx.navigation:navigation-runtime:2.8.4
androidx.paging:paging-common-android:3.3.6
androidx.paging:paging-common:3.3.6
androidx.paging:paging-compose-android:3.3.5
androidx.paging:paging-compose:3.3.5
androidx.performance:performance-annotation-android:1.0.0-alpha01
androidx.performance:performance-annotation:1.0.0-alpha01
androidx.profileinstaller:profileinstaller:1.4.1
Expand Down
6 changes: 1 addition & 5 deletions cmp-navigation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ kotlin {
implementation(projects.feature.about)
implementation(projects.feature.activate)
implementation(projects.feature.auth)
// implementation(projects.feature.center)
implementation(projects.feature.center)
implementation(projects.feature.checkerInboxTask)
// implementation(projects.feature.client)
// implementation(projects.feature.collectionSheet)
Expand All @@ -46,12 +46,8 @@ kotlin {
// implementation(projects.feature.pathTracking)
// implementation(projects.feature.report)
// implementation(projects.feature.savings)
// implementation(projects.feature.splash)
implementation(projects.feature.search)
implementation(projects.feature.settings)
// implementation(projects.feature.search)

implementation(projects.feature.settings)
implementation(projects.feature.splash)
//
// implementation(project.libs.mifos.passcode)
Expand Down
4 changes: 2 additions & 2 deletions cmp-navigation/src/commonMain/kotlin/cmp/navigation/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ fun App(
if (isNavScreen) {
TopAppBar(
title = {
Text("Dashboard")
Text(NavigationConstants.getTitleForRoute(route))
},
navigationIcon = {
IconButton(onClick = {
Expand Down Expand Up @@ -290,9 +290,9 @@ fun App(
) { paddingValues ->
FeatureNavHost(
appState = appState,
padding = paddingValues,
onClickLogout = onClickLogout,
modifier = Modifier,
padding = paddingValues,
)
if (dialogState) {
MifosDialogBox(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ object NavigationConstants {
fun isNavScreen(route: String?): Boolean {
return NavScreenRoutes.contains(route)
}
fun getTitleForRoute(route: String?): String {
return when (route) {
HomeDestinationsScreen.ClientListScreen.route -> HomeDestinationsScreen.ClientListScreen.title
HomeDestinationsScreen.CenterListScreen.route -> HomeDestinationsScreen.CenterListScreen.title
HomeDestinationsScreen.GroupListScreen.route -> HomeDestinationsScreen.GroupListScreen.title
else -> "Dashboard"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.mifos.core.network.di.DataManagerModule
import com.mifos.core.network.di.NetworkModule
import com.mifos.feature.activate.di.ActivateModule
import com.mifos.feature.auth.di.AuthModule
import com.mifos.feature.center.di.CenterModule
import com.mifos.feature.checker.inbox.task.di.CheckerInboxTaskModule
import com.mifos.feature.note.di.NoteModule
import com.mifos.feature.search.di.SearchModule
Expand Down Expand Up @@ -53,7 +54,7 @@ object KoinModules {
// AboutModule,
ActivateModule,
AuthModule,
// CenterModule,
CenterModule,
CheckerInboxTaskModule,
// ClientModule,
// CollectionSheetModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import androidx.navigation.compose.NavHost
import cmp.navigation.AppState
import com.mifos.feature.about.navigation.aboutNavGraph
import com.mifos.feature.activate.navigation.activateScreen
import com.mifos.feature.activate.navigation.navigateToActivateScreen
import com.mifos.feature.center.navigation.centerNavGraph
import com.mifos.feature.checker.inbox.task.navigation.checkerInboxTaskNavGraph
import com.mifos.feature.note.navigation.noteNavGraph
import com.mifos.feature.search.navigation.searchNavGraph
Expand Down Expand Up @@ -54,6 +56,16 @@ internal fun FeatureNavHost(

activateScreen(onBackPressed = appState.navController::popBackStack)

centerNavGraph(
navController = appState.navController,
paddingValues = padding,
onActivateCenter = appState.navController::navigateToActivateScreen,
addSavingsAccount = {
// navController.navigateToAddSavingsAccount(it, 0, true)
},

)

settingsScreen(
navigateBack = appState.navController::popBackStack,
navigateToLoginScreen = {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import com.mifos.core.model.utils.Parcelable
import com.mifos.core.model.utils.Parcelize
import com.mifos.room.utils.Entity
import com.mifos.room.utils.PrimaryKey
import kotlinx.serialization.Serializable

@Serializable
@Parcelize
@Entity(
indices = [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.mifos.room.utils.Entity
import com.mifos.room.utils.ForeignKey
import com.mifos.room.utils.ForeignKeyAction
import com.mifos.room.utils.PrimaryKey
import kotlinx.serialization.Serializable

@Entity(
tableName = "Office",
Expand All @@ -31,6 +32,7 @@ import com.mifos.room.utils.PrimaryKey
),
],
)
@Serializable
data class OfficeEntity(
@PrimaryKey(autoGenerate = true)
val id: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import com.mifos.room.utils.PrimaryKey
import com.mifos.room.utils.UNDEFINED
import com.mifos.room.utils.UNSPECIFIED
import com.mifos.room.utils.VALUE_UNSPECIFIED
import kotlinx.serialization.Serializable

@Entity(
indices = [],
Expand All @@ -25,6 +26,7 @@ import com.mifos.room.utils.VALUE_UNSPECIFIED
ignoredColumns = [],
tableName = "OfficeOpeningDate",
)
@Serializable
data class OfficeOpeningDateEntity(
@PrimaryKey(autoGenerate = true)
@ColumnInfo(index = true, name = INHERIT_FIELD_NAME, typeAffinity = UNDEFINED, collate = UNSPECIFIED, defaultValue = VALUE_UNSPECIFIED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import com.mifos.core.model.utils.Parcelable
import com.mifos.core.model.utils.Parcelize
import com.mifos.room.utils.Entity
import com.mifos.room.utils.PrimaryKey
import kotlinx.serialization.Serializable

@Serializable
@Parcelize
@Entity(
indices = [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ package com.mifos.core.designsystem.icon

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.ArrowForward
import androidx.compose.material.icons.automirrored.filled.Assignment
import androidx.compose.material.icons.automirrored.filled.CompareArrows
import androidx.compose.material.icons.automirrored.filled.Help
Expand All @@ -27,6 +26,8 @@ import androidx.compose.material.icons.filled.Apartment
import androidx.compose.material.icons.filled.ArrowDropDown
import androidx.compose.material.icons.filled.ArrowDropUp
import androidx.compose.material.icons.filled.AssignmentTurnedIn
import androidx.compose.material.icons.filled.ChevronLeft
import androidx.compose.material.icons.filled.ChevronRight
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.CloudDownload
import androidx.compose.material.icons.filled.Edit
Expand Down Expand Up @@ -116,7 +117,7 @@ object MifosIcons {
val ArrowUp = Icons.Rounded.KeyboardArrowUp
val ArrowDown = Icons.Rounded.KeyboardArrowDown
val MoreVert = Icons.Rounded.MoreVert
val ArrowForward = Icons.AutoMirrored.Filled.ArrowForward
val ArrowForward = Icons.Filled.ChevronRight
val FileTask = Icons.Default.AssignmentTurnedIn
val AddLocation = Icons.Rounded.AddLocation
val CloudDownload = Icons.Default.CloudDownload
Expand Down Expand Up @@ -169,7 +170,7 @@ object MifosIcons {
val ArrowDropUp: ImageVector = Icons.Default.ArrowDropUp
val OutlinedVisibilityOff: ImageVector = Icons.Outlined.VisibilityOff
val OutlinedVisibility: ImageVector = Icons.Outlined.Visibility
val ArrowBack = Icons.AutoMirrored.Default.ArrowBack
val ArrowBack = Icons.Filled.ChevronLeft
val Edit = Icons.Default.Edit
val FilterList = Icons.Filled.FilterList
val FlashOn = Icons.Default.FlashOn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ class GetCenterDetailsUseCase(
flow { emit(repository.getCentersGroupAndMeeting(centerId)) },
repository.getCenterSummaryInfo(centerId, genericResultSet),
) { centerGroup, centerInfoState ->
DataState.Success(Pair(centerGroup, centerInfoState.data!!))

when (centerInfoState) {
is DataState.Error -> DataState.Error(centerInfoState.exception)
DataState.Loading -> DataState.Loading
is DataState.Success -> DataState.Success(Pair(centerGroup, centerInfoState.data))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ package com.mifos.core.model.objects.groups

import com.mifos.core.model.utils.Parcelable
import com.mifos.core.model.utils.Parcelize
import kotlinx.serialization.Serializable

/**
* Created by Rajan Maurya on 05/02/17.
*/
@Serializable
@Parcelize
data class CenterInfo(
var activeClients: Int? = null,
Expand Down
44 changes: 21 additions & 23 deletions feature/center/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,30 @@
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
*/
plugins {
alias(libs.plugins.mifos.android.feature)
alias(libs.plugins.mifos.android.library.compose)
alias(libs.plugins.mifos.android.library.jacoco)
alias(libs.plugins.mifos.cmp.feature)
}

android {
namespace = "com.mifos.feature.center"
}

dependencies {

implementation(projects.core.datastore)
implementation(projects.core.network)
implementation(projects.core.domain)

implementation(libs.androidx.material)

//DBFlow dependencies
testImplementation(libs.hilt.android.testing)
//paging compose
implementation(libs.androidx.paging.compose)

//coil
implementation(libs.coil.kt.compose)

implementation(libs.ktor.client.core)
implementation(libs.ktor.client.android)
implementation(libs.ktorfit.lib)
}
kotlin{
sourceSets{
commonMain.dependencies {
implementation(projects.core.datastore)
implementation(projects.core.network)
implementation(projects.core.domain)
implementation(compose.material3)
implementation(compose.components.resources)
implementation(compose.ui)
implementation(libs.androidx.paging.common)
implementation(libs.coil.kt.compose)
}
androidMain.dependencies{
implementation(libs.androidx.paging.compose)
implementation(compose.ui)
implementation(compose.material3)
implementation(libs.androidx.compose.foundation)
}
}
}
Loading