Add macOS as an OS type

PiperOrigin-RevId: 561959449
This commit is contained in:
Nick Bourdakos
2023-09-01 08:19:11 -07:00
committed by Copybara-Service
parent b7628b098b
commit aa0c06257f
3 changed files with 18 additions and 2 deletions
+1
View File
@@ -120,6 +120,7 @@ cc_library(
"//internal/network:__subpackages__",
"//internal/platform:__pkg__",
"//internal/platform/implementation:__subpackages__",
"//location/nearby/analytics/cpp:__subpackages__",
"//location/nearby/cpp/sharing:__subpackages__",
"//third_party/nearby/sharing:__subpackages__",
],
@@ -68,7 +68,15 @@ api::DeviceInfo::DeviceType DeviceInfo::GetDeviceType() const {
#endif
}
api::DeviceInfo::OsType DeviceInfo::GetOsType() const { return api::DeviceInfo::OsType::kIos; }
api::DeviceInfo::OsType DeviceInfo::GetOsType() const {
#if TARGET_OS_OSX
return api::DeviceInfo::OsType::kMacOS;
#elif TARGET_OS_IPHONE
return api::DeviceInfo::OsType::kIos;
#else
return api::DeviceInfo::OsType::kUnknown;
#endif
}
std::optional<std::u16string> DeviceInfo::GetFullName() const { return std::nullopt; }
std::optional<std::u16string> DeviceInfo::GetGivenName() const { return std::nullopt; }
@@ -29,7 +29,14 @@ class DeviceInfo {
public:
enum class ScreenStatus { kUndetermined = 0, kLocked, kUnlocked };
enum class DeviceType { kUnknown = 0, kPhone, kTablet, kLaptop };
enum class OsType { kUnknown = 0, kAndroid, kChromeOs, kIos, kWindows };
enum class OsType {
kUnknown = 0,
kAndroid,
kChromeOs,
kIos,
kWindows,
kMacOS
};
virtual ~DeviceInfo() = default;