From 5faa395f241f804677773e00c2f1c8795aaefa58 Mon Sep 17 00:00:00 2001 From: Janusz Sobczak Date: Fri, 4 Nov 2022 15:25:08 -0700 Subject: [PATCH] Change enum PublicCredentialType to enum class. PiperOrigin-RevId: 486243753 --- .../platform/implementation/credential_callbacks.h | 10 +++++++++- presence/implementation/credential_manager_impl.cc | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/internal/platform/implementation/credential_callbacks.h b/internal/platform/implementation/credential_callbacks.h index eaa2e363..c9df5238 100644 --- a/internal/platform/implementation/credential_callbacks.h +++ b/internal/platform/implementation/credential_callbacks.h @@ -16,6 +16,7 @@ #define THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_IMPLEMENTATION_CREDENTIAL_CALLBACKS_H_ #include +#include #include #include @@ -37,7 +38,7 @@ struct CredentialSelector { ::nearby::internal::IdentityType identity_type; }; -enum PublicCredentialType { +enum class PublicCredentialType { kLocalPublicCredential = 1, kRemotePublicCredential = 2, }; @@ -62,6 +63,13 @@ struct GetPublicCredentialsResultCallback { credentials_fetched_cb; std::function get_credentials_failed_cb; }; + +inline std::ostream& operator<<(std::ostream& os, + const PublicCredentialType& credential_type) { + return os << "PublicCredentialType(" << static_cast(credential_type) + << ")"; +} + } // namespace presence } // namespace nearby diff --git a/presence/implementation/credential_manager_impl.cc b/presence/implementation/credential_manager_impl.cc index 85cd70c7..9e9624b7 100644 --- a/presence/implementation/credential_manager_impl.cc +++ b/presence/implementation/credential_manager_impl.cc @@ -296,7 +296,8 @@ absl::StatusOr CredentialManagerImpl::DecryptDataElements( .identity_type = internal::IDENTITY_TYPE_PUBLIC, }; ExceptionOr> credentials = - GetPublicCredentialsSync(selector, kRemotePublicCredential, kTimeout); + GetPublicCredentialsSync( + selector, PublicCredentialType::kRemotePublicCredential, kTimeout); if (!credentials.ok()) { return absl::UnavailableError("Failed to fetch credentials"); }