Created
September 13, 2018 19:26
-
-
Save adrianhall/2ddc8d1d2ad18a60a519a49dd48e855f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import android.arch.lifecycle.LiveData | |
enum class IdentityRequest { | |
NEED_SIGNUP, | |
NEED_CREDENTIALS, | |
NEED_NEWPASSWORD, | |
NEED_MULTIFACTORCODE, | |
SUCCESS, | |
FAILURE | |
} | |
typealias IdentityResponse = (Map<String, String>?) -> Unit | |
typealias IdentityHandler = (IdentityRequest, Map<String,String>?, IdentityResponse) -> Unit | |
interface IdentityRepository { | |
/** | |
* Property for the current user record (null if not signed in) | |
*/ | |
val currentUser: LiveData<User?> | |
/** | |
* Stored username | |
*/ | |
val storedUsername: LiveData<String?> | |
/** | |
* Initiate a sign-in flow | |
*/ | |
fun initiateSignin(handler: IdentityHandler) | |
/** | |
* Initiate a sign-out flow | |
*/ | |
fun initiateSignout(handler: IdentityHandler) | |
/** | |
* Initiate a forgot password flow | |
*/ | |
fun initiateForgotPassword(handler: IdentityHandler) | |
/** | |
* Initiate sign-up flow | |
*/ | |
fun initiateSignup(handler: IdentityHandler) | |
/** | |
* Update the stored username | |
*/ | |
fun updateStoredUsername(username: String?) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment