diff --git a/feature/settings/build.gradle.kts b/feature/settings/build.gradle.kts index 7a9203e64cb..bfbb84dfdd8 100644 --- a/feature/settings/build.gradle.kts +++ b/feature/settings/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * 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) diff --git a/feature/settings/src/androidTest/java/com/mifos/feature/settings/ExampleInstrumentedTest.kt b/feature/settings/src/androidTest/java/com/mifos/feature/settings/ExampleInstrumentedTest.kt index 45b45d60810..3bf49926205 100644 --- a/feature/settings/src/androidTest/java/com/mifos/feature/settings/ExampleInstrumentedTest.kt +++ b/feature/settings/src/androidTest/java/com/mifos/feature/settings/ExampleInstrumentedTest.kt @@ -1,13 +1,20 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.feature.settings -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +28,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("com.mifos.feature.settings", appContext.packageName) } -} \ No newline at end of file +} diff --git a/feature/settings/src/main/AndroidManifest.xml b/feature/settings/src/main/AndroidManifest.xml index f1bb078dccf..7aa77dcdfb6 100644 --- a/feature/settings/src/main/AndroidManifest.xml +++ b/feature/settings/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + diff --git a/feature/settings/src/main/java/com/mifos/feature/settings/navigation/SettingsNavigation.kt b/feature/settings/src/main/java/com/mifos/feature/settings/navigation/SettingsNavigation.kt index e8d566b9884..71421f6157f 100644 --- a/feature/settings/src/main/java/com/mifos/feature/settings/navigation/SettingsNavigation.kt +++ b/feature/settings/src/main/java/com/mifos/feature/settings/navigation/SettingsNavigation.kt @@ -1,10 +1,17 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ 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 -import com.mifos.feature.settings.updateServer.UpdateServerConfigScreenRoute /** * Created by Pronay Sarker on 10/08/2024 (7:52 AM) @@ -16,13 +23,13 @@ fun NavGraphBuilder.settingsScreen( languageChanged: () -> Unit, ) { composable( - route = SettingsScreens.SettingsScreen.route + route = SettingsScreens.SettingsScreen.route, ) { SettingsScreen( onBackPressed = navigateBack, navigateToLoginScreen = navigateToLoginScreen, languageChanged = languageChanged, - changePasscode = changePasscode + changePasscode = changePasscode, ) } -} \ No newline at end of file +} diff --git a/feature/settings/src/main/java/com/mifos/feature/settings/navigation/SettingsScreens.kt b/feature/settings/src/main/java/com/mifos/feature/settings/navigation/SettingsScreens.kt index 142e619e755..b94420fdd43 100644 --- a/feature/settings/src/main/java/com/mifos/feature/settings/navigation/SettingsScreens.kt +++ b/feature/settings/src/main/java/com/mifos/feature/settings/navigation/SettingsScreens.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.feature.settings.navigation /** @@ -5,4 +14,4 @@ package com.mifos.feature.settings.navigation */ sealed class SettingsScreens(val route: String) { data object SettingsScreen : SettingsScreens("settings_screen") -} \ No newline at end of file +} diff --git a/feature/settings/src/main/java/com/mifos/feature/settings/settings/SettingsScreen.kt b/feature/settings/src/main/java/com/mifos/feature/settings/settings/SettingsScreen.kt index b6562dd7b61..ca74b702c4d 100644 --- a/feature/settings/src/main/java/com/mifos/feature/settings/settings/SettingsScreen.kt +++ b/feature/settings/src/main/java/com/mifos/feature/settings/settings/SettingsScreen.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.feature.settings.settings import android.content.ComponentName @@ -9,7 +18,6 @@ import android.widget.Toast import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn @@ -34,13 +42,11 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.platform.LocalAutofill import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringArrayResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import androidx.core.content.ContentProviderCompat.requireContext import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.mifos.core.common.enums.MifosAppLanguage @@ -55,7 +61,7 @@ import com.mifos.feature.settings.updateServer.UpdateServerConfigScreenRoute import java.util.Locale @Composable -fun SettingsScreen( +internal fun SettingsScreen( onBackPressed: () -> Unit, navigateToLoginScreen: () -> Unit, changePasscode: (String) -> Unit, @@ -89,17 +95,16 @@ fun SettingsScreen( updateLanguageLocale( context = context, language = it.code, - isSystemLanguage = isSystemLanguage + isSystemLanguage = isSystemLanguage, ) languageChanged() }, ) } - @OptIn(ExperimentalMaterial3Api::class) @Composable -fun SettingsScreen( +internal fun SettingsScreen( onBackPressed: () -> Unit, selectedLanguage: String, selectedTheme: String, @@ -110,7 +115,6 @@ fun SettingsScreen( updateTheme: (theme: AppTheme) -> Unit, updateLanguage: (language: MifosAppLanguage) -> Unit, ) { - val snackbarHostState = remember { SnackbarHostState() } var showLanguageUpdateDialog by rememberSaveable { mutableStateOf(false) } var showEndpointUpdateDialog by rememberSaveable { mutableStateOf(false) } @@ -128,7 +132,7 @@ fun SettingsScreen( snackbarHostState = snackbarHostState, ) { paddingValues -> Column( - Modifier.padding(paddingValues) + Modifier.padding(paddingValues), ) { SettingsCards( settingsCardClicked = { item -> @@ -145,7 +149,7 @@ fun SettingsScreen( SettingsCardItem.SERVER_CONFIG -> showServerConfig = true } - } + }, ) } } @@ -154,7 +158,7 @@ fun SettingsScreen( SyncSurveysDialog( closeDialog = { showSyncSurveyDialog = false - } + }, ) } @@ -168,7 +172,7 @@ fun SettingsScreen( onSuccessful = { showServerConfig = false showRestartCountdownToast(context, 2) - } + }, ) } } @@ -179,7 +183,7 @@ fun SettingsScreen( items = stringArrayResource(R.array.feature_settings_languages), selectItem = { _, index -> updateLanguage(MifosAppLanguage.entries[index]) }, onDismissRequest = { showLanguageUpdateDialog = false }, - selectedItem = MifosAppLanguage.fromCode(selectedLanguage).displayName + selectedItem = MifosAppLanguage.fromCode(selectedLanguage).displayName, ) } @@ -189,7 +193,7 @@ fun SettingsScreen( items = AppTheme.entries.map { it.themeName }.toTypedArray(), selectItem = { _, index -> updateTheme(AppTheme.entries[index]) }, onDismissRequest = { showThemeUpdateDialog = false }, - selectedItem = selectedTheme + selectedItem = selectedTheme, ) } @@ -198,13 +202,13 @@ fun SettingsScreen( initialBaseURL = baseURL, initialTenant = tenant, onDismissRequest = { showEndpointUpdateDialog = false }, - handleEndpointUpdate = handleEndpointUpdate + handleEndpointUpdate = handleEndpointUpdate, ) } } @Composable -fun SettingsCards( +private fun SettingsCards( settingsCardClicked: (SettingsCardItem) -> Unit, ) { LazyColumn { @@ -215,24 +219,24 @@ fun SettingsCards( icon = card.icon, onclick = { settingsCardClicked(card) - } + }, ) } } } @Composable -fun SettingsCardItem( +private fun SettingsCardItem( title: Int, details: Int, icon: ImageVector?, - onclick: () -> Unit + onclick: () -> Unit, ) { Card( modifier = Modifier.fillMaxWidth(), colors = CardDefaults.cardColors(containerColor = Color.Transparent), shape = RoundedCornerShape(0.dp), - onClick = { onclick.invoke() } + onClick = { onclick.invoke() }, ) { Row( verticalAlignment = Alignment.CenterVertically, @@ -242,18 +246,18 @@ fun SettingsCardItem( Icon( imageVector = it, contentDescription = null, - modifier = Modifier.weight(0.2f) + modifier = Modifier.weight(0.2f), ) } if (icon == null) { Spacer(modifier = Modifier.weight(0.2f)) } Column( - modifier = Modifier.weight(0.8f) + modifier = Modifier.weight(0.8f), ) { Text( text = stringResource(id = title), - style = MaterialTheme.typography.bodyMedium + style = MaterialTheme.typography.bodyMedium, ) Text( modifier = Modifier.padding(end = 16.dp), @@ -266,8 +270,7 @@ fun SettingsCardItem( } } - -fun updateLanguageLocale(context: Context, language: String, isSystemLanguage: Boolean) { +private fun updateLanguageLocale(context: Context, language: String, isSystemLanguage: Boolean) { if (isSystemLanguage) { LanguageHelper.setLocale(context, language) } else { @@ -287,7 +290,7 @@ private fun showRestartCountdownToast(context: Context, seconds: Int) { Toast.makeText( context, "Restarting app in $secondsRemaining seconds", - Toast.LENGTH_SHORT + Toast.LENGTH_SHORT, ).show() } @@ -298,7 +301,7 @@ private fun showRestartCountdownToast(context: Context, seconds: Int) { countDownTimer.start() } -fun Context.restartApplication() { +private fun Context.restartApplication() { val packageManager: PackageManager = this.packageManager val intent: Intent = packageManager.getLaunchIntentForPackage(this.packageName)!! val componentName: ComponentName = intent.component!! @@ -309,7 +312,7 @@ fun Context.restartApplication() { @Composable @Preview(showSystemUi = true, showBackground = true) -fun PreviewSettingsScreen() { +private fun PreviewSettingsScreen() { SettingsScreen( onBackPressed = {}, selectedLanguage = "", @@ -321,5 +324,4 @@ fun PreviewSettingsScreen() { updateTheme = {}, changePasscode = {}, ) - -} \ No newline at end of file +} diff --git a/feature/settings/src/main/java/com/mifos/feature/settings/settings/SettingsViewModel.kt b/feature/settings/src/main/java/com/mifos/feature/settings/settings/SettingsViewModel.kt index b8f74247cae..4cbb02c6875 100644 --- a/feature/settings/src/main/java/com/mifos/feature/settings/settings/SettingsViewModel.kt +++ b/feature/settings/src/main/java/com/mifos/feature/settings/settings/SettingsViewModel.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.feature.settings.settings import androidx.appcompat.app.AppCompatDelegate @@ -17,7 +26,7 @@ import javax.inject.Inject @HiltViewModel class SettingsViewModel @Inject constructor( - private val prefManager: PrefManager + private val prefManager: PrefManager, ) : ViewModel() { val tenant: StateFlow = prefManager.getStringValue(Constants.TENANT) @@ -35,7 +44,6 @@ class SettingsViewModel @Inject constructor( val language: StateFlow = prefManager.getStringValue(Constants.LANGUAGE) .stateIn(viewModelScope, SharingStarted.Eagerly, "System Language") - fun updateTheme(theme: AppTheme) { prefManager.setStringValue(Constants.THEME, theme.themeName) AppCompatDelegate.setDefaultNightMode( @@ -43,7 +51,7 @@ class SettingsViewModel @Inject constructor( AppTheme.DARK -> AppCompatDelegate.MODE_NIGHT_YES AppTheme.LIGHT -> AppCompatDelegate.MODE_NIGHT_NO else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM - } + }, ) } @@ -54,54 +62,56 @@ class SettingsViewModel @Inject constructor( } fun tryUpdatingEndpoint(selectedBaseUrl: String, selectedTenant: String): Boolean { - // TODO Implement endpoint update + val isEndpointUpdated = !(baseUrl.value == selectedBaseUrl && tenant.value == selectedTenant) + if (isEndpointUpdated) { + prefManager.setStringValue(Constants.BASE_URL, selectedBaseUrl) + prefManager.setStringValue(Constants.TENANT, selectedTenant) + } return !(baseUrl.equals(selectedBaseUrl) && tenant.equals(selectedTenant)) } - } - enum class SettingsCardItem( val title: Int, val details: Int, - val icon: ImageVector? + val icon: ImageVector?, ) { SYNC_SURVEY( title = R.string.feature_settings_sync_survey, details = R.string.feature_settings_sync_survey_desc, - icon = null + icon = null, ), LANGUAGE( title = R.string.feature_settings_language, details = R.string.feature_settings_language_desc, - icon = MifosIcons.language + icon = MifosIcons.language, ), THEME( title = R.string.feature_settings_theme, details = R.string.feature_settings_theme_desc, - icon = MifosIcons.theme + icon = MifosIcons.theme, ), PASSCODE( title = R.string.feature_settings_change_passcode, details = R.string.feature_settings_change_passcode_desc, - icon = MifosIcons.password + icon = MifosIcons.password, ), ENDPOINT( title = R.string.feature_settings_instance_url, details = R.string.feature_settings_instance_url_desc, - icon = null + icon = null, ), SERVER_CONFIG( title = R.string.feature_settings_server_config, details = R.string.feature_settings_server_config_desc, - icon = null - ) + icon = null, + ), } enum class AppTheme( - val themeName: String + val themeName: String, ) { SYSTEM(themeName = "System Theme"), LIGHT(themeName = "Light Theme"), - DARK(themeName = "Dark Theme") -} \ No newline at end of file + DARK(themeName = "Dark Theme"), +} diff --git a/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialog.kt b/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialog.kt index e365c49b5b9..90c23283de3 100644 --- a/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialog.kt +++ b/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialog.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.feature.settings.syncSurvey import android.annotation.SuppressLint @@ -47,11 +56,10 @@ import com.mifos.feature.settings.R import kotlinx.coroutines.launch @Composable -fun SyncSurveysDialog( +internal fun SyncSurveysDialog( viewModel: SyncSurveysDialogViewModel = hiltViewModel(), closeDialog: () -> Unit, ) { - val state by viewModel.syncSurveysDialogUiState.collectAsState() LaunchedEffect(key1 = true) { @@ -66,7 +74,7 @@ fun SyncSurveysDialog( @SuppressLint("CoroutineCreationDuringComposition", "MutableCollectionMutableState") @Composable -fun SyncSurveysDialog( +internal fun SyncSurveysDialog( uiState: SyncSurveysDialogUiState, closeDialog: () -> Unit, ) { @@ -92,7 +100,6 @@ fun SyncSurveysDialog( var totalProgressText by rememberSaveable { mutableStateOf("") } var syncFailedText by rememberSaveable { mutableStateOf("") } - SyncSurveysDialogContent( closeDialog = closeDialog, showCancelButton = showCancelButton, @@ -105,11 +112,10 @@ fun SyncSurveysDialog( totalSyncProgress = totalSyncProgress.toFloat() / totalSyncProgressMax.toFloat(), surveySyncProgress = surveySyncProgress.toFloat() / surveySyncProgressMax.toFloat(), questionName = questionName, - responseName = responseName + responseName = responseName, ) when (uiState) { - is SyncSurveysDialogUiState.Initial -> Unit is SyncSurveysDialogUiState.DismissDialog -> { @@ -121,7 +127,7 @@ fun SyncSurveysDialog( snackBarHostState.showSnackbar( message = uiState.message, actionLabel = "Ok", - duration = SnackbarDuration.Short + duration = SnackbarDuration.Short, ) } closeDialog.invoke() @@ -132,10 +138,9 @@ fun SyncSurveysDialog( Toast.makeText( context, context.getString(R.string.feature_settings_error_network_not_available), - Toast.LENGTH_SHORT + Toast.LENGTH_SHORT, ).show() } - } is SyncSurveysDialogUiState.ShowProgressbar -> { @@ -158,7 +163,7 @@ fun SyncSurveysDialog( surveySyncProgressMax = uiState.total totalSyncProgressMax = uiState.total val totalSurveys = uiState.total.toString() + stringResource(R.string.feature_settings_space) + - stringResource(R.string.feature_settings_surveys) + stringResource(R.string.feature_settings_surveys) totalSurveysText = totalSurveys syncFailedText = 0.toString() } @@ -191,9 +196,8 @@ fun SyncSurveysDialog( } } - @Composable -fun SyncSurveysDialogContent( +private fun SyncSurveysDialogContent( closeDialog: () -> Unit, questionSyncProgress: Float, responseSyncProgress: Float, @@ -205,9 +209,8 @@ fun SyncSurveysDialogContent( totalProgressText: String, showCancelButton: Boolean, questionName: String, - responseName: String + responseName: String, ) { - Dialog(onDismissRequest = { closeDialog.invoke() }) { Box( modifier = Modifier @@ -219,25 +222,25 @@ fun SyncSurveysDialogContent( Column( modifier = Modifier .fillMaxWidth() - .padding(5.dp) + .padding(5.dp), ) { Text( text = stringResource(id = R.string.feature_settings_sync_surveys_full_information), modifier = Modifier .padding(10.dp) - .align(Alignment.CenterHorizontally) + .align(Alignment.CenterHorizontally), ) Column( modifier = Modifier .fillMaxWidth() - .padding(8.dp) + .padding(8.dp), ) { Row( modifier = Modifier .fillMaxWidth() .padding(vertical = 8.dp), - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, ) { Text(text = stringResource(id = R.string.feature_settings_name)) Text(text = surveyName) @@ -247,7 +250,7 @@ fun SyncSurveysDialogContent( modifier = Modifier .fillMaxWidth() .padding(vertical = 8.dp), - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, ) { Text(text = stringResource(id = R.string.feature_settings_total)) Text(text = totalSurveysText) @@ -257,75 +260,75 @@ fun SyncSurveysDialogContent( modifier = Modifier .fillMaxWidth() .padding(vertical = 8.dp), - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, ) { Text(text = stringResource(id = R.string.feature_settings_syncing_survey)) Text(text = surveyName) } LinearProgressIndicator( - progress = surveySyncProgress, + progress = { surveySyncProgress }, modifier = Modifier .fillMaxWidth() - .padding(vertical = 8.dp) + .padding(vertical = 8.dp), ) Row( modifier = Modifier .fillMaxWidth() .padding(vertical = 8.dp), - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, ) { Text(text = stringResource(id = R.string.feature_settings_syncing_question)) Text(text = questionName) } LinearProgressIndicator( - progress = questionSyncProgress, + progress = { questionSyncProgress }, modifier = Modifier .fillMaxWidth() - .padding(vertical = 8.dp) + .padding(vertical = 8.dp), ) Row( modifier = Modifier .fillMaxWidth() .padding(vertical = 8.dp), - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, ) { Text(text = stringResource(id = R.string.feature_settings_syncing_response)) Text(text = responseName) } LinearProgressIndicator( - progress = responseSyncProgress, + progress = { responseSyncProgress }, modifier = Modifier .fillMaxWidth() - .padding(vertical = 8.dp) + .padding(vertical = 8.dp), ) Row( modifier = Modifier .fillMaxWidth() .padding(vertical = 8.dp), - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, ) { Text(text = stringResource(id = R.string.feature_settings_total_sync_progress)) Text(text = totalProgressText) } LinearProgressIndicator( - progress = totalSyncProgress, + progress = { totalSyncProgress }, modifier = Modifier .fillMaxWidth() - .padding(vertical = 8.dp) + .padding(vertical = 8.dp), ) Row( modifier = Modifier .fillMaxWidth() .padding(vertical = 8.dp), - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, ) { Text(text = stringResource(id = R.string.feature_settings_failed_sync)) Text(text = syncFailedText) @@ -335,7 +338,7 @@ fun SyncSurveysDialogContent( Row( modifier = Modifier .fillMaxWidth() - .padding(vertical = 16.dp) + .padding(vertical = 16.dp), ) { SyncSurveyButton( onClick = { closeDialog.invoke() }, @@ -343,7 +346,7 @@ fun SyncSurveysDialogContent( .weight(1f) .padding(end = 8.dp), text = stringResource(id = R.string.feature_settings_cancel), - isEnabled = showCancelButton + isEnabled = showCancelButton, ) SyncSurveyButton( @@ -352,7 +355,7 @@ fun SyncSurveysDialogContent( .weight(1f) .padding(start = 8.dp), text = stringResource(id = R.string.feature_settings_hide), - isEnabled = true + isEnabled = true, ) } } @@ -361,11 +364,11 @@ fun SyncSurveysDialogContent( } @Composable -fun SyncSurveyButton( +private fun SyncSurveyButton( text: String, onClick: () -> Unit, modifier: Modifier = Modifier, - isEnabled: Boolean + isEnabled: Boolean, ) { Button( onClick = onClick, @@ -376,9 +379,9 @@ fun SyncSurveyButton( containerColor = BluePrimary, contentColor = White, disabledContainerColor = Color.DarkGray, - disabledContentColor = White + disabledContentColor = White, ), - enabled = isEnabled + enabled = isEnabled, ) { Text(text = text) } @@ -398,10 +401,10 @@ class SyncSurveysDialogPreviewProvider : PreviewParameterProvider fun syncResponseDataInDatabase( questionId: Int, - responseDatas: ResponseDatas + responseDatas: ResponseDatas, ): Observable fun allSurvey(): Observable> - - -} \ No newline at end of file +} diff --git a/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialogRepositoryImp.kt b/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialogRepositoryImp.kt index 8537e6dc6e5..73789b3960a 100644 --- a/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialogRepositoryImp.kt +++ b/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialogRepositoryImp.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.feature.settings.syncSurvey import com.mifos.core.network.datamanager.DataManagerSurveys @@ -16,14 +25,14 @@ class SyncSurveysDialogRepositoryImp @Inject constructor(private val dataManager override fun syncQuestionDataInDatabase( surveyId: Int, - questionDatas: QuestionDatas + questionDatas: QuestionDatas, ): Observable { return dataManagerSurvey.syncQuestionDataInDatabase(surveyId, questionDatas) } override fun syncResponseDataInDatabase( questionId: Int, - responseDatas: ResponseDatas + responseDatas: ResponseDatas, ): Observable { return dataManagerSurvey.syncResponseDataInDatabase(questionId, responseDatas) } @@ -31,6 +40,4 @@ class SyncSurveysDialogRepositoryImp @Inject constructor(private val dataManager override fun allSurvey(): Observable> { return dataManagerSurvey.allSurvey } - - -} \ No newline at end of file +} diff --git a/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialogUiState.kt b/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialogUiState.kt index 7b99e779320..7a4ee2f7e65 100644 --- a/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialogUiState.kt +++ b/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialogUiState.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.feature.settings.syncSurvey /** @@ -28,5 +37,4 @@ sealed class SyncSurveysDialogUiState { data object ShowProgressbar : SyncSurveysDialogUiState() data class ShowUI(val total: Int) : SyncSurveysDialogUiState() - -} \ No newline at end of file +} diff --git a/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialogViewModel.kt b/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialogViewModel.kt index 315c2468a93..d1fa6a35559 100644 --- a/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialogViewModel.kt +++ b/feature/settings/src/main/java/com/mifos/feature/settings/syncSurvey/SyncSurveysDialogViewModel.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.feature.settings.syncSurvey import androidx.lifecycle.ViewModel @@ -9,9 +18,9 @@ import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import retrofit2.HttpException +import rx.Observable import rx.Subscriber import rx.android.schedulers.AndroidSchedulers -import rx.plugins.RxJavaPlugins import rx.schedulers.Schedulers import javax.inject.Inject @@ -20,7 +29,7 @@ import javax.inject.Inject */ @HiltViewModel class SyncSurveysDialogViewModel @Inject constructor( - private val repository: SyncSurveysDialogRepository + private val repository: SyncSurveysDialogRepository, ) : ViewModel() { @@ -42,7 +51,6 @@ class SyncSurveysDialogViewModel @Inject constructor( private var mResponseDataSyncIndex = 0 private var maxSingleSyncSurveyProgressBar = 0 - private fun checkNetworkConnection(): Boolean { return networkUtilsWrapper.isNetworkConnected() } @@ -113,13 +121,13 @@ class SyncSurveysDialogViewModel @Inject constructor( if (mQuestionDataSyncIndex != mQuestionDatasList.size) { syncQuestionData( mSurveyList[mSurveySyncIndex].id, - mQuestionDatasList[mQuestionDataSyncIndex] + mQuestionDatasList[mQuestionDataSyncIndex], ) } else { _syncSurveysDialogUiState.value = mSurveyList[mSurveySyncIndex].name?.let { SyncSurveysDialogUiState.UpdateSingleSyncSurvey( - mSurveySyncIndex, it, mQuestionDatasList.size + mSurveySyncIndex, it, mQuestionDatasList.size, ) }!! mSurveySyncIndex += 1 @@ -138,14 +146,14 @@ class SyncSurveysDialogViewModel @Inject constructor( if (mResponseDataSyncIndex != mResponseDatasList.size) { syncResponseData( mQuestionDatasList[mQuestionDataSyncIndex].id, - mResponseDatasList[mResponseDataSyncIndex] + mResponseDatasList[mResponseDataSyncIndex], ) } else { _syncSurveysDialogUiState.value = SyncSurveysDialogUiState.UpdateQuestionSync( mQuestionDataSyncIndex, mQuestionDatasList[mQuestionDataSyncIndex].questionId, - mResponseDatasList.size + mResponseDatasList.size, ) mQuestionDataSyncIndex += 1 mResponseDataSyncIndex = 0 @@ -161,7 +169,7 @@ class SyncSurveysDialogViewModel @Inject constructor( private fun onAccountSyncFailed(e: Throwable) { try { if (e is HttpException) { - val singleSyncSurveyMax = maxSingleSyncSurveyProgressBar + maxSingleSyncSurveyProgressBar mFailedSyncSurvey.add(mSurveyList[mSurveySyncIndex]) mSurveySyncIndex += 1 _syncSurveysDialogUiState.value = @@ -169,7 +177,8 @@ class SyncSurveysDialogViewModel @Inject constructor( checkNetworkConnectionAndSyncSurvey() } } catch (throwable: Throwable) { - RxJavaPlugins.getInstance().errorHandler.handleError(throwable) + val errorObservable = Observable.error(RuntimeException("Custom error")) + errorObservable.subscribe { println("Error: ${throwable.message}") } } } @@ -183,33 +192,34 @@ class SyncSurveysDialogViewModel @Inject constructor( repository.syncSurveyInDatabase(survey) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onStart() { - _syncSurveysDialogUiState.value = - SyncSurveysDialogUiState.ShowUI(mSurveyList.size) - } + .subscribe( + object : Subscriber() { + override fun onStart() { + _syncSurveysDialogUiState.value = + SyncSurveysDialogUiState.ShowUI(mSurveyList.size) + } - override fun onCompleted() { - _syncSurveysDialogUiState.value = - mSurveyList[mSurveySyncIndex].name?.let { - SyncSurveysDialogUiState.UpdateSingleSyncSurvey( - mSurveySyncIndex + 1, it, mQuestionDatasList.size - ) - }!! - } + override fun onCompleted() { + _syncSurveysDialogUiState.value = + mSurveyList[mSurveySyncIndex].name?.let { + SyncSurveysDialogUiState.UpdateSingleSyncSurvey( + mSurveySyncIndex + 1, it, mQuestionDatasList.size, + ) + }!! + } - override fun onError(e: Throwable) { - _syncSurveysDialogUiState.value = - SyncSurveysDialogUiState.ShowError(e.message.toString()) - onAccountSyncFailed(e) - } + override fun onError(e: Throwable) { + _syncSurveysDialogUiState.value = + SyncSurveysDialogUiState.ShowError(e.message.toString()) + onAccountSyncFailed(e) + } - override fun onNext(survey: Survey) { - mQuestionDatasList = survey.questionDatas - checkSurveySyncStatus() - } - } - ) + override fun onNext(survey: Survey) { + mQuestionDatasList = survey.questionDatas + checkSurveySyncStatus() + } + }, + ) } /** @@ -221,28 +231,29 @@ class SyncSurveysDialogViewModel @Inject constructor( repository.syncQuestionDataInDatabase(surveyId, questionDatas) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() { - _syncSurveysDialogUiState.value = - SyncSurveysDialogUiState.UpdateQuestionSync( - mQuestionDataSyncIndex + 1, - mQuestionDatasList[mQuestionDataSyncIndex].questionId, - mResponseDatasList.size - ) - } + .subscribe( + object : Subscriber() { + override fun onCompleted() { + _syncSurveysDialogUiState.value = + SyncSurveysDialogUiState.UpdateQuestionSync( + mQuestionDataSyncIndex + 1, + mQuestionDatasList[mQuestionDataSyncIndex].questionId, + mResponseDatasList.size, + ) + } - override fun onError(e: Throwable) { - _syncSurveysDialogUiState.value = - SyncSurveysDialogUiState.ShowError(e.message.toString()) - onAccountSyncFailed(e) - } + override fun onError(e: Throwable) { + _syncSurveysDialogUiState.value = + SyncSurveysDialogUiState.ShowError(e.message.toString()) + onAccountSyncFailed(e) + } - override fun onNext(questionDatas: QuestionDatas) { - mResponseDatasList = questionDatas.responseDatas - checkQuestionDataSyncStatusAndSync() - } - } - ) + override fun onNext(questionDatas: QuestionDatas) { + mResponseDatasList = questionDatas.responseDatas + checkQuestionDataSyncStatusAndSync() + } + }, + ) } /** @@ -254,31 +265,32 @@ class SyncSurveysDialogViewModel @Inject constructor( repository.syncResponseDataInDatabase(questionId, responseDatas) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber() { - override fun onCompleted() { - SyncSurveysDialogUiState.UpdateResponseSync( - mResponseDataSyncIndex, - mResponseDatasList[mResponseDataSyncIndex].value - ) - } - - override fun onError(e: Throwable) { - _syncSurveysDialogUiState.value = - SyncSurveysDialogUiState.ShowError(e.message.toString()) - onAccountSyncFailed(e) - } - - override fun onNext(responseDatas: ResponseDatas) { - _syncSurveysDialogUiState.value = + .subscribe( + object : Subscriber() { + override fun onCompleted() { SyncSurveysDialogUiState.UpdateResponseSync( mResponseDataSyncIndex, - mResponseDatasList[mResponseDataSyncIndex].value + mResponseDatasList[mResponseDataSyncIndex].value, ) - mResponseDataSyncIndex += 1 - checkNetworkConnectionAndSyncResponseData() - } - } - ) + } + + override fun onError(e: Throwable) { + _syncSurveysDialogUiState.value = + SyncSurveysDialogUiState.ShowError(e.message.toString()) + onAccountSyncFailed(e) + } + + override fun onNext(responseDatas: ResponseDatas) { + _syncSurveysDialogUiState.value = + SyncSurveysDialogUiState.UpdateResponseSync( + mResponseDataSyncIndex, + mResponseDatasList[mResponseDataSyncIndex].value, + ) + mResponseDataSyncIndex += 1 + checkNetworkConnectionAndSyncResponseData() + } + }, + ) } private fun checkSurveySyncStatus() { @@ -302,20 +314,21 @@ class SyncSurveysDialogViewModel @Inject constructor( repository.allSurvey() .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) - .subscribe(object : Subscriber>() { - override fun onCompleted() { - startSyncingSurveys() - } + .subscribe( + object : Subscriber>() { + override fun onCompleted() { + startSyncingSurveys() + } - override fun onError(e: Throwable) { - _syncSurveysDialogUiState.value = - SyncSurveysDialogUiState.ShowError(e.message.toString()) - } + override fun onError(e: Throwable) { + _syncSurveysDialogUiState.value = + SyncSurveysDialogUiState.ShowError(e.message.toString()) + } - override fun onNext(surveys: List) { - mSurveyList = surveys - } - } - ) + override fun onNext(surveys: List) { + mSurveyList = surveys + } + }, + ) } -} \ No newline at end of file +} diff --git a/feature/settings/src/main/java/com/mifos/feature/settings/updateServer/UpdateServerConfigEvent.kt b/feature/settings/src/main/java/com/mifos/feature/settings/updateServer/UpdateServerConfigEvent.kt index 614434f13b1..76dbc12364e 100644 --- a/feature/settings/src/main/java/com/mifos/feature/settings/updateServer/UpdateServerConfigEvent.kt +++ b/feature/settings/src/main/java/com/mifos/feature/settings/updateServer/UpdateServerConfigEvent.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.feature.settings.updateServer sealed interface UpdateServerConfigEvent { @@ -13,4 +22,4 @@ sealed interface UpdateServerConfigEvent { data class UpdateTenant(val tenant: String) : UpdateServerConfigEvent data object UpdateServerConfig : UpdateServerConfigEvent -} \ No newline at end of file +} diff --git a/feature/settings/src/main/java/com/mifos/feature/settings/updateServer/UpdateServerConfigScreen.kt b/feature/settings/src/main/java/com/mifos/feature/settings/updateServer/UpdateServerConfigScreen.kt index 34042591c92..867c4af57e4 100644 --- a/feature/settings/src/main/java/com/mifos/feature/settings/updateServer/UpdateServerConfigScreen.kt +++ b/feature/settings/src/main/java/com/mifos/feature/settings/updateServer/UpdateServerConfigScreen.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.feature.settings.updateServer import androidx.annotation.VisibleForTesting @@ -50,7 +59,7 @@ import com.mifos.core.ui.util.DevicePreviews import com.mifos.feature.settings.R @Composable -fun UpdateServerConfigScreenRoute( +internal fun UpdateServerConfigScreenRoute( onCloseClick: () -> Unit, onSuccessful: () -> Unit, modifier: Modifier = Modifier, @@ -79,7 +88,7 @@ fun UpdateServerConfigScreenRoute( portError = portError, tenantError = tenantError, onEvent = viewModel::onEvent, - onCloseClick = onCloseClick + onCloseClick = onCloseClick, ) } @@ -102,7 +111,7 @@ internal fun UpdateServerConfigScreenContent( apiPathError, endPointError, portError, - tenantError + tenantError, ).any { it != null } Surface( modifier = modifier, @@ -113,28 +122,28 @@ internal fun UpdateServerConfigScreenContent( .fillMaxWidth() .padding(bottom = 24.dp) .imePadding(), - verticalArrangement = Arrangement.spacedBy(8.dp) + verticalArrangement = Arrangement.spacedBy(8.dp), ) { Box( modifier = Modifier .fillMaxWidth() .background( - MaterialTheme.colorScheme.secondaryContainer + MaterialTheme.colorScheme.secondaryContainer, ) - .padding(12.dp) + .padding(12.dp), ) { Row( modifier = Modifier .fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically + verticalAlignment = Alignment.CenterVertically, ) { Text( text = stringResource(R.string.feature_settings_title), style = MaterialTheme.typography.headlineSmall, fontWeight = FontWeight.SemiBold, maxLines = 1, - overflow = TextOverflow.Ellipsis + overflow = TextOverflow.Ellipsis, ) Spacer(modifier = Modifier.width(8.dp)) @@ -144,7 +153,7 @@ internal fun UpdateServerConfigScreenContent( ) { Icon( imageVector = Icons.Default.Close, - contentDescription = stringResource(R.string.feature_settings_close_bottomsheet) + contentDescription = stringResource(R.string.feature_settings_close_bottomsheet), ) } } @@ -172,7 +181,7 @@ internal fun UpdateServerConfigScreenContent( }, onValueChange = { onEvent(UpdateServerConfigEvent.UpdateProtocol(it)) - } + }, ) } @@ -190,7 +199,7 @@ internal fun UpdateServerConfigScreenContent( }, onValueChange = { onEvent(UpdateServerConfigEvent.UpdateEndPoint(it)) - } + }, ) } @@ -208,7 +217,7 @@ internal fun UpdateServerConfigScreenContent( }, onValueChange = { onEvent(UpdateServerConfigEvent.UpdateApiPath(it)) - } + }, ) } @@ -227,7 +236,7 @@ internal fun UpdateServerConfigScreenContent( }, onValueChange = { onEvent(UpdateServerConfigEvent.UpdatePort(it)) - } + }, ) } @@ -245,7 +254,7 @@ internal fun UpdateServerConfigScreenContent( }, onValueChange = { onEvent(UpdateServerConfigEvent.UpdateTenant(it)) - } + }, ) } @@ -253,18 +262,18 @@ internal fun UpdateServerConfigScreenContent( Row( modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(4.dp, Alignment.Start) + horizontalArrangement = Arrangement.spacedBy(4.dp, Alignment.Start), ) { Icon( imageVector = Icons.Default.Info, contentDescription = "infoIcon", tint = MaterialTheme.colorScheme.error, - modifier = Modifier.size(20.dp) + modifier = Modifier.size(20.dp), ) Text( text = stringResource(R.string.feature_settings_note_text), - style = MaterialTheme.typography.labelSmall + style = MaterialTheme.typography.labelSmall, ) } @@ -282,12 +291,12 @@ internal fun UpdateServerConfigScreenContent( enabled = !hasAnyError, colors = ButtonDefaults.elevatedButtonColors( containerColor = BluePrimary, - contentColor = Color.White - ) + contentColor = Color.White, + ), ) { Icon( imageVector = Icons.Default.Save, - contentDescription = "updateConfig" + contentDescription = "updateConfig", ) Spacer(modifier = Modifier.width(4.dp)) Text(stringResource(R.string.feature_settings_update_config_btn_text).uppercase()) @@ -308,10 +317,10 @@ private fun UpdateServerConfigScreenEmptyData() { endPoint = "", apiPath = "", port = "", - tenant = "" + tenant = "", ), onEvent = {}, - onCloseClick = {} + onCloseClick = {}, ) } -} \ No newline at end of file +} diff --git a/feature/settings/src/main/java/com/mifos/feature/settings/updateServer/UpdateServerConfigViewModel.kt b/feature/settings/src/main/java/com/mifos/feature/settings/updateServer/UpdateServerConfigViewModel.kt index 62b736d24b6..2095ecf6943 100644 --- a/feature/settings/src/main/java/com/mifos/feature/settings/updateServer/UpdateServerConfigViewModel.kt +++ b/feature/settings/src/main/java/com/mifos/feature/settings/updateServer/UpdateServerConfigViewModel.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.feature.settings.updateServer import androidx.compose.runtime.State @@ -36,7 +45,7 @@ class UpdateServerConfigViewModel @Inject constructor( }.stateIn( scope = viewModelScope, started = SharingStarted.WhileSubscribed(5_000), - initialValue = null + initialValue = null, ) val endPointError = snapshotFlow { _state.value.endPoint }.mapLatest { @@ -44,7 +53,7 @@ class UpdateServerConfigViewModel @Inject constructor( }.stateIn( scope = viewModelScope, started = SharingStarted.WhileSubscribed(5_000), - initialValue = null + initialValue = null, ) val apiPathError = snapshotFlow { _state.value.apiPath }.mapLatest { @@ -52,7 +61,7 @@ class UpdateServerConfigViewModel @Inject constructor( }.stateIn( scope = viewModelScope, started = SharingStarted.WhileSubscribed(5_000), - initialValue = null + initialValue = null, ) val portError = snapshotFlow { _state.value.port }.mapLatest { @@ -60,7 +69,7 @@ class UpdateServerConfigViewModel @Inject constructor( }.stateIn( scope = viewModelScope, started = SharingStarted.WhileSubscribed(5_000), - initialValue = null + initialValue = null, ) val tenantError = snapshotFlow { _state.value.tenant }.mapLatest { @@ -68,39 +77,38 @@ class UpdateServerConfigViewModel @Inject constructor( }.stateIn( scope = viewModelScope, started = SharingStarted.WhileSubscribed(5_000), - initialValue = null + initialValue = null, ) - fun onEvent(event: UpdateServerConfigEvent) { when (event) { is UpdateServerConfigEvent.UpdateProtocol -> { _state.value = _state.value.copy( - protocol = event.protocol + protocol = event.protocol, ) } is UpdateServerConfigEvent.UpdateEndPoint -> { _state.value = _state.value.copy( - endPoint = event.endPoint + endPoint = event.endPoint, ) } is UpdateServerConfigEvent.UpdateApiPath -> { _state.value = _state.value.copy( - apiPath = event.apiPath + apiPath = event.apiPath, ) } is UpdateServerConfigEvent.UpdatePort -> { _state.value = _state.value.copy( - port = event.port + port = event.port, ) } is UpdateServerConfigEvent.UpdateTenant -> { _state.value = _state.value.copy( - tenant = event.tenant + tenant = event.tenant, ) } @@ -111,7 +119,7 @@ class UpdateServerConfigViewModel @Inject constructor( apiPathError, endPointError, portError, - tenantError + tenantError, ).any { it.value != null } if (!hasAnyError) { @@ -122,4 +130,4 @@ class UpdateServerConfigViewModel @Inject constructor( } } } -} \ No newline at end of file +} diff --git a/feature/settings/src/main/res/values/feature_settings_.xml b/feature/settings/src/main/res/values/feature_settings_.xml index 2e5cdc43de7..a0d9f1f6e56 100644 --- a/feature/settings/src/main/res/values/feature_settings_.xml +++ b/feature/settings/src/main/res/values/feature_settings_.xml @@ -1,4 +1,13 @@ + Update Server Configuration diff --git a/feature/settings/src/main/res/values/strings.xml b/feature/settings/src/main/res/values/strings.xml index d1ea76947b1..6662f017c9c 100644 --- a/feature/settings/src/main/res/values/strings.xml +++ b/feature/settings/src/main/res/values/strings.xml @@ -1,4 +1,13 @@ + CloseBottomSheetIcon Update Config diff --git a/feature/settings/src/test/java/com/mifos/feature/settings/ExampleUnitTest.kt b/feature/settings/src/test/java/com/mifos/feature/settings/ExampleUnitTest.kt index a80ed24668d..85e81868fbf 100644 --- a/feature/settings/src/test/java/com/mifos/feature/settings/ExampleUnitTest.kt +++ b/feature/settings/src/test/java/com/mifos/feature/settings/ExampleUnitTest.kt @@ -1,9 +1,17 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.feature.settings +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +22,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/mifosng-android/src/main/AndroidManifest.xml b/mifosng-android/src/main/AndroidManifest.xml index 79cee3283c7..b1b61998f13 100755 --- a/mifosng-android/src/main/AndroidManifest.xml +++ b/mifosng-android/src/main/AndroidManifest.xml @@ -46,10 +46,7 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -