Device Info
Summary: Utility class to obtain device information. Reviewed By: antonk52 Differential Revision: D39054479 fbshipit-source-id: 9e237e2a45cf46ceb5fb8fd8a9da5d87837e61b6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
446bb042d0
commit
69df1ee362
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "FlipperReactDeviceInfo.h"
|
||||||
|
|
||||||
|
#include <winrt/Windows.ApplicationModel.h>
|
||||||
|
#include <winrt/Windows.Security.ExchangeActiveSyncProvisioning.h>
|
||||||
|
|
||||||
|
using namespace winrt::Windows::Foundation;
|
||||||
|
|
||||||
|
namespace facebook {
|
||||||
|
namespace flipper {
|
||||||
|
|
||||||
|
std::string FlipperReactDeviceInfo::getDevice() {
|
||||||
|
try {
|
||||||
|
return winrt::to_string(
|
||||||
|
winrt::Windows::Security::ExchangeActiveSyncProvisioning::
|
||||||
|
EasClientDeviceInformation()
|
||||||
|
.SystemProductName());
|
||||||
|
} catch (...) {
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::string FlipperReactDeviceInfo::getDeviceId() {
|
||||||
|
try {
|
||||||
|
return winrt::to_string(
|
||||||
|
winrt::Windows::Security::ExchangeActiveSyncProvisioning::
|
||||||
|
EasClientDeviceInformation()
|
||||||
|
.SystemSku());
|
||||||
|
} catch (...) {
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::string FlipperReactDeviceInfo::getHost() {
|
||||||
|
return "localhost";
|
||||||
|
}
|
||||||
|
std::string FlipperReactDeviceInfo::getAppName() {
|
||||||
|
return winrt::to_string(
|
||||||
|
winrt::Windows::ApplicationModel::Package::Current().DisplayName());
|
||||||
|
}
|
||||||
|
std::string FlipperReactDeviceInfo::getAppId() {
|
||||||
|
return winrt::to_string(
|
||||||
|
winrt::Windows::ApplicationModel::Package::Current().Id().Name());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace flipper
|
||||||
|
} // namespace facebook
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace facebook {
|
||||||
|
namespace flipper {
|
||||||
|
|
||||||
|
class FlipperReactDeviceInfo {
|
||||||
|
public:
|
||||||
|
std::string getDevice();
|
||||||
|
std::string getDeviceId();
|
||||||
|
std::string getHost();
|
||||||
|
std::string getAppName();
|
||||||
|
std::string getAppId();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace flipper
|
||||||
|
} // namespace facebook
|
||||||
Reference in New Issue
Block a user