Skip to content

Automatic merge of main into feature_branch/ump-sdk - Aug 07, 2023 #1419

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

Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/cpp-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
# Run a full packaging step any time a new branch is merged into main.
- main
schedule:
- cron: "0 9 * * *" # 9am UTC = 1am PST / 2am PDT
- cron: "0 8 * * *" # 8am UTC = 12am PST / 1am PDT
workflow_dispatch:
inputs:
preserveIntermediateArtifacts:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
cd -
# Copy all *-Swift.h header files into ios_pod/swift_headers/
echo "Copying headers..."
find "${ziptmp}" -name '*-Swift.h' -print0 | xargs -0 -n 1 -J REPLACETEXT cp -f REPLACETEXT ios_pod/swift_headers/
find "${ziptmp}" -name '*-Swift.h' -path '*ios*arm64*x86_64*simulator*' -print0 | xargs -0 -n 1 -J REPLACETEXT cp -f REPLACETEXT ios_pod/swift_headers/
copyright_line="// Copyright $(date +%Y) Google LLC"
# Add a note to each file about its source.
for ios_header in ios_pod/swift_headers/*.h; do
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ gcs_key_file.json
*_build/
cmake-build-*/
testing/test_framework/external/
CMakeFiles/
CMakeCache.txt

# XCode user specific folders
**/xcuserdata/
Expand Down
2 changes: 1 addition & 1 deletion Android/firebase_dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ project.afterEvaluate {

// Add the bill-of-materials
project.dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.0')
implementation platform('com.google.firebase:firebase-bom:32.2.2')
}
for (String lib : firebaseCpp.dependencies.libSet) {
// Generate and include the proguard file
Expand Down
4 changes: 2 additions & 2 deletions analytics/integration_test/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use_frameworks! :linkage => :static

target 'integration_test' do
platform :ios, '11.0'
pod 'Firebase/Analytics', '10.12.0'
pod 'Firebase/Analytics', '10.13.0'
end

target 'integration_test_tvos' do
platform :tvos, '12.0'
pod 'Firebase/Analytics', '10.12.0'
pod 'Firebase/Analytics', '10.13.0'
end

post_install do |installer|
Expand Down
2 changes: 1 addition & 1 deletion analytics/ios_headers/FIREventNames.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2023 Google LLC

// Copied from Firebase Analytics iOS SDK 10.12.0.
// Copied from Firebase Analytics iOS SDK 10.13.0.

/// @file FIREventNames.h
///
Expand Down
2 changes: 1 addition & 1 deletion analytics/ios_headers/FIRParameterNames.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2023 Google LLC

// Copied from Firebase Analytics iOS SDK 10.12.0.
// Copied from Firebase Analytics iOS SDK 10.13.0.

/// @file FIRParameterNames.h
///
Expand Down
2 changes: 1 addition & 1 deletion analytics/ios_headers/FIRUserPropertyNames.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2023 Google LLC

// Copied from Firebase Analytics iOS SDK 10.12.0.
// Copied from Firebase Analytics iOS SDK 10.13.0.

/// @file FIRUserPropertyNames.h
///
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 @@ -50,7 +50,7 @@ android {
}

dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.0')
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-analytics'
}

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 @@ -53,7 +53,7 @@ android {
}

dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.0')
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.android.gms:play-services-base:18.2.0'
implementation project(':app:app_resources')
Expand Down
2 changes: 1 addition & 1 deletion app/integration_test/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ platform :ios, '11.0'
use_frameworks! :linkage => :static

target 'integration_test' do
pod 'Firebase/Analytics', '10.12.0'
pod 'Firebase/Analytics', '10.13.0'
end

post_install do |installer|
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 @@ -49,7 +49,7 @@ android {
}

dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.0')
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-dynamic-links'
implementation project(':app:app_resources')
Expand Down
3 changes: 0 additions & 3 deletions app/src/include/firebase/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -571,11 +571,8 @@ class App {
/// Get the App with the given name, or nullptr if none have been created.
static App* GetInstance(const char* name);

#if !defined(DOXYGEN)
// Hidden from the public documentation for now
/// Get all the apps, including the default one.
static std::vector<App*> GetApps();
#endif // !defined(DOXYGEN)

#ifndef SWIG
// <SWIG>
Expand Down
4 changes: 2 additions & 2 deletions app/src/tests/runner/ios/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
Expand All @@ -46,4 +46,4 @@
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
</plist>
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 @@ -49,7 +49,7 @@ android {
}

dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.0')
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-appcheck'
}

