Skip to content

Commit

Permalink
Merge branch 'release/6.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAsterisco committed Apr 14, 2024
2 parents 4ab909d + 6321db4 commit ea70fb8
Show file tree
Hide file tree
Showing 149 changed files with 159 additions and 155 deletions.
18 changes: 11 additions & 7 deletions RxFireAuth/Classes/UserManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -476,13 +476,14 @@ extension UserManager {
let firebaseCredentials = credentials.asAuthCredentials()

var oldUserId: String?
let signInCompletionHandler: (Error?) -> Void = { (error) in
let signInCompletionHandler: (Bool, Error?) -> Void = { (fromAutomaticLinking, error) in
guard !disposable.isDisposed else { return }
if let error = error {
if (error as NSError).code == AuthErrorCode.invalidCredential.rawValue {
if fromAutomaticLinking {
observer(.failure(UserInternalError.automaticLinkingFailed(oldUserId: oldUserId, internalError: error)))
} else {
observer(.failure(map(error: error)))
}
observer(.failure(map(error: error)))
} else if let newUser = Auth.auth().currentUser {
observer(
.success(
Expand Down Expand Up @@ -534,6 +535,7 @@ extension UserManager {
if credentials.isReusable {
self.signIn(
with: firebaseCredentials,
fromAutomaticLinking: true,
in: disposable,
completionHandler: signInCompletionHandler
)
Expand All @@ -551,14 +553,15 @@ extension UserManager {
}

/// Linking succeeded or failed with a different error, so we return.
signInCompletionHandler(error)
signInCompletionHandler(false, error)
}
}
} else {
/// There's nobody logged-in.
/// We'll go ahead and sign in with the authentication method.
self.signIn(
with: firebaseCredentials,
fromAutomaticLinking: false,
in: disposable,
completionHandler: signInCompletionHandler
)
Expand Down Expand Up @@ -641,16 +644,17 @@ extension UserManager {
///
/// - parameters:
/// - credentials: The credential to use to sign in.
/// - fromAutomaticLinking: A bool indicating whether this invocation comes as a result of automatic linking.
/// - disposable: A disposable that controls the life of this operation.
/// - completionHandler: A completion handler to call when done.
func signIn(with credentials: AuthCredential, in disposable: Cancelable, completionHandler: @escaping (Error?) -> Void) {
func signIn(with credentials: AuthCredential, fromAutomaticLinking: Bool, in disposable: Cancelable, completionHandler: @escaping (Bool, Error?) -> Void) {
Auth.auth().signIn(with: credentials) { (_, error) in
guard !disposable.isDisposed else { return }

if let error = error {
completionHandler(error)
completionHandler(fromAutomaticLinking, error)
} else {
completionHandler(nil)
completionHandler(fromAutomaticLinking, nil)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/data/documentation/rxfireauth.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"abstract":[{"text":"An authentication provider.","type":"text"}],"sections":[],"primaryContentSections":[{"declarations":[{"languages":["swift"],"platforms":["macOS"],"tokens":[{"text":"enum","kind":"keyword"},{"text":" ","kind":"text"},{"kind":"identifier","text":"AuthenticationProvider"}]}],"kind":"declarations"},{"content":[{"level":2,"text":"Overview","type":"heading","anchor":"overview"},{"style":"note","name":"Since","type":"aside","content":[{"inlineContent":[{"text":"version 4.0.0","type":"text"}],"type":"paragraph"}]}],"kind":"content"}],"metadata":{"fragments":[{"kind":"keyword","text":"enum"},{"text":" ","kind":"text"},{"text":"AuthenticationProvider","kind":"identifier"}],"navigatorTitle":[{"kind":"identifier","text":"AuthenticationProvider"}],"symbolKind":"enum","externalID":"s:10RxFireAuth22AuthenticationProviderO","modules":[{"name":"RxFireAuth"}],"role":"symbol","roleHeading":"Enumeration","title":"AuthenticationProvider"},"topicSections":[{"title":"Enumeration Cases","identifiers":["doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/apple","doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/google","doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/password"]},{"title":"Initializers","identifiers":["doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/init(rawValue:)"]},{"generated":true,"title":"Default Implementations","identifiers":["doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/Equatable-Implementations","doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/RawRepresentable-Implementations"]}],"kind":"symbol","relationshipsSections":[{"type":"conformsTo","title":"Conforms To","identifiers":["doc:\/\/RxFireAuth\/SQ","doc:\/\/RxFireAuth\/SH","doc:\/\/RxFireAuth\/SY"],"kind":"relationships"}],"schemaVersion":{"minor":3,"patch":0,"major":0},"identifier":{"url":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider","interfaceLanguage":"swift"},"hierarchy":{"paths":[["doc:\/\/RxFireAuth\/documentation\/RxFireAuth"]]},"variants":[{"paths":["\/documentation\/rxfireauth\/authenticationprovider"],"traits":[{"interfaceLanguage":"swift"}]}],"references":{"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/google":{"type":"topic","title":"AuthenticationProvider.google","fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"google"}],"abstract":[{"type":"text","text":"Google Sign In"}],"kind":"symbol","role":"symbol","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/google","url":"\/documentation\/rxfireauth\/authenticationprovider\/google"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/RawRepresentable-Implementations":{"title":"RawRepresentable Implementations","type":"topic","url":"\/documentation\/rxfireauth\/authenticationprovider\/rawrepresentable-implementations","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/RawRepresentable-Implementations","kind":"article","role":"collectionGroup","abstract":[]},"doc://RxFireAuth/SQ":{"type":"unresolvable","identifier":"doc:\/\/RxFireAuth\/SQ","title":"Swift.Equatable"},"doc://RxFireAuth/SY":{"type":"unresolvable","identifier":"doc:\/\/RxFireAuth\/SY","title":"Swift.RawRepresentable"},"doc://RxFireAuth/SH":{"type":"unresolvable","identifier":"doc:\/\/RxFireAuth\/SH","title":"Swift.Hashable"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/password":{"title":"AuthenticationProvider.password","role":"symbol","kind":"symbol","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/password","fragments":[{"text":"case","kind":"keyword"},{"text":" ","kind":"text"},{"text":"password","kind":"identifier"}],"url":"\/documentation\/rxfireauth\/authenticationprovider\/password","abstract":[{"type":"text","text":"Email & Password"}],"type":"topic"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/init(rawValue:)":{"title":"init(rawValue:)","role":"symbol","kind":"symbol","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/init(rawValue:)","fragments":[{"kind":"identifier","text":"init"},{"text":"?(","kind":"text"},{"text":"rawValue","kind":"externalParam"},{"text":": ","kind":"text"},{"text":"String","preciseIdentifier":"s:SS","kind":"typeIdentifier"},{"text":")","kind":"text"}],"url":"\/documentation\/rxfireauth\/authenticationprovider\/init(rawvalue:)","abstract":[],"type":"topic"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider":{"type":"topic","kind":"symbol","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider","title":"AuthenticationProvider","url":"\/documentation\/rxfireauth\/authenticationprovider","abstract":[{"text":"An authentication provider.","type":"text"}],"navigatorTitle":[{"text":"AuthenticationProvider","kind":"identifier"}],"fragments":[{"text":"enum","kind":"keyword"},{"text":" ","kind":"text"},{"text":"AuthenticationProvider","kind":"identifier"}],"role":"symbol"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/apple":{"kind":"symbol","title":"AuthenticationProvider.apple","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/apple","fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"apple"}],"role":"symbol","url":"\/documentation\/rxfireauth\/authenticationprovider\/apple","type":"topic","abstract":[{"text":"Sign in with Apple.","type":"text"}]},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/Equatable-Implementations":{"type":"topic","title":"Equatable Implementations","url":"\/documentation\/rxfireauth\/authenticationprovider\/equatable-implementations","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/Equatable-Implementations","abstract":[],"kind":"article","role":"collectionGroup"},"doc://RxFireAuth/documentation/RxFireAuth":{"identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth","role":"collection","type":"topic","kind":"symbol","title":"RxFireAuth","abstract":[],"url":"\/documentation\/rxfireauth"}}}
{"topicSections":[{"identifiers":["doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/apple","doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/google","doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/password"],"title":"Enumeration Cases"},{"identifiers":["doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/init(rawValue:)"],"title":"Initializers"},{"identifiers":["doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/Equatable-Implementations","doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/RawRepresentable-Implementations"],"title":"Default Implementations","generated":true}],"abstract":[{"text":"An authentication provider.","type":"text"}],"schemaVersion":{"major":0,"minor":3,"patch":0},"primaryContentSections":[{"kind":"declarations","declarations":[{"tokens":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"text":"AuthenticationProvider","kind":"identifier"}],"platforms":["macOS"],"languages":["swift"]}]},{"kind":"content","content":[{"level":2,"text":"Overview","type":"heading","anchor":"overview"},{"type":"aside","name":"Since","content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"version 4.0.0"}]}],"style":"note"}]}],"identifier":{"url":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider","interfaceLanguage":"swift"},"variants":[{"traits":[{"interfaceLanguage":"swift"}],"paths":["\/documentation\/rxfireauth\/authenticationprovider"]}],"hierarchy":{"paths":[["doc:\/\/RxFireAuth\/documentation\/RxFireAuth"]]},"kind":"symbol","relationshipsSections":[{"identifiers":["doc:\/\/RxFireAuth\/SQ","doc:\/\/RxFireAuth\/SH","doc:\/\/RxFireAuth\/SY"],"kind":"relationships","title":"Conforms To","type":"conformsTo"}],"metadata":{"externalID":"s:10RxFireAuth22AuthenticationProviderO","fragments":[{"text":"enum","kind":"keyword"},{"kind":"text","text":" "},{"text":"AuthenticationProvider","kind":"identifier"}],"roleHeading":"Enumeration","title":"AuthenticationProvider","navigatorTitle":[{"text":"AuthenticationProvider","kind":"identifier"}],"symbolKind":"enum","modules":[{"name":"RxFireAuth"}],"role":"symbol"},"sections":[],"references":{"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/RawRepresentable-Implementations":{"kind":"article","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/RawRepresentable-Implementations","url":"\/documentation\/rxfireauth\/authenticationprovider\/rawrepresentable-implementations","title":"RawRepresentable Implementations","role":"collectionGroup","type":"topic","abstract":[]},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/google":{"type":"topic","kind":"symbol","url":"\/documentation\/rxfireauth\/authenticationprovider\/google","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/google","role":"symbol","title":"AuthenticationProvider.google","fragments":[{"text":"case","kind":"keyword"},{"text":" ","kind":"text"},{"text":"google","kind":"identifier"}],"abstract":[{"type":"text","text":"Google Sign In"}]},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/Equatable-Implementations":{"title":"Equatable Implementations","type":"topic","role":"collectionGroup","url":"\/documentation\/rxfireauth\/authenticationprovider\/equatable-implementations","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/Equatable-Implementations","kind":"article","abstract":[]},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/apple":{"title":"AuthenticationProvider.apple","abstract":[{"type":"text","text":"Sign in with Apple."}],"fragments":[{"kind":"keyword","text":"case"},{"text":" ","kind":"text"},{"text":"apple","kind":"identifier"}],"url":"\/documentation\/rxfireauth\/authenticationprovider\/apple","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/apple","kind":"symbol","role":"symbol","type":"topic"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/password":{"title":"AuthenticationProvider.password","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/password","url":"\/documentation\/rxfireauth\/authenticationprovider\/password","type":"topic","kind":"symbol","role":"symbol","abstract":[{"type":"text","text":"Email & Password"}],"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"password"}]},"doc://RxFireAuth/documentation/RxFireAuth":{"title":"RxFireAuth","abstract":[],"type":"topic","kind":"symbol","role":"collection","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth","url":"\/documentation\/rxfireauth"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider/init(rawValue:)":{"abstract":[],"kind":"symbol","identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider\/init(rawValue:)","role":"symbol","type":"topic","url":"\/documentation\/rxfireauth\/authenticationprovider\/init(rawvalue:)","fragments":[{"kind":"identifier","text":"init"},{"kind":"text","text":"?("},{"kind":"externalParam","text":"rawValue"},{"text":": ","kind":"text"},{"kind":"typeIdentifier","preciseIdentifier":"s:SS","text":"String"},{"text":")","kind":"text"}],"title":"init(rawValue:)"},"doc://RxFireAuth/SY":{"identifier":"doc:\/\/RxFireAuth\/SY","title":"Swift.RawRepresentable","type":"unresolvable"},"doc://RxFireAuth/SQ":{"identifier":"doc:\/\/RxFireAuth\/SQ","title":"Swift.Equatable","type":"unresolvable"},"doc://RxFireAuth/SH":{"identifier":"doc:\/\/RxFireAuth\/SH","title":"Swift.Hashable","type":"unresolvable"},"doc://RxFireAuth/documentation/RxFireAuth/AuthenticationProvider":{"identifier":"doc:\/\/RxFireAuth\/documentation\/RxFireAuth\/AuthenticationProvider","abstract":[{"text":"An authentication provider.","type":"text"}],"url":"\/documentation\/rxfireauth\/authenticationprovider","role":"symbol","kind":"symbol","title":"AuthenticationProvider","fragments":[{"text":"enum","kind":"keyword"},{"kind":"text","text":" "},{"kind":"identifier","text":"AuthenticationProvider"}],"type":"topic","navigatorTitle":[{"text":"AuthenticationProvider","kind":"identifier"}]}}}
Loading

0 comments on commit ea70fb8

Please sign in to comment.