forked from qt-creator/qt-creator
iOS: Move app URL gathering from devicectl to a function
And add a test to document what we expect from devicectl. Change-Id: I2f5312ebadef60239b77308acb7114f1d55143b4 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -83,4 +83,17 @@ expected_str<QMap<QString, QString>> parseDeviceInfo(const QByteArray &rawOutput
|
||||
return make_unexpected(QLatin1String("Device is not handled by devicectl"));
|
||||
}
|
||||
|
||||
Utils::expected_str<QUrl> parseAppInfo(const QByteArray &rawOutput, const QString &bundleIdentifier)
|
||||
{
|
||||
const Utils::expected_str<QJsonValue> result = parseDevicectlResult(rawOutput);
|
||||
if (!result)
|
||||
return make_unexpected(result.error());
|
||||
const QJsonArray apps = (*result)["apps"].toArray();
|
||||
for (const QJsonValue &app : apps) {
|
||||
if (app["bundleIdentifier"].toString() == bundleIdentifier)
|
||||
return QUrl(app["url"].toString());
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace Ios::Internal
|
||||
|
||||
Reference in New Issue
Block a user