Library for passcode implementation along with an optional additional feature to ask for passcode when your app resumes from background. (Works with minSDK >= 21)
⚠️ This repository is archived and no longer maintained.
Development for Mifos Passcode has been moved to a new repository built with Kotlin Multiplatform technology.
Please refer to the actively maintained repository here:
👉 https://github.com/openMF/mifos-passcode-cmp
This transition allows for:
- ✨ Modernized architecture using Kotlin Multiplatform (KMP)
- ✅ Shared logic across Android, iOS, and other platforms
- 🚀 Improved performance, testability, and scalability
-
androidAppModule:- Contains the Android-specific application code.
- Depends on the
sharedmodule to utilize common code across platforms.
-
iosAppModule:- Holds the iOS-specific application code.
- Integrates the
sharedmodule, typically as a framework, to access shared logic.
-
sharedModule:- The core module containing platform-agnostic code, including business logic and Compose Multiplatform UI components.
- Referenced by both
androidAppandiosAppmodules to promote code reuse.
-
cmp-mifos-passcodeModule:- A specialized module designed to package and publish the
sharedmodule as a Compose Multiplatform (CMP) library. - Facilitates the distribution and reuse of the shared codebase across different projects or teams.
- A specialized module designed to package and publish the
In order to use the library
1. Gradle dependency
- Add the following to your project level
build.gradle:
allprojects {
repositories {
jcenter()
}
}- Add this to your app
build.gradle:
dependencies {
implementation 'com.github.openMF.mifos-passcode:compose:1.0.3'
}Screen.Recording.2024-08-30.at.10.04.52.PM.mov
WhatsApp.Video.2024-09-01.at.17.29.04_8c02d8d7.mp4
For a basic implementation of the PassCode Screen
-
Inject the
PasscodeRepositoryin your activity which is essentially abstracting the operations related to saving, retrieving, and validating the passcode -
Import
PasscodeScreento your project which has 4 parameters mentioned below:onForgotButton: This will allow to handle the case when the user isn't able to log into the app. In our project we are redirecting the user to login pageonSkipButton: This offers users the flexibility to bypass the passcode setup process, granting them immediate access to the desired screenonPasscodeConfirm: This allows you to pass a function that accepts a string parameteronPasscodeRejected: This can be used to handle the event when user has entered a wrong passcode
-
This is how a typical implementation would look like
@Inject
lateinit var passcodeRepository: PasscodeRepository
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MifosPasscodeTheme {
PasscodeScreen(
onForgotButton = {},
onSkipButton = {},
onPasscodeConfirm = {},
onPasscodeRejected = {}
)
}
}
}- You can now define functions of your own and pass them to their respective fields. You can find the entire implementation in the
PasscodeActivityof:appmodule
- Here are some screenshots of the app
![]() |
![]() |
![]() |


