Skip to content

Commit

Permalink
fix(authentication): retain authStateChangeEvent until consumed (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
robingenz authored Aug 28, 2022
1 parent e06605d commit eeeecae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-crabs-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@capacitor-firebase/authentication": patch
---

fix: retain `authStateChangeEvent` until consumed on Android and iOS
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,6 @@ public void startActivityForResult(PluginCall call, Intent intent, String callba
super.startActivityForResult(call, intent, callbackName);
}

public void notifyListeners(String eventName, JSObject data) {
super.notifyListeners(eventName, data);
}

@Override
protected void handleOnActivityResult(int requestCode, int resultCode, Intent data) {
super.handleOnActivityResult(requestCode, resultCode, data);
Expand All @@ -456,7 +452,7 @@ private void updateAuthState() {
JSObject userResult = FirebaseAuthenticationHelper.createUserResult(user);
JSObject result = new JSObject();
result.put("user", userResult);
notifyListeners(AUTH_STATE_CHANGE_EVENT, result);
notifyListeners(AUTH_STATE_CHANGE_EVENT, result, true);
}

@ActivityCallback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public class FirebaseAuthenticationPlugin: CAPPlugin {
let userResult = FirebaseAuthenticationHelper.createUserResult(user)
var result = JSObject()
result["user"] = userResult
notifyListeners(authStateChangeEvent, data: result)
notifyListeners(authStateChangeEvent, data: result, retainUntilConsumed: true)
}

private func firebaseAuthenticationConfig() -> FirebaseAuthenticationConfig {
Expand Down

0 comments on commit eeeecae

Please sign in to comment.