Skip to content

Commit

Permalink
Merge pull request #60 from koji-1009/2.2.1
Browse files Browse the repository at this point in the history
2.2.1
  • Loading branch information
koji-1009 authored Jul 5, 2021
2 parents edb627a + 005dd81 commit 09a41fc
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
4 changes: 4 additions & 0 deletions flutter_auth_ui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.2.1

- Support Email link auth on iOS

## 2.2.0

- Update firebase_auth to `1.4.1`
Expand Down
4 changes: 2 additions & 2 deletions flutter_auth_ui/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ PODS:
- FirebaseUI/Phone (11.0.3):
- FirebasePhoneAuthUI (~> 11.0)
- Flutter (1.0.0)
- flutter_auth_ui (2.2.0):
- flutter_auth_ui (2.2.1):
- FirebaseUI/Anonymous (~> 11.0)
- FirebaseUI/Auth (~> 11.0)
- FirebaseUI/Email (~> 11.0)
Expand Down Expand Up @@ -196,7 +196,7 @@ SPEC CHECKSUMS:
FirebasePhoneAuthUI: ee72e8b968bf39420c3af4f8cf810c7f755f032f
FirebaseUI: d2777b3abcb3fa40ea9eea9e40db5a154df608d3
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
flutter_auth_ui: 0ecfe9aa6a5a804d78dcfd4237b4ea9860892e46
flutter_auth_ui: a292c877aaae988250e5bd01500067b22574e67d
GoogleDataTransport: 04c3e9a480bbcaa2ec3f5d27f1cdeb6a92f20c8d
GoogleSignIn: 7137d297ddc022a7e0aa4619c86d72c909fa7213
GoogleUtilities: f8a43108b38a68eebe8b3540e1f4f2d28843ce20
Expand Down
2 changes: 1 addition & 1 deletion flutter_auth_ui/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.2.0"
version: "2.2.1"
flutter_auth_ui_web:
dependency: transitive
description:
Expand Down
27 changes: 13 additions & 14 deletions flutter_auth_ui/ios/Classes/SwiftFlutterAuthUiPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,32 @@ public class SwiftFlutterAuthUiPlugin: NSObject, FlutterPlugin, FUIAuthDelegate
// As the email is persisted and available between launches it's
// possible to finish authentication process even if the user
// closed the application before tapping the link.
public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [AnyHashable : Any] = [:]) -> Bool {
public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [AnyHashable: Any] = [:]) -> Bool {
if let activity = launchOptions[UIApplication.LaunchOptionsKey.userActivityDictionary] as? NSUserActivity {
handleActivity(activity)
}

// Allow others to handle their part
return true
}

public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
let sourceApplication = options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String
if FUIAuth.defaultAuthUI()?.handleOpen(url, sourceApplication: sourceApplication) ?? false {
return true
}

// other URL handling goes here.
return false
}

public func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]) -> Void) -> Bool {
handleActivity(userActivity)

// Allow others to handle their part
return false
}

// "2. Once you catch the deep link, you will need to pass it to the auth UI so it can be handled."
// See https:firebase.google.com/docs/auth/ios/firebaseui#email_link_authentication
private func handleActivity(_ userActivity: NSUserActivity) {
Expand All @@ -55,23 +55,22 @@ public class SwiftFlutterAuthUiPlugin: NSObject, FlutterPlugin, FUIAuthDelegate
let link = link(from: userActivity) else {
return
}



// If the deep link is being caught during the cold launch of the app
// i.e. in application(_:, didFinishLaunchingWithOptions:)
// there are no providers registered in AuthUI yet. However, the email
// is persisted so we can finish authentication process if the persisted
// email matches the link tapped. To do this we have to add FUIEmailAuth to
// the providers list.
if (authUI.providers.isEmpty) {
if authUI.providers.isEmpty {
authUI.providers = [FUIEmailAuth()]
}

guard Auth.auth().isSignIn(withEmailLink: link.absoluteString) else {
return
}
let _ = authUI.handleOpen(link, sourceApplication: bundle)

_ = authUI.handleOpen(link, sourceApplication: bundle)
}

// See https://firebase.google.com/docs/dynamic-links/create-manually#parameters
Expand All @@ -84,7 +83,7 @@ public class SwiftFlutterAuthUiPlugin: NSObject, FlutterPlugin, FUIAuthDelegate
let url = URL(string: link) else {
return nil
}

return url
}

Expand Down
2 changes: 1 addition & 1 deletion flutter_auth_ui/ios/flutter_auth_ui.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
Pod::Spec.new do |s|
s.name = 'flutter_auth_ui'
s.version = '2.2.0'
s.version = '2.2.1'
s.summary = 'Unofficial firebaseui package for flutter. This library aims to provide support for Android, iOS and the web. Login with Email, Phone, Google account and etc.'
s.description = <<-DESC
A new Flutter plugin.
Expand Down
2 changes: 1 addition & 1 deletion flutter_auth_ui/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_auth_ui
description: Unofficial firebaseui package for flutter. This library aims to provide support for Android, iOS and the web. Login with Email, Phone, Google account and etc.
version: 2.2.0
version: 2.2.1
homepage: https://github.com/koji-1009/flutter_auth_ui

flutter:
Expand Down

0 comments on commit 09a41fc

Please sign in to comment.