Skip to content

Commit

Permalink
Don't redeclare inherited state in CredentialsProviderDesktop (#731)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidt-sebastian authored Nov 29, 2021
1 parent 4462002 commit 11505cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
9 changes: 2 additions & 7 deletions firestore/src/main/credentials_provider_desktop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,6 @@ void FirebaseCppCredentialsProvider::GetToken(
}
}

void FirebaseCppCredentialsProvider::InvalidateToken() {
std::lock_guard<std::recursive_mutex> lock(contents_->mutex);
force_refresh_token_ = true;
}

void FirebaseCppCredentialsProvider::AddAuthStateListener() {
App& app = contents_->app;
auto callback = reinterpret_cast<void*>(OnAuthStateChanged);
Expand Down Expand Up @@ -234,8 +229,8 @@ void FirebaseCppCredentialsProvider::RequestToken(
// can fail if there is a token change while the request is outstanding.
int expected_generation = contents_->token_generation;

bool force_refresh = force_refresh_token_;
force_refresh_token_ = false;
bool force_refresh = force_refresh_;
force_refresh_ = false;
auto future = GetAuthTokenAsync(contents_->app, force_refresh);

std::weak_ptr<Contents> weak_contents(contents_);
Expand Down
9 changes: 0 additions & 9 deletions firestore/src/main/credentials_provider_desktop.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class FirebaseCppCredentialsProvider
void GetToken(
firestore::credentials::TokenListener<firestore::credentials::AuthToken>
listener) override;
void InvalidateToken() override;

private:
void AddAuthStateListener();
Expand Down Expand Up @@ -109,14 +108,6 @@ class FirebaseCppCredentialsProvider
int token_generation = 0;
};
std::shared_ptr<Contents> contents_;

// Affects the next `GetToken` request; if `true`, the token will be refreshed
// even if it hasn't expired yet.
bool force_refresh_token_ = false;

// Provided by the user code; may be an empty function.
firestore::credentials::CredentialChangeListener<firestore::credentials::User>
change_listener_;
};

} // namespace firestore
Expand Down

0 comments on commit 11505cc

Please sign in to comment.