Last active
April 18, 2018 21:34
-
-
Save adrianhall/6ebb4bba40aa46f68884cd56daa94f3e to your computer and use it in GitHub Desktop.
The definition for a custom UI IdentityManager
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
| package com.shellmonger.apps.familyphotos.services.interfaces | |
| import android.arch.lifecycle.LiveData | |
| import com.shellmonger.apps.familyphotos.models.User | |
| enum class IdentityRequest { | |
| NEED_CREDENTIALS, | |
| NEED_NEWPASSWORD, | |
| NEED_MULTIFACTORCODE, | |
| SUCCESS, | |
| FAILURE | |
| } | |
| typealias IdentityResponse = (Map<String, String>) -> Unit | |
| typealias IdentityHandler = (IdentityRequest, Map<String, String>?, IdentityResponse) -> Unit | |
| interface IdentityManager { | |
| /** | |
| * Property for the current user record - null if the user is not signed in | |
| */ | |
| val currentUser: LiveData<User?> | |
| /** | |
| * Sign in with a username / password | |
| */ | |
| fun initiateSignin(handler: IdentityHandler) | |
| /** | |
| * Sign out of the system | |
| */ | |
| fun initiateSignout(handler: IdentityHandler) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment