diff --git a/nymea-app/platformintegration/ios/platformhelperios.cpp b/nymea-app/platformintegration/ios/platformhelperios.cpp index abbd28b0..5b6b7d0a 100644 --- a/nymea-app/platformintegration/ios/platformhelperios.cpp +++ b/nymea-app/platformintegration/ios/platformhelperios.cpp @@ -30,6 +30,7 @@ #include #include #include +#include PlatformHelperIOS::PlatformHelperIOS(QObject *parent) : PlatformHelper(parent) { @@ -61,7 +62,21 @@ void PlatformHelperIOS::hideSplashScreen() QString PlatformHelperIOS::machineHostname() const { - return QSysInfo::machineHostName(); + const QString hostName = QSysInfo::machineHostName(); + if (!hostName.isEmpty() && hostName != "localhost") { + return hostName; + } + + // Fall back to something user visible when the OS only reports "localhost". + const QString model = deviceModel(); + const QString manufacturer = deviceManufacturer(); + if (model.isEmpty()) { + return manufacturer; + } + if (manufacturer.isEmpty() || model.startsWith(manufacturer)) { + return model; + } + return manufacturer + " " + model; } QString PlatformHelperIOS::device() const @@ -87,6 +102,14 @@ QString PlatformHelperIOS::deviceSerial() const QString PlatformHelperIOS::deviceModel() const { + struct utsname systemInfo; + if (uname(&systemInfo) == 0) { + const QString machine = QString::fromUtf8(systemInfo.machine); + if (!machine.isEmpty()) { + return machine; + } + } + return QSysInfo::prettyProductName(); }