Skip to content

Commit

Permalink
feat: implemented navigation component in checker inbox task module
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya-gupta99 committed Aug 18, 2024
1 parent e074088 commit 9cdcc3c
Show file tree
Hide file tree
Showing 17 changed files with 85 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ExperimentalFoundationApi::class
)

package com.mifos.feature.checker_inbox_task.checker_inbox.ui
package com.mifos.feature.checker_inbox_task.checker_inbox

import android.widget.Toast
import androidx.activity.compose.BackHandler
Expand Down Expand Up @@ -70,7 +70,7 @@ import com.mifos.core.designsystem.theme.White
import com.mifos.core.objects.checkerinboxandtasks.CheckerTask
import com.mifos.core.ui.components.SelectionModeTopAppBar
import com.mifos.feature.checker_inbox_task.R
import com.mifos.feature.checker_inbox_task.dialog.CheckerInboxTasksFilterDialog
import com.mifos.feature.checker_inbox_task.checker_inbox_dialog.CheckerInboxTasksFilterDialog
import java.sql.Timestamp

@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mifos.feature.checker_inbox_task.checker_inbox.ui
package com.mifos.feature.checker_inbox_task.checker_inbox

import com.mifos.core.objects.checkerinboxandtasks.CheckerInboxSearchTemplate
import com.mifos.core.objects.checkerinboxandtasks.CheckerTask
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mifos.feature.checker_inbox_task.checker_inbox.ui
package com.mifos.feature.checker_inbox_task.checker_inbox

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mifos.feature.checker_inbox_task.dialog
package com.mifos.feature.checker_inbox_task.checker_inbox_dialog

import android.annotation.SuppressLint
import android.widget.Toast
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mifos.feature.checker_inbox_task.dialog
package com.mifos.feature.checker_inbox_task.checker_inbox_dialog

import android.util.Log
import androidx.compose.runtime.mutableStateOf
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mifos.feature.checker_inbox_task.checker_inbox_tasks.ui
package com.mifos.feature.checker_inbox_task.checker_inbox_tasks

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mifos.feature.checker_inbox_task.checker_inbox_tasks.ui
package com.mifos.feature.checker_inbox_task.checker_inbox_tasks


/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mifos.feature.checker_inbox_task.checker_inbox_tasks.ui
package com.mifos.feature.checker_inbox_task.checker_inbox_tasks

import android.util.Log
import androidx.lifecycle.ViewModel
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.mifos.feature.checker_inbox_task.navigation

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

fun NavGraphBuilder.checkerInboxTaskGraph(
navController: NavController,
) {
navigation(
startDestination = CheckerInboxTaskScreens.CheckerInboxTaskScreen.route,
route = CheckerInboxTaskScreens.CheckerInboxTaskScreenRoute.route
) {
checkerInboxTaskRoute(
onBackPressed = navController::popBackStack,
checkerInbox = navController::navigateCheckerInbox
)
checkerInboxRoute(
onBackPressed = navController::popBackStack
)
}
}

fun NavGraphBuilder.checkerInboxTaskRoute(
onBackPressed: () -> Unit,
checkerInbox: () -> Unit
) {
composable(
route = CheckerInboxTaskScreens.CheckerInboxTaskScreen.route
) {
CheckerInboxTasksScreen(
onBackPressed = onBackPressed,
checkerInbox = checkerInbox
)
}
}

fun NavGraphBuilder.checkerInboxRoute(
onBackPressed: () -> Unit
) {
composable(
route = CheckerInboxTaskScreens.CheckerInboxScreen.route
) {
CheckerInboxScreen(
onBackPressed = onBackPressed
)
}
}

