mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Pure Refactor: move filtering logic into AdvertisementFilter class
- this decouples filtering logic from advertisement decoding logic in preparation for introducing a Rust backed impl of AdvertisementDecoder - this change is only a refactor and does not change functionality in any way PiperOrigin-RevId: 618978564
This commit is contained in:
@@ -57,19 +57,12 @@ class AdvertisementDecoder {
|
||||
AddBannedDataTypes();
|
||||
}
|
||||
|
||||
static std::vector<CredentialSelector> GetCredentialSelectors(
|
||||
const ScanRequest& scan_request);
|
||||
|
||||
// Returns a list of Data Elements decoded from the advertisement.
|
||||
// Returns an error if the advertisement is misformatted or if it couldn't be
|
||||
// decrypted.
|
||||
absl::StatusOr<Advertisement> DecodeAdvertisement(
|
||||
absl::string_view advertisement);
|
||||
|
||||
// Returns true if the decoded advertisement in `data_elements` matches the
|
||||
// filters in `scan_request`.
|
||||
bool MatchesScanFilter(const std::vector<DataElement>& data_elements);
|
||||
|
||||
private:
|
||||
// Decrypts data elements stored inside encrypted `elem` and appends them to
|
||||
// `decoded_advertisement_`.
|
||||
@@ -81,10 +74,6 @@ class AdvertisementDecoder {
|
||||
const std::vector<internal::SharedCredential>& credentials,
|
||||
absl::string_view salt, absl::string_view data_elements);
|
||||
void AddBannedDataTypes();
|
||||
bool MatchesScanFilter(const std::vector<DataElement>& data_elements,
|
||||
const PresenceScanFilter& filter);
|
||||
bool MatchesScanFilter(const std::vector<DataElement>& data_elements,
|
||||
const LegacyPresenceScanFilter& filter);
|
||||
|
||||
ScanRequest scan_request_;
|
||||
absl::flat_hash_map<IdentityType, std::vector<internal::SharedCredential>>*
|
||||
|
||||
Reference in New Issue
Block a user