Use machine name for advertisement when user not logged in.

PiperOrigin-RevId: 690479544
This commit is contained in:
Francis Tsui
2024-10-27 22:52:21 -07:00
committed by Copybara-Service
parent 17e2bb8ed3
commit b4d11ecbda
28 changed files with 59 additions and 517 deletions
-15
View File
@@ -22,7 +22,6 @@ cc_library(
],
hdrs = [
"nearby_share_prefs.h",
"nearby_share_profile_info_provider.h",
"nearby_share_switches.h",
],
visibility = ["//visibility:public"],
@@ -35,20 +34,6 @@ cc_library(
],
)
cc_library(
name = "test_support",
testonly = True,
srcs = [
"fake_nearby_share_profile_info_provider.cc",
],
hdrs = [
"fake_nearby_share_profile_info_provider.h",
"nearby_share_profile_info_provider.h",
],
visibility = ["//visibility:public"],
deps = [],
)
cc_library(
name = "enum",
hdrs = ["nearby_share_enums.h"],
@@ -1,35 +0,0 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "sharing/common/fake_nearby_share_profile_info_provider.h"
#include <optional>
#include <string>
namespace nearby {
namespace sharing {
FakeNearbyShareProfileInfoProvider::FakeNearbyShareProfileInfoProvider() =
default;
FakeNearbyShareProfileInfoProvider::~FakeNearbyShareProfileInfoProvider() =
default;
std::optional<std::string> FakeNearbyShareProfileInfoProvider::GetGivenName()
const {
return given_name_;
}
} // namespace sharing
} // namespace nearby
@@ -1,46 +0,0 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef THIRD_PARTY_NEARBY_SHARING_COMMON_FAKE_NEARBY_SHARE_PROFILE_INFO_PROVIDER_H_
#define THIRD_PARTY_NEARBY_SHARING_COMMON_FAKE_NEARBY_SHARE_PROFILE_INFO_PROVIDER_H_
#include <optional>
#include <string>
#include "sharing/common/nearby_share_profile_info_provider.h"
namespace nearby {
namespace sharing {
class FakeNearbyShareProfileInfoProvider
: public NearbyShareProfileInfoProvider {
public:
FakeNearbyShareProfileInfoProvider();
~FakeNearbyShareProfileInfoProvider() override;
// NearbyShareProfileInfoProvider:
std::optional<std::string> GetGivenName() const override;
void set_given_name(const std::optional<std::string>& given_name) {
given_name_ = given_name;
}
private:
std::optional<std::string> given_name_;
};
} // namespace sharing
} // namespace nearby
#endif // THIRD_PARTY_NEARBY_SHARING_COMMON_FAKE_NEARBY_SHARE_PROFILE_INFO_PROVIDER_H_
@@ -1,35 +0,0 @@
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef THIRD_PARTY_NEARBY_SHARING_COMMON_NEARBY_SHARE_PROFILE_INFO_PROVIDER_H_
#define THIRD_PARTY_NEARBY_SHARING_COMMON_NEARBY_SHARE_PROFILE_INFO_PROVIDER_H_
#include <optional>
#include <string>
namespace nearby {
namespace sharing {
class NearbyShareProfileInfoProvider {
public:
NearbyShareProfileInfoProvider() = default;
virtual ~NearbyShareProfileInfoProvider() = default;
// Returns UTF-8 encoded given name of current account.
// Returns absl::nullopt if a valid given name cannot be returned.
virtual std::optional<std::string> GetGivenName() const = 0;
};
} // namespace sharing
} // namespace nearby
#endif // THIRD_PARTY_NEARBY_SHARING_COMMON_NEARBY_SHARE_PROFILE_INFO_PROVIDER_H_