Skip to content

Commit

Permalink
Additional changes to align to the Obj C API (#61)
Browse files Browse the repository at this point in the history
* user is not optional

* add missing getIDToken variant

* add missing delete variant
  • Loading branch information
darinf authored Apr 5, 2024
1 parent 03fe03a commit 25dac03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Sources/FirebaseAuth/FirebaseAuthResult+Swift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ public final class AuthDataResult {
self.impl = impl
}

public var user: User? {
guard impl.user.is_valid() else { return nil }
return .init(impl.user)
public var user: User {
.init(impl.user)
}

// public var additionalUserInfo: AdditionalUserInfo? {
Expand Down
8 changes: 8 additions & 0 deletions Sources/FirebaseAuth/FirebaseUser+Swift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ public final class User {
return try await AuthTokenResult(idTokenForcingRefresh(forceRefresh))
}

public func getIDToken(completion: ((String?, Error?) -> Void)?) {
idTokenForcingRefresh(false, completion: completion)
}

public func getIDToken() async throws -> String {
return try await idTokenForcingRefresh(false)
}
Expand Down Expand Up @@ -230,6 +234,10 @@ public final class User {
// fatalError("\(#function) not yet implemented")
// }

public func delete(completion: ((Error?) -> Void)?) {
fatalError("\(#function) not yet implemented")
}

public func delete() async throws {
fatalError("\(#function) not yet implemented")
}
Expand Down

0 comments on commit 25dac03

Please sign in to comment.