forked from openMF/android-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement compose navigation on splash , auth, passcode module
- Loading branch information
1 parent
e074088
commit f531026
Showing
41 changed files
with
595 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...re/auth/login/presentation/LoginScreen.kt → ...m/mifos/feature/auth/login/LoginScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...e/auth/login/presentation/LoginUiState.kt → .../mifos/feature/auth/login/LoginUiState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...auth/login/presentation/LoginViewModel.kt → ...ifos/feature/auth/login/LoginViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
feature/auth/src/main/java/com/mifos/feature/auth/navigation/AuthNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
9 changes: 9 additions & 0 deletions
9
feature/auth/src/main/java/com/mifos/feature/auth/navigation/AuthScreens.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
plugins { | ||
alias(libs.plugins.mifos.android.feature) | ||
alias(libs.plugins.mifos.android.library.compose) | ||
alias(libs.plugins.mifos.android.library.jacoco) | ||
} | ||
|
||
android { | ||
namespace = "com.mifos.feature.passcode" | ||
} | ||
|
||
dependencies { | ||
implementation(projects.core.domain) | ||
|
||
//DBFlow dependencies | ||
kapt(libs.dbflow.processor) | ||
implementation(libs.dbflow) | ||
kapt(libs.github.dbflow.processor) | ||
testImplementation(libs.hilt.android.testing) | ||
testImplementation(projects.core.testing) | ||
|
||
androidTestImplementation(projects.core.testing) | ||
|
||
// passcode dependency | ||
implementation("com.github.openMF.mifos-passcode:compose:1.0.3") | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
24 changes: 24 additions & 0 deletions
24
feature/passcode/src/androidTest/java/com/mifos/feature/passcode/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.mifos.feature.passcode | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.mifos.feature.passcode.test", appContext.packageName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> |
38 changes: 38 additions & 0 deletions
38
feature/passcode/src/main/java/com/mifos/feature/passcode/navigation/PasscodeNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.mifos.feature.passcode.navigation | ||
|
||
import androidx.navigation.NavController | ||
import androidx.navigation.NavGraphBuilder | ||
import androidx.navigation.NavType | ||
import androidx.navigation.compose.composable | ||
import androidx.navigation.navArgument | ||
import androidx.navigation.navigation | ||
import com.mifos.core.common.utils.Constants | ||
import com.mifos.feature.passcode.passcode.PasscodeScreen | ||
|
||
fun NavGraphBuilder.passcodeNavGraph( | ||
navController: NavController | ||
) { | ||
navigation( | ||
startDestination = PasscodeScreens.PasscodeScreen.route, | ||
route = "passcode_screen_route" | ||
) { | ||
passcodeScreenRoute() | ||
} | ||
} | ||
|
||
fun NavGraphBuilder.passcodeScreenRoute( | ||
|
||
) { | ||
composable( | ||
route = PasscodeScreens.PasscodeScreen.route, | ||
arguments = listOf( | ||
navArgument( | ||
name = Constants.PASSCODE_INITIAL_LOGIN, | ||
builder = { type = NavType.BoolType }) | ||
) | ||
) { | ||
PasscodeScreen( | ||
|
||
) | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
feature/passcode/src/main/java/com/mifos/feature/passcode/navigation/PasscodeScreens.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.mifos.feature.passcode.navigation | ||
|
||
sealed class PasscodeScreens(val route: String) { | ||
|
||
data object PasscodeScreen : PasscodeScreens("passcode_screen") | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
feature/passcode/src/main/java/com/mifos/feature/passcode/passcode/PasscodeScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.mifos.feature.passcode.passcode | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import androidx.lifecycle.compose.collectAsStateWithLifecycle | ||
import com.mifos.core.designsystem.component.MifosScaffold | ||
|
||
@Composable | ||
fun PasscodeScreen( | ||
viewmodel: PasscodeViewmodel = hiltViewModel() | ||
) { | ||
|
||
val passcodeStatus by viewmodel.passcodeStatus.collectAsStateWithLifecycle() | ||
|
||
|
||
} | ||
|
||
@Composable | ||
fun PasscodeScreen( | ||
|
||
) { | ||
|
||
MifosScaffold { paddingValues -> | ||
Column(modifier = Modifier.padding(paddingValues)) { | ||
com.mifos.compose.component.PasscodeScreen( | ||
onForgotButton = { }, | ||
onSkipButton = { }, | ||
onPasscodeConfirm = { }, | ||
onPasscodeRejected = { } | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun PasscodeScreenPreview() { | ||
PasscodeScreen() | ||
} |
17 changes: 17 additions & 0 deletions
17
feature/passcode/src/main/java/com/mifos/feature/passcode/passcode/PasscodeViewmodel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.mifos.feature.passcode.passcode | ||
|
||
import androidx.lifecycle.SavedStateHandle | ||
import androidx.lifecycle.ViewModel | ||
import com.mifos.core.common.utils.Constants | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class PasscodeViewmodel @Inject constructor( | ||
private val savedStateHandle: SavedStateHandle | ||
) : ViewModel() { | ||
|
||
val passcodeStatus = | ||
savedStateHandle.getStateFlow(key = Constants.PASSCODE_INITIAL_LOGIN, initialValue = false) | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
feature/passcode/src/test/java/com/mifos/feature/passcode/ExampleUnitTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.mifos.feature.passcode | ||
|
||
import org.junit.Test | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Example local unit test, which will execute on the development machine (host). | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
class ExampleUnitTest { | ||
@Test | ||
fun addition_isCorrect() { | ||
assertEquals(4, 2 + 2) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
plugins { | ||
alias(libs.plugins.mifos.android.feature) | ||
alias(libs.plugins.mifos.android.library.compose) | ||
alias(libs.plugins.mifos.android.library.jacoco) | ||
} | ||
|
||
android { | ||
namespace = "com.mifos.feature.splash" | ||
} | ||
|
||
dependencies { | ||
implementation(projects.core.domain) | ||
|
||
//DBFlow dependencies | ||
kapt(libs.dbflow.processor) | ||
implementation(libs.dbflow) | ||
kapt(libs.github.dbflow.processor) | ||
testImplementation(libs.hilt.android.testing) | ||
testImplementation(projects.core.testing) | ||
|
||
androidTestImplementation(projects.core.testing) | ||
|
||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
24 changes: 24 additions & 0 deletions
24
feature/splash/src/androidTest/java/com/mifos/feature/splash/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.mifos.feature.splash | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
|
||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
import org.junit.Assert.* | ||
|
||
/** | ||
* Instrumented test, which will execute on an Android device. | ||
* | ||
* See [testing documentation](http://d.android.com/tools/testing). | ||
*/ | ||
@RunWith(AndroidJUnit4::class) | ||
class ExampleInstrumentedTest { | ||
@Test | ||
fun useAppContext() { | ||
// Context of the app under test. | ||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext | ||
assertEquals("com.mifos.feature.splash.test", appContext.packageName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> |
Oops, something went wrong.