Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

openMF/mifos-passcode

Repository files navigation

Mifos-Passcode

Library for passcode implementation along with an optional additional feature to ask for passcode when your app resumes from background. (Works with minSDK >= 21)

📦 Archived Repository Notice

⚠️ This repository is archived and no longer maintained.

Development for Mifos Passcode has been moved to a new repository built with Kotlin Multiplatform technology.

🔄 New Repository

Please refer to the actively maintained repository here:
👉 https://github.com/openMF/mifos-passcode-cmp

📌 Why the move?

This transition allows for:

  • ✨ Modernized architecture using Kotlin Multiplatform (KMP)
  • ✅ Shared logic across Android, iOS, and other platforms
  • 🚀 Improved performance, testability, and scalability

Project Structure :

  • androidApp Module:

    • Contains the Android-specific application code.
    • Depends on the shared module to utilize common code across platforms.
  • iosApp Module:

    • Holds the iOS-specific application code.
    • Integrates the shared module, typically as a framework, to access shared logic.
  • shared Module:

    • The core module containing platform-agnostic code, including business logic and Compose Multiplatform UI components.
    • Referenced by both androidApp and iosApp modules to promote code reuse.
  • cmp-mifos-passcode Module:

    • A specialized module designed to package and publish the shared module as a Compose Multiplatform (CMP) library.
    • Facilitates the distribution and reuse of the shared codebase across different projects or teams.

Usage

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'
}

Example

Android Implementation:

Screen.Recording.2024-08-30.at.10.04.52.PM.mov

IOS Implementation :

WhatsApp.Video.2024-09-01.at.17.29.04_8c02d8d7.mp4

For a basic implementation of the PassCode Screen

  • Inject the PasscodeRepository in your activity which is essentially abstracting the operations related to saving, retrieving, and validating the passcode

  • Import PasscodeScreen to 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 page
    • onSkipButton: This offers users the flexibility to bypass the passcode setup process, granting them immediate access to the desired screen
    • onPasscodeConfirm: This allows you to pass a function that accepts a string parameter
    • onPasscodeRejected: 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 PasscodeActivity of :app module

Screenshots

  • Here are some screenshots of the app

About

Library for passcode generation on different mobile apps.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 9