Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.


import FirebaseAuth
import SwiftUI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,24 @@ public final class AuthService {
}

func sendEmailVerification() async throws {
if currentUser != nil {
do {
// TODO: - can use set user action code settings?
try await currentUser!.sendEmailVerification()
} catch {
errorMessage = string.localizedErrorMessage(
for: error
)
throw error
do {
if let user = currentUser {
// Requires running on MainActor as passing to sendEmailVerification() which is non-isolated
let settings: ActionCodeSettings? = await MainActor.run {
configuration.verifyEmailActionCodeSettings
}

if let settings = settings {
try await user.sendEmailVerification(with: settings)
} else {
try await user.sendEmailVerification()
}
}
} catch {
errorMessage = string.localizedErrorMessage(
for: error
)
throw error
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// Created by Russell Wheatley on 24/04/2025.
//

import FirebaseCore
import SwiftUI

private enum FocusableField: Hashable {
Expand Down Expand Up @@ -94,3 +95,9 @@ extension UpdatePasswordView: View {
}
}
}

#Preview {
FirebaseOptions.dummyConfigurationForPreview()
return UpdatePasswordView()
.environment(AuthService())
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public struct SignInWithFacebookButton {
if trackingAuthorizationStatus == .authorized {
self.limitedLogin = newValue
} else {
self.limitedLogin = false
self.limitedLogin = true
}
}
)
Expand Down Expand Up @@ -121,7 +121,6 @@ extension SignInWithFacebookButton: View {
)
}
}
Text(errorMessage).foregroundColor(.red)
}
}

Expand Down
Loading