Expand Down
20 changes: 10 additions & 10 deletions app_check/integration_test/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ use_frameworks! :linkage => :static

target 'integration_test' do
platform :ios, '11.0'
pod 'Firebase/AppCheck', '10.12.0'
pod 'Firebase/Database', '10.12.0'
pod 'Firebase/Auth', '10.12.0'
pod 'Firebase/Storage', '10.12.0'
pod 'Firebase/Functions', '10.12.0'
pod 'Firebase/AppCheck', '10.13.0'
pod 'Firebase/Database', '10.13.0'
pod 'Firebase/Auth', '10.13.0'
pod 'Firebase/Storage', '10.13.0'
pod 'Firebase/Functions', '10.13.0'
end

target 'integration_test_tvos' do
platform :tvos, '12.0'
pod 'Firebase/AppCheck', '10.12.0'
pod 'Firebase/Database', '10.12.0'
pod 'Firebase/Auth', '10.12.0'
pod 'Firebase/Storage', '10.12.0'
pod 'Firebase/Functions', '10.12.0'
pod 'Firebase/AppCheck', '10.13.0'
pod 'Firebase/Database', '10.13.0'
pod 'Firebase/Auth', '10.13.0'
pod 'Firebase/Storage', '10.13.0'
pod 'Firebase/Functions', '10.13.0'
end

post_install do |installer|
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 @@ -49,7 +49,7 @@ android {
}

dependencies {
implementation platform('com.google.firebase:firebase-bom:32.2.0')
implementation platform('com.google.firebase:firebase-bom:32.2.2')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-auth'
implementation project(':app:app_resources')
Expand Down
4 changes: 2 additions & 2 deletions auth/integration_test/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use_frameworks! :linkage => :static

target 'integration_test' do
platform :ios, '11.0'
pod 'Firebase/Auth', '10.12.0'
pod 'Firebase/Auth', '10.13.0'
end

target 'integration_test_tvos' do
platform :tvos, '12.0'
pod 'Firebase/Auth', '10.12.0'
pod 'Firebase/Auth', '10.13.0'
end

post_install do |installer|
Expand Down
30 changes: 30 additions & 0 deletions auth/src/android/auth_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <assert.h>
#include <jni.h>

#include <string>

#include "app/src/assert.h"
#include "app/src/embedded_file.h"
#include "app/src/include/firebase/internal/mutex.h"
Expand Down Expand Up @@ -53,6 +55,7 @@ using util::JniStringToString;
X(RemoveIdTokenListener, "removeIdTokenListener", \
"(Lcom/google/firebase/auth/FirebaseAuth$IdTokenListener;)V"), \
X(SignOut, "signOut", "()V"), \
X(UseEmulator, "useEmulator", "(Ljava/lang/String;I)V"), \
X(FetchSignInMethodsForEmail, "fetchSignInMethodsForEmail", \
"(Ljava/lang/String;)" \
"Lcom/google/android/gms/tasks/Task;"), \
Expand Down Expand Up @@ -185,6 +188,31 @@ void UpdateCurrentUser(AuthData* auth_data) {
}
}

const char* const kEmulatorLocalHost = "10.0.2.2";
const char* const kEmulatorPort = "9099";
void CheckEmulator(AuthData* auth_data) {
JNIEnv* env = Env(auth_data);

// Use emulator as long as this env variable is set, regardless its value.
if (std::getenv("USE_AUTH_EMULATOR") == nullptr) {
LogDebug("Using Auth Prod for testing.");
return;
}

// Use AUTH_EMULATOR_PORT if it is set to non empty string,
// otherwise use the default port.
uint32_t port = std::stoi(kEmulatorPort);
if (std::getenv("AUTH_EMULATOR_PORT") != nullptr) {
port = std::stoi(std::getenv("AUTH_EMULATOR_PORT"));
}

jstring j_host = env->NewStringUTF(kEmulatorLocalHost);
env->CallVoidMethod(AuthImpl(auth_data),
auth::GetMethodId(auth::kUseEmulator), j_host, port);
env->DeleteLocalRef(j_host);
firebase::util::CheckAndClearJniExceptions(env);
}

