Skip to content

Commit 3383b56

Browse files
authored
Merge branch 'development' into MM-458
2 parents 39a34a0 + 989d07e commit 3383b56

25 files changed

+859
-2
lines changed

feature/settings/src/commonMain/kotlin/org/mifos/mobile/feature/settings/about/AboutNavigation.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ import androidx.navigation.NavOptions
1515
import org.mifos.mobile.core.ui.composableWithPushTransitions
1616
import org.mifos.mobile.feature.settings.componenets.SettingsItems
1717

18+
/**
19+
* Defines the "About Us" screen destination in the navigation graph.
20+
*
21+
* @param onBackClick Lambda to handle back navigation.
22+
*/
1823
internal fun NavGraphBuilder.aboutDestination(
1924
onBackClick: () -> Unit,
2025
) {
@@ -25,5 +30,10 @@ internal fun NavGraphBuilder.aboutDestination(
2530
}
2631
}
2732

33+
/**
34+
* Navigates to the "About Us" screen.
35+
*
36+
* @param navOptions Optional navigation options.
37+
*/
2838
internal fun NavController.navigateToAbout(navOptions: NavOptions? = null) =
2939
navigate(SettingsItems.AboutUs, navOptions)

feature/settings/src/commonMain/kotlin/org/mifos/mobile/feature/settings/about/AboutScreen.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ import org.mifos.mobile.core.designsystem.theme.DesignToken
4949
import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme
5050
import org.mifos.mobile.core.designsystem.theme.MifosTypography
5151

52+
/**
53+
* The main entry point for the "About Us" screen. This composable function serves as a wrapper
54+
* around the actual content, allowing for separation of concerns and easier testing.
55+
*
56+
* @param modifier The [Modifier] to be applied to the screen.
57+
* @param onBackClick A lambda function to be invoked when the back button is pressed,
58+
* triggering navigation to the previous screen.
59+
*/
5260
@Composable
5361
fun AboutScreen(
5462
modifier: Modifier = Modifier,
@@ -60,6 +68,13 @@ fun AboutScreen(
6068
)
6169
}
6270

71+
/**
72+
* Renders the UI content for the "About Us" screen. This includes the screen's scaffold,
73+
* top bar, and the informational content about the Mifos Initiative.
74+
*
75+
* @param modifier The [Modifier] to be applied to the content layout.
76+
* @param onBackClick A lambda function to handle the back navigation event from the scaffold.
77+
*/
6378
@Composable
6479
internal fun AboutScreenContent(
6580
modifier: Modifier = Modifier,
@@ -154,6 +169,11 @@ internal fun AboutScreenContent(
154169
}
155170
}
156171

