registerAccountStateHandler
Register a callback that will be called whenever NamiCustomerManager.login or NamiCustomerManager.logout is called with results from those calls.
NamiCustomerManager.registerAccountStateHandler { accountStateAction, success, error in
if success {
if accountStateAction == .login {
// logged in
} else if accountStateAction == .logout {
// logged out
}
} else {
// an error occured
}
}NamiCustomerManager.registerAccountStateHandler { accountStateAction, success, error ->
if (success) {
if (accountStateAction == AccountStateAction.LOGIN) {
Log.d(LOG_TAG, "User is logged in")
} else if (accountStateAction == AccountStateAction.LOGOUT) {
Log.d(LOG_TAG, "User is logged out")
}
} else if (error != null) {
if (accountStateAction == AccountStateAction.LOGIN) {
Log.d(LOG_TAG, "There was an error logging in. Error - ${error}")
} else if (accountStateAction == AccountStateAction.LOGOUT) {
Log.d(LOG_TAG, "There was an error logging out. Error - ${error}")
}
}
}Last updated