File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed
FirebaseSwiftUI/FirebaseAuthSwiftUI/Sources/Services Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -296,16 +296,24 @@ public final class AuthService {
296296 }
297297
298298 func sendEmailVerification( ) async throws {
299- if currentUser != nil {
300- do {
301- // TODO: - can use set user action code settings?
302- try await currentUser!. sendEmailVerification ( )
303- } catch {
304- errorMessage = string. localizedErrorMessage (
305- for: error
306- )
307- throw error
299+ do {
300+ if let user = currentUser {
301+ // Requires running on MainActor as passing to sendEmailVerification() which is non-isolated
302+ let settings : ActionCodeSettings ? = await MainActor . run {
303+ configuration. verifyEmailActionCodeSettings
304+ }
305+
306+ if let settings = settings {
307+ try await user. sendEmailVerification ( with: settings)
308+ } else {
309+ try await user. sendEmailVerification ( )
310+ }
308311 }
312+ } catch {
313+ errorMessage = string. localizedErrorMessage (
314+ for: error
315+ )
316+ throw error
309317 }
310318 }
311319}
You can’t perform that action at this time.
0 commit comments