Skip to content

Remove deprecated Auth function from C++ SDK #1767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions auth/src/android/user_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ METHOD_LOOKUP_DEFINITION(tokenresult,
X(IsAnonymous, "isAnonymous", "()Z"), \
X(Token, "getIdToken", "(Z)Lcom/google/android/gms/tasks/Task;"), \
X(ProviderData, "getProviderData", "()Ljava/util/List;"), \
X(UpdateEmail, "updateEmail", "(Ljava/lang/String;)" \
"Lcom/google/android/gms/tasks/Task;"), \
X(VerifyBeforeUpdateEmail, "verifyBeforeUpdateEmail", \
"(Ljava/lang/String;)Lcom/google/android/gms/tasks/Task;"), \
X(UpdatePassword, "updatePassword", "(Ljava/lang/String;)" \
Expand Down Expand Up @@ -353,26 +351,6 @@ std::vector<UserInfoInterface> User::provider_data() const {
return provider_data;
}

Future<void> User::UpdateEmail(const char* email) {
if (!ValidUser(auth_data_)) {
return Future<void>();
}
ReferenceCountedFutureImpl& futures = auth_data_->future_impl;
const auto handle = futures.SafeAlloc<void>(kUserFn_UpdateEmail);
JNIEnv* env = Env(auth_data_);

jstring j_email = env->NewStringUTF(email);
jobject pending_result = env->CallObjectMethod(
UserImpl(auth_data_), user::GetMethodId(user::kUpdateEmail), j_email);
env->DeleteLocalRef(j_email);

if (!CheckAndCompleteFutureOnError(env, &futures, handle)) {
RegisterCallback(pending_result, handle, auth_data_, nullptr);
env->DeleteLocalRef(pending_result);
}
return MakeFuture(&futures, handle);
}

Future<void> User::UpdatePassword(const char* password) {
if (!ValidUser(auth_data_)) {
return Future<void>();
Expand Down
28 changes: 0 additions & 28 deletions auth/src/desktop/user_desktop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -835,34 +835,6 @@ Future<void> User::Reload() {
callback);
}

Future<void> User::UpdateEmail(const char* const email) {
if (auth_data_ == nullptr) { // user is not valid
return Future<void>(); // invalid future
}
Promise<void> promise(&auth_data_->future_impl, kUserFn_UpdateEmail);
if (!ValidateCurrentUser(&promise, auth_data_)) {
return promise.LastResult();
}
if (!ValidateEmail(&promise, email)) {
return promise.LastResult();
}
if (!ValidateCurrentUser(&promise, auth_data_)) {
return promise.LastResult();
}

const char* language_code = nullptr;
auto auth_impl = static_cast<AuthImpl*>(auth_data_->auth_impl);
if (!auth_impl->language_code.empty()) {
language_code = auth_impl->language_code.c_str();
}

typedef SetAccountInfoRequest RequestT;
auto request = RequestT::CreateUpdateEmailRequest(
*auth_data_->app, GetApiKey(*auth_data_), email);
return CallAsyncWithFreshToken(auth_data_, promise, std::move(request),
PerformSetAccountInfoFlow<void>);
}

Future<void> User::UpdatePassword(const char* const password) {
if (auth_data_ == nullptr) { // user is not valid
return Future<void>(); // invalid future
Expand Down
14 changes: 0 additions & 14 deletions auth/src/include/firebase/auth/user.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,6 @@ class User : public UserInfoInterface {
/// </SWIG>
std::vector<UserInfoInterface> provider_data() const;

/// @deprecated This is a deprecated method. Please use
/// SendEmailVerificationBeforeUpdatingEmail(email) instead.
///
/// Sets the email address for the user.
///
/// May fail if there is already an email/password-based account for the same
/// email address.
FIREBASE_DEPRECATED Future<void> UpdateEmail(const char* email);

/// @deprecated
///
/// Get results of the most recent call to UpdateEmail.
FIREBASE_DEPRECATED Future<void> UpdateEmailLastResult() const;

/// Attempts to change the password for the current user.
///
/// For an account linked to an Identity Provider (IDP) with no password,
Expand Down
14 changes: 0 additions & 14 deletions auth/src/ios/user_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,6 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
return provider_data;
}

Future<void> User::UpdateEmail(const char *email) {
if (!ValidUser(auth_data_)) {
return Future<void>();
}
ReferenceCountedFutureImpl &futures = auth_data_->future_impl;
const auto handle = futures.SafeAlloc<void>(kUserFn_UpdateEmail);
[UserImpl(auth_data_) updateEmail:@(email)
completion:^(NSError *_Nullable error) {
futures.Complete(handle, AuthErrorFromNSError(error),
[error.localizedDescription UTF8String]);
}];
return MakeFuture(&futures, handle);
}

Future<void> User::UpdatePassword(const char *password) {
if (!ValidUser(auth_data_)) {
return Future<void>();
Expand Down
1 change: 0 additions & 1 deletion auth/src/user.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ namespace firebase {
namespace auth {

AUTH_RESULT_FN(User, GetToken, std::string)
AUTH_RESULT_FN(User, UpdateEmail, void)
AUTH_RESULT_FN(User, UpdatePassword, void)
AUTH_RESULT_FN(User, LinkWithCredential, AuthResult)
AUTH_RESULT_FN(User, Reauthenticate, void)
Expand Down
1 change: 1 addition & 0 deletions release_build_files/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ code.
## Release Notes
### Upcoming Release
- Changes
- Auth: Removed deprecated `User::UpdateEmail`.
- iOS: Added an option to explicitly specify your app's `AppDelegate` class
name via the `FirebaseAppDelegateClassName` key in `Info.plist`. This
provides a more direct way for Firebase to interact with your specified
Expand Down
Loading