File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
FirebaseAuth/Sources/Swift/Auth Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1361,6 +1361,23 @@ extension Auth: AuthInterop {
1361
1361
}
1362
1362
}
1363
1363
1364
+ open struct AuthState {
1365
+ let auth : Auth
1366
+ let user : FirebaseAuth . User ?
1367
+ }
1368
+
1369
+ open var authStateChanges : AsyncStream < AuthState > {
1370
+ return AsyncStream { continuation in
1371
+ let listener = self . addStateDidChangeListener { auth, user in
1372
+ continuation. yield ( AuthState ( auth: auth, user: user) )
1373
+ }
1374
+
1375
+ continuation. onTermination = { _ in
1376
+ self . removeStateDidChangeListener ( listener)
1377
+ }
1378
+ }
1379
+ }
1380
+
1364
1381
/// Unregisters a block as an "auth state did change" listener.
1365
1382
/// - Parameter listenerHandle: The handle for the listener.
1366
1383
@objc ( removeAuthStateDidChangeListener: )
You can’t perform that action at this time.
0 commit comments