Skip to content

Commit 77491ee

Browse files
Remove deprecated Auth function from C++ SDK
Matching a change made in the Unity SDK, this commit removes: - Auth: `User::UpdateEmail` and `User::UpdateEmailLastResult` Updated the release notes to reflect this change.
1 parent fb725e9 commit 77491ee

File tree

6 files changed

+1
-79
lines changed

6 files changed

+1
-79
lines changed

auth/src/android/user_android.cc

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ METHOD_LOOKUP_DEFINITION(tokenresult,
4141
X(IsAnonymous, "isAnonymous", "()Z"), \
4242
X(Token, "getIdToken", "(Z)Lcom/google/android/gms/tasks/Task;"), \
4343
X(ProviderData, "getProviderData", "()Ljava/util/List;"), \
44-
X(UpdateEmail, "updateEmail", "(Ljava/lang/String;)" \
45-
"Lcom/google/android/gms/tasks/Task;"), \
4644
X(VerifyBeforeUpdateEmail, "verifyBeforeUpdateEmail", \
4745
"(Ljava/lang/String;)Lcom/google/android/gms/tasks/Task;"), \
4846
X(UpdatePassword, "updatePassword", "(Ljava/lang/String;)" \
@@ -353,26 +351,6 @@ std::vector<UserInfoInterface> User::provider_data() const {
353351
return provider_data;
354352
}
355353

356-
Future<void> User::UpdateEmail(const char* email) {
357-
if (!ValidUser(auth_data_)) {
358-
return Future<void>();
359-
}
360-
ReferenceCountedFutureImpl& futures = auth_data_->future_impl;
361-
const auto handle = futures.SafeAlloc<void>(kUserFn_UpdateEmail);
362-
JNIEnv* env = Env(auth_data_);
363-
364-
jstring j_email = env->NewStringUTF(email);
365-
jobject pending_result = env->CallObjectMethod(
366-
UserImpl(auth_data_), user::GetMethodId(user::kUpdateEmail), j_email);
367-
env->DeleteLocalRef(j_email);
368-
369-
if (!CheckAndCompleteFutureOnError(env, &futures, handle)) {
370-
RegisterCallback(pending_result, handle, auth_data_, nullptr);
371-
env->DeleteLocalRef(pending_result);
372-
}
373-
return MakeFuture(&futures, handle);
374-
}
375-
376354
Future<void> User::UpdatePassword(const char* password) {
377355
if (!ValidUser(auth_data_)) {
378356
return Future<void>();

auth/src/desktop/user_desktop.cc

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -835,34 +835,6 @@ Future<void> User::Reload() {
835835
callback);
836836
}
837837

838-
Future<void> User::UpdateEmail(const char* const email) {
839-
if (auth_data_ == nullptr) { // user is not valid
840-
return Future<void>(); // invalid future
841-
}
842-
Promise<void> promise(&auth_data_->future_impl, kUserFn_UpdateEmail);
843-
if (!ValidateCurrentUser(&promise, auth_data_)) {
844-
return promise.LastResult();
845-
}
846-
if (!ValidateEmail(&promise, email)) {
847-
return promise.LastResult();
848-
}
849-
if (!ValidateCurrentUser(&promise, auth_data_)) {
850-
return promise.LastResult();
851-
}
852-
853-
const char* language_code = nullptr;
854-
auto auth_impl = static_cast<AuthImpl*>(auth_data_->auth_impl);
855-
if (!auth_impl->language_code.empty()) {
856-
language_code = auth_impl->language_code.c_str();
857-
}
858-
859-
typedef SetAccountInfoRequest RequestT;
860-
auto request = RequestT::CreateUpdateEmailRequest(
861-
*auth_data_->app, GetApiKey(*auth_data_), email);
862-
return CallAsyncWithFreshToken(auth_data_, promise, std::move(request),
863-
PerformSetAccountInfoFlow<void>);
864-
}
865-
866838
Future<void> User::UpdatePassword(const char* const password) {
867839
if (auth_data_ == nullptr) { // user is not valid
868840
return Future<void>(); // invalid future

auth/src/include/firebase/auth/user.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -229,20 +229,6 @@ class User : public UserInfoInterface {
229229
/// </SWIG>
230230
std::vector<UserInfoInterface> provider_data() const;
231231

232-
/// @deprecated This is a deprecated method. Please use
233-
/// SendEmailVerificationBeforeUpdatingEmail(email) instead.
234-
///
235-
/// Sets the email address for the user.
236-
///
237-
/// May fail if there is already an email/password-based account for the same
238-
/// email address.
239-
FIREBASE_DEPRECATED Future<void> UpdateEmail(const char* email);
240-
241-
/// @deprecated
242-
///
243-
/// Get results of the most recent call to UpdateEmail.
244-
FIREBASE_DEPRECATED Future<void> UpdateEmailLastResult() const;
245-
246232
/// Attempts to change the password for the current user.
247233
///
248234
/// For an account linked to an Identity Provider (IDP) with no password,

auth/src/ios/user_ios.mm

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,6 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
102102
return provider_data;
103103
}
104104

105-
Future<void> User::UpdateEmail(const char *email) {
106-
if (!ValidUser(auth_data_)) {
107-
return Future<void>();
108-
}
109-
ReferenceCountedFutureImpl &futures = auth_data_->future_impl;
110-
const auto handle = futures.SafeAlloc<void>(kUserFn_UpdateEmail);
111-
[UserImpl(auth_data_) updateEmail:@(email)
112-
completion:^(NSError *_Nullable error) {
113-
futures.Complete(handle, AuthErrorFromNSError(error),
114-
[error.localizedDescription UTF8String]);
115-
}];
116-
return MakeFuture(&futures, handle);
117-
}
118-
119105
Future<void> User::UpdatePassword(const char *password) {
120106
if (!ValidUser(auth_data_)) {
121107
return Future<void>();

auth/src/user.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ namespace firebase {
2020
namespace auth {
2121

2222
AUTH_RESULT_FN(User, GetToken, std::string)
23-
AUTH_RESULT_FN(User, UpdateEmail, void)
2423
AUTH_RESULT_FN(User, UpdatePassword, void)
2524
AUTH_RESULT_FN(User, LinkWithCredential, AuthResult)
2625
AUTH_RESULT_FN(User, Reauthenticate, void)

release_build_files/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ code.
677677
## Release Notes
678678
### Upcoming Release
679679
- Changes
680+
- Auth: Removed deprecated `User::UpdateEmail`.
680681
- iOS: Added an option to explicitly specify your app's `AppDelegate` class
681682
name via the `FirebaseAppDelegateClassName` key in `Info.plist`. This
682683
provides a more direct way for Firebase to interact with your specified

0 commit comments

Comments
 (0)