Skip to content

Instantly share code, notes, and snippets.

@adrianhall
Last active April 18, 2018 21:34
Show Gist options
  • Save adrianhall/6ebb4bba40aa46f68884cd56daa94f3e to your computer and use it in GitHub Desktop.
Save adrianhall/6ebb4bba40aa46f68884cd56daa94f3e to your computer and use it in GitHub Desktop.
The definition for a custom UI IdentityManager
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