fun NavController.navigateCheckerInbox() {
navigate(CheckerInboxTaskScreens.CheckerInboxScreen.route)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.mifos.feature.checker_inbox_task.navigation

sealed class CheckerInboxTaskScreens(val route: String) {

data object CheckerInboxTaskScreenRoute :
CheckerInboxTaskScreens("checker_inbox_task_screen_route")

data object CheckerInboxTaskScreen : CheckerInboxTaskScreens("checker_inbox_task_screen")

data object CheckerInboxScreen : CheckerInboxTaskScreens("checker_inbox_screen")

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.compose.material.icons.rounded.Settings
import androidx.compose.material.icons.rounded.Task
import androidx.compose.ui.graphics.vector.ImageVector
import com.mifos.feature.about.navigation.ABOUT_SCREEN_ROUTE
import com.mifos.feature.checker_inbox_task.navigation.CHECKER_INBOX_TASK_SCREEN_ROUTE
import com.mifos.feature.checker_inbox_task.navigation.CheckerInboxTaskScreens
import com.mifos.feature.groups.navigation.GROUP_LIST_SCREEN_ROUTE
import com.mifos.feature.individual_collection_sheet.navigation.GENERATE_COLLECTION_SHEET_SCREEN_ROUTE
import com.mifos.feature.individual_collection_sheet.navigation.INDIVIDUAL_COLLECTION_SHEET_SCREEN_ROUTE
Expand Down Expand Up @@ -53,7 +53,7 @@ sealed class HomeDestinationsScreen(

data object CheckerInboxAndTasksScreen : HomeDestinationsScreen(
title = "Checker Inbox & Tasks",
route = CHECKER_INBOX_TASK_SCREEN_ROUTE,
route = CheckerInboxTaskScreens.CheckerInboxTaskScreen.route,
icon = Icons.Rounded.CheckBox
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import androidx.navigation.compose.NavHost
import com.mifos.core.common.utils.Constants
import com.mifos.feature.about.navigation.aboutScreen
import com.mifos.feature.center.navigation.centerNavGraph
import com.mifos.feature.checker_inbox_task.navigation.checkerInboxTasksScreen
import com.mifos.feature.checker_inbox_task.navigation.checkerInboxTaskGraph
import com.mifos.feature.client.navigation.clientNavGraph
import com.mifos.feature.document.navigation.documentListScreen
import com.mifos.feature.document.navigation.navigateToDocumentListScreen
Expand Down Expand Up @@ -120,8 +120,8 @@ fun Navigation(
}
)

checkerInboxTasksScreen(
onBackPressed = { navController.popBackStack() },
checkerInboxTaskGraph(
navController = navController
)

individualCollectionSheetScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import com.mifos.mifosxdroid.R
import com.mifos.mifosxdroid.databinding.DialogFragmentCheckerTaskFilterBinding
import com.mifos.feature.checker_inbox_task.dialog.CheckerInboxViewModel
import com.mifos.feature.checker_inbox_task.checker_inbox_dialog.CheckerInboxViewModel
import com.mifos.feature.checker_inbox_task.dialog.CheckerInboxViewModelFactory
import com.mifos.mifosxdroid.uihelpers.MFDatePicker
import com.mifos.utils.FragmentConstants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy
import com.mifos.core.common.utils.Constants
import com.mifos.core.objects.checkerinboxandtasks.CheckerTask
import com.mifos.feature.checker_inbox_task.checker_inbox.ui.CheckerInboxScreen
import com.mifos.feature.checker_inbox_task.checker_inbox.CheckerInboxScreen
import com.mifos.mifosxdroid.core.MifosBaseFragment
import dagger.hilt.android.AndroidEntryPoint
import java.sql.Timestamp


@AndroidEntryPoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy
import androidx.navigation.fragment.findNavController
import com.mifos.feature.checker_inbox_task.checker_inbox_tasks.ui.CheckerInboxTasksScreen
import com.mifos.feature.checker_inbox_task.checker_inbox_tasks.CheckerInboxTasksScreen
import com.mifos.mifosxdroid.R
import com.mifos.mifosxdroid.core.MifosBaseFragment
import dagger.hilt.android.AndroidEntryPoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.mifos.mifosxdroid.online.checkerinbox
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.mifos.core.network.datamanager.DataManagerCheckerInbox
import com.mifos.feature.checker_inbox_task.dialog.CheckerInboxViewModel
import com.mifos.feature.checker_inbox_task.checker_inbox_dialog.CheckerInboxViewModel
import rx.subscriptions.CompositeSubscription
import javax.inject.Inject

Expand Down

0 comments on commit 9cdcc3c

Please sign in to comment.