Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[auth-swift] Remove FDL dep and update sample readme #12864

Merged
merged 4 commits into from
May 1, 2024
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 @@ -13,7 +13,6 @@
// limitations under the License.

import FirebaseAuth
import FirebaseDynamicLinks
import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
Expand Down Expand Up @@ -58,21 +57,15 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// MARK: - Firebase 🔥

private func handleIncomingDynamicLink(_ incomingURL: URL) {
DynamicLinks.dynamicLinks().handleUniversalLink(incomingURL) { dynamicLink, error in
guard error == nil else {
return print("ⓧ Error in \(#function): \(error!.localizedDescription)")
}
let link = incomingURL.absoluteString

guard let link = dynamicLink?.url?.absoluteString else { return }
if AppManager.shared.auth().isSignIn(withEmailLink: link) {
// Save the link as it will be used in the next step to complete login
UserDefaults.standard.set(link, forKey: "Link")

if AppManager.shared.auth().isSignIn(withEmailLink: link) {
// Save the link as it will be used in the next step to complete login
UserDefaults.standard.set(link, forKey: "Link")

// Post a notification to the PasswordlessViewController to resume authentication
NotificationCenter.default
.post(Notification(name: Notification.Name("PasswordlessEmailNotificationSuccess")))
}
// Post a notification to the PasswordlessViewController to resume authentication
NotificationCenter.default
.post(Notification(name: Notification.Name("PasswordlessEmailNotificationSuccess")))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class PasswordlessViewController: OtherAuthViewController {

private func sendSignInLink(to email: String) {
let actionCodeSettings = ActionCodeSettings()
let stringURL = "https://\(authorizedDomain).firebaseapp.com/login?email=\(email)"

// Update "demo" to match the path defined in the dynamic link.
let stringURL = "https://\(authorizedDomain)/demo"
actionCodeSettings.url = URL(string: stringURL)
// The sign-in operation must be completed in the app.
actionCodeSettings.handleCodeInApp = true
Expand All @@ -47,6 +49,7 @@ class PasswordlessViewController: OtherAuthViewController {

// Set `email` property as it will be used to complete sign in after opening email link
self.email = email
print("successfully sent email")
}
}

Expand Down
3 changes: 0 additions & 3 deletions FirebaseAuth/Tests/SampleSwift/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ target 'AuthenticationExample' do

pod 'RecaptchaEnterprise', '~> 18.3'

### For Email Link/Passwordless Auth
pod 'FirebaseDynamicLinks', :path => '../../..'

## Pod for Sign in with Google
pod 'GoogleSignIn'

Expand Down
Loading
Loading