// Release cached Java classes.
static void ReleaseClasses(JNIEnv* env) {
ReleaseAuthClasses(env);
Expand Down Expand Up @@ -269,6 +297,8 @@ void Auth::InitPlatformAuth(AuthData* auth_data) {
// Ensure our User is in-line with underlying API's user.
// It's possible for a user to already be logged-in on start-up.
UpdateCurrentUser(auth_data);

CheckEmulator(auth_data);
}

void Auth::DestroyPlatformAuth(AuthData* auth_data) {
Expand Down
1 change: 1 addition & 0 deletions auth/src/desktop/auth_desktop.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define FIREBASE_AUTH_SRC_DESKTOP_AUTH_DESKTOP_H_

#include <memory>
#include <string>

#include "app/rest/request.h"
#include "app/src/scheduler.h"
Expand Down
38 changes: 38 additions & 0 deletions auth/src/desktop/rpcs/auth_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "app/src/heartbeat/heartbeat_controller_desktop.h"
#include "app/src/include/firebase/app.h"
#include "app/src/include/firebase/internal/mutex.h"
#include "firebase/log.h"

namespace firebase {
namespace auth {
Expand All @@ -37,6 +38,8 @@ AuthRequest::AuthRequest(::firebase::App& app, const char* schema,
// dependencies upon other parts of this library. This complication is due to
// the way the tests are currently configured where each library has minimal
// dependencies.

CheckEmulator();
static std::string auth_user_agent; // NOLINT
static std::string extended_auth_user_agent; // NOLINT
static Mutex* user_agent_mutex = new Mutex();
Expand Down Expand Up @@ -77,5 +80,40 @@ AuthRequest::AuthRequest(::firebase::App& app, const char* schema,
}
}

std::string AuthRequest::GetUrl() {
if (emulator_url.empty()) {
std::string url(kHttps);
url += kServerURL;
return url;
} else {
std::string url(kHttp);
url += emulator_url;
url += kServerURL;
return url;
}
}

void AuthRequest::CheckEmulator() {
if (!emulator_url.empty()) {
LogDebug("Emulator Url already set: %s", emulator_url.c_str());
return;
}
// Use emulator as long as this env variable is set, regardless its value.
if (std::getenv("USE_AUTH_EMULATOR") == nullptr) {
LogDebug("Using Auth Prod for testing.");
return;
}

emulator_url.append(kEmulatorLocalHost);
emulator_url.append(":");
// Use AUTH_EMULATOR_PORT if it is set to non empty string,
// otherwise use the default port.
if (std::getenv("AUTH_EMULATOR_PORT") == nullptr) {
emulator_url.append(kEmulatorPort);
} else {
emulator_url.append(std::getenv("AUTH_EMULATOR_PORT"));
}
}

} // namespace auth
} // namespace firebase
18 changes: 18 additions & 0 deletions auth/src/desktop/rpcs/auth_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#ifndef FIREBASE_AUTH_SRC_DESKTOP_RPCS_AUTH_REQUEST_H_
#define FIREBASE_AUTH_SRC_DESKTOP_RPCS_AUTH_REQUEST_H_

#include <string>

#include "app/rest/request_json.h"
#include "app/src/include/firebase/app.h"
#include "auth/request_generated.h"
Expand All @@ -28,6 +30,16 @@ namespace auth {
// Key name for header when sending language code data.
extern const char* kHeaderFirebaseLocale;

const char* const kHttps = "https://";

const char* const kHttp = "http://";

const char* const kServerURL =
"www.googleapis.com/identitytoolkit/v3/relyingparty/";

const char* const kEmulatorLocalHost = "localhost";
const char* const kEmulatorPort = "9099";

class AuthRequest
: public firebase::rest::RequestJson<fbs::Request, fbs::RequestT> {
public:
Expand All @@ -39,6 +51,12 @@ class AuthRequest
bool deliver_heartbeat)
: AuthRequest(app, reinterpret_cast<const char*>(schema),
deliver_heartbeat) {}

std::string GetUrl();

private:
void CheckEmulator();
std::string emulator_url;
};

} // namespace auth
Expand Down
9 changes: 4 additions & 5 deletions auth/src/desktop/rpcs/create_auth_uri_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "auth/src/desktop/rpcs/create_auth_uri_request.h"

#include <string>

#include "app/src/assert.h"
#include "app/src/include/firebase/app.h"
#include "app/src/log.h"
Expand All @@ -27,11 +29,8 @@ CreateAuthUriRequest::CreateAuthUriRequest(::firebase::App& app,
: AuthRequest(app, request_resource_data, true) {
FIREBASE_ASSERT_RETURN_VOID(api_key);

const char api_host[] =
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/"
"createAuthUri?key=";
std::string url;
url.reserve(strlen(api_host) + strlen(api_key));
const char api_host[] = "createAuthUri?key=";
std::string url = GetUrl();
url.append(api_host);
url.append(api_key);
set_url(url.c_str());
Expand Down
Loading