Skip to content

Commit

Permalink
Implemented navigation in home destination modules (openMF#2184)
Browse files Browse the repository at this point in the history
implement navigation in module

implement navigation to home screens
  • Loading branch information
itsPronay authored Aug 11, 2024
1 parent 1b13d26 commit 8b42ed1
Show file tree
Hide file tree
Showing 18 changed files with 545 additions and 212 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.mifos.feature.about.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.mifos.feature.about.AboutScreen

/**
* Created by Pronay Sarker on 10/08/2024 (7:56 AM)
*/
const val ABOUT_SCREEN_ROUTE = "about_screen_route"

fun NavController.navigateToAboutScreen() {
this.navigate(ABOUT_SCREEN_ROUTE)
}

fun NavGraphBuilder.aboutScreen(
onBackPressed: () -> Unit
) {
composable(ABOUT_SCREEN_ROUTE) {
AboutScreen(
onBackPressed = onBackPressed
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.mifos.feature.center.navigation

import androidx.compose.foundation.layout.PaddingValues
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.mifos.feature.center.center_list.ui.CenterListScreen

/**
* Created by Pronay Sarker on 10/08/2024 (6:55 AM)
*/
const val CENTER_LIST_SCREEN_ROUTE = "center_list_route"

fun NavController.navigateToCenterList() {
this.navigate(CENTER_LIST_SCREEN_ROUTE)
}

fun NavGraphBuilder.centerListScreen(
paddingValues: PaddingValues,
createNewCenter: () -> Unit,
syncClicked: () -> Unit,
onCenterSelect: () -> Unit
) {
composable(CENTER_LIST_SCREEN_ROUTE) {
CenterListScreen(
paddingValues = paddingValues,
createNewCenter = { /*TODO*/ },
syncClicked = { },
onCenterSelect = { }
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.mifos.feature.checker_inbox_task.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.mifos.feature.checker_inbox_task.checker_inbox_tasks.ui.CheckerInboxTasksScreen

/**
* Created by Pronay Sarker on 10/08/2024 (7:59 AM)
*/
const val CHECKER_INBOX_TASK_SCREEN_ROUTE = "checker_inbox_task_screen_route"

fun NavController.navigateToCheckerInboxTaskScreen() {
this.navigate(CHECKER_INBOX_TASK_SCREEN_ROUTE)
}

fun NavGraphBuilder.checkerInboxTasksScreen(
onBackPressed: () -> Unit,
){
composable(CHECKER_INBOX_TASK_SCREEN_ROUTE) {
CheckerInboxTasksScreen(
onBackPressed = onBackPressed,
checkerInbox = {}
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.mifos.feature.client.navigation

import androidx.compose.foundation.layout.PaddingValues
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.mifos.feature.client.clientList.presentation.ClientListScreen

/**
* Created by Pronay Sarker on 10/08/2024 (6:47 AM)
*/
const val CLIENT_LIST_SCREEN_ROUTE = "client_list_screen"

fun NavController.navigateToClientListScreen() {
this.navigate(CLIENT_LIST_SCREEN_ROUTE)
}

fun NavGraphBuilder.clientListScreen(
paddingValues: PaddingValues,
createNewClient : () -> Unit,
syncClicked : () -> Unit,
onClientSelect : () -> Unit
) {
composable(CLIENT_LIST_SCREEN_ROUTE) {
ClientListScreen(
paddingValues = paddingValues,
createNewClient = { },
syncClicked = { },
onClientSelect = { }
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.mifos.feature.individual_collection_sheet.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.mifos.feature.individual_collection_sheet.generate_collection_sheet.GenerateCollectionSheetScreen

/**
* Created by Pronay Sarker on 10/08/2024 (7:30 AM)
*/
const val GENERATE_COLLECTION_SHEET_SCREEN_ROUTE = "generate_collection_sheet_route"

fun NavController.navigateToGenerateCollectionSheet() {
this.navigate(GENERATE_COLLECTION_SHEET_SCREEN_ROUTE)
}

fun NavGraphBuilder.generateCollectionSheetScreen(
onBackPressed: () -> Unit
){
composable(GENERATE_COLLECTION_SHEET_SCREEN_ROUTE) {
GenerateCollectionSheetScreen (
onBackPressed = onBackPressed
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.mifos.feature.individual_collection_sheet.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.mifos.core.objects.collectionsheet.IndividualCollectionSheet
import com.mifos.feature.individual_collection_sheet.individual_collection_sheet.ui.IndividualCollectionSheetScreen

/**
* Created by Pronay Sarker on 10/08/2024 (7:24 AM)
*/
const val INDIVIDUAL_COLLECTION_SHEET_SCREEN_ROUTE = "individual_collection_sheet_route"

fun NavController.navigateToIndividualCollectionSheet() {
this.navigate(INDIVIDUAL_COLLECTION_SHEET_SCREEN_ROUTE)
}

fun NavGraphBuilder.individualCollectionSheetScreen(
onBackClicked: () -> Unit,
onDetail: (String, IndividualCollectionSheet) -> Unit,
){
composable(INDIVIDUAL_COLLECTION_SHEET_SCREEN_ROUTE) {
IndividualCollectionSheetScreen(
onBackPressed = {},
onDetail = { _, _ -> }
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ fun GroupDetailsScreen(
savingsAccountSelected: (Int, DepositType) -> Unit,
activateGroup: (Int) -> Unit
) {

val viewModel: GroupDetailsViewModel = hiltViewModel()
val state by viewModel.groupDetailsUiState.collectAsStateWithLifecycle()
val loanAccounts by viewModel.loanAccount.collectAsStateWithLifecycle()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.mifos.feature.groups.navigation

import androidx.compose.foundation.layout.PaddingValues
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.mifos.core.objects.group.Group
import com.mifos.feature.groups.group_list.GroupsListRoute

/**
* Created by Pronay Sarker on 10/08/2024 (6:07 AM)
*/
const val GROUP_LIST_SCREEN_ROUTE = "group_list_route"

fun NavController.navigateToGroupList() {
this.navigate(GROUP_LIST_SCREEN_ROUTE)
}

fun NavGraphBuilder.groupListScreen(
paddingValues: PaddingValues,
onAddGroupClick: () -> Unit,
onGroupClick: (Group) -> Unit,
onSyncClick: (List<Group>) -> Unit,
) {
composable(GROUP_LIST_SCREEN_ROUTE) {
GroupsListRoute(
paddingValues = paddingValues,
onAddGroupClick = onAddGroupClick,
onGroupClick = onGroupClick,
onSyncClick = onSyncClick
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.mifos.feature.path_tracking.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.mifos.feature.path_tracking.PathTrackingScreen

/**
* Created by Pronay Sarker on 10/08/2024 (7:35 AM)
*/
const val PATH_TRACKING_SCREEN_ROUTE = "path_tracking_route"

fun NavController.navigateToPathTrackingScreen() {
this.navigate(PATH_TRACKING_SCREEN_ROUTE)
}

fun NavGraphBuilder.pathTrackingScreen(
onBackPressed: () -> Unit
) {
composable(PATH_TRACKING_SCREEN_ROUTE) {
PathTrackingScreen(
onBackPressed = onBackPressed,
onPathTrackingClick = {}
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.mifos.feature.report.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.mifos.feature.report.run_report.RunReportScreen

/**
* Created by Pronay Sarker on 10/08/2024 (7:32 AM)
*/
const val RUN_REPORTS_SCREEN_ROUTE = "run_reports_route"

fun NavController.navigateToRunReports() {
this.navigate(RUN_REPORTS_SCREEN_ROUTE)
}

fun NavGraphBuilder.runReportsScreen(
onReportClick: () -> Unit,
onBackPressed: () -> Unit
) {
composable(RUN_REPORTS_SCREEN_ROUTE) {
RunReportScreen(
onBackPressed = {},
onReportClick = {}
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.mifos.feature.search.Navigation

import androidx.compose.ui.Modifier
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.mifos.core.ui.components.FabType
import com.mifos.feature.search.SearchScreenRoute

/**
* Created by Pronay Sarker on 10/08/2024 (6:35 AM)
*/
const val SEARCH_SCREEN_ROUTE = "search_screen"

fun NavController.navigateToSearchScreen() {
this.navigate(SEARCH_SCREEN_ROUTE)
}

fun NavGraphBuilder.searchScreen(
modifier: Modifier = Modifier,
centerListScreen: () -> Unit,
groupListScreen: () -> Unit,
clientListScreen: () -> Unit,
) {
composable(SEARCH_SCREEN_ROUTE) {
SearchScreenRoute(
modifier = Modifier,
onFabClick = { fabOptions ->
when(fabOptions){
FabType.CLIENT -> TODO()
FabType.CENTER -> TODO()
FabType.GROUP -> TODO()
}
},
onSearchOptionClick = {

},
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.mifos.feature.settings.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.mifos.feature.settings.settings.SettingsScreen

/**
* Created by Pronay Sarker on 10/08/2024 (7:52 AM)
*/
const val SETTINGS_SCREEN_ROUTE = "settings_screen_route"

fun NavController.navigateToSettingsScreen() {
this.navigate(SETTINGS_SCREEN_ROUTE)
}

fun NavGraphBuilder.settingsScreen(
navigateBack: () -> Unit,
navigateToLoginScreen: () -> Unit,
changePasscode: (String) -> Unit,
languageChanged: () -> Unit,
serverConfig: () -> Unit
) {
composable(SETTINGS_SCREEN_ROUTE) {
SettingsScreen(
onBackPressed = navigateBack,
navigateToLoginScreen = navigateToLoginScreen,
languageChanged = languageChanged,
serverConfig = serverConfig,
changePasscode = { }
)
}
}
Loading

0 comments on commit 8b42ed1

Please sign in to comment.