diff --git a/feature/splash/build.gradle.kts b/feature/splash/build.gradle.kts index fcdf2a2474..d4a05dd178 100644 --- a/feature/splash/build.gradle.kts +++ b/feature/splash/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/splash/src/androidTest/java/com/mifos/feature/splash/ExampleInstrumentedTest.kt b/feature/splash/src/androidTest/java/com/mifos/feature/splash/ExampleInstrumentedTest.kt index 8992390a5b..9d9ec54fba 100644 --- a/feature/splash/src/androidTest/java/com/mifos/feature/splash/ExampleInstrumentedTest.kt +++ b/feature/splash/src/androidTest/java/com/mifos/feature/splash/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.splash -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import junit.framework.TestCase.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.splash.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/feature/splash/src/main/AndroidManifest.xml b/feature/splash/src/main/AndroidManifest.xml index a5918e68ab..1dc76da0f7 100644 --- a/feature/splash/src/main/AndroidManifest.xml +++ b/feature/splash/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + \ No newline at end of file diff --git a/feature/splash/src/main/java/com/mifos/feature/splash/navigation/SplashNavigation.kt b/feature/splash/src/main/java/com/mifos/feature/splash/navigation/SplashNavigation.kt index 6fe06714bd..e4f73ac38c 100644 --- a/feature/splash/src/main/java/com/mifos/feature/splash/navigation/SplashNavigation.kt +++ b/feature/splash/src/main/java/com/mifos/feature/splash/navigation/SplashNavigation.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.splash.navigation import androidx.navigation.NavGraphBuilder @@ -7,7 +16,7 @@ import com.mifos.feature.splash.splash.SplashScreen fun NavGraphBuilder.splashNavGraph( navigatePasscode: () -> Unit, - navigateLogin: () -> Unit + navigateLogin: () -> Unit, ) { navigation( startDestination = SplashScreens.SplashScreen.route, @@ -15,21 +24,21 @@ fun NavGraphBuilder.splashNavGraph( ) { splashScreenRoute( navigateLogin = navigateLogin, - navigatePasscode = navigatePasscode + navigatePasscode = navigatePasscode, ) } } fun NavGraphBuilder.splashScreenRoute( navigatePasscode: () -> Unit, - navigateLogin: () -> Unit + navigateLogin: () -> Unit, ) { composable( route = SplashScreens.SplashScreen.route, ) { SplashScreen( navigatePasscode = navigatePasscode, - navigateLogin = navigateLogin + navigateLogin = navigateLogin, ) } -} \ No newline at end of file +} diff --git a/feature/splash/src/main/java/com/mifos/feature/splash/navigation/SplashScreens.kt b/feature/splash/src/main/java/com/mifos/feature/splash/navigation/SplashScreens.kt index ee4762d7ee..2943581b75 100644 --- a/feature/splash/src/main/java/com/mifos/feature/splash/navigation/SplashScreens.kt +++ b/feature/splash/src/main/java/com/mifos/feature/splash/navigation/SplashScreens.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.splash.navigation sealed class SplashScreens(val route: String) { @@ -5,5 +14,4 @@ sealed class SplashScreens(val route: String) { data object SplashScreenRoute : SplashScreens("splash_screen_route") data object SplashScreen : SplashScreens("splash_screen") - -} \ No newline at end of file +} diff --git a/feature/splash/src/main/java/com/mifos/feature/splash/splash/SplashScreen.kt b/feature/splash/src/main/java/com/mifos/feature/splash/splash/SplashScreen.kt index 4afc3b8947..a9ce41f1c1 100644 --- a/feature/splash/src/main/java/com/mifos/feature/splash/splash/SplashScreen.kt +++ b/feature/splash/src/main/java/com/mifos/feature/splash/splash/SplashScreen.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.splash.splash import androidx.compose.foundation.Image @@ -20,27 +29,27 @@ import com.mifos.core.designsystem.theme.SummerSky import com.mifos.feature.splash.R @Composable -fun SplashScreen( - viewmodel: SplashScreenViewmodel = hiltViewModel(), +internal fun SplashScreen( navigatePasscode: () -> Unit, - navigateLogin: () -> Unit + viewmodel: SplashScreenViewmodel = hiltViewModel(), + navigateLogin: () -> Unit, ) { val state by viewmodel.isAuthenticated.collectAsStateWithLifecycle() SplashScreen( state = state, navigatePasscode = navigatePasscode, - navigateLogin = navigateLogin + navigateLogin = navigateLogin, ) } @Composable -fun SplashScreen( +internal fun SplashScreen( state: Boolean?, navigatePasscode: () -> Unit, - navigateLogin: () -> Unit + navigateLogin: () -> Unit, + modifier: Modifier = Modifier, ) { - when (state) { false -> navigateLogin() true -> navigatePasscode() @@ -48,19 +57,20 @@ fun SplashScreen( } MifosScaffold( - containerColor = SummerSky + modifier = modifier, + containerColor = SummerSky, ) { paddingValues -> Column( modifier = Modifier .padding(paddingValues) .fillMaxSize(), verticalArrangement = Arrangement.Center, - horizontalAlignment = Alignment.CenterHorizontally + horizontalAlignment = Alignment.CenterHorizontally, ) { Image( modifier = Modifier.size(100.dp), painter = painterResource(id = R.drawable.feature_splash_icon), - contentDescription = null + contentDescription = null, ) } } @@ -72,6 +82,6 @@ private fun SplashScreenPreview() { SplashScreen( state = false, navigatePasscode = {}, - navigateLogin = {} + navigateLogin = {}, ) -} \ No newline at end of file +} diff --git a/feature/splash/src/main/java/com/mifos/feature/splash/splash/SplashScreenViewmodel.kt b/feature/splash/src/main/java/com/mifos/feature/splash/splash/SplashScreenViewmodel.kt index f4883f73a3..a4bacd67ad 100644 --- a/feature/splash/src/main/java/com/mifos/feature/splash/splash/SplashScreenViewmodel.kt +++ b/feature/splash/src/main/java/com/mifos/feature/splash/splash/SplashScreenViewmodel.kt @@ -1,6 +1,14 @@ +/* + * 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.splash.splash -import android.util.Log import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.mifos.core.datastore.PrefManager @@ -14,7 +22,7 @@ import javax.inject.Inject @HiltViewModel class SplashScreenViewmodel @Inject constructor( - private val prefManager: PrefManager + private val prefManager: PrefManager, ) : ViewModel() { private val _isAuthenticated = MutableStateFlow(null) @@ -28,5 +36,4 @@ class SplashScreenViewmodel @Inject constructor( delay(2000) _isAuthenticated.value = prefManager.isAuthenticated() } - -} \ No newline at end of file +} diff --git a/feature/splash/src/test/java/com/mifos/feature/splash/ExampleUnitTest.kt b/feature/splash/src/test/java/com/mifos/feature/splash/ExampleUnitTest.kt index 8da7f2fdf5..d313d85f15 100644 --- a/feature/splash/src/test/java/com/mifos/feature/splash/ExampleUnitTest.kt +++ b/feature/splash/src/test/java/com/mifos/feature/splash/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.splash +import junit.framework.TestCase.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/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxPendingTasksActivity.kt b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxPendingTasksActivity.kt index d3c9bc5183..32ef02c680 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxPendingTasksActivity.kt +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxPendingTasksActivity.kt @@ -20,7 +20,7 @@ class CheckerInboxPendingTasksActivity : MifosBaseActivity() { supportFragmentManager.findFragmentById(R.id.container_nav_host_fragment) as NavHostFragment navHostFragment.navController.apply { popBackStack() - navigate(R.id.checkerInboxTasksFragment) +// navigate(R.id.checkerInboxTasksFragment) } } } diff --git a/mifosng-android/src/main/res/layout/activity_splash.xml b/mifosng-android/src/main/res/layout/activity_splash.xml deleted file mode 100755 index 5c36fffd2b..0000000000 --- a/mifosng-android/src/main/res/layout/activity_splash.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/mifosng-android/src/main/res/layout/fragment_splash.xml b/mifosng-android/src/main/res/layout/fragment_splash.xml deleted file mode 100755 index 84c3136f48..0000000000 --- a/mifosng-android/src/main/res/layout/fragment_splash.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/mifosng-android/src/main/res/menu/splash_screen.xml b/mifosng-android/src/main/res/menu/splash_screen.xml deleted file mode 100755 index f7106ad956..0000000000 --- a/mifosng-android/src/main/res/menu/splash_screen.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - diff --git a/mifosng-android/src/main/res/navigation/nav_graph.xml b/mifosng-android/src/main/res/navigation/nav_graph.xml index b96f665baa..8affb1b62a 100644 --- a/mifosng-android/src/main/res/navigation/nav_graph.xml +++ b/mifosng-android/src/main/res/navigation/nav_graph.xml @@ -74,22 +74,6 @@ app:argType="integer" /> - - - - - - - -