Skip to content

Commit

Permalink
Merge branch 'main' into workflow/auto-update-deps-240-20241004-151505
Browse files Browse the repository at this point in the history
  • Loading branch information
jonsimantov authored Oct 15, 2024
2 parents f526ccf + 2437818 commit e0e28c3
Show file tree
Hide file tree
Showing 44 changed files with 183 additions and 43 deletions.
2 changes: 1 addition & 1 deletion analytics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ android {
}

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName "1.0"
Expand Down
5 changes: 4 additions & 1 deletion analytics/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
// r8 on this version of the Android tools has a bug,
// so specify a different version to use.
classpath 'com.android.tools:r8:8.3.37'
classpath 'com.google.gms:google-services:4.4.1'
}
}
Expand Down Expand Up @@ -55,7 +58,7 @@ android {

defaultConfig {
applicationId 'com.google.android.analytics.testapp'
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName '1.0'
Expand Down
2 changes: 1 addition & 1 deletion app/app_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
buildToolsVersion '32.0.0'

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
}

Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ android {
}

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName "1.0"
Expand Down
2 changes: 1 addition & 1 deletion app/google_api_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
buildToolsVersion '32.0.0'

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
}

Expand Down
5 changes: 4 additions & 1 deletion app/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
// r8 on this version of the Android tools has a bug,
// so specify a different version to use.
classpath 'com.android.tools:r8:8.3.37'
classpath 'com.google.gms:google-services:4.4.1'
}
}
Expand Down Expand Up @@ -55,7 +58,7 @@ android {

defaultConfig {
applicationId 'com.google.android.analytics.testapp'
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName '1.0'
Expand Down
2 changes: 1 addition & 1 deletion app/invites_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
buildToolsVersion '32.0.0'

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
}

Expand Down
2 changes: 1 addition & 1 deletion app/test_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ android {
buildToolsVersion '32.0.0'

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
}

Expand Down
2 changes: 1 addition & 1 deletion app_check/app_check_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
buildToolsVersion '32.0.0'

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
}

