mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Fix Metadata downloading callback issue
PiperOrigin-RevId: 508767628
This commit is contained in:
committed by
Copybara-Service
parent
b204aed4cb
commit
1d01973d17
@@ -43,7 +43,8 @@ void FastPairMetadataDownloader::Run() {
|
||||
void FastPairMetadataDownloader::Succeed(DeviceMetadata& device_metadata) {
|
||||
DCHECK(was_run_);
|
||||
DCHECK(success_callback_);
|
||||
|
||||
NEARBY_LOGS(INFO) << __func__ << ": Fast Pair download of "
|
||||
<< device_metadata.GetDetails().name() << " succeeded.";
|
||||
std::move(success_callback_)(device_metadata);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,13 +90,12 @@ void FastPairMetadataDownloaderImpl::CallAccessServer(
|
||||
repository_->GetObservedDevice(
|
||||
request,
|
||||
[&](const proto::GetObservedDeviceResponse& response) {
|
||||
NEARBY_LOGS(INFO) << "Maggie: " << __func__
|
||||
<< "Name: " << response.device().name();
|
||||
NEARBY_LOGS(INFO) << "Maggie: " << __func__
|
||||
NEARBY_LOGS(INFO) << __func__ << "Name: " << response.device().name();
|
||||
NEARBY_LOGS(INFO) << __func__
|
||||
<< "Image URL: " << response.device().image_url();
|
||||
|
||||
NEARBY_LOGS(INFO)
|
||||
<< "Maggie: " << __func__ << "StringNotification: "
|
||||
<< __func__ << "StringNotification: "
|
||||
<< response.strings().initial_notification_description();
|
||||
OnAccessServerSuccess(response);
|
||||
},
|
||||
|
||||
@@ -44,17 +44,8 @@ FastPairRepositoryImpl::FastPairRepositoryImpl(
|
||||
void FastPairRepositoryImpl::GetDeviceMetadata(
|
||||
absl::string_view hex_model_id,
|
||||
DeviceMetadataCallback callback) {
|
||||
callback_ = std::move(callback);
|
||||
downloader_ = FastPairMetadataDownloaderImpl::Factory::Create(
|
||||
hex_model_id, repository_factory_.get(),
|
||||
[&](DeviceMetadata& device_metadata) {
|
||||
NEARBY_LOGS(INFO) << __func__ << ": Fast Pair download of "
|
||||
<< device_metadata.GetDetails().name()
|
||||
<< " succeeded.";
|
||||
DCHECK(callback_);
|
||||
std::move(callback_)(device_metadata);
|
||||
},
|
||||
[&]() {
|
||||
hex_model_id, repository_factory_.get(), std::move(callback), []() {
|
||||
NEARBY_LOGS(INFO) << __func__
|
||||
<< ": Fast Pair Metadata download failed.";
|
||||
});
|
||||
|
||||
@@ -44,7 +44,6 @@ class FastPairRepositoryImpl : public FastPairRepository {
|
||||
std::unique_ptr<FastPairMetadataDownloader> downloader_;
|
||||
std::unique_ptr<network::HttpClientFactory> http_factory_;
|
||||
std::unique_ptr<FastPairMetadataRepositoryFactory> repository_factory_;
|
||||
DeviceMetadataCallback callback_;
|
||||
};
|
||||
} // namespace fastpair
|
||||
} // namespace nearby
|
||||
|
||||
Reference in New Issue
Block a user