Skip to content

Commit

Permalink
Merge branch 'master' into nav_graph_path
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya-gupta99 authored Aug 21, 2024
2 parents cdc9bd1 + e2b3338 commit 05a7983
Show file tree
Hide file tree
Showing 74 changed files with 908 additions and 208 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ object Constants {
const val ACTIVATE_CENTER = "activate_center"
const val ACTIVATE_GROUP = "activate_group"
const val ACTIVATE_TYPE = "activation_type"
const val ACTIVATE_ID = "activation_id"
const val INTIAL_LOGIN = "initial_login"
const val INDIVIDUAL_SHEET = "collection_sheet"
const val DISBURSEMENT_DATE = "disbursement_date"
Expand Down Expand Up @@ -216,4 +217,5 @@ object Constants {
const val REPORT_TYPE_ITEM = "report_type_item"
const val REPORT_PARAMETER_RESPONSE = "report_parameter_response"
const val LOAN_WITH_ASSOCIATIONS = "loanWithAssociation"
const val PASSCODE_INITIAL_LOGIN = "passcode_initial_login"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ val LightGray = Color(0xFFD3D3D3)
val BluePrimary = Color(0xFF2D5BA8)
val BluePrimaryDark = Color(0xFF9BB1E3)
val BlueSecondary = Color(0xFFD7E2FC)
val LightGreen = Color(0xFF99CC00)
val LightGreen = Color(0xFF99CC00)
val SummerSky = Color(0xFF29B6F6)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.mifos.feature.about.navigation

/**
* Created by Pronay Sarker on 18/08/2024 (2:42 PM)
*/
sealed class AboutScreens(val route: String) {
data object AboutScreen : AboutScreens(route = "about_screen_route")
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ 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) {
composable(AboutScreens.AboutScreen.route) {
AboutScreen(
onBackPressed = onBackPressed
)
}
}
}

fun NavController.navigateToAboutScreen() {
navigate(AboutScreens.AboutScreen.route)
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ import java.util.Locale

@Composable
fun ActivateScreen(
id: Int,
activateType: String,
onBackPressed: () -> Unit
) {

val viewModel: ActivateViewModel = hiltViewModel()
val state by viewModel.activateUiState.collectAsStateWithLifecycle()
val id by viewModel.id.collectAsStateWithLifecycle()
val activateType by viewModel.activateType.collectAsStateWithLifecycle()

ActivateScreen(
state = state,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.mifos.feature.activate

import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.mifos.core.common.utils.Constants
import com.mifos.core.common.utils.Resource
import com.mifos.core.domain.use_cases.ActivateCenterUseCase
import com.mifos.core.domain.use_cases.ActivateClientUseCase
Expand All @@ -18,9 +20,13 @@ import javax.inject.Inject
class ActivateViewModel @Inject constructor(
private val activateClientUseCase: ActivateClientUseCase,
private val activateCenterUseCase: ActivateCenterUseCase,
private val activateGroupUseCase: ActivateGroupUseCase
private val activateGroupUseCase: ActivateGroupUseCase,
savedStateHandle: SavedStateHandle
) : ViewModel() {

val id = savedStateHandle.getStateFlow(key = Constants.ACTIVATE_ID, initialValue = 0)
val activateType = savedStateHandle.getStateFlow(key = Constants.ACTIVATE_TYPE, initialValue = "")

private val _activateUiState = MutableStateFlow<ActivateUiState>(ActivateUiState.Initial)
val activateUiState = _activateUiState.asStateFlow()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.mifos.feature.activate.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavType
import androidx.navigation.compose.composable
import androidx.navigation.navArgument
import com.mifos.core.common.utils.Constants
import com.mifos.feature.activate.ActivateScreen

/**
* Created by Pronay Sarker on 18/08/2024 (1:40 PM)
*/
fun NavGraphBuilder.activateScreen(
onBackPressed: () -> Unit
) {
composable(
route = ActivateScreens.ActivateScreen.route,
arguments = listOf(
navArgument(name = Constants.ACTIVATE_ID, builder = { NavType.IntType }),
navArgument(name = Constants.ACTIVATE_TYPE, builder = { NavType.StringType })
)
) {
ActivateScreen(
onBackPressed = onBackPressed
)
}
}

fun NavController.navigateToActivateScreen(id : Int, type : String){
navigate(ActivateScreens.ActivateScreen.argument(id, type))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.mifos.feature.activate.navigation

import com.mifos.core.common.utils.Constants

/**
* Created by Pronay Sarker on 18/08/2024 (1:40 PM)
*/
sealed class ActivateScreens(val route: String) {
data object ActivateScreen : ActivateScreens("activate_screen/{${Constants.ACTIVATE_ID}}/{${Constants.ACTIVATE_TYPE}}") {
fun argument(id: Int, type: String) = "activate_screen/$id/$type"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mifos.feature.auth.login.presentation
package com.mifos.feature.auth.login

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mifos.feature.auth.login.presentation
package com.mifos.feature.auth.login

/**
* Created by Aditya Gupta on 06/08/23.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.mifos.feature.auth.login.presentation
package com.mifos.feature.auth.login

import android.content.Context
import androidx.lifecycle.ViewModel
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.mifos.feature.auth.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import androidx.navigation.navigation
import com.mifos.feature.auth.login.LoginScreen

fun NavGraphBuilder.authNavGraph(
navigateHome: () -> Unit,
navigatePasscode: () -> Unit,
updateServerConfig: () -> Unit
) {
navigation(
startDestination = AuthScreens.LoginScreen.route,
route = AuthScreens.LoginScreenRoute.route
) {
loginRoute(
navigatePasscode = navigatePasscode,
navigateHome = navigateHome,
updateServerConfig = updateServerConfig
)
}

}

fun NavGraphBuilder.loginRoute(
navigateHome: () -> Unit,
navigatePasscode: () -> Unit,
updateServerConfig: () -> Unit
) {
composable(
route = AuthScreens.LoginScreen.route
) {
LoginScreen(
homeIntent = navigateHome,
passcodeIntent = navigatePasscode,
onClickToUpdateServerConfig = updateServerConfig
)
}
}

fun NavController.navigateToLogin() {
navigate(AuthScreens.LoginScreen.route)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.mifos.feature.auth.navigation

sealed class AuthScreens(val route: String) {

data object LoginScreenRoute : AuthScreens("login_screen_route")

data object LoginScreen : AuthScreens("login_screen")

}
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 @@ -195,6 +195,7 @@ fun GenerateCollectionSheetScreen(
}
}

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun GenerateCollectionSheetContent(
centerDetailsState: List<CenterDetail>?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ fun IndividualCollectionSheetScreen(
onBackPressed: () -> Unit,
onDetail: (String, IndividualCollectionSheet) -> Unit,
) {

val snackbarHostState = remember { SnackbarHostState() }

val pagerState = rememberPagerState(
Expand Down
Loading

0 comments on commit 05a7983

Please sign in to comment.