Expand Down
2 changes: 1 addition & 1 deletion app_check/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ android {
}

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName "1.0"
Expand Down
5 changes: 4 additions & 1 deletion app_check/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
// r8 on this version of the Android tools has a bug,
// so specify a different version to use.
classpath 'com.android.tools:r8:8.3.37'
classpath 'com.google.gms:google-services:4.4.1'
}
}
Expand Down Expand Up @@ -55,7 +58,7 @@ android {

defaultConfig {
applicationId 'com.google.firebase.cpp.appcheck.testapp'
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName '1.0'
Expand Down
2 changes: 1 addition & 1 deletion auth/auth_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
buildToolsVersion '32.0.0'

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
}

Expand Down
2 changes: 1 addition & 1 deletion auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ android {
}

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName "1.0"
Expand Down
5 changes: 4 additions & 1 deletion auth/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
// r8 on this version of the Android tools has a bug,
// so specify a different version to use.
classpath 'com.android.tools:r8:8.3.37'
classpath 'com.google.gms:google-services:4.4.1'
}
}
Expand Down Expand Up @@ -55,7 +58,7 @@ android {

defaultConfig {
applicationId 'com.google.android.auth.testapp'
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName '1.0'
Expand Down
87 changes: 87 additions & 0 deletions auth/integration_test/src/integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,38 @@ TEST_F(FirebaseAuthTest, TestUpdateUserProfile) {
auth_->CreateUserWithEmailAndPassword(email.c_str(), kTestPassword);
WaitForCompletion(create_user, "CreateUserWithEmailAndPassword");
EXPECT_TRUE(auth_->current_user().is_valid());

// Set some user profile properties.
firebase::auth::User user = create_user.result()->user;
const char kDisplayName[] = "Hello World";
const char kPhotoUrl[] = "http://example.com/image.jpg";
firebase::auth::User::UserProfile user_profile;
user_profile.display_name = kDisplayName;
user_profile.photo_url = kPhotoUrl;
firebase::Future<void> update_profile = user.UpdateUserProfile(user_profile);
WaitForCompletion(update_profile, "UpdateUserProfile");
user = auth_->current_user();
EXPECT_EQ(user.display_name(), kDisplayName);
EXPECT_EQ(user.photo_url(), kPhotoUrl);

// Validate that the new properties are present after signing out and in.
SignOut();
WaitForCompletion(
auth_->SignInWithEmailAndPassword(email.c_str(), kTestPassword),
"SignInWithEmailAndPassword");
user = auth_->current_user();
EXPECT_EQ(user.display_name(), kDisplayName);
EXPECT_EQ(user.photo_url(), kPhotoUrl);
DeleteUser();
}

TEST_F(FirebaseAuthTest, TestUpdateUserProfileNull) {
std::string email = GenerateEmailAddress();
firebase::Future<firebase::auth::AuthResult> create_user =
auth_->CreateUserWithEmailAndPassword(email.c_str(), kTestPassword);
WaitForCompletion(create_user, "CreateUserWithEmailAndPassword");
EXPECT_TRUE(auth_->current_user().is_valid());

// Set some user profile properties.
firebase::auth::User user = create_user.result()->user;
const char kDisplayName[] = "Hello World";
Expand All @@ -661,6 +693,19 @@ TEST_F(FirebaseAuthTest, TestUpdateUserProfile) {
user = auth_->current_user();
EXPECT_EQ(user.display_name(), kDisplayName);
EXPECT_EQ(user.photo_url(), kPhotoUrl);

// Setting the entries to null should leave the old values
firebase::auth::User::UserProfile user_profile_null;
user_profile_null.display_name = nullptr;
user_profile_null.photo_url = nullptr;
firebase::Future<void> update_profile_null =
user.UpdateUserProfile(user_profile_null);
WaitForCompletion(update_profile_null, "UpdateUserProfileNull");
user = auth_->current_user();
EXPECT_EQ(user.display_name(), kDisplayName);
EXPECT_EQ(user.photo_url(), kPhotoUrl);

// Validate that the new properties are present after signing out and in.
SignOut();
WaitForCompletion(
auth_->SignInWithEmailAndPassword(email.c_str(), kTestPassword),
Expand All @@ -671,6 +716,48 @@ TEST_F(FirebaseAuthTest, TestUpdateUserProfile) {
DeleteUser();
}

TEST_F(FirebaseAuthTest, TestUpdateUserProfileEmpty) {
std::string email = GenerateEmailAddress();
firebase::Future<firebase::auth::AuthResult> create_user =
auth_->CreateUserWithEmailAndPassword(email.c_str(), kTestPassword);
WaitForCompletion(create_user, "CreateUserWithEmailAndPassword");
EXPECT_TRUE(auth_->current_user().is_valid());

// Set some user profile properties.
firebase::auth::User user = create_user.result()->user;
const char kDisplayName[] = "Hello World";
const char kPhotoUrl[] = "http://example.com/image.jpg";
firebase::auth::User::UserProfile user_profile;
user_profile.display_name = kDisplayName;
user_profile.photo_url = kPhotoUrl;
firebase::Future<void> update_profile = user.UpdateUserProfile(user_profile);
WaitForCompletion(update_profile, "UpdateUserProfile");
user = auth_->current_user();
EXPECT_EQ(user.display_name(), kDisplayName);
EXPECT_EQ(user.photo_url(), kPhotoUrl);

// Setting the fields to empty should clear it.
firebase::auth::User::UserProfile user_profile_empty;
user_profile_empty.display_name = "";
user_profile_empty.photo_url = "";
firebase::Future<void> update_profile_empty =
user.UpdateUserProfile(user_profile_empty);
WaitForCompletion(update_profile_empty, "UpdateUserProfileEmpty");
user = auth_->current_user();
EXPECT_EQ(user.display_name(), "");
EXPECT_EQ(user.photo_url(), "");

// Validate that the properties are cleared out after signing out and in.
SignOut();
WaitForCompletion(
auth_->SignInWithEmailAndPassword(email.c_str(), kTestPassword),
"SignInWithEmailAndPassword");
user = auth_->current_user();
EXPECT_EQ(user.display_name(), "");
EXPECT_EQ(user.photo_url(), "");
DeleteUser();
}

TEST_F(FirebaseAuthTest, TestUpdateEmailAndPassword) {
std::string email = GenerateEmailAddress();
WaitForCompletion(
Expand Down
9 changes: 7 additions & 2 deletions auth/src/android/user_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,10 @@ Future<void> User::UpdateUserProfile(const UserProfile& profile) {

// Extra painfully call UserProfileChangeRequest.Builder.setPhotoUri.
if (error == kAuthErrorNone && profile.photo_url != nullptr) {
jobject j_uri = CharsToJniUri(env, profile.photo_url);
jobject j_uri = nullptr;
if (strlen(profile.photo_url) > 0) {
j_uri = CharsToJniUri(env, profile.photo_url);
}
jobject j_builder_discard = env->CallObjectMethod(
j_user_profile_builder,
userprofilebuilder::GetMethodId(userprofilebuilder::kSetPhotoUri),
Expand All @@ -434,7 +437,9 @@ Future<void> User::UpdateUserProfile(const UserProfile& profile) {
if (j_builder_discard) {
env->DeleteLocalRef(j_builder_discard);
}
env->DeleteLocalRef(j_uri);
if (j_uri) {
env->DeleteLocalRef(j_uri);
}
}

jobject j_user_profile_request = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion database/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ android {
}

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName "1.0"
Expand Down
2 changes: 1 addition & 1 deletion database/database_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ android {
buildToolsVersion '32.0.0'

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
}

Expand Down
5 changes: 4 additions & 1 deletion database/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
// r8 on this version of the Android tools has a bug,
// so specify a different version to use.
classpath 'com.android.tools:r8:8.3.37'
classpath 'com.google.gms:google-services:4.4.1'
}
}
Expand Down Expand Up @@ -55,7 +58,7 @@ android {

defaultConfig {
applicationId 'com.google.firebase.cpp.database.testapp'
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName '1.0'
Expand Down
2 changes: 1 addition & 1 deletion dynamic_links/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ android {
}

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName "1.0"
Expand Down
5 changes: 4 additions & 1 deletion dynamic_links/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
// r8 on this version of the Android tools has a bug,
// so specify a different version to use.
classpath 'com.android.tools:r8:8.3.37'
classpath 'com.google.gms:google-services:4.4.1'
}
}
Expand Down Expand Up @@ -55,7 +58,7 @@ android {

defaultConfig {
applicationId 'com.google.android.dynamiclinks.testapp'
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName '1.0'
Expand Down
2 changes: 1 addition & 1 deletion firestore/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ android {

defaultConfig {
// Jelly Bean is the minimum supported version needed by Firebase.
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName "1.0"
Expand Down
2 changes: 1 addition & 1 deletion firestore/firestore_resources/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
buildToolsVersion '32.0.0'

defaultConfig {
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
}

Expand Down
5 changes: 4 additions & 1 deletion firestore/integration_test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
// r8 on this version of the Android tools has a bug,
// so specify a different version to use.
classpath 'com.android.tools:r8:8.3.37'
classpath 'com.google.gms:google-services:4.4.1'
}
}
Expand Down Expand Up @@ -55,7 +58,7 @@ android {

defaultConfig {
applicationId 'com.google.firebase.cpp.firestore.testapp'
minSdkVersion 24
minSdkVersion 23
targetSdkVersion 34
versionCode 1
versionName '1.0'
Expand Down
Loading

0 comments on commit e0e28c3

Please sign in to comment.