File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
auth0/src/main/java/com/auth0/android/provider Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import com.auth0.android.callback.Callback
1919 * @param onDetached called when a result arrives but the callback is already detached
2020 */
2121internal class LifecycleAwareCallback <S >(
22- private var delegateCallback : Callback <S , AuthenticationException >? ,
22+ @Volatile private var delegateCallback : Callback <S , AuthenticationException >? ,
2323 lifecycleOwner : LifecycleOwner ,
2424 private val onDetached : (success: S ? , error: AuthenticationException ? ) -> Unit ,
2525) : Callback<S, AuthenticationException>, DefaultLifecycleObserver {
Original file line number Diff line number Diff line change @@ -204,14 +204,22 @@ public object WebAuthProvider {
204204 state,
205205 object : Callback <Credentials , AuthenticationException > {
206206 override fun onSuccess (result : Credentials ) {
207- for (callback in callbacks) {
208- callback.onSuccess(result)
207+ if (callbacks.isNotEmpty()) {
208+ for (callback in callbacks) {
209+ callback.onSuccess(result)
210+ }
211+ } else {
212+ pendingLoginResult.set(PendingResult .Success (result))
209213 }
210214 }
211215
212216 override fun onFailure (error : AuthenticationException ) {
213- for (callback in callbacks) {
214- callback.onFailure(error)
217+ if (callbacks.isNotEmpty()) {
218+ for (callback in callbacks) {
219+ callback.onFailure(error)
220+ }
221+ } else {
222+ pendingLoginResult.set(PendingResult .Failure (error))
215223 }
216224 }
217225 },
@@ -713,7 +721,7 @@ public object WebAuthProvider {
713721 startInternal(context, effectiveCallback)
714722 }
715723
716- internal fun startInternal (
724+ private fun startInternal (
717725 context : Context ,
718726 callback : Callback <Credentials , AuthenticationException >
719727 ) {
You can’t perform that action at this time.
0 commit comments