diff --git a/firestore/integration_test_internal/src/util/integration_test_util.cc b/firestore/integration_test_internal/src/util/integration_test_util.cc index d3a4129ed5..281593703e 100644 --- a/firestore/integration_test_internal/src/util/integration_test_util.cc +++ b/firestore/integration_test_internal/src/util/integration_test_util.cc @@ -39,8 +39,8 @@ struct TestFriend { #if !defined(__ANDROID__) return new FirestoreInternal( app, database_id, - absl::make_unique(), - absl::make_unique()); + std::make_shared(), + std::make_shared()); #else return new FirestoreInternal(app, database_id); #endif // !defined(__ANDROID__) diff --git a/firestore/src/main/create_app_check_credentials_provider.h b/firestore/src/main/create_app_check_credentials_provider.h index 50e515dfe5..e7c088d8d5 100644 --- a/firestore/src/main/create_app_check_credentials_provider.h +++ b/firestore/src/main/create_app_check_credentials_provider.h @@ -31,7 +31,7 @@ class App; namespace firestore { -std::unique_ptr +std::shared_ptr CreateAppCheckCredentialsProvider(App& app); } // namespace firestore diff --git a/firestore/src/main/create_app_check_credentials_provider_desktop.cc b/firestore/src/main/create_app_check_credentials_provider_desktop.cc index 6225ffe142..ddb7c0152d 100644 --- a/firestore/src/main/create_app_check_credentials_provider_desktop.cc +++ b/firestore/src/main/create_app_check_credentials_provider_desktop.cc @@ -14,7 +14,8 @@ * limitations under the License. */ -#include "absl/memory/memory.h" +#include + #include "firestore/src/main/app_check_credentials_provider_desktop.h" #include "firestore/src/main/create_credentials_provider.h" @@ -23,9 +24,9 @@ namespace firestore { using credentials::AppCheckCredentialsProvider; -std::unique_ptr CreateAppCheckCredentialsProvider( +std::shared_ptr CreateAppCheckCredentialsProvider( App& app) { - return absl::make_unique(app); + return std::make_shared(app); } } // namespace firestore diff --git a/firestore/src/main/create_app_check_credentials_provider_ios.mm b/firestore/src/main/create_app_check_credentials_provider_ios.mm index dfc6d8d6fe..60368f96cf 100644 --- a/firestore/src/main/create_app_check_credentials_provider_ios.mm +++ b/firestore/src/main/create_app_check_credentials_provider_ios.mm @@ -16,6 +16,8 @@ #include "firestore/src/main/create_credentials_provider.h" +#include + #import "FIRAppInternal.h" #import "FIRComponent.h" #import "FIRComponentContainer.h" @@ -24,7 +26,6 @@ #import "FirebaseCore.h" #include "Firestore/core/src/credentials/firebase_app_check_credentials_provider_apple.h" -#include "absl/memory/memory.h" #include "app/src/include/firebase/app.h" namespace firebase { @@ -33,12 +34,12 @@ using credentials::AppCheckCredentialsProvider; using credentials::FirebaseAppCheckCredentialsProvider; -std::unique_ptr CreateAppCheckCredentialsProvider( +std::shared_ptr CreateAppCheckCredentialsProvider( App& app) { FIRApp* ios_app = app.GetPlatformApp(); auto ios_app_check = FIR_COMPONENT(FIRAppCheckInterop, ios_app.container); - return absl::make_unique(ios_app, - ios_app_check); + return std::make_shared(ios_app, + ios_app_check); } } // namespace firestore diff --git a/firestore/src/main/create_credentials_provider.h b/firestore/src/main/create_credentials_provider.h index eb6837cf22..5edc5b8f74 100644 --- a/firestore/src/main/create_credentials_provider.h +++ b/firestore/src/main/create_credentials_provider.h @@ -31,7 +31,7 @@ class App; namespace firestore { -std::unique_ptr CreateCredentialsProvider( +std::shared_ptr CreateCredentialsProvider( App& app); } // namespace firestore diff --git a/firestore/src/main/create_credentials_provider_desktop.cc b/firestore/src/main/create_credentials_provider_desktop.cc index fac9e68afb..5232e19e39 100644 --- a/firestore/src/main/create_credentials_provider_desktop.cc +++ b/firestore/src/main/create_credentials_provider_desktop.cc @@ -26,8 +26,8 @@ namespace firestore { using credentials::AuthCredentialsProvider; using firebase::auth::Auth; -std::unique_ptr CreateCredentialsProvider(App& app) { - return std::make_unique(app); +std::shared_ptr CreateCredentialsProvider(App& app) { + return std::make_shared(app); } } // namespace firestore diff --git a/firestore/src/main/create_credentials_provider_ios.mm b/firestore/src/main/create_credentials_provider_ios.mm index a6999a3b69..57eb74441c 100644 --- a/firestore/src/main/create_credentials_provider_ios.mm +++ b/firestore/src/main/create_credentials_provider_ios.mm @@ -34,10 +34,10 @@ using credentials::AuthCredentialsProvider; using credentials::FirebaseAuthCredentialsProvider; -std::unique_ptr CreateCredentialsProvider(App& app) { +std::shared_ptr CreateCredentialsProvider(App& app) { FIRApp* ios_app = app.GetPlatformApp(); auto ios_auth = FIR_COMPONENT(FIRAuthInterop, ios_app.container); - return std::make_unique(ios_app, ios_auth); + return std::make_shared(ios_app, ios_auth); } } // namespace firestore diff --git a/firestore/src/main/firestore_main.cc b/firestore/src/main/firestore_main.cc index 8a512a49e5..927c1ac2c7 100644 --- a/firestore/src/main/firestore_main.cc +++ b/firestore/src/main/firestore_main.cc @@ -109,8 +109,8 @@ FirestoreInternal::FirestoreInternal(App* app, const std::string& database_id) FirestoreInternal::FirestoreInternal( App* app, const std::string& database_id, - std::unique_ptr auth_credentials, - std::unique_ptr app_check_credentials) + std::shared_ptr auth_credentials, + std::shared_ptr app_check_credentials) : app_(NOT_NULL(app)), firestore_core_(CreateFirestore(app, database_id, @@ -137,8 +137,8 @@ FirestoreInternal::~FirestoreInternal() { std::shared_ptr FirestoreInternal::CreateFirestore( App* app, const std::string& database_id, - std::unique_ptr auth_credentials, - std::unique_ptr app_check_credentials) { + std::shared_ptr auth_credentials, + std::shared_ptr app_check_credentials) { const AppOptions& opt = app->options(); return std::make_shared( DatabaseId{opt.project_id(), database_id}, app->name(), diff --git a/firestore/src/main/firestore_main.h b/firestore/src/main/firestore_main.h index 7920eccc4f..ee423298f7 100644 --- a/firestore/src/main/firestore_main.h +++ b/firestore/src/main/firestore_main.h @@ -154,15 +154,15 @@ class FirestoreInternal { FirestoreInternal( App* app, const std::string& database_id, - std::unique_ptr auth_credentials, - std::unique_ptr + std::shared_ptr auth_credentials, + std::shared_ptr app_check_credentials); std::shared_ptr CreateFirestore( App* app, const std::string& database_id, - std::unique_ptr auth_credentials, - std::unique_ptr + std::shared_ptr auth_credentials, + std::shared_ptr app_check_credentials); // Gets the reference-counted Future implementation of this instance, which diff --git a/release_build_files/readme.md b/release_build_files/readme.md index bebceabca9..c5e8fec34c 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -616,6 +616,7 @@ code. ### Upcoming - Changes - App Check: Add in support for Limited Use Tokens. + - Firestore (iOS): Fix crash when using Auth or App Check Credentials. ### 13.4.0 - Changes