Skip to content

Commit c7e03ab

Browse files
committed
splash cleanup
fix errors
1 parent 544af47 commit c7e03ab

File tree

13 files changed

+99
-85
lines changed

13 files changed

+99
-85
lines changed

feature/splash/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
110
plugins {
211
alias(libs.plugins.mifos.android.feature)
312
alias(libs.plugins.mifos.android.library.compose)

feature/splash/src/androidTest/java/com/mifos/feature/splash/ExampleInstrumentedTest.kt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
110
package com.mifos.feature.splash
211

3-
import androidx.test.platform.app.InstrumentationRegistry
412
import androidx.test.ext.junit.runners.AndroidJUnit4
5-
13+
import androidx.test.platform.app.InstrumentationRegistry
14+
import junit.framework.TestCase.assertEquals
615
import org.junit.Test
716
import org.junit.runner.RunWith
817

9-
import org.junit.Assert.*
10-
1118
/**
1219
* Instrumented test, which will execute on an Android device.
1320
*
@@ -21,4 +28,4 @@ class ExampleInstrumentedTest {
2128
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
2229
assertEquals("com.mifos.feature.splash.test", appContext.packageName)
2330
}
24-
}
31+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2024 Mifos Initiative
4+
5+
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
6+
If a copy of the MPL was not distributed with this file,
7+
You can obtain one at https://mozilla.org/MPL/2.0/.
8+
9+
See https://github.com/openMF/android-client/blob/master/LICENSE.md
10+
-->
211
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
312

413
</manifest>
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
110
package com.mifos.feature.splash.navigation
211

312
import androidx.navigation.NavGraphBuilder
@@ -7,29 +16,29 @@ import com.mifos.feature.splash.splash.SplashScreen
716

817
fun NavGraphBuilder.splashNavGraph(
918
navigatePasscode: () -> Unit,
10-
navigateLogin: () -> Unit
19+
navigateLogin: () -> Unit,
1120
) {
1221
navigation(
1322
startDestination = SplashScreens.SplashScreen.route,
1423
route = SplashScreens.SplashScreenRoute.route,
1524
) {
1625
splashScreenRoute(
1726
navigateLogin = navigateLogin,
18-
navigatePasscode = navigatePasscode
27+
navigatePasscode = navigatePasscode,
1928
)
2029
}
2130
}
2231

2332
fun NavGraphBuilder.splashScreenRoute(
2433
navigatePasscode: () -> Unit,
25-
navigateLogin: () -> Unit
34+
navigateLogin: () -> Unit,
2635
) {
2736
composable(
2837
route = SplashScreens.SplashScreen.route,
2938
) {
3039
SplashScreen(
3140
navigatePasscode = navigatePasscode,
32-
navigateLogin = navigateLogin
41+
navigateLogin = navigateLogin,
3342
)
3443
}
35-
}
44+
}
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
110
package com.mifos.feature.splash.navigation
211

312
sealed class SplashScreens(val route: String) {
413

514
data object SplashScreenRoute : SplashScreens("splash_screen_route")
615

716
data object SplashScreen : SplashScreens("splash_screen")
8-
9-
}
17+
}

feature/splash/src/main/java/com/mifos/feature/splash/splash/SplashScreen.kt

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
110
package com.mifos.feature.splash.splash
211

312
import androidx.compose.foundation.Image
@@ -20,47 +29,48 @@ import com.mifos.core.designsystem.theme.SummerSky
2029
import com.mifos.feature.splash.R
2130

2231
@Composable
23-
fun SplashScreen(
24-
viewmodel: SplashScreenViewmodel = hiltViewModel(),
32+
internal fun SplashScreen(
2533
navigatePasscode: () -> Unit,
26-
navigateLogin: () -> Unit
34+
viewmodel: SplashScreenViewmodel = hiltViewModel(),
35+
navigateLogin: () -> Unit,
2736
) {
2837
val state by viewmodel.isAuthenticated.collectAsStateWithLifecycle()
2938

3039
SplashScreen(
3140
state = state,
3241
navigatePasscode = navigatePasscode,
33-
navigateLogin = navigateLogin
42+
navigateLogin = navigateLogin,
3443
)
3544
}
3645

3746
@Composable
38-
fun SplashScreen(
47+
internal fun SplashScreen(
3948
state: Boolean?,
4049
navigatePasscode: () -> Unit,
41-
navigateLogin: () -> Unit
50+
navigateLogin: () -> Unit,
51+
modifier: Modifier = Modifier,
4252
) {
43-
4453
when (state) {
4554
false -> navigateLogin()
4655
true -> navigatePasscode()
4756
else -> {}
4857
}
4958

5059
MifosScaffold(
51-
containerColor = SummerSky
60+
modifier = modifier,
61+
containerColor = SummerSky,
5262
) { paddingValues ->
5363
Column(
5464
modifier = Modifier
5565
.padding(paddingValues)
5666
.fillMaxSize(),
5767
verticalArrangement = Arrangement.Center,
58-
horizontalAlignment = Alignment.CenterHorizontally
68+
horizontalAlignment = Alignment.CenterHorizontally,
5969
) {
6070
Image(
6171
modifier = Modifier.size(100.dp),
6272
painter = painterResource(id = R.drawable.feature_splash_icon),
63-
contentDescription = null
73+
contentDescription = null,
6474
)
6575
}
6676
}
@@ -72,6 +82,6 @@ private fun SplashScreenPreview() {
7282
SplashScreen(
7383
state = false,
7484
navigatePasscode = {},
75-
navigateLogin = {}
85+
navigateLogin = {},
7686
)
77-
}
87+
}

feature/splash/src/main/java/com/mifos/feature/splash/splash/SplashScreenViewmodel.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
110
package com.mifos.feature.splash.splash
211

3-
import android.util.Log
412
import androidx.lifecycle.ViewModel
513
import androidx.lifecycle.viewModelScope
614
import com.mifos.core.datastore.PrefManager
@@ -14,7 +22,7 @@ import javax.inject.Inject
1422

1523
@HiltViewModel
1624
class SplashScreenViewmodel @Inject constructor(
17-
private val prefManager: PrefManager
25+
private val prefManager: PrefManager,
1826
) : ViewModel() {
1927

2028
private val _isAuthenticated = MutableStateFlow<Boolean?>(null)
@@ -28,5 +36,4 @@ class SplashScreenViewmodel @Inject constructor(
2836
delay(2000)
2937
_isAuthenticated.value = prefManager.isAuthenticated()
3038
}
31-
32-
}
39+
}
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
/*
2+
* Copyright 2024 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
110
package com.mifos.feature.splash
211

12+
import junit.framework.TestCase.assertEquals
313
import org.junit.Test
414

5-
import org.junit.Assert.*
6-
715
/**
816
* Example local unit test, which will execute on the development machine (host).
917
*
@@ -14,4 +22,4 @@ class ExampleUnitTest {
1422
fun addition_isCorrect() {
1523
assertEquals(4, 2 + 2)
1624
}
17-
}
25+
}

mifosng-android/src/main/java/com/mifos/mifosxdroid/online/checkerinbox/CheckerInboxPendingTasksActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CheckerInboxPendingTasksActivity : MifosBaseActivity() {
2020
supportFragmentManager.findFragmentById(R.id.container_nav_host_fragment) as NavHostFragment
2121
navHostFragment.navController.apply {
2222
popBackStack()
23-
navigate(R.id.checkerInboxTasksFragment)
23+
// navigate(R.id.checkerInboxTasksFragment)
2424
}
2525
}
2626
}

mifosng-android/src/main/res/layout/activity_splash.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)