File tree Expand file tree Collapse file tree 4 files changed +25
-12
lines changed
FirebaseAuthSwiftUI/Sources
FirebaseFacebookSwiftUI/Sources/Views Expand file tree Collapse file tree 4 files changed +25
-12
lines changed Original file line number Diff line number Diff line change 1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15-
1615import FirebaseAuth
1716import SwiftUI
1817
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}
Original file line number Diff line number Diff line change 1919// Created by Russell Wheatley on 24/04/2025.
2020//
2121
22+ import FirebaseCore
2223import SwiftUI
2324
2425private enum FocusableField : Hashable {
@@ -94,3 +95,9 @@ extension UpdatePasswordView: View {
9495 }
9596 }
9697}
98+
99+ #Preview {
100+ FirebaseOptions . dummyConfigurationForPreview ( )
101+ return UpdatePasswordView ( )
102+ . environment ( AuthService ( ) )
103+ }
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public struct SignInWithFacebookButton {
4242 if trackingAuthorizationStatus == . authorized {
4343 self . limitedLogin = newValue
4444 } else {
45- self . limitedLogin = false
45+ self . limitedLogin = true
4646 }
4747 }
4848 )
@@ -121,7 +121,6 @@ extension SignInWithFacebookButton: View {
121121 )
122122 }
123123 }
124- Text ( errorMessage) . foregroundColor ( . red)
125124 }
126125}
127126
You can’t perform that action at this time.
0 commit comments