Skip to content

Commit

Permalink
[auth-swift] Modernize Phone Auth Notification Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 committed May 21, 2024
1 parent a5af29d commit ff2b3c1
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 20 deletions.
6 changes: 0 additions & 6 deletions FirebaseAuth/Sources/Swift/Auth/Auth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ import FirebaseCoreExtension
completionHandler(UIBackgroundFetchResult.noData)
}

// TODO(#11693): This deprecated API is temporarily needed for Phone Auth.
open func application(_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable: Any]) {
_ = canHandleNotification(userInfo)
}

open func application(_ application: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@
delegate.application?(self.application,
didReceiveRemoteNotification: proberNotification) { _ in
}
} else if let delegate = self.application.delegate,
delegate
.responds(to: #selector(UIApplicationDelegate
.application(_:didReceiveRemoteNotification:))) {
delegate.application?(self.application,
didReceiveRemoteNotification: proberNotification)
} else {
AuthLog.logWarning(
code: "I-AUT000015",
Expand Down
5 changes: 3 additions & 2 deletions FirebaseAuth/Sources/Swift/User/User.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1429,8 +1429,9 @@ extension User: NSSecureCoding {}
var providerData: [String: UserInfoImpl] = [:]
if let providerUserInfos = user.providerUserInfo {
for providerUserInfo in providerUserInfos {
let userInfo = UserInfoImpl.userInfo(withGetAccountInfoResponseProviderUserInfo:
providerUserInfo)
let userInfo = UserInfoImpl.userInfo(
withGetAccountInfoResponseProviderUserInfo: providerUserInfo
)
if let providerID = providerUserInfo.providerID {
providerData[providerID] = userInfo
}
Expand Down
7 changes: 3 additions & 4 deletions FirebaseAuth/Sources/Swift/User/UserInfoImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ extension UserInfoImpl: NSSecureCoding {}
/// - Returns: A new instance of `UserInfo` using data from the getAccountInfo endpoint.
class func userInfo(withGetAccountInfoResponseProviderUserInfo providerUserInfo: GetAccountInfoResponseProviderUserInfo)
-> UserInfoImpl {
guard let providerID = providerUserInfo.providerID,
let uid = providerUserInfo.federatedID else {
guard let providerID = providerUserInfo.providerID else {
// This was a crash in ObjC implementation. Should providerID be not nullable?
fatalError("Missing providerID or uid from GetAccountInfoResponseProviderUserInfo")
fatalError("Missing providerID from GetAccountInfoResponseProviderUserInfo")
}
return UserInfoImpl(withProviderID: providerID,
userID: uid,
userID: providerUserInfo.federatedID ?? "",
displayName: providerUserInfo.displayName,
photoURL: providerUserInfo.photoURL,
email: providerUserInfo.email,
Expand Down
2 changes: 1 addition & 1 deletion FirebaseAuth/Sources/Swift/Utilities/AuthUIDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)

import Foundation
import UIKit
Expand Down
4 changes: 3 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ let package = Package(
),
.package(
url: "https://github.com/google/GoogleUtilities.git",
"7.12.1" ..< "8.0.0"
branch: "pb-rm-deprecated-didReceive"
// TODO: Update to 8.0.0 when ready.
// "7.12.1" ..< "8.0.0"
),
.package(
url: "https://github.com/google/gtm-session-fetcher.git",
Expand Down

0 comments on commit ff2b3c1

Please sign in to comment.