Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ struct TestFriend {
#if !defined(__ANDROID__)
return new FirestoreInternal(
app, database_id,
absl::make_unique<credentials::EmptyAuthCredentialsProvider>(),
absl::make_unique<credentials::EmptyAppCheckCredentialsProvider>());
std::make_shared<credentials::EmptyAuthCredentialsProvider>(),
std::make_shared<credentials::EmptyAppCheckCredentialsProvider>());
#else
return new FirestoreInternal(app, database_id);
#endif // !defined(__ANDROID__)
Expand Down
2 changes: 1 addition & 1 deletion firestore/src/main/create_app_check_credentials_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class App;

namespace firestore {

std::unique_ptr<credentials::AppCheckCredentialsProvider>
std::shared_ptr<credentials::AppCheckCredentialsProvider>
CreateAppCheckCredentialsProvider(App& app);

} // namespace firestore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
*/

#include "absl/memory/memory.h"
#include <memory>

#include "firestore/src/main/app_check_credentials_provider_desktop.h"
#include "firestore/src/main/create_credentials_provider.h"

Expand All @@ -23,9 +24,9 @@ namespace firestore {

using credentials::AppCheckCredentialsProvider;

std::unique_ptr<AppCheckCredentialsProvider> CreateAppCheckCredentialsProvider(
std::shared_ptr<AppCheckCredentialsProvider> CreateAppCheckCredentialsProvider(
App& app) {
return absl::make_unique<CppAppCheckCredentialsProvider>(app);
return std::make_shared<CppAppCheckCredentialsProvider>(app);
}

} // namespace firestore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

#include <memory>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To adhere to the Google C++ Style Guide for include order, C++ standard library headers like <memory> should be placed before project-specific headers. Please move this include before #include "firestore/src/main/create_credentials_provider.h".


#include "firestore/src/main/create_credentials_provider.h"

#import "FIRAppInternal.h"
Expand All @@ -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 {
Expand All @@ -33,12 +34,12 @@
using credentials::AppCheckCredentialsProvider;
using credentials::FirebaseAppCheckCredentialsProvider;

std::unique_ptr<AppCheckCredentialsProvider> CreateAppCheckCredentialsProvider(
std::shared_ptr<AppCheckCredentialsProvider> CreateAppCheckCredentialsProvider(
App& app) {
FIRApp* ios_app = app.GetPlatformApp();
auto ios_app_check = FIR_COMPONENT(FIRAppCheckInterop, ios_app.container);
return absl::make_unique<FirebaseAppCheckCredentialsProvider>(ios_app,
ios_app_check);
return std::make_shared<FirebaseAppCheckCredentialsProvider>(ios_app,
ios_app_check);
}

} // namespace firestore
Expand Down
2 changes: 1 addition & 1 deletion firestore/src/main/create_credentials_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class App;

namespace firestore {

std::unique_ptr<credentials::AuthCredentialsProvider> CreateCredentialsProvider(
std::shared_ptr<credentials::AuthCredentialsProvider> CreateCredentialsProvider(
App& app);

} // namespace firestore
Expand Down
4 changes: 2 additions & 2 deletions firestore/src/main/create_credentials_provider_desktop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ namespace firestore {
using credentials::AuthCredentialsProvider;
using firebase::auth::Auth;

std::unique_ptr<AuthCredentialsProvider> CreateCredentialsProvider(App& app) {
return std::make_unique<FirebaseCppCredentialsProvider>(app);
std::shared_ptr<AuthCredentialsProvider> CreateCredentialsProvider(App& app) {
return std::make_shared<FirebaseCppCredentialsProvider>(app);
}

} // namespace firestore
Expand Down
4 changes: 2 additions & 2 deletions firestore/src/main/create_credentials_provider_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
using credentials::AuthCredentialsProvider;
using credentials::FirebaseAuthCredentialsProvider;

std::unique_ptr<AuthCredentialsProvider> CreateCredentialsProvider(App& app) {
std::shared_ptr<AuthCredentialsProvider> CreateCredentialsProvider(App& app) {
FIRApp* ios_app = app.GetPlatformApp();
auto ios_auth = FIR_COMPONENT(FIRAuthInterop, ios_app.container);
return std::make_unique<FirebaseAuthCredentialsProvider>(ios_app, ios_auth);
return std::make_shared<FirebaseAuthCredentialsProvider>(ios_app, ios_auth);
}

} // namespace firestore
Expand Down
8 changes: 4 additions & 4 deletions firestore/src/main/firestore_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<AuthCredentialsProvider> auth_credentials,
std::unique_ptr<AppCheckCredentialsProvider> app_check_credentials)
std::shared_ptr<AuthCredentialsProvider> auth_credentials,
std::shared_ptr<AppCheckCredentialsProvider> app_check_credentials)
: app_(NOT_NULL(app)),
firestore_core_(CreateFirestore(app,
database_id,
Expand All @@ -137,8 +137,8 @@ FirestoreInternal::~FirestoreInternal() {
std::shared_ptr<api::Firestore> FirestoreInternal::CreateFirestore(
App* app,
const std::string& database_id,
std::unique_ptr<AuthCredentialsProvider> auth_credentials,
std::unique_ptr<AppCheckCredentialsProvider> app_check_credentials) {
std::shared_ptr<AuthCredentialsProvider> auth_credentials,
std::shared_ptr<AppCheckCredentialsProvider> app_check_credentials) {
const AppOptions& opt = app->options();
return std::make_shared<api::Firestore>(
DatabaseId{opt.project_id(), database_id}, app->name(),
Expand Down
8 changes: 4 additions & 4 deletions firestore/src/main/firestore_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ class FirestoreInternal {
FirestoreInternal(
App* app,
const std::string& database_id,
std::unique_ptr<credentials::AuthCredentialsProvider> auth_credentials,
std::unique_ptr<credentials::AppCheckCredentialsProvider>
std::shared_ptr<credentials::AuthCredentialsProvider> auth_credentials,
std::shared_ptr<credentials::AppCheckCredentialsProvider>
app_check_credentials);

std::shared_ptr<api::Firestore> CreateFirestore(
App* app,
const std::string& database_id,
std::unique_ptr<credentials::AuthCredentialsProvider> auth_credentials,
std::unique_ptr<credentials::AppCheckCredentialsProvider>
std::shared_ptr<credentials::AuthCredentialsProvider> auth_credentials,
std::shared_ptr<credentials::AppCheckCredentialsProvider>
app_check_credentials);

// Gets the reference-counted Future implementation of this instance, which
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 @@ -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
Expand Down
Loading