|
19 | 19 |
|
20 | 20 | @available(swift 5.0)
|
21 | 21 | @available(iOS 13.0, macOS 10.15, macCatalyst 13.0, tvOS 13.0, watchOS 6.0, *)
|
22 |
| - extension Auth { |
| 22 | + public extension Auth { |
23 | 23 | // MARK: - Authentication State Management
|
24 | 24 |
|
25 | 25 | /// Registers a publisher that publishes authentication state changes.
|
|
34 | 34 | ///
|
35 | 35 | /// - Returns: A publisher emitting a `User` instance (if the user has signed in) or `nil` (if the user has signed out).
|
36 | 36 | /// The publisher will emit on the *main* thread.
|
37 |
| - public func authStateDidChangePublisher() -> AnyPublisher<User?, Never> { |
| 37 | + func authStateDidChangePublisher() -> AnyPublisher<User?, Never> { |
38 | 38 | let subject = PassthroughSubject<User?, Never>()
|
39 | 39 | let handle = addStateDidChangeListener { auth, user in
|
40 | 40 | subject.send(user)
|
|
60 | 60 | /// - Returns: A publisher emitting a `User` instance (if a different user is signed in or
|
61 | 61 | /// the ID token of the current user has changed) or `nil` (if the user has signed out).
|
62 | 62 | /// The publisher will emit on the *main* thread.
|
63 |
| - public func idTokenDidChangePublisher() -> AnyPublisher<User?, Never> { |
| 63 | + func idTokenDidChangePublisher() -> AnyPublisher<User?, Never> { |
64 | 64 | let subject = PassthroughSubject<User?, Never>()
|
65 | 65 | let handle = addIDTokenDidChangeListener { auth, user in
|
66 | 66 | subject.send(user)
|
|
80 | 80 | /// - Returns: A publisher that emits when the user of the calling Auth instance has been updated or
|
81 | 81 | /// an error was encountered. The publisher will emit on the **main** thread.
|
82 | 82 | @discardableResult
|
83 |
| - public func updateCurrentUser(_ user: User) -> Future<Void, Error> { |
| 83 | + func updateCurrentUser(_ user: User) -> Future<Void, Error> { |
84 | 84 | Future<Void, Error> { promise in
|
85 | 85 | self.updateCurrentUser(user) { error in
|
86 | 86 | if let error = error {
|
|
109 | 109 | ///
|
110 | 110 | /// See `AuthErrors` for a list of error codes that are common to all API methods
|
111 | 111 | @discardableResult
|
112 |
| - public func signInAnonymously() -> Future<AuthDataResult, Error> { |
| 112 | + func signInAnonymously() -> Future<AuthDataResult, Error> { |
113 | 113 | Future<AuthDataResult, Error> { promise in
|
114 | 114 | self.signInAnonymously { authDataResult, error in
|
115 | 115 | if let error = error {
|
|
145 | 145 | ///
|
146 | 146 | /// See `AuthErrors` for a list of error codes that are common to all API methods
|
147 | 147 | @discardableResult
|
148 |
| - public func createUser(withEmail email: String, |
149 |
| - password: String) -> Future<AuthDataResult, Error> { |
| 148 | + func createUser(withEmail email: String, |
| 149 | + password: String) -> Future<AuthDataResult, Error> { |
150 | 150 | Future<AuthDataResult, Error> { promise in
|
151 | 151 | self.createUser(withEmail: email, password: password) { authDataResult, error in
|
152 | 152 | if let error = error {
|
|
178 | 178 | ///
|
179 | 179 | /// See `AuthErrors` for a list of error codes that are common to all API methods
|
180 | 180 | @discardableResult
|
181 |
| - public func signIn(withEmail email: String, |
182 |
| - password: String) -> Future<AuthDataResult, Error> { |
| 181 | + func signIn(withEmail email: String, |
| 182 | + password: String) -> Future<AuthDataResult, Error> { |
183 | 183 | Future<AuthDataResult, Error> { promise in
|
184 | 184 | self.signIn(withEmail: email, password: password) { authDataResult, error in
|
185 | 185 | if let error = error {
|
|
212 | 212 | /// See `AuthErrors` for a list of error codes that are common to all API methods
|
213 | 213 | @available(watchOS, unavailable)
|
214 | 214 | @discardableResult
|
215 |
| - public func signIn(withEmail email: String, |
216 |
| - link: String) -> Future<AuthDataResult, Error> { |
| 215 | + func signIn(withEmail email: String, |
| 216 | + link: String) -> Future<AuthDataResult, Error> { |
217 | 217 | Future<AuthDataResult, Error> { promise in
|
218 | 218 | self.signIn(withEmail: email, link: link) { authDataResult, error in
|
219 | 219 | if let error = error {
|
|
236 | 236 | /// - Returns: A publisher that emits whether the call was successful or not. The publisher will emit on the *main* thread.
|
237 | 237 | @available(watchOS, unavailable)
|
238 | 238 | @discardableResult
|
239 |
| - public func sendSignInLink(toEmail email: String, |
240 |
| - actionCodeSettings: ActionCodeSettings) -> Future<Void, Error> { |
| 239 | + func sendSignInLink(toEmail email: String, |
| 240 | + actionCodeSettings: ActionCodeSettings) -> Future<Void, Error> { |
241 | 241 | Future<Void, Error> { promise in
|
242 | 242 | self.sendSignInLink(toEmail: email, actionCodeSettings: actionCodeSettings) { error in
|
243 | 243 | if let error = error {
|
|
262 | 262 | /// - `AuthErrorCodeInvalidEmail` - Indicates the email address is malformed.
|
263 | 263 | ///
|
264 | 264 | /// See `AuthErrors` for a list of error codes that are common to all API methods
|
265 |
| - public func fetchSignInMethods(forEmail email: String) -> Future<[String], Error> { |
| 265 | + func fetchSignInMethods(forEmail email: String) -> Future<[String], Error> { |
266 | 266 | Future<[String], Error> { promise in
|
267 | 267 | self.fetchSignInMethods(forEmail: email) { signInMethods, error in
|
268 | 268 | if let error = error {
|
|
292 | 292 | ///
|
293 | 293 | /// See `AuthErrors` for a list of error codes that are common to all API methods
|
294 | 294 | @discardableResult
|
295 |
| - public func confirmPasswordReset(withCode code: String, |
296 |
| - newPassword: String) -> Future<Void, Error> { |
| 295 | + func confirmPasswordReset(withCode code: String, |
| 296 | + newPassword: String) -> Future<Void, Error> { |
297 | 297 | Future<Void, Error> { promise in
|
298 | 298 | self.confirmPasswordReset(withCode: code, newPassword: newPassword) { error in
|
299 | 299 | if let error = error {
|
|
314 | 314 | /// verified, the publisher will emit the email address of the account the code was issued for.
|
315 | 315 | /// The publisher will emit on the *main* thread.
|
316 | 316 | @discardableResult
|
317 |
| - public func verifyPasswordResetCode(_ code: String) -> Future<String, Error> { |
| 317 | + func verifyPasswordResetCode(_ code: String) -> Future<String, Error> { |
318 | 318 | Future<String, Error> { promise in
|
319 | 319 | self.verifyPasswordResetCode(code) { email, error in
|
320 | 320 | if let error = error {
|
|
334 | 334 | /// - Returns: A publisher that emits the email address of the account the code was issued for or an error if
|
335 | 335 | /// the code could not be verified. The publisher will emit on the *main* thread.
|
336 | 336 | @discardableResult
|
337 |
| - public func checkActionCode(code: String) -> Future<ActionCodeInfo, Error> { |
| 337 | + func checkActionCode(code: String) -> Future<ActionCodeInfo, Error> { |
338 | 338 | Future<ActionCodeInfo, Error> { promise in
|
339 | 339 | self.checkActionCode(code) { actionCodeInfo, error in
|
340 | 340 | if let error = error {
|
|
355 | 355 | /// - Remark: This method will not work for out-of-band codes which require an additional parameter,
|
356 | 356 | /// such as password reset codes.
|
357 | 357 | @discardableResult
|
358 |
| - public func applyActionCode(code: String) -> Future<Void, Error> { |
| 358 | + func applyActionCode(code: String) -> Future<Void, Error> { |
359 | 359 | Future<Void, Error> { promise in
|
360 | 360 | self.applyActionCode(code) { error in
|
361 | 361 | if let error = error {
|
|
380 | 380 | ///
|
381 | 381 | /// See `AuthErrors` for a list of error codes that are common to all API methods
|
382 | 382 | @discardableResult
|
383 |
| - public func sendPasswordReset(withEmail email: String) -> Future<Void, Error> { |
| 383 | + func sendPasswordReset(withEmail email: String) -> Future<Void, Error> { |
384 | 384 | Future<Void, Error> { promise in
|
385 | 385 | self.sendPasswordReset(withEmail: email) { error in
|
386 | 386 | if let error = error {
|
|
414 | 414 | ///
|
415 | 415 | /// See `AuthErrors` for a list of error codes that are common to all API methods
|
416 | 416 | @discardableResult
|
417 |
| - public func sendPasswordReset(withEmail email: String, |
418 |
| - actionCodeSettings: ActionCodeSettings) -> Future<Void, Error> { |
| 417 | + func sendPasswordReset(withEmail email: String, |
| 418 | + actionCodeSettings: ActionCodeSettings) -> Future<Void, Error> { |
419 | 419 | Future<Void, Error> { promise in
|
420 | 420 | self.sendPasswordReset(withEmail: email, actionCodeSettings: actionCodeSettings) { error in
|
421 | 421 | if let error = error {
|
|
462 | 462 | ///
|
463 | 463 | /// See `AuthErrors` for a list of error codes that are common to all API methods
|
464 | 464 | @discardableResult
|
465 |
| - public func signIn(with provider: FederatedAuthProvider, |
466 |
| - uiDelegate: AuthUIDelegate?) -> Future<AuthDataResult, Error> { |
| 465 | + func signIn(with provider: FederatedAuthProvider, |
| 466 | + uiDelegate: AuthUIDelegate?) -> Future<AuthDataResult, Error> { |
467 | 467 | Future<AuthDataResult, Error> { promise in
|
468 | 468 | self.signIn(with: provider, uiDelegate: uiDelegate) { authDataResult, error in
|
469 | 469 | if let error = error {
|
|
491 | 491 | ///
|
492 | 492 | /// See `AuthErrors` for a list of error codes that are common to all API methods
|
493 | 493 | @discardableResult
|
494 |
| - public func signIn(withCustomToken token: String) -> Future<AuthDataResult, Error> { |
| 494 | + func signIn(withCustomToken token: String) -> Future<AuthDataResult, Error> { |
495 | 495 | Future<AuthDataResult, Error> { promise in
|
496 | 496 | self.signIn(withCustomToken: token) { authDataResult, error in
|
497 | 497 | if let error = error {
|
|
540 | 540 | ///
|
541 | 541 | /// See `AuthErrors` for a list of error codes that are common to all API methods
|
542 | 542 | @discardableResult
|
543 |
| - public func signIn(with credential: AuthCredential) -> Future<AuthDataResult, Error> { |
| 543 | + func signIn(with credential: AuthCredential) -> Future<AuthDataResult, Error> { |
544 | 544 | Future<AuthDataResult, Error> { promise in
|
545 | 545 | self.signIn(with: credential) { authDataResult, error in
|
546 | 546 | if let error = error {
|
|
0 commit comments