172+
/**
173+
* A Jetpack Compose preview function for the [AboutScreenContent]. This allows for
174+
* visualizing the UI component in Android Studio's preview pane without needing to
175+
* run the entire application.
176+
*/
157177
@Preview
158178
@Composable
159179
internal fun AboutScreenContentPreview() {

feature/settings/src/commonMain/kotlin/org/mifos/mobile/feature/settings/appInfo/AppInfoNavigation.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,24 @@ import androidx.navigation.NavOptions
1515
import org.mifos.mobile.core.ui.composableWithPushTransitions
1616
import org.mifos.mobile.feature.settings.componenets.SettingsItems
1717

18+
/**
19+
* Navigates to the App Info screen. This is an extension function on [NavController]
20+
* that simplifies the process of navigating to the app info destination.
21+
*
22+
* @param navOptions Optional [NavOptions] to apply to this navigation operation,
23+
* allowing for customization of aspects like launch modes and animations.
24+
*/
1825
internal fun NavController.navigateToAppInfo(navOptions: NavOptions? = null) =
1926
navigate(SettingsItems.AppInfo, navOptions)
2027

28+
/**
29+
* Defines the composable destination for the "App Info" screen within the navigation graph.
30+
* This sets up the route and the content to be displayed, along with screen transitions.
31+
*
32+
* @param onBackClick A lambda function to be invoked when the user initiates a back action.
33+
* @param navigateToPrivacyPolicy A lambda function to navigate to the Privacy Policy screen.
34+
* @param navigateToTermsAndConditions A lambda function to navigate to the Terms and Conditions screen.
35+
*/
2136
internal fun NavGraphBuilder.appInfoDestination(
2237
onBackClick: () -> Unit,
2338
navigateToPrivacyPolicy: () -> Unit,

feature/settings/src/commonMain/kotlin/org/mifos/mobile/feature/settings/appInfo/AppInfoScreen.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ import org.mifos.mobile.core.designsystem.theme.DesignToken
4848
import org.mifos.mobile.core.designsystem.theme.MifosTypography
4949
import org.mifos.mobile.feature.settings.util.appVersion
5050

51+
/**
52+
* The main composable for the App Info screen, which acts as a stateful wrapper
53+
* around the core UI content.
54+
*
55+
* @param onBackClick Lambda to handle back navigation events.
56+
* @param navigateToPrivacyPolicy Lambda to navigate to the Privacy Policy screen.
57+
* @param modifier The [Modifier] to be applied to this screen.
58+
* @param navigateToTermsAndConditions Lambda to navigate to the Terms and Conditions screen.
59+
*/
5160
@Composable
5261
internal fun AppInfoScreen(
5362
onBackClick: () -> Unit,
@@ -63,6 +72,15 @@ internal fun AppInfoScreen(
6372
)
6473
}
6574

75+
/**
76+
* Renders the stateless UI content for the App Info screen. This includes details
77+
* about the app, version, and links to legal documents.
78+
*
79+
* @param onBackClick Lambda to handle back navigation from the top bar.
80+
* @param navigateToPrivacyPolicy Lambda to navigate to the Privacy Policy screen.
81+
* @param modifier The [Modifier] to be applied to the layout.
82+
* @param navigateToTermsAndConditions Lambda to navigate to the Terms and Conditions screen.
83+
*/
6684
@Suppress("UnusedParameter")
6785
@Composable
6886
internal fun AppInfoContent(

feature/settings/src/commonMain/kotlin/org/mifos/mobile/feature/settings/componenets/MifosLogoutDilaog.kt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ import org.mifos.mobile.core.designsystem.theme.AppColors
3737
import org.mifos.mobile.core.designsystem.theme.DesignToken
3838
import org.mifos.mobile.core.designsystem.theme.MifosTypography
3939

40+
/**
41+
* A composable function that displays a confirmation dialog for logging out.
42+
* The dialog's visibility and content are controlled by the [LogoutDialogState].
43+
*
44+
* @param visibilityState The state that determines whether the dialog is shown or hidden,
45+
* and provides the necessary content and actions.
46+
*/
4047
@Composable
4148
fun MifosLogoutDialog(
4249
visibilityState: LogoutDialogState,
@@ -117,10 +124,27 @@ fun MifosLogoutDialog(
117124
}
118125
}
119126

127+
/**
128+
* Represents the state of the [MifosLogoutDialog].
129+
*/
120130
sealed interface LogoutDialogState {
121131

132+
/**
133+
* The dialog is hidden.
134+
*/
122135
data object Hidden : LogoutDialogState
123136

137+
/**
138+
* The dialog is visible.
139+
*
140+
* @param description The main descriptive text of the dialog.
141+
* @param title The title of the dialog.
142+
* @param message A message typically shown below the main action button.
143+
* @param messageActionText Clickable text accompanying the message.
144+
* @param onLogout Lambda to be executed when the logout button is clicked.
145+
* @param onNavigateToHome Lambda to be executed when the message action text is clicked.
146+
* @param onDismiss Lambda to be executed when the dialog is dismissed.
147+
*/
124148
data class Shown(
125149
val description: StringResource,
126150
val title: StringResource,
@@ -132,6 +156,9 @@ sealed interface LogoutDialogState {
132156
) : LogoutDialogState
133157
}
134158

159+
/**
160+
* A Jetpack Compose preview for the [MifosLogoutDialog].
161+
*/
135162
@Preview
136163
@Composable
137164
fun MifosLogoutDialogPreview() {

feature/settings/src/commonMain/kotlin/org/mifos/mobile/feature/settings/componenets/SettingsItems.kt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ import org.jetbrains.compose.resources.StringResource
3737
import org.mifos.mobile.core.common.Constants
3838
import org.mifos.mobile.core.designsystem.icon.MifosIcons
3939

40+
/**
41+
* A sealed class representing all navigable items available on the settings screen.
42+
* Each object holds metadata for a specific setting, such as its title, subtitle, icon,
43+
* and navigation route, making it easy to generate UI components dynamically.
44+
*
45+
* This class is serializable to support navigation graph persistence.
46+
*
47+
* @property title The string resource for the setting's title.
48+
* @property subTitle The string resource for the setting's descriptive subtitle.
49+
* @property icon The vector graphic icon representing the setting.
50+
* @property route The unique navigation route string for the destination screen.
51+
*/
4052
@Serializable
4153
sealed class SettingsItems(
4254
@Contextual val title: StringResource,
@@ -53,6 +65,7 @@ sealed class SettingsItems(
5365
// route = Constants.PROFILE,
5466
// )
5567

68+
/** Represents the 'Change Password' setting. */
5669
@Serializable
5770
data object Password : SettingsItems(
5871
title = Res.string.feature_settings_action_password,
@@ -61,6 +74,7 @@ sealed class SettingsItems(
6174
route = Constants.PASSWORD,
6275
)
6376

77+
/** Represents the 'Set Passcode' setting for app authentication. */
6478
@Serializable
6579
data object AuthPasscode : SettingsItems(
6680
title = Res.string.feature_settings_action_auth_passcode,
@@ -69,6 +83,7 @@ sealed class SettingsItems(
6983
route = Constants.AUTH_PASSCODE,
7084
)
7185

86+
/** Represents the 'Language' selection setting. */
7287
@Serializable
7388
data object Language : SettingsItems(
7489
title = Res.string.feature_settings_action_language,
@@ -78,6 +93,7 @@ sealed class SettingsItems(
7893
)
7994

8095
// TODO : uncomment once ui/ux team provide a valid colours for dark theme
96+
/** Represents the 'Display Theme' setting (e.g., light/dark mode). */
8197
@Serializable
8298
data object Theme : SettingsItems(
8399
title = Res.string.feature_settings_action_theme,
@@ -94,6 +110,7 @@ sealed class SettingsItems(
94110
// route = Constants.ENDPOINT,
95111
// )
96112

113+
/** Represents the 'About Us' information screen. */
97114
@Serializable
98115
data object AboutUs : SettingsItems(
99116
title = Res.string.feature_settings_action_about_us,
@@ -102,6 +119,7 @@ sealed class SettingsItems(
102119
route = Constants.ABOUT_US,
103120
)
104121

122+
/** Represents the 'FAQ' (Frequently Asked Questions) screen. */
105123
@Serializable
106124
data object FAQ : SettingsItems(
107125
title = Res.string.feature_settings_action_faq,
@@ -110,6 +128,7 @@ sealed class SettingsItems(
110128
route = Constants.FAQ,
111129
)
112130

131+
/** Represents the 'Help' or support screen. */
113132
@Serializable
114133
data object Help : SettingsItems(
115134
title = Res.string.feature_settings_action_help,
@@ -118,6 +137,7 @@ sealed class SettingsItems(
118137
route = Constants.HELP,
119138
)
120139

140+
/** Represents the 'App Info' screen with version and legal details. */
121141
@Serializable
122142
data object AppInfo : SettingsItems(
123143
title = Res.string.feature_settings_action_app_info,
@@ -126,6 +146,7 @@ sealed class SettingsItems(
126146
route = Constants.APP_INFO,
127147
)
128148

149+
/** Represents the 'Logout' action. */
129150
@Serializable
130151
data object Logout : SettingsItems(
131152
title = Res.string.feature_settings_action_logout,
@@ -135,6 +156,10 @@ sealed class SettingsItems(
135156
)
136157
}
137158

159+
/**
160+
* An immutable list defining the order and content of items displayed on the settings screen.
161+
* This list is used to dynamically render the settings menu.
162+
*/
138163
internal val settingsItems: ImmutableList<SettingsItems> = persistentListOf(
139164
// SettingsItems.Profile,
140165
SettingsItems.Password,

feature/settings/src/commonMain/kotlin/org/mifos/mobile/feature/settings/di/SettingsModule.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ import org.mifos.mobile.feature.settings.password.ChangePasswordViewModel
1818
import org.mifos.mobile.feature.settings.settings.SettingsViewModel
1919
import org.mifos.mobile.feature.settings.theme.ChangeThemeViewModel
2020

21+
/**
22+
* Koin module for providing dependencies related to the settings feature.
23+
* This module declares all the ViewModels used across the settings screens,
24+
* making them available for dependency injection.
25+
*/
2126
val SettingsModule = module {
2227
viewModelOf(::SettingsViewModel)
2328
viewModelOf(::UpdatePasscodeViewModel)

feature/settings/src/commonMain/kotlin/org/mifos/mobile/feature/settings/faq/FaqNavigation.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ import androidx.navigation.NavOptions
1515
import org.mifos.mobile.core.ui.composableWithPushTransitions
1616
import org.mifos.mobile.feature.settings.componenets.SettingsItems
1717

18+
/**
19+
* Defines the composable destination for the "FAQ" (Frequently Asked Questions) screen
20+
* within the navigation graph.
21+
*
22+
* @param onBackClick A lambda function to be invoked when the user initiates a back action.
23+
* @param contact A lambda function to handle navigation to a contact or help screen.
24+
*/
1825
fun NavGraphBuilder.faqDestination(
1926
onBackClick: () -> Unit,
2027
contact: () -> Unit,
@@ -26,5 +33,12 @@ fun NavGraphBuilder.faqDestination(
2633
)
2734
}
2835
}
36+
37+
/**
38+
* Navigates to the "FAQ" screen. This is an extension function on [NavController]
39+
* that simplifies the process of navigating to the FAQ destination.
40+
*
41+
* @param navOptions Optional [NavOptions] to apply to this navigation operation.
42+
*/
2943
fun NavController.navigateToFaq(navOptions: NavOptions? = null) =
3044
navigate(SettingsItems.FAQ, navOptions)

feature/settings/src/commonMain/kotlin/org/mifos/mobile/feature/settings/faq/FaqScreen.kt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ import org.mifos.mobile.core.ui.component.FaqItemHolder
4848
import org.mifos.mobile.core.ui.utils.DevicePreview
4949
import org.mifos.mobile.core.ui.utils.EventsEffect
5050

51+
/**
52+
* A stateful composable that displays the FAQ screen. It collects state and events from
53+
* the [FaqViewModel] and delegates the UI rendering to [FaqScreenContent].
54+
*
55+
* @param onNavigateBack Callback to handle back navigation.
56+
* @param onClickHelp Callback to navigate to the help/contact screen.
57+
* @param modifier The [Modifier] to be applied to this screen.
58+
* @param viewModel The ViewModel responsible for the screen's logic and state.
59+
*/
5160
@Composable
5261
internal fun FaqScreen(
5362
onNavigateBack: () -> Unit,
@@ -71,6 +80,13 @@ internal fun FaqScreen(
7180
)
7281
}
7382

83+
/**
84+
* A stateless composable that renders the UI for the FAQ screen based on the provided [uiState].
85+
*
86+
* @param uiState The current state of the FAQ screen.
87+
* @param onAction Callback to send actions to the ViewModel.
88+
* @param modifier The [Modifier] to be applied to the layout.
89+
*/
7490
@Composable
7591
private fun FaqScreenContent(
7692
uiState: FaqState,
@@ -95,6 +111,14 @@ private fun FaqScreenContent(
95111
)
96112
}
97113

114+
/**
115+
* Renders the main content of the FAQ screen, including the list of questions and answers
116+
* or an empty state view if no FAQs are available.
117+
*
118+
* @param faqArrayList The list of [FAQ] items to display.
119+
* @param selectedFaqPosition The index of the currently expanded FAQ item.
120+
* @param onAction Callback to send actions to the ViewModel.
121+
*/
98122
@Composable
99123
private fun FaqContent(
100124
faqArrayList: List<FAQ>,
@@ -150,6 +174,10 @@ private fun FaqContent(
150174
}
151175
}
152176

177+
/**
178+
* A Jetpack Compose preview for the [FaqScreenContent]. This allows for
179+
* visualizing the UI component in Android Studio's preview pane.
180+
*/
153181
@DevicePreview
154182
@Composable
155183
fun FaqScreenPreview() {

0 commit comments

Comments
 (0)