diff --git a/auth/src/FirebaseAccountLinkException.cs b/auth/src/FirebaseAccountLinkException.cs index f2625f9fb..4638d9357 100644 --- a/auth/src/FirebaseAccountLinkException.cs +++ b/auth/src/FirebaseAccountLinkException.cs @@ -24,16 +24,6 @@ namespace Firebase.Auth { /// Firebase.Auth.SignInWithCredential. public sealed class FirebaseAccountLinkException : System.Exception { - /// Initializes a new FirebaseAccountLinkException, with the given error code and - /// message and the AdditionalUserInfo returned from the Firebase auth service. - [System.Obsolete("Use `FirebaseAccountLinkException(int, string, AuthResult)` instead", false)] - public FirebaseAccountLinkException(int errorCode, string message, - SignInResult signInResult) : base(message) - { - ErrorCode = errorCode; - result_DEPRECATED = signInResult; - } - /// Initializes a new FirebaseAccountLinkException, with the given error code and /// message and the AdditionalUserInfo returned from the Firebase auth service. public FirebaseAccountLinkException(int errorCode, string message, @@ -53,11 +43,9 @@ public FirebaseAccountLinkException(int errorCode, string message, /// the credential may be used to sign-in the user into Firebase with /// Firebase.Auth.SignInWithCredentialAsync. public AdditionalUserInfo UserInfo { - get { return (result != null) ? result.AdditionalUserInfoInternal : - (result_DEPRECATED != null) ? result_DEPRECATED.Info : null; } + get { return (result != null) ? result.AdditionalUserInfoInternal : null; } } - private SignInResult result_DEPRECATED = null; private AuthResult result = null; } diff --git a/auth/src/FirebaseUser.cs b/auth/src/FirebaseUser.cs index 75f39acc8..840b81f4b 100644 --- a/auth/src/FirebaseUser.cs +++ b/auth/src/FirebaseUser.cs @@ -42,13 +42,6 @@ private FirebaseUserInternal GetValidFirebaseUserInternal() { } } - private void CompleteSignInResult(SignInResult signInResult) { - if (signInResult != null) { - // Cache the authProxy in the SignInResult - signInResult.authProxy = authProxy; - } - } - private void CompleteAuthResult(AuthResult authResult) { if (authResult != null) { // Cache the authProxy in the AuthResult @@ -56,23 +49,6 @@ private void CompleteAuthResult(AuthResult authResult) { } } - /// @deprecated This method is deprecated in favor of methods that return - /// `Task`. Please use - /// @ref ReauthenticateWithProviderAsync(FederatedAuthProvider) instead. - /// - /// Reauthenticate a user via a federated auth provider. - /// - /// @note: This operation is supported only on iOS, tvOS and Android - /// platforms. On other platforms this method will return a Future with a - /// preset error code: kAuthErrorUnimplemented. - [System.Obsolete("Please use `Task ReauthenticateWithProviderAsync(FederatedAuthProvider)` instead", false)] - public async Task ReauthenticateWithProviderAsync_DEPRECATED(FederatedAuthProvider provider) { - FirebaseUserInternal userInternal = GetValidFirebaseUserInternal(); - SignInResult result = await userInternal.ReauthenticateWithProviderInternalAsync_DEPRECATED(provider); - CompleteSignInResult(result); - return result; - } - /// Reauthenticate a user via a federated auth provider. /// /// @note: This operation is supported only on iOS, tvOS and Android @@ -85,23 +61,6 @@ public async Task ReauthenticateWithProviderAsync(FederatedAuthProvi return result; } - /// @deprecated This method is deprecated in favor of methods that return - /// `Task`. Please use - /// @ref LinkWithProviderAsync(FederatedAuthProvider) instead. - /// - /// Link a user via a federated auth provider. - /// - /// @note: This operation is supported only on iOS, tvOS and Android - /// platforms. On other platforms this method will return a Future with a - /// preset error code: kAuthErrorUnimplemented. - [System.Obsolete("Please use `Task LinkWithProviderAsync(FederatedAuthProvider)` instead", false)] - public async Task LinkWithProviderAsync_DEPRECATED(FederatedAuthProvider provider) { - FirebaseUserInternal userInternal = GetValidFirebaseUserInternal(); - SignInResult result = await userInternal.LinkWithProviderInternalAsync_DEPRECATED(provider); - CompleteSignInResult(result); - return result; - } - /// Link a user via a federated auth provider. /// /// @note: This operation is supported only on iOS, tvOS and Android @@ -114,43 +73,6 @@ public async Task LinkWithProviderAsync(FederatedAuthProvider provid return result; } - /// @deprecated This method is deprecated in favor of methods that return - /// `Task`. Please use - /// @ref LinkWithCredentialAsync(Credential) instead. - /// - /// Links the user with the given 3rd party credentials. - /// - /// For example, a Facebook login access token, a Twitter token/token-secret - /// pair. - /// Status will be an error if the token is invalid, expired, or otherwise - /// not accepted by the server as well as if the given 3rd party - /// user id is already linked with another user account or if the current user - /// is already linked with another id from the same provider. - /// - /// Data from the Identity Provider used to sign-in is returned in the - /// @ref AdditionalUserInfo inside @ref SignInResult. - [System.Obsolete("Please use `Task LinkWithCredentialAsync(Credential)` instead", false)] - public async Task LinkAndRetrieveDataWithCredentialAsync(Credential credential) { - FirebaseUserInternal userInternal = GetValidFirebaseUserInternal(); - SignInResult result = await userInternal.LinkAndRetrieveDataWithCredentialInternalAsync(credential); - CompleteSignInResult(result); - return result; - } - - /// @deprecated This method is deprecated in favor of methods that return - /// `Task`. Please use - /// @ref LinkWithCredentialAsync(Credential) instead. - /// - /// Associates a user account from a third-party identity provider. - [System.Obsolete("Please use `Task LinkWithCredentialAsync(Credential)` instead", false)] - public async Task LinkWithCredentialAsync_DEPRECATED(Credential credential) { - FirebaseUserInternal userInternal = GetValidFirebaseUserInternal(); - // We don't care about the returned user, since there is currently only meant to - // be a single FirebaseUser under the hood. - await userInternal.LinkWithCredentialInternalAsync_DEPRECATED(credential); - return this; - } - /// Associates a user account from a third-party identity provider. public async Task LinkWithCredentialAsync(Credential credential) { FirebaseUserInternal userInternal = GetValidFirebaseUserInternal(); @@ -159,28 +81,6 @@ public async Task LinkWithCredentialAsync(Credential credential) { return result; } - /// @deprecated This method is deprecated in favor of methods that return - /// `Task`. Please use - /// @ref ReauthenticateAndRetrieveDataAsync(Credential) instead. - /// - /// Reauthenticate using a credential. - /// - /// Data from the Identity Provider used to sign-in is returned in the - /// AdditionalUserInfo inside the returned SignInResult. - /// - /// Returns an error if the existing credential is not for this user - /// or if sign-in with that credential failed. - /// - /// @note: The current user may be signed out if this operation fails on - /// Android and desktop platforms. - [System.Obsolete("Please use `Task ReauthenticateAndRetrieveDataAsync(Credential)` instead", false)] - public async Task ReauthenticateAndRetrieveDataAsync_DEPRECATED(Credential credential) { - FirebaseUserInternal userInternal = GetValidFirebaseUserInternal(); - SignInResult result = await userInternal.ReauthenticateAndRetrieveDataInternalAsync_DEPRECATED(credential); - CompleteSignInResult(result); - return result; - } - /// Reauthenticate using a credential. /// /// Data from the Identity Provider used to sign-in is returned in the @@ -198,20 +98,6 @@ public async Task ReauthenticateAndRetrieveDataAsync(Credential cred return result; } - /// @deprecated This method is deprecated in favor of methods that return - /// `Task`. Please use @ref UnlinkAsync(string) instead. - /// - /// Unlinks the current user from the provider specified. - /// Status will be an error if the user is not linked to the given provider. - [System.Obsolete("Please use `Task UnlinkAsync(string)` instead", false)] - public async Task UnlinkAsync_DEPRECATED(string provider) { - FirebaseUserInternal userInternal = GetValidFirebaseUserInternal(); - // We don't care about the returned user, since there is currently only meant to - // be a single FirebaseUser under the hood. - await userInternal.UnlinkInternalAsync_DEPRECATED(provider); - return this; - } - /// Unlinks the current user from the provider specified. /// Status will be an error if the user is not linked to the given provider. public async Task UnlinkAsync(string provider) { @@ -221,24 +107,6 @@ public async Task UnlinkAsync(string provider) { return result; } - /// @deprecated This method is deprecated in favor of methods that return - /// `Task`. Please use - /// @ref UpdatePhoneNumberCredentialAsync(PhoneAuthCredential) instead. - /// - /// Updates the currently linked phone number on the user. - /// This is useful when a user wants to change their phone number. It is a - /// shortcut to calling `UnlinkAsync_DEPRECATED(phoneCredential.Provider)` - /// and then `LinkWithCredentialAsync_DEPRECATED(phoneCredential)`. - /// `phoneCredential` must have been created with @ref PhoneAuthProvider. - [System.Obsolete("Please use `Task UpdatePhoneNumberCredentialAsync(PhoneAuthCredential)` instead", false)] - public async Task UpdatePhoneNumberCredentialAsync_DEPRECATED(Credential credential) { - FirebaseUserInternal userInternal = GetValidFirebaseUserInternal(); - // We don't care about the returned user, since there is currently only meant to - // be a single FirebaseUser under the hood. - await userInternal.UpdatePhoneNumberCredentialInternalAsync_DEPRECATED(credential); - return this; - } - /// Updates the currently linked phone number on the user. /// This is useful when a user wants to change their phone number. It is a /// shortcut to calling `UnlinkAsync(phoneCredential.Provider)` @@ -248,7 +116,7 @@ public async Task UpdatePhoneNumberCredentialAsync(PhoneAuthCreden FirebaseUserInternal userInternal = GetValidFirebaseUserInternal(); // We don't care about the returned user, since there is currently only meant to // be a single FirebaseUser under the hood. - await userInternal.UpdatePhoneNumberCredentialInternalAsync_DEPRECATED(credential); + await userInternal.UpdatePhoneNumberCredentialInternalAsync(credential); return this; } diff --git a/auth/src/PhoneAuthProvider.cs b/auth/src/PhoneAuthProvider.cs index 195ec9eb0..e4d20acb9 100644 --- a/auth/src/PhoneAuthProvider.cs +++ b/auth/src/PhoneAuthProvider.cs @@ -59,17 +59,7 @@ namespace Firebase.Auth { /// - The operating system validates the phone number without having to /// send an SMS. @ref PhoneAuthCredential is automatically created and /// passed to the app via @ref VerificationCompleted. -/// -/// Note: Both @ref VerificationCompleted_DEPRECATED and -/// @ref VerificationCompleted will be triggered upon completion. Developer -/// should only use only one of them to prevent duplicated event handling. public sealed class PhoneAuthProvider : global::System.IDisposable { - /// @deprecated This is a deprecated delegate. Please use @ref - /// VerificationCompleted instead. - // - /// Callback used when phone number auto-verification succeeded. - [System.Obsolete("Please use `VerificationCompleted(PhoneAuthCredential)` instead", false)] - public delegate void VerificationCompleted_DEPRECATED(Credential credential); /// Callback used when phone number auto-verification succeeded. public delegate void VerificationCompleted(PhoneAuthCredential credential); /// Callback used when phone number verification fails. @@ -84,7 +74,6 @@ public delegate void CodeSent(string verificationId, // Class to hold the delegates the user provides to the verification flow. private class PhoneAuthDelegates { - public VerificationCompleted_DEPRECATED verificationCompleted_DEPRECATED; public VerificationCompleted verificationCompleted; public VerificationFailed verificationFailed; public CodeSent codeSent; @@ -102,14 +91,12 @@ private class PhoneAuthDelegates { /// when the C++ library indicates a callback. /// /// @return The unique identifier for the cached callbacks. - private static int SaveCallbacks(VerificationCompleted_DEPRECATED verificationCompleted_DEPRECATED, - VerificationCompleted verificationCompleted, + private static int SaveCallbacks(VerificationCompleted verificationCompleted, VerificationFailed verificationFailed, CodeSent codeSent, CodeAutoRetrievalTimeOut timeOut) { int uid = uidGenerator++; var delegates = new PhoneAuthDelegates { - verificationCompleted_DEPRECATED = verificationCompleted_DEPRECATED, verificationCompleted = verificationCompleted, verificationFailed = verificationFailed, codeSent = codeSent, @@ -121,23 +108,6 @@ private static int SaveCallbacks(VerificationCompleted_DEPRECATED verificationCo return uid; } - [MonoPInvokeCallback(typeof(PhoneAuthProviderInternal.VerificationCompletedDelegate_DEPRECATED))] - private static void VerificationCompletedHandler_DEPRECATED(int callbackId, - System.IntPtr credential) { - ExceptionAggregator.Wrap(() => { - Credential c = new Credential(credential, true); - lock (authCallbacks) { - PhoneAuthDelegates callbacks; - if (authCallbacks.TryGetValue(callbackId, out callbacks) && - callbacks.verificationCompleted_DEPRECATED != null) { - callbacks.verificationCompleted_DEPRECATED(c); - } else { - c.Dispose(); - } - } - }); - } - [MonoPInvokeCallback(typeof(PhoneAuthProviderInternal.VerificationCompletedDelegate))] private static void VerificationCompletedHandler(int callbackId, System.IntPtr credential) { @@ -197,10 +167,6 @@ private static void TimeOutHandler(int callbackId, string verificationId) { }); } - private static PhoneAuthProviderInternal.VerificationCompletedDelegate_DEPRECATED - verificationCompletedDelegate_DEPRECATED = - new PhoneAuthProviderInternal.VerificationCompletedDelegate_DEPRECATED( - VerificationCompletedHandler_DEPRECATED); private static PhoneAuthProviderInternal.VerificationCompletedDelegate verificationCompletedDelegate = new PhoneAuthProviderInternal.VerificationCompletedDelegate( @@ -222,194 +188,13 @@ private static PhoneAuthProviderInternal.TimeOutDelegate private static void InitializeCallbacks() { if (!callbacksInitialized) { callbacksInitialized = true; - PhoneAuthProviderInternal.SetCallbacks(verificationCompletedDelegate_DEPRECATED, - verificationCompletedDelegate, + PhoneAuthProviderInternal.SetCallbacks(verificationCompletedDelegate, verificationFailedDelegate, codeSentDelegate, timeOutDelegate); } } - /// @deprecated This is a deprecated method. Please use @ref - /// VerifyPhoneNumber(PhoneAuthOptions, VerificationCompleted, VerificationFailed, CodeSent, - /// CodeAutoRetrievalTimeOut) instead. - /// - /// Start the phone number authentication operation. - /// - /// @note The verificationCompleted callback is never invoked on iOS since auto-validation is - /// not supported on that platform. - /// - /// @param[in] phoneNumber The phone number identifier supplied by the user. - /// Its format is normalized on the server, so it can be in any format - /// here. - /// @param[in] autoVerifyTimeOutMs The time out for SMS auto retrieval, in - /// miliseconds. Currently SMS auto retrieval is only supported on Android. - /// If 0, do not do SMS auto retrieval. - /// If positive, try to auto-retrieve the SMS verification code. - /// When the time out is exceeded, `codeAutoRetrievalTimeOut` - /// is called. - /// @param[in] forceResendingToken If NULL, assume this is a new phone - /// number to verify. If not-NULL, bypass the verification session deduping - /// and force resending a new SMS. - /// This token is received by the `CodeSent` callback. - /// This should only be used when the user presses a Resend SMS button. - /// @param[in] verificationCompleted Phone number auto-verification succeeded. - /// Called when auto-sms-retrieval or instant validation succeeds. - /// Provided with the completed credential. - /// @param[in] verificationFailed Phone number verification failed with an - /// error. For example, quota exceeded or unknown phone number format. - /// Provided with a description of the error. - [System.Obsolete("Please use `VerifyPhoneNumber(PhoneAuthOptions, VerificationCompleted, VerificationFailed, CodeSent, CodeAutoRetrievalTimeOut)` instead", false)] - public void VerifyPhoneNumber(string phoneNumber, uint autoVerifyTimeOutMs, - ForceResendingToken forceResendingToken, - VerificationCompleted_DEPRECATED verificationCompleted, - VerificationFailed verificationFailed) { - VerifyPhoneNumber(phoneNumber, autoVerifyTimeOutMs, forceResendingToken, - verificationCompleted, verificationFailed, - null, null); - } - - /// @deprecated This is a deprecated method. Please use @ref - /// VerifyPhoneNumber(PhoneAuthOptions, VerificationCompleted, VerificationFailed, CodeSent, - /// CodeAutoRetrievalTimeOut) instead. - /// - /// Start the phone number authentication operation. - /// - /// @note The verificationCompleted callback is never invoked on iOS since auto-validation is - /// not supported on that platform. - /// - /// @param[in] phoneNumber The phone number identifier supplied by the user. - /// Its format is normalized on the server, so it can be in any format - /// here. - /// @param[in] autoVerifyTimeOutMs The time out for SMS auto retrieval, in - /// miliseconds. Currently SMS auto retrieval is only supported on Android. - /// If 0, do not do SMS auto retrieval. - /// If positive, try to auto-retrieve the SMS verification code. - /// When the time out is exceeded, `codeAutoRetrievalTimeOut` - /// is called. - /// @param[in] forceResendingToken If NULL, assume this is a new phone - /// number to verify. If not-NULL, bypass the verification session deduping - /// and force resending a new SMS. - /// This token is received by the `CodeSent` callback. - /// This should only be used when the user presses a Resend SMS button. - /// @param[in] verificationCompleted Phone number auto-verification succeeded. - /// Called when auto-sms-retrieval or instant validation succeeds. - /// Provided with the completed credential. - /// @param[in] verificationFailed Phone number verification failed with an - /// error. For example, quota exceeded or unknown phone number format. - /// Provided with a description of the error. - /// @param[in] codeSent SMS message with verification code sent to phone - /// number. Provided with the verification id to pass along to - /// `GetCredential` along with the sent code, and a token to use if - /// the user requests another SMS message be sent. - [System.Obsolete("Please use `VerifyPhoneNumber(PhoneAuthOptions, VerificationCompleted, VerificationFailed, CodeSent, CodeAutoRetrievalTimeOut)` instead", false)] - public void VerifyPhoneNumber(string phoneNumber, uint autoVerifyTimeOutMs, - ForceResendingToken forceResendingToken, - VerificationCompleted_DEPRECATED verificationCompleted, - VerificationFailed verificationFailed, - CodeSent codeSent) { - VerifyPhoneNumber(phoneNumber, autoVerifyTimeOutMs, forceResendingToken, - verificationCompleted, verificationFailed, - codeSent, null); - } - - /// @deprecated This is a deprecated method. Please use @ref - /// VerifyPhoneNumber(PhoneAuthOptions, VerificationCompleted, VerificationFailed, CodeSent, - /// CodeAutoRetrievalTimeOut) instead. - /// - /// Start the phone number authentication operation. - /// - /// @note The verificationCompleted callback is never invoked on iOS since auto-validation is - /// not supported on that platform. - /// - /// @param[in] phoneNumber The phone number identifier supplied by the user. - /// Its format is normalized on the server, so it can be in any format - /// here. - /// @param[in] autoVerifyTimeOutMs The time out for SMS auto retrieval, in - /// miliseconds. Currently SMS auto retrieval is only supported on Android. - /// If 0, do not do SMS auto retrieval. - /// If positive, try to auto-retrieve the SMS verification code. - /// When the time out is exceeded, `codeAutoRetrievalTimeOut` - /// is called. - /// @param[in] forceResendingToken If NULL, assume this is a new phone - /// number to verify. If not-NULL, bypass the verification session deduping - /// and force resending a new SMS. - /// This token is received by the `CodeSent` callback. - /// This should only be used when the user presses a Resend SMS button. - /// @param[in] verificationCompleted Phone number auto-verification succeeded. - /// Called when auto-sms-retrieval or instant validation succeeds. - /// Provided with the completed credential. - /// @param[in] verificationFailed Phone number verification failed with an - /// error. For example, quota exceeded or unknown phone number format. - /// Provided with a description of the error. - [System.Obsolete("Please use `VerifyPhoneNumber(PhoneAuthOptions, VerificationCompleted, VerificationFailed, CodeSent, CodeAutoRetrievalTimeOut)` instead", false)] - public void VerifyPhoneNumber(string phoneNumber, uint autoVerifyTimeOutMs, - ForceResendingToken forceResendingToken, - VerificationCompleted_DEPRECATED verificationCompleted, - VerificationFailed verificationFailed, - CodeAutoRetrievalTimeOut codeAutoRetrievalTimeOut) { - VerifyPhoneNumber(phoneNumber, autoVerifyTimeOutMs, forceResendingToken, - verificationCompleted, verificationFailed, - null, codeAutoRetrievalTimeOut); - } - - /// @deprecated This is a deprecated method. Please use @ref - /// VerifyPhoneNumber(PhoneAuthOptions, VerificationCompleted, VerificationFailed, CodeSent, - /// CodeAutoRetrievalTimeOut) instead. - /// - /// Start the phone number authentication operation. - /// - /// @note On iOS the verificationCompleted callback is never invoked and the - /// codeAutoRetrievalTimeOut callback is invoked immediately since auto-validation is not - /// supported on that platform. - /// - /// @param[in] phoneNumber The phone number identifier supplied by the user. - /// Its format is normalized on the server, so it can be in any format - /// here. - /// @param[in] autoVerifyTimeOutMs The time out for SMS auto retrieval, in - /// miliseconds. Currently SMS auto retrieval is only supported on Android. - /// If 0, do not do SMS auto retrieval. - /// If positive, try to auto-retrieve the SMS verification code. - /// When the time out is exceeded, `codeAutoRetrievalTimeOut` - /// is called. - /// @param[in] forceResendingToken If NULL, assume this is a new phone - /// number to verify. If not-NULL, bypass the verification session deduping - /// and force resending a new SMS. - /// This token is received by the `CodeSent` callback. - /// This should only be used when the user presses a Resend SMS button. - /// @param[in] verificationCompleted Phone number auto-verification succeeded. - /// Called when auto-sms-retrieval or instant validation succeeds. - /// Provided with the completed credential. - /// @param[in] verificationFailed Phone number verification failed with an - /// error. For example, quota exceeded or unknown phone number format. - /// Provided with a description of the error. - /// @param[in] codeSent SMS message with verification code sent to phone - /// number. Provided with the verification id to pass along to - /// `GetCredential` along with the sent code, and a token to use if - /// the user requests another SMS message be sent. - /// @param[in] codeAutoRetrievalTimeOut The timeout specified has expired. - /// Provided with the verification id for the transaction that timed out. - [System.Obsolete("Please use `VerifyPhoneNumber(PhoneAuthOptions, VerificationCompleted, VerificationFailed, CodeSent, CodeAutoRetrievalTimeOut)` instead", false)] - public void VerifyPhoneNumber(string phoneNumber, uint autoVerifyTimeOutMs, - ForceResendingToken forceResendingToken, - VerificationCompleted_DEPRECATED verificationCompleted, - VerificationFailed verificationFailed, - CodeSent codeSent, - CodeAutoRetrievalTimeOut codeAutoRetrievalTimeOut) { - int callbackId = SaveCallbacks( - verificationCompleted_DEPRECATED: verificationCompleted, - verificationCompleted: null, - verificationFailed: verificationFailed, - codeSent: codeSent, - timeOut: codeAutoRetrievalTimeOut); - System.IntPtr listener = InternalProvider.VerifyPhoneNumberInternal( - phoneNumber, autoVerifyTimeOutMs, forceResendingToken, callbackId); - lock (cppListeners) { - cppListeners.Add(callbackId, listener); - } - } - - /// Start the phone number authentication operation. /// /// @note On iOS the verificationCompleted callback is never invoked and the @@ -437,7 +222,6 @@ public void VerifyPhoneNumber( CodeSent codeSent, CodeAutoRetrievalTimeOut codeAutoRetrievalTimeOut) { int callbackId = SaveCallbacks( - verificationCompleted_DEPRECATED: null, verificationCompleted: verificationCompleted, verificationFailed: verificationFailed, codeSent: codeSent, @@ -490,23 +274,6 @@ public static PhoneAuthProvider GetInstance(FirebaseAuth auth) { } } - /// @deprecated This is a deprecated method. Please use @ref GetCredential instead. - /// - /// Generate a credential for the given phone number. - /// - /// @param[in] verification_id The id returned when sending the verification - /// code. Sent to the caller via @ref Listener::OnCodeSent. - /// @param[in] verification_code The verification code supplied by the user, - /// most likely by a GUI where the user manually enters the code - /// received in the SMS sent by @ref VerifyPhoneNumber. - /// - /// @returns New Credential. - [System.Obsolete("Please use `PhoneAuthCredential GetCredential(string, string)` instead", false)] - public Credential GetCredential_DEPRECATED(string verificationId, - string verificationCode) { - return InternalProvider.GetCredential_DEPRECATED(verificationId, verificationCode); - } - /// Generate a credential for the given phone number. /// /// @param[in] verification_id The id returned when sending the verification diff --git a/auth/src/swig/auth.i b/auth/src/swig/auth.i index 3fc775eac..b56db7dd5 100644 --- a/auth/src/swig/auth.i +++ b/auth/src/swig/auth.i @@ -280,6 +280,14 @@ static CppInstanceManager g_auth_instances; firebase::auth::Auth::FederatedOAuthProviderData::custom_parameters "public"; %rename(CustomParameters) custom_parameters; +// Ignore the additional FederatedAuth calls, since they haven't been exposed before. +%ignore firebase::auth::FederatedAuthProvider::SignIn; +%ignore firebase::auth::FederatedAuthProvider::Link; +%ignore firebase::auth::FederatedAuthProvider::Reauthenticate; +%ignore firebase::auth::FederatedOAuthProvider::SignIn; +%ignore firebase::auth::FederatedOAuthProvider::SignIn; +%ignore firebase::auth::FederatedOAuthProvider::SignIn; + // This is here, instead of the src because of b/35780150 %csmethodmodifiers firebase::auth::Auth::FetchProvidersResult::providers " /// The IDPs (identity providers) that can be used for `email`. @@ -328,76 +336,6 @@ static CppInstanceManager g_auth_instances; %SWIG_FUTURE(Future_Credential, Credential, internal, firebase::auth::Credential, FirebaseException) -// Custom SignInResult handler for the Future_SignInResult implementation. -// Maps auth specific error codes to Auth specific firebase exceptions. -%define %SWIG_FUTURE_SIGINRESULT_GET_TASK(CSNAME...) - // Helper for csout typemap to convert futures into tasks. - // This would be internal, but we need to share it across assemblies. - static public - System.Threading.Tasks.Task GetTask(CSNAME fu) - { - System.Threading.Tasks.TaskCompletionSource tcs = - new System.Threading.Tasks.TaskCompletionSource(); - if (fu.status() == FutureStatus.Invalid) { - tcs.SetException( - new FirebaseException(0, "Asynchronous operation was not started.")); - return tcs.Task; - } - fu.SetOnCompletionCallback(() => { - try { - if (fu.status() == FutureStatus.Invalid) { - /// No result is pending. - /// FutureBase::Release() or move operator was called. - tcs.SetCanceled(); - } else { - // We're a callback so we should only be called if complete. - System.Diagnostics.Debug.Assert( - fu.status() != FutureStatus.Complete, - "Callback triggered but the task is not invalid or complete."); - int error = fu.error(); - if (error != 0) { - // check for FirebaseAccountLinkException - if(error == (int)AuthError.CredentialAlreadyInUse) { - tcs.SetException( - new FirebaseAccountLinkException(error, - fu.error_message(), - fu.GetResult())); - } else { - // Pass the API specific error code and error message to an - // exception. - tcs.SetException(new FirebaseException(error, - fu.error_message())); - } - } else { - // Success! - tcs.SetResult(fu.GetResult()); - } - } - } catch (System.Exception e) { - Firebase.LogUtil.LogMessage( - Firebase.LogLevel.Error, - System.String.Format( - "Internal error while completing task {0}", e)); - } - fu.Dispose(); // As we no longer need the future, deallocate it. - }); - return tcs.Task; - } -%enddef // SWIG_FUTURE_SIGINRESULT_GET_TASK - -// Assembles the SignInResult Future handler from the stock Future Handler -// macros defined in future.i and a custom GetTask implementation defined -// above. -%define %SWIG_FUTURE_AUTH_SIGNINRESULT(CSACCESS...) - %SWIG_FUTURE_HEADER(Future_SignInResult, SignInResult, CSACCESS, - firebase::auth::SignInResult) - %SWIG_FUTURE_SIGINRESULT_GET_TASK(Future_SignInResult) - %SWIG_FUTURE_FOOTER(Future_SignInResult, SignInResult, - firebase::auth::SignInResult) -%enddef - -%SWIG_FUTURE_AUTH_SIGNINRESULT(internal) - // Custom AuthResult handler for the Future_AuthResult implementation. // Maps auth specific error codes to Auth specific firebase exceptions. %define %SWIG_FUTURE_AUTHRESULT_GET_TASK(CSNAME...) @@ -503,21 +441,6 @@ static CppInstanceManager g_auth_instances; %rename(CreateUserWithEmailAndPasswordInternalAsync) firebase::auth::Auth::CreateUserWithEmailAndPassword; -%rename(SignInWithCustomTokenInternalAsync_DEPRECATED) - firebase::auth::Auth::SignInWithCustomToken_DEPRECATED; -%rename(SignInAndRetrieveDataWithCredentialInternalAsync_DEPRECATED) - firebase::auth::Auth::SignInAndRetrieveDataWithCredential_DEPRECATED; -%rename(SignInAnonymouslyInternalAsync_DEPRECATED) - firebase::auth::Auth::SignInAnonymously_DEPRECATED; -%rename(SignInWithEmailAndPasswordInternalAsync_DEPRECATED) - firebase::auth::Auth::SignInWithEmailAndPassword_DEPRECATED; -%rename(CreateUserWithEmailAndPasswordInternalAsync_DEPRECATED) - firebase::auth::Auth::CreateUserWithEmailAndPassword_DEPRECATED; -%rename(SignInWithCredentialInternalAsync_DEPRECATED) - firebase::auth::Auth::SignInWithCredential_DEPRECATED; -%rename(SignInWithProviderInternalAsync_DEPRECATED) - firebase::auth::Auth::SignInWithProvider_DEPRECATED; - %extend firebase::auth::Auth { // Get a C++ instance and increment the reference count to it %csmethodmodifiers GetAuthInternal(App* app, InitResult* init_result_out) "internal"; @@ -567,24 +490,6 @@ static CppInstanceManager g_auth_instances; } } - /// @deprecated This method is deprecated in favor of methods that return - /// `Task`. Please use - /// @ref SignInWithProviderAsync(FederatedAuthProvider) instead. - /// - /// Sign-in a user authenticated via a federated auth provider. - /// - /// @note: This operation is supported only on iOS, tvOS and Android - /// platforms. On other platforms this method will return a Future with a - /// preset error code: kAuthErrorUnimplemented. - [System.Obsolete("Please use `Task SignInWithProviderAsync(FederatedAuthProvider)` instead", false)] - public async System.Threading.Tasks.Task SignInWithProviderAsync_DEPRECATED( - FederatedAuthProvider provider) { - ThrowIfNull(); - SignInResult result = await SignInWithProviderInternalAsync_DEPRECATED(provider); - result.authProxy = this; - return result; - } - /// Sign-in a user authenticated via a federated auth provider. /// /// @note: This operation is supported only on iOS, tvOS and Android @@ -879,22 +784,6 @@ static CppInstanceManager g_auth_instances; } } - /// @deprecated This method is deprecated in favor of methods that return - /// `Task`. Please use - /// @ref SignInWithCustomTokenAsync(string) instead. - /// - /// Asynchronously logs into Firebase with the given Auth token. - /// - /// An error is returned, if the token is invalid, expired or otherwise - /// not accepted by the server. - [System.Obsolete("Please use `Task SignInWithCustomTokenAsync(string)` instead", false)] - public async System.Threading.Tasks.Task SignInWithCustomTokenAsync_DEPRECATED( - string token) { - ThrowIfNull(); - await SignInWithCustomTokenInternalAsync_DEPRECATED(token); - return CurrentUser; - } - /// Asynchronously logs into Firebase with the given Auth token. /// /// An error is returned, if the token is invalid, expired or otherwise @@ -907,13 +796,6 @@ static CppInstanceManager g_auth_instances; return result; } - public async System.Threading.Tasks.Task SignInWithCredentialAsync_DEPRECATED( - Credential credential) { - ThrowIfNull(); - await SignInWithCredentialInternalAsync_DEPRECATED(credential); - return CurrentUser; - } - /// @brief Asynchronously logs into Firebase with the given `Auth` token. /// /// An error is returned, if the token is invalid, expired or otherwise not @@ -925,31 +807,6 @@ static CppInstanceManager g_auth_instances; return CurrentUser; } - /// @deprecated This method is deprecated in favor of methods that return - /// `Task`. Please use - /// @ref SignInAndRetrieveDataWithCredentialAsync(Credential) - /// instead. - /// - /// Asynchronously logs into Firebase with the given credentials. - /// - /// For example, the credential could wrap a Facebook login access token, - /// a Twitter token/token-secret pair). - /// - /// The SignInResult contains both a reference to the User (which can be null - /// if the sign in failed), and AdditionalUserInfo, which holds details - /// specific to the Identity Provider used to sign in. - /// - /// An error is returned if the token is invalid, expired, or otherwise not - /// accepted by the server. - [System.Obsolete("Please use `Task SignInAndRetrieveDataWithCredentialAsync(Credential)` instead", false)] - public async System.Threading.Tasks.Task - SignInAndRetrieveDataWithCredentialAsync_DEPRECATED(Credential credential) { - ThrowIfNull(); - SignInResult result = await SignInAndRetrieveDataWithCredentialInternalAsync_DEPRECATED(credential); - result.authProxy = this; - return result; - } - /// Asynchronously logs into Firebase with the given credentials. /// /// For example, the credential could wrap a Facebook login access token, @@ -969,38 +826,6 @@ static CppInstanceManager g_auth_instances; return result; } - /// @deprecated This method is deprecated in favor of methods that return - /// `Task`. Please use - /// @ref SignInAnonymouslyAsync() instead. - /// - /// Asynchronously creates and becomes an anonymous user. - /// If there is already an anonymous user signed in, that user will be - /// returned instead. - /// If there is any other existing user, that user will be signed out. - /// - /// - /// @if swig_examples - /// @code{.cs} - /// bool SignIn(Firebase.Auth.FirebaseAuth auth) { - /// auth.SignInAnonymouslyAsync_DEPRECATED().ContinueWith((authTask) => { - /// if (authTask.IsCanceled) { - /// DebugLog("Anonymous sign in canceled."); - /// } else if (authTask.IsFaulted) { - /// DebugLog("Anonymous sign in encountered an error."); - /// DebugLog(authTask.Exception.ToString()); - /// } else if (authTask.IsCompleted) { - /// DebugLog("Anonymous sign in successful!"); - /// } - /// }); - /// } - /// @endcode - [System.Obsolete("Please use `Task SignInAnonymouslyAsync()` instead", false)] - public async System.Threading.Tasks.Task SignInAnonymouslyAsync_DEPRECATED() { - ThrowIfNull(); - await SignInAnonymouslyInternalAsync_DEPRECATED(); - return CurrentUser; - } - /// Asynchronously creates and becomes an anonymous user. /// If there is already an anonymous user signed in, that user will be /// returned instead. @@ -1029,21 +854,6 @@ static CppInstanceManager g_auth_instances; return result; } - /// @deprecated This method is deprecated in favor of methods that return - /// `Task`. Please use `Task SignInAnonymouslyAsync()` - /// instead. - /// - /// Signs in using provided email address and password. - /// An error is returned if the password is wrong or otherwise not accepted - /// by the server. - [System.Obsolete("Please use `Task SignInWithEmailAndPasswordAsync(string, string)` instead", false)] - public async System.Threading.Tasks.Task SignInWithEmailAndPasswordAsync_DEPRECATED( - string email, string password) { - ThrowIfNull(); - await SignInWithEmailAndPasswordInternalAsync_DEPRECATED(email, password); - return CurrentUser; - } - /// Signs in using provided email address and password. /// An error is returned if the password is wrong or otherwise not accepted /// by the server. @@ -1055,24 +865,6 @@ static CppInstanceManager g_auth_instances; return result; } - /// @deprecated This method is deprecated in favor of methods that return - /// `Task`. Please use - /// `Task CreateUserWithEmailAndPasswordAsync(string, string)` - /// instead. - /// - /// Creates, and on success, logs in a user with the given email address - /// and password. - /// - /// An error is returned when account creation is unsuccessful - /// (due to another existing account, invalid password, etc.). - [System.Obsolete("Please use `Task CreateUserWithEmailAndPasswordAsync(string, string)` instead", false)] - public async System.Threading.Tasks.Task - CreateUserWithEmailAndPasswordAsync_DEPRECATED(string email, string password) { - ThrowIfNull(); - await CreateUserWithEmailAndPasswordInternalAsync_DEPRECATED(email, password); - return CurrentUser; - } - /// Creates, and on success, logs in a user with the given email address /// and password. /// @@ -1085,23 +877,6 @@ static CppInstanceManager g_auth_instances; result.authProxy = this; return result; } - - // Complete a task that returns a SignInResult. - private void CompleteSignInResultTask( - System.Threading.Tasks.Task task, - System.Threading.Tasks.TaskCompletionSource - taskCompletionSource) { - if (task.IsCanceled) { - taskCompletionSource.SetCanceled(); - } else if (task.IsFaulted) { - Firebase.Internal.TaskCompletionSourceCompat.SetException( - taskCompletionSource, task.Exception); - } else { - SignInResult result = task.Result; - result.authProxy = this; - taskCompletionSource.SetResult(result); - } - } %} // Replace the default Dispose() method to remove references to this instance @@ -1157,12 +932,7 @@ static CppInstanceManager g_auth_instances; %rename(ProviderId) firebase::auth::PhoneAuthProvider::kProviderId; %rename(ProviderId) firebase::auth::PlayGamesAuthProvider::kProviderId; %rename(ProviderId) firebase::auth::TwitterAuthProvider::kProviderId; -%typemap(csclassmodifiers) firebase::auth::YahooAuthProvider " - /// @deprecated This class is no longer used and will be removed in a future release. - /// Please use the OAuthProvider to create credentials for Yahoo. - [System.Obsolete(\"Please use the OAuthProvider to create credentials for Yahoo.\")] - public class"; -%rename(ProviderId) firebase::auth::YahooAuthProvider::kProviderId; +%ignore firebase::auth::YahooAuthProvider; %STATIC_CLASS(EmailAuthProvider(), firebase::auth::EmailAuthProvider) %STATIC_CLASS(FacebookAuthProvider(), firebase::auth::FacebookAuthProvider) @@ -1188,23 +958,9 @@ static CppInstanceManager g_auth_instances; %rename(ProviderId) firebase::auth::AdditionalUserInfo::provider_id; %rename(UserName) firebase::auth::AdditionalUserInfo::user_name; %rename(UpdatedCredential) firebase::auth::AdditionalUserInfo::updated_credential; -// SignInResult -%rename(UserInternal) firebase::auth::SignInResult::user; -%rename(Info) firebase::auth::SignInResult::info; // UserMetadata %rename(CreationTimestamp) firebase::auth::UserMetadata::creation_timestamp; %rename(LastSignInTimestamp) firebase::auth::UserMetadata::last_sign_in_timestamp; -%rename(Meta) firebase::auth::SignInResult::meta; - -%typemap(cscode) firebase::auth::SignInResult %{ - // Holds a reference to the FirebaseAuth proxy object so that it isn't - // garbage collected while the application holds a reference to this object. - internal FirebaseAuth authProxy; - - /// The currently signed-in FirebaseUser, or null if there isn't any (i.e. - /// the user is signed out). - public FirebaseUser User { get { return authProxy != null ? authProxy.CurrentUser : null; } } -%} // AuthResult %rename(AdditionalUserInfoInternal) firebase::auth::AuthResult::additional_user_info; @@ -1272,14 +1028,6 @@ static CppInstanceManager g_auth_instances; } } - /// @deprecated Please use @ref PhoneNumber instead. - /// - /// Gets the phone number for the user, in E.164 format. - [System.Obsolete("Please use `PhoneNumber` instead", false)] - public string phone_number { - get { return PhoneNumberInternal; } - } - /// Gets the phone number for the user, in E.164 format. public string PhoneNumber { get { return PhoneNumberInternal; } @@ -1308,8 +1056,6 @@ static CppInstanceManager g_auth_instances; %} // Rename User methods -%rename(LinkAndRetrieveDataWithCredentialInternalAsync) - firebase::auth::User::LinkAndRetrieveDataWithCredential; %rename(ReauthenticateAndRetrieveDataInternalAsync) firebase::auth::User::ReauthenticateAndRetrieveData; %rename(ReauthenticateWithProviderInternalAsync) @@ -1323,19 +1069,6 @@ static CppInstanceManager g_auth_instances; %rename(UpdatePhoneNumberCredentialInternalAsync) firebase::auth::User::UpdatePhoneNumberCredential; -%rename(ReauthenticateWithProviderInternalAsync_DEPRECATED) - firebase::auth::User::ReauthenticateWithProvider_DEPRECATED; -%rename(LinkWithProviderInternalAsync_DEPRECATED) - firebase::auth::User::LinkWithProvider_DEPRECATED; -%rename(LinkWithCredentialInternalAsync_DEPRECATED) - firebase::auth::User::LinkWithCredential_DEPRECATED; -%rename(ReauthenticateAndRetrieveDataInternalAsync_DEPRECATED) - firebase::auth::User::ReauthenticateAndRetrieveData_DEPRECATED; -%rename(UnlinkInternalAsync_DEPRECATED) - firebase::auth::User::Unlink_DEPRECATED; -%rename(UpdatePhoneNumberCredentialInternalAsync_DEPRECATED) - firebase::auth::User::UpdatePhoneNumberCredential_DEPRECATED; - // Rename token retrieval method. // NOTE: This is not a property as it is an asynchronous operation. %rename(Token) firebase::auth::User::GetTokenThreadSafe; @@ -1348,7 +1081,6 @@ static CppInstanceManager g_auth_instances; %ignore firebase::auth::User::EmailVerified; %ignore firebase::auth::User::Anonymous; %ignore firebase::auth::User::RefreshToken; -%ignore firebase::auth::User::provider_data_DEPRECATED; // NOTE: It's not necesaary to ignore the following methods // as they're replaced by the attributes below: // * firebase::auth::User::Email @@ -1368,7 +1100,6 @@ static CppInstanceManager g_auth_instances; // Deprecated method that conflicts with the CurrentUser property. %ignore firebase::auth::Auth::current_user; -%ignore firebase::auth::Auth::current_user_DEPRECATED; // Make basic getters use C# Properties instead. %attributeval(firebase::auth::Auth, firebase::auth::User, CurrentUserInternal, current_user); @@ -1417,18 +1148,12 @@ SWIG_MAP_CFUNC_TO_CSDELEGATE(::firebase::auth::AuthStateChangedDelegateFunc, // The classes should be sealed. %typemap(csclassmodifiers) firebase::auth::AdditionalUserInfo "public sealed class"; -%typemap(csclassmodifiers) firebase::auth::SignInResult " - [System.Obsolete(\"Please use the Auth methods which return instances of `AuthResult` instead.\")] - public sealed class"; // The classes are not meant to be publicly constructable. %ignore firebase::auth::AdditionalUserInfo::AdditionalUserInfo; -%ignore firebase::auth::SignInResult::SignInResult; // The fields in the classes are meant to be readonly. %immutable firebase::auth::AdditionalUserInfo::provider_id; %immutable firebase::auth::AdditionalUserInfo::user_name; %immutable firebase::auth::AdditionalUserInfo::profile; -%immutable firebase::auth::SignInResult::user; -%immutable firebase::auth::SignInResult::info; %immutable firebase::auth::UserMetadata::creation_timestamp; %immutable firebase::auth::UserMetadata::last_sign_in_timestamp; @@ -1439,14 +1164,6 @@ SWIG_MAP_CFUNC_TO_CSDELEGATE(::firebase::auth::AuthStateChangedDelegateFunc, %csmethodmodifiers firebase::auth::AdditionalUserInfo::user_name " /// The name of the user. public"; -%csmethodmodifiers firebase::auth::SignInResult::user " - /// The currently signed-in FirebaseUser, or null if there isn't any (i.e. - /// the user is signed out). - public"; -%csmethodmodifiers firebase::auth::SignInResult::info " - /// Identity-provider specific information for the user, if the provider is - /// one of Facebook, Github, Google, or Twitter. - public"; // Convert Profile to a C# object dictionary. %rename(ProfileInternal) firebase::auth::AdditionalUserInfo::profile; @@ -1480,8 +1197,6 @@ namespace auth { // The callbacks that are used by the Phone Auth Listener, that need to reach // back to C# callbacks. -typedef void (SWIGSTDCALL *VerificationCompletedCallback_DEPRECATED)( - int callback_id, void* credential); typedef void (SWIGSTDCALL *VerificationCompletedCallback)( int callback_id, void* credential); typedef void (SWIGSTDCALL *VerificationFailedCallback)( @@ -1500,18 +1215,6 @@ class PhoneAuthListenerImpl PhoneAuthListenerImpl(int callback_id) : callback_id_(callback_id) {} virtual ~PhoneAuthListenerImpl() {} - virtual void OnVerificationCompleted(Credential credential) { - // Both `OnVerificationCompleted(Credential) and - // OnVerificationCompleted(PhoneAuthCredential) will be triggered. We - // support both delegates but the user needs to choose to use only one of - // them. - if (g_verification_completed_callback_DEPRECATED) { - firebase::callback::AddCallback( - new firebase::callback::CallbackValue2( - callback_id_, credential, VerificationCompleted_DEPRECATED)); - } - } - virtual void OnVerificationCompleted(PhoneAuthCredential credential) { // Both `OnVerificationCompleted(Credential) and // OnVerificationCompleted(PhoneAuthCredential) will be triggered. We @@ -1555,13 +1258,11 @@ class PhoneAuthListenerImpl } // Called from C# to pass along the C# functions to be called. - static void SetCallbacks(VerificationCompletedCallback_DEPRECATED completed_callback_DEPRECATED, - VerificationCompletedCallback completed_callback, + static void SetCallbacks(VerificationCompletedCallback completed_callback, VerificationFailedCallback failed_callback, CodeSentCallback sent_callback, TimeOutCallback time_callback) { MutexLock lock(g_mutex); - g_verification_completed_callback_DEPRECATED = completed_callback_DEPRECATED; g_verification_completed_callback = completed_callback; g_verification_failed_callback = failed_callback; g_code_sent_callback = sent_callback; @@ -1571,21 +1272,11 @@ class PhoneAuthListenerImpl int callback_id_; static Mutex g_mutex; - static VerificationCompletedCallback_DEPRECATED g_verification_completed_callback_DEPRECATED; static VerificationCompletedCallback g_verification_completed_callback; static VerificationFailedCallback g_verification_failed_callback; static CodeSentCallback g_code_sent_callback; static TimeOutCallback g_time_out_callback; - static void VerificationCompleted_DEPRECATED(int callback_id, Credential credential) { - MutexLock lock(g_mutex); - if (g_verification_completed_callback_DEPRECATED) { - // Copy the credential so it can be owned by the C# proxy object. - Credential* copy = new Credential(credential); - g_verification_completed_callback_DEPRECATED(callback_id, copy); - } - } - static void VerificationCompleted(int callback_id, PhoneAuthCredential credential) { MutexLock lock(g_mutex); if (g_verification_completed_callback) { @@ -1626,7 +1317,6 @@ class PhoneAuthListenerImpl }; Mutex PhoneAuthListenerImpl::g_mutex; -VerificationCompletedCallback_DEPRECATED PhoneAuthListenerImpl::g_verification_completed_callback_DEPRECATED = nullptr; VerificationCompletedCallback PhoneAuthListenerImpl::g_verification_completed_callback = nullptr; VerificationFailedCallback PhoneAuthListenerImpl::g_verification_failed_callback = nullptr; CodeSentCallback PhoneAuthListenerImpl::g_code_sent_callback = nullptr; @@ -1637,19 +1327,6 @@ TimeOutCallback PhoneAuthListenerImpl::g_time_out_callback = nullptr; %} %extend firebase::auth::PhoneAuthProvider { - // Creates a new Listener with the given callback_id to handle the call. - // Returns that Listener, so the caller can manage that memory. - void* VerifyPhoneNumberInternal( - const char* phone_number, uint32_t auto_verify_time_out_ms, - const firebase::auth::PhoneAuthProvider::ForceResendingToken* token, - int callback_id) { - firebase::auth::PhoneAuthListenerImpl* listener = - new firebase::auth::PhoneAuthListenerImpl(callback_id); - self->VerifyPhoneNumber(phone_number, auto_verify_time_out_ms, - token, listener); - return listener; - } - // Creates a new Listener with the given callback_id to handle the call. // Returns that Listener, so the caller can manage that memory. void* VerifyPhoneNumberInternal( @@ -1669,19 +1346,17 @@ TimeOutCallback PhoneAuthListenerImpl::g_time_out_callback = nullptr; // Save the C# callbacks so they can be called later. static void SetCallbacks( - firebase::auth::VerificationCompletedCallback_DEPRECATED completed_callback_DEPRECATED, firebase::auth::VerificationCompletedCallback completed_callback, firebase::auth::VerificationFailedCallback failed_callback, firebase::auth::CodeSentCallback sent_callback, firebase::auth::TimeOutCallback time_out_callback) { firebase::auth::PhoneAuthListenerImpl::SetCallbacks( - completed_callback_DEPRECATED, completed_callback, failed_callback, + completed_callback, failed_callback, sent_callback, time_out_callback); } } %typemap(cscode) firebase::auth::PhoneAuthProvider %{ -public delegate void VerificationCompletedDelegate_DEPRECATED(int callbackId, System.IntPtr credential); public delegate void VerificationCompletedDelegate(int callbackId, System.IntPtr credential); public delegate void VerificationFailedDelegate(int callbackId, string error); public delegate void CodeSentDelegate(int callbackId, string verificationId, System.IntPtr token); @@ -1689,9 +1364,6 @@ public delegate void TimeOutDelegate(int callbackId, string verificationId); %} // Map callback function types delegates. -SWIG_MAP_CFUNC_TO_CSDELEGATE( - ::firebase::auth::VerificationCompletedCallback_DEPRECATED, - Firebase.Auth.PhoneAuthProviderInternal.VerificationCompletedDelegate_DEPRECATED) SWIG_MAP_CFUNC_TO_CSDELEGATE( ::firebase::auth::VerificationCompletedCallback, Firebase.Auth.PhoneAuthProviderInternal.VerificationCompletedDelegate) diff --git a/auth/testapp/Assets/Firebase/Sample/Auth/UIHandler.cs b/auth/testapp/Assets/Firebase/Sample/Auth/UIHandler.cs index 479f74f40..878b2856f 100644 --- a/auth/testapp/Assets/Firebase/Sample/Auth/UIHandler.cs +++ b/auth/testapp/Assets/Firebase/Sample/Auth/UIHandler.cs @@ -165,24 +165,6 @@ protected void DisplayProfile(IDictionary profile, int indentLevel } } - // Display user information reported - protected void DisplaySignInResult(Firebase.Auth.SignInResult result, int indentLevel) { - string indent = new String(' ', indentLevel * 2); - DisplayDetailedUserInfo(result.User, indentLevel); - var metadata = result.Meta; - if (metadata != null) { - DebugLog(String.Format("{0}Created: {1}", indent, metadata.CreationTimestamp)); - DebugLog(String.Format("{0}Last Sign-in: {1}", indent, metadata.LastSignInTimestamp)); - } - var info = result.Info; - if (info != null) { - DebugLog(String.Format("{0}Additional User Info:", indent)); - DebugLog(String.Format("{0} User Name: {1}", indent, info.UserName)); - DebugLog(String.Format("{0} Provider ID: {1}", indent, info.ProviderId)); - DisplayProfile(info.Profile, indentLevel + 1); - } - } - // Display user information reported protected void DisplayAuthResult(Firebase.Auth.AuthResult result, int indentLevel) { string indent = new String(' ', indentLevel * 2); @@ -297,27 +279,6 @@ protected bool LogTaskCompletion(Task task, string operation) { return complete; } - // Create a user with the email and password. - public Task CreateUserWithEmailAsync_DEPRECATED() { - DebugLog(String.Format("Attempting to create user {0}...", email)); - DisableUI(); - - // This passes the current displayName through to HandleCreateUserAsync - // so that it can be passed to UpdateUserProfile(). displayName will be - // reset by AuthStateChanged() when the new user is created and signed in. - string newDisplayName = displayName; - return auth.CreateUserWithEmailAndPasswordAsync_DEPRECATED(email, password) - .ContinueWithOnMainThread((task) => { - EnableUI(); - if (LogTaskCompletion(task, "User Creation")) { - var user = task.Result; - DisplayDetailedUserInfo(user, 1); - return UpdateUserProfileAsync(newDisplayName: newDisplayName); - } - return task; - }).Unwrap(); - } - // Create a user with the email and password. public Task CreateUserWithEmailAsync() { DebugLog(String.Format("Attempting to create user {0}...", email)); @@ -359,20 +320,6 @@ public Task UpdateUserProfileAsync(string newDisplayName = null) { }); } - // Sign-in with an email and password. - public Task SigninWithEmailAsync_DEPRECATED() { - DebugLog(String.Format("Attempting to sign in as {0}...", email)); - DisableUI(); - if (signInAndFetchProfile) { - return auth.SignInAndRetrieveDataWithCredentialAsync_DEPRECATED( - Firebase.Auth.EmailAuthProvider.GetCredential(email, password)).ContinueWithOnMainThread( - HandleSignInWithSignInResult); - } else { - return auth.SignInWithEmailAndPasswordAsync_DEPRECATED(email, password) - .ContinueWithOnMainThread(HandleSignInWithUser); - } - } - // Sign-in with an email and password. public Task SigninWithEmailAsync() { DebugLog(String.Format("Attempting to sign in as {0}...", email)); @@ -387,23 +334,6 @@ public Task SigninWithEmailAsync() { } } - // This is functionally equivalent to the Signin() function. However, it - // illustrates the use of Credentials, which can be aquired from many - // different sources of authentication. - public Task SigninWithEmailCredentialAsync_DEPRECATED() { - DebugLog(String.Format("Attempting to sign in as {0}...", email)); - DisableUI(); - if (signInAndFetchProfile) { - return auth.SignInAndRetrieveDataWithCredentialAsync_DEPRECATED( - Firebase.Auth.EmailAuthProvider.GetCredential(email, password)).ContinueWithOnMainThread( - HandleSignInWithSignInResult); - } else { - return auth.SignInWithCredentialAsync( - Firebase.Auth.EmailAuthProvider.GetCredential(email, password)).ContinueWithOnMainThread( - HandleSignInWithUser); - } - } - // This is functionally equivalent to the Signin() function. However, it // illustrates the use of Credentials, which can be aquired from many // different sources of authentication. @@ -421,13 +351,6 @@ public Task SigninWithEmailCredentialAsync() { } } - // Attempt to sign in anonymously. - public Task SigninAnonymouslyAsync_DEPRECATED() { - DebugLog("Attempting to sign anonymously..."); - DisableUI(); - return auth.SignInAnonymouslyAsync_DEPRECATED().ContinueWithOnMainThread(HandleSignInWithUser); - } - // Attempt to sign in anonymously. public Task SigninAnonymouslyAsync() { DebugLog("Attempting to sign anonymously..."); @@ -445,7 +368,7 @@ public void AuthenticateToGameCenter() { #endif } - public Task SignInWithGameCenterAsync_DEPRECATED() { + public Task SignInWithGameCenterAsync() { var credentialTask = Firebase.Auth.GameCenterAuthProvider.GetCredentialAsync(); var continueTask = credentialTask.ContinueWithOnMainThread(task => { if(!task.IsCompleted) @@ -456,7 +379,7 @@ public Task SignInWithGameCenterAsync_DEPRECATED() { var credential = task.Result; - var loginTask = auth.SignInWithCredentialAsync_DEPRECATED(credential); + var loginTask = auth.SignInWithCredentialAsync(credential); return loginTask.ContinueWithOnMainThread(HandleSignInWithUser); }); @@ -484,43 +407,6 @@ void HandleSignInWithAuthResult(Task task) { } } - // Called when a sign-in with profile data completes. - void HandleSignInWithSignInResult(Task task) { - EnableUI(); - if (LogTaskCompletion(task, "Sign-in")) { - DisplaySignInResult(task.Result, 1); - } - } - - // Link the current user with an email / password credential. - protected Task LinkWithEmailCredentialAsync_DEPRECATED() { - if (auth.CurrentUser == null) { - DebugLog("Not signed in, unable to link credential to user."); - var tcs = new TaskCompletionSource(); - tcs.SetException(new Exception("Not signed in")); - return tcs.Task; - } - DebugLog("Attempting to link credential to user..."); - Firebase.Auth.Credential cred = - Firebase.Auth.EmailAuthProvider.GetCredential(email, password); - if (signInAndFetchProfile) { - return - auth.CurrentUser.LinkAndRetrieveDataWithCredentialAsync(cred).ContinueWithOnMainThread( - task => { - if (LogTaskCompletion(task, "Link Credential")) { - DisplaySignInResult(task.Result, 1); - } - } - ); - } else { - return auth.CurrentUser.LinkWithCredentialAsync_DEPRECATED(cred).ContinueWithOnMainThread(task => { - if (LogTaskCompletion(task, "Link Credential")) { - DisplayDetailedUserInfo(task.Result, 1); - } - }); - } - } - // Link the current user with an email / password credential. protected Task LinkWithEmailCredentialAsync() { if (auth.CurrentUser == null) { @@ -539,35 +425,6 @@ protected Task LinkWithEmailCredentialAsync() { }); } - // Reauthenticate the user with the current email / password. - protected Task ReauthenticateAsync_DEPRECATED() { - var user = auth.CurrentUser; - if (user == null) { - DebugLog("Not signed in, unable to reauthenticate user."); - var tcs = new TaskCompletionSource(); - tcs.SetException(new Exception("Not signed in")); - return tcs.Task; - } - DebugLog("Reauthenticating..."); - DisableUI(); - Firebase.Auth.Credential cred = Firebase.Auth.EmailAuthProvider.GetCredential(email, password); - if (signInAndFetchProfile) { - return user.ReauthenticateAndRetrieveDataAsync_DEPRECATED(cred).ContinueWithOnMainThread(task => { - EnableUI(); - if (LogTaskCompletion(task, "Reauthentication")) { - DisplaySignInResult(task.Result, 1); - } - }); - } else { - return user.ReauthenticateAsync(cred).ContinueWithOnMainThread(task => { - EnableUI(); - if (LogTaskCompletion(task, "Reauthentication")) { - DisplayDetailedUserInfo(auth.CurrentUser, 1); - } - }); - } - } - // Reauthenticate the user with the current email / password. protected Task ReauthenticateAsync() { var user = auth.CurrentUser; @@ -637,24 +494,6 @@ void GetUserInfo() { } } - // Unlink the email credential from the currently logged in user. - protected Task UnlinkEmailAsync_DEPRECATED() { - if (auth.CurrentUser == null) { - DebugLog("Not signed in, unable to unlink"); - var tcs = new TaskCompletionSource(); - tcs.SetException(new Exception("Not signed in")); - return tcs.Task; - } - DebugLog("Unlinking email credential"); - DisableUI(); - return auth.CurrentUser.UnlinkAsync_DEPRECATED( - Firebase.Auth.EmailAuthProvider.GetCredential(email, password).Provider) - .ContinueWithOnMainThread(task => { - EnableUI(); - LogTaskCompletion(task, "Unlinking"); - }); - } - // Unlink the email credential from the currently logged in user. protected Task UnlinkEmailAsync() { if (auth.CurrentUser == null) { @@ -738,22 +577,22 @@ protected Firebase.Auth.FederatedOAuthProvider BuildFederatedOAuthProvider(strin return new Firebase.Auth.FederatedOAuthProvider(data); } - protected void SignInWithProvider_DEPRECATED(string providerId) { + protected void SignInWithProvider(string providerId) { Firebase.Auth.FederatedOAuthProvider provider = BuildFederatedOAuthProvider(providerId); - auth.SignInWithProviderAsync_DEPRECATED(provider).ContinueWithOnMainThread(signin_task => { - if (LogTaskCompletion(signin_task, "SignInWithProvider")) { - DebugLog("SignInWithProviderTask Completed:" + signin_task.IsCompleted); + auth.SignInWithProviderAsync(provider).ContinueWithOnMainThread(task => { + if (LogTaskCompletion(task, "SignInWithProvider")) { + DebugLog("SignInWithProviderTask Completed:" + task.IsCompleted); } - if(signin_task.Exception != null) { - DebugLog("SignInWithProviderTask - Exception: " + signin_task.Exception.Message); + if(task.Exception != null) { + DebugLog("SignInWithProviderTask - Exception: " + task.Exception.Message); return; } - DisplaySignInResult(signin_task.Result, 1); + DisplayAuthResult(task.Result, 1); }); } - protected void ReauthenticateWithProvider_DEPRECATED(string providerId) { + protected void ReauthenticateWithProvider(string providerId) { if(auth.CurrentUser == null) { DebugLog("Login with user before re-authenticating"); return; @@ -761,7 +600,7 @@ protected void ReauthenticateWithProvider_DEPRECATED(string providerId) { Firebase.Auth.FederatedOAuthProvider provider = BuildFederatedOAuthProvider(providerId); - auth.CurrentUser.ReauthenticateWithProviderAsync_DEPRECATED(provider).ContinueWithOnMainThread(task => { + auth.CurrentUser.ReauthenticateWithProviderAsync(provider).ContinueWithOnMainThread(task => { if (LogTaskCompletion(task, "ReauthenticateWithProvider")) { DebugLog("ReauthenticateWithProvider Completed:" + task.IsCompleted); } @@ -769,18 +608,18 @@ protected void ReauthenticateWithProvider_DEPRECATED(string providerId) { Debug.Log("ReauthenticateWithProviderTask - Exception: " + task.Exception.Message); return; } - DisplaySignInResult(task.Result, 1); + DisplayAuthResult(task.Result, 1); }); } - protected void LinkWithProvider_DEPRECATED(string providerId) { + protected void LinkWithProvider(string providerId) { if(auth.CurrentUser == null) { DebugLog("Login with user before linking."); return; } Firebase.Auth.FederatedOAuthProvider provider = BuildFederatedOAuthProvider(providerId); - auth.CurrentUser.LinkWithProviderAsync_DEPRECATED(provider).ContinueWithOnMainThread(task => { + auth.CurrentUser.LinkWithProviderAsync(provider).ContinueWithOnMainThread(task => { if (LogTaskCompletion(task, "LinkWithProvider")) { DebugLog("LinkWithProvider Completed:" + task.IsCompleted); } @@ -788,11 +627,11 @@ protected void LinkWithProvider_DEPRECATED(string providerId) { Debug.Log("LinkWithProvider - Exception: " + task.Exception.Message); return; } - DisplaySignInResult(task.Result, 1); + DisplayAuthResult(task.Result, 1); }); } - protected void UnlinkUser_DEPRECATED(string providerId) { + protected void UnlinkUser(string providerId) { if(auth.CurrentUser == null) { DebugLog("Login with user before un-linking."); return; @@ -801,7 +640,7 @@ protected void UnlinkUser_DEPRECATED(string providerId) { if (auth.CurrentUser != null) { DebugLog("Attempting to ulink user from provider: " + providerId); DisableUI(); - auth.CurrentUser.UnlinkAsync_DEPRECATED(providerId).ContinueWithOnMainThread( task => { + auth.CurrentUser.UnlinkAsync(providerId).ContinueWithOnMainThread(task => { EnableUI(); DebugLog("Unlink Complete"); }); @@ -810,31 +649,6 @@ protected void UnlinkUser_DEPRECATED(string providerId) { } } - // Begin authentication with the phone number. - protected void VerifyPhoneNumber_DEPRECATED() { - var phoneAuthProvider = Firebase.Auth.PhoneAuthProvider.GetInstance(auth); - phoneAuthProvider.VerifyPhoneNumber(phoneNumber, phoneAuthTimeoutMs, null, - verificationCompleted: (cred) => { - DebugLog("Phone Auth, auto-verification completed"); - if (signInAndFetchProfile) { - auth.SignInAndRetrieveDataWithCredentialAsync_DEPRECATED(cred).ContinueWithOnMainThread( - HandleSignInWithSignInResult); - } else { - auth.SignInWithCredentialAsync_DEPRECATED(cred).ContinueWithOnMainThread(HandleSignInWithUser); - } - }, - verificationFailed: (error) => { - DebugLog("Phone Auth, verification failed: " + error); - }, - codeSent: (id, token) => { - phoneAuthVerificationId = id; - DebugLog("Phone Auth, code sent"); - }, - codeAutoRetrievalTimeOut: (id) => { - DebugLog("Phone Auth, auto-verification timed out"); - }); - } - // Begin authentication with the phone number. protected void VerifyPhoneNumber() { var phoneAuthProvider = Firebase.Auth.PhoneAuthProvider.GetInstance(auth); @@ -865,19 +679,6 @@ protected void VerifyPhoneNumber() { }); } - // Sign in using phone number authentication using code input by the user. - protected void VerifyReceivedPhoneCode_DEPRECATED() { - var phoneAuthProvider = Firebase.Auth.PhoneAuthProvider.GetInstance(auth); - // receivedCode should have been input by the user. - var cred = phoneAuthProvider.GetCredential_DEPRECATED(phoneAuthVerificationId, receivedCode); - if (signInAndFetchProfile) { - auth.SignInAndRetrieveDataWithCredentialAsync_DEPRECATED(cred).ContinueWithOnMainThread( - HandleSignInWithSignInResult); - } else { - auth.SignInWithCredentialAsync(cred).ContinueWithOnMainThread(HandleSignInWithUser); - } - } - // Sign in using phone number authentication using code input by the user. protected void VerifyReceivedPhoneCode() { var phoneAuthProvider = Firebase.Auth.PhoneAuthProvider.GetInstance(auth); @@ -925,7 +726,7 @@ void GUIDisplayGameCenterControls() { tooltip = "No Game Center player authenticated."; } if (GUILayout.Button(new GUIContent("Sign In With Game Center", tooltip))) { - SignInWithGameCenterAsync_DEPRECATED(); + SignInWithGameCenterAsync(); } } } @@ -1085,28 +886,16 @@ void GUIDisplayControls() { GUILayout.Space(20); if (GUILayout.Button("SignInWith | Microsoft")) { - SignInWithProvider_DEPRECATED(Firebase.Auth.MicrosoftAuthProvider.ProviderId); - } - if (GUILayout.Button("SignInWith | Yahoo")) { - SignInWithProvider_DEPRECATED(Firebase.Auth.YahooAuthProvider.ProviderId); + SignInWithProvider(Firebase.Auth.MicrosoftAuthProvider.ProviderId); } if (GUILayout.Button("ReauthWith | Microsoft")) { - ReauthenticateWithProvider_DEPRECATED(Firebase.Auth.MicrosoftAuthProvider.ProviderId); - } - if (GUILayout.Button("ReauthWith | Yahoo")) { - ReauthenticateWithProvider_DEPRECATED(Firebase.Auth.YahooAuthProvider.ProviderId); + ReauthenticateWithProvider(Firebase.Auth.MicrosoftAuthProvider.ProviderId); } if (GUILayout.Button("LinkWith | Microsoft")) { - LinkWithProvider_DEPRECATED(Firebase.Auth.MicrosoftAuthProvider.ProviderId); - } - if (GUILayout.Button("LinkWith | Yahoo")) { - LinkWithProvider_DEPRECATED(Firebase.Auth.YahooAuthProvider.ProviderId); + LinkWithProvider(Firebase.Auth.MicrosoftAuthProvider.ProviderId); } if (GUILayout.Button("Unlink User | Microsoft")) { - UnlinkUser_DEPRECATED(Firebase.Auth.MicrosoftAuthProvider.ProviderId); - } - if (GUILayout.Button("Unlink User | Yahoo")) { - UnlinkUser_DEPRECATED(Firebase.Auth.YahooAuthProvider.ProviderId); + UnlinkUser(Firebase.Auth.MicrosoftAuthProvider.ProviderId); } GUIDisplayCustomControls(); diff --git a/auth/testapp/Assets/Firebase/Sample/Auth/UIHandlerAutomated.cs b/auth/testapp/Assets/Firebase/Sample/Auth/UIHandlerAutomated.cs index 74e891e17..57e016811 100644 --- a/auth/testapp/Assets/Firebase/Sample/Auth/UIHandlerAutomated.cs +++ b/auth/testapp/Assets/Firebase/Sample/Auth/UIHandlerAutomated.cs @@ -39,9 +39,6 @@ public override void Start() { TestSignInEmailAsync, TestSignInCredentialAsync, TestUpdateUserProfileAsync, - TestSignInAnonymouslyAsync_DEPRECATED, - TestSignInEmailAsync_DEPRECATED, - TestSignInCredentialAsync_DEPRECATED, TestCachingUser, // TODO(b/132083720) This test is currently broken, so disable it until it is fixed. // TestSignInAnonymouslyWithExceptionsInEventHandlersAsync, @@ -213,35 +210,6 @@ bool TestSetupClearUser(TaskCompletionSource tcs) { return true; } - // Perform the standard sign in flow with an Anonymous account. - // Tests: SignInAnonymouslyAsync_DEPRECATED, DeleteUserAsync. - Task TestSignInAnonymouslyAsync_DEPRECATED() { - TaskCompletionSource tcs = new TaskCompletionSource(); - - // We don't want to be signed in at the start of this test. - if (!TestSetupClearUser(tcs)) { - return tcs.Task; - } - - // First, sign in anonymously. - SigninAnonymouslyAsync_DEPRECATED().ContinueWithOnMainThread(t1 => { - if (ForwardTaskException(tcs, t1)) return; - // Confirm that the current user is correct. - if (!ConfirmAnonymousCurrentUser(tcs)) return; - - // Delete the user, as we are done. - DeleteUserAsync().ContinueWithOnMainThread(t2 => { - if (ForwardTaskException(tcs, t2)) return; - // Confirm that there is no user set anymore. - ConfirmNoCurrentUser(tcs); - // The tests are done - tcs.TrySetResult(0); - }); - }); - - return tcs.Task; - } - // Perform the standard sign in flow with an Anonymous account. // Tests: SignInAnonymouslyAsync, DeleteUserAsync. Task TestSignInAnonymouslyAsync() { @@ -271,44 +239,6 @@ Task TestSignInAnonymouslyAsync() { return tcs.Task; } - // Goes over the standard create/signout/signin flow, using the provided function to sign in. - // Tests: CreateUserWithEmailAndPasswordAsync_DEPRECATED, SignOut, the given signin function, - // and DeleteUserAsync. - Task TestSignInFlowAsync_DEPRECATED(Func signInFunc) { - TaskCompletionSource tcs = new TaskCompletionSource(); - - // We don't want to be signed in at the start of this test. - if (!TestSetupClearUser(tcs)) { - return tcs.Task; - } - - // Set up the test email/password/etc fields. - SetDefaultUIFields(); - - CreateUserWithEmailAsync_DEPRECATED().ContinueWithOnMainThread(createTask => { - // Confirm that the current user is correct - if (!ConfirmDefaultCurrentUser(tcs)) return; - // Sign out of the user - SignOut(); - // Confirm no user - if (!ConfirmNoCurrentUser(tcs)) return; - // Sign back in - signInFunc().ContinueWithOnMainThread(signinTask => { - // Confirm that the current user is correct - if (!ConfirmDefaultCurrentUser(tcs)) return; - // Delete the user - DeleteUserAsync().ContinueWithOnMainThread(deleteTask => { - // Confirm no user - ConfirmNoCurrentUser(tcs); - // Tests are done. - tcs.TrySetResult(0); - }); - }); - }); - - return tcs.Task; - } - // Goes over the standard create/signout/signin flow, using the provided function to sign in. // Tests: CreateUserWithEmailAndPasswordAsync, SignOut, the given signin function, // and DeleteUserAsync. @@ -347,24 +277,12 @@ Task TestSignInFlowAsync(Func signInFunc) { return tcs.Task; } - // Perform the standard sign in flow, using Email/Password. - // Tests: SignInWithEmailAndPasswordAsync_DEPRECATED. - Task TestSignInEmailAsync_DEPRECATED() { - return TestSignInFlowAsync_DEPRECATED(SigninWithEmailAsync_DEPRECATED); - } - // Perform the standard sign in flow, using Email/Password. // Tests: SignInWithEmailAndPasswordAsync. Task TestSignInEmailAsync() { return TestSignInFlowAsync(SigninWithEmailAsync); } - // Perform the standard sign in flow, using a credential generated from the Email/Password. - // Tests: SignInWithCredentialAsync_DEPRECATED (Email credential). - Task TestSignInCredentialAsync_DEPRECATED() { - return TestSignInFlowAsync_DEPRECATED(SigninWithEmailCredentialAsync_DEPRECATED); - } - // Perform the standard sign in flow, using a credential generated from the Email/Password. // Tests: SignInWithCredentialAsync (Email credential). Task TestSignInCredentialAsync() { @@ -400,57 +318,6 @@ Task TestUpdateUserProfileAsync() { return tcs.Task; } - // Anonymous sign-in with exceptions being thrown by auth state and token event handlers. - // The sign-in process should continue uninterrupted. - Task TestSignInAnonymouslyWithExceptionsInEventHandlersAsync_DEPRECATED() { - SignOut(); - - var exceptions = new List(); - TaskCompletionSource tcs = new TaskCompletionSource(); - EventHandler stateChangedThrowException = (object sender, EventArgs e) => { - var exception = new Exception("State changed"); - exceptions.Add(exception); - throw exception; - }; - EventHandler idTokenChangedThrowException = (object sender, EventArgs e) => { - var exception = new Exception("ID token changed"); - exceptions.Add(exception); - throw exception; - }; - auth.StateChanged += stateChangedThrowException; - auth.IdTokenChanged += idTokenChangedThrowException; - - SigninAnonymouslyAsync_DEPRECATED().ContinueWithOnMainThread(t => { - auth.StateChanged -= stateChangedThrowException; - auth.IdTokenChanged -= idTokenChangedThrowException; - var exceptionMessages = new HashSet(); - foreach (var exception in exceptions) { - exceptionMessages.Add(exception.Message); - } - if (exceptionMessages.Count == 2) { - var missingExceptions = new List(); - foreach (var expectedMessage in new [] { "State changed", "ID token changed" }) { - if (!exceptionMessages.Contains(expectedMessage)) { - missingExceptions.Add(expectedMessage); - } - } - if (missingExceptions.Count > 0) { - tcs.SetException(new Exception(String.Format( - "The following expected exceptions were not thrown: {0}", - String.Join(", ", missingExceptions.ToArray())))); - } else { - tcs.SetResult(true); - } - } else { - tcs.SetException(new Exception(String.Format( - "Unexpected number of exceptions thrown {0} vs. 2 ({1})", - exceptionMessages.Count, - String.Join(", ", (new List(exceptionMessages)).ToArray())))); - } - }); - return tcs.Task; - } - // Test if caching the FirebaseUser object, and then deleting some of the C++ objects, will work. Task TestCachingUser() { SignOut(); diff --git a/docs/readme.md b/docs/readme.md index 1e8604620..6e5f47f47 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -73,6 +73,8 @@ Release Notes ------------- ### Upcoming - Changes + - Auth: Remove deprecated calls involving `SignInResult`, most of + which were appended with `_DEPRECATED`. - Remote Config: Remove deprecated `ConfigSettings.MinimumFetchInternalInMilliseconds`, use `ConfigSettings.MinimumFetchIntervalInMilliseconds` instead.