Commit 16d72eac authored by Volker Krause's avatar Volker Krause
Browse files

Cleanup handling of pass update URLs

parent b387eba4
......@@ -36,6 +36,7 @@
#include <QLocale>
#include <QTextCodec>
#include <QImage>
#include <QUrl>
using namespace KPkPass;
......@@ -373,9 +374,19 @@ QString Pass::authenticationToken() const
return d->passObj.value(QLatin1String("authenticationToken")).toString();
}
QString Pass::webServiceUrl() const
QUrl Pass::webServiceUrl() const
{
return d->passObj.value(QLatin1String("webServiceURL")).toString();
return QUrl(d->passObj.value(QLatin1String("webServiceURL")).toString());
}
QUrl Pass::passUpdateUrl() const
{
QUrl url(webServiceUrl());
if (!url.isValid()) {
return {};
}
url.setPath(url.path() + QLatin1String("/v1/passes/") + passTypeIdentifier() + QLatin1Char('/') + serialNumber());
return url;
}
QVector<Barcode> Pass::barcodes() const
......
......@@ -33,6 +33,7 @@
class QByteArray;
class QString;
class QUrl;
namespace KPkPass {
......@@ -64,9 +65,6 @@ class KPKPASS_EXPORT Pass : public QObject
Q_PROPERTY(QColor labelColor READ labelColor CONSTANT)
Q_PROPERTY(QString logoText READ logoText CONSTANT)
Q_PROPERTY(QString authenticationToken READ authenticationToken CONSTANT)
Q_PROPERTY(QString webServiceUrl READ webServiceUrl CONSTANT)
// needs to be QVariantList just for QML (Grantlee would also work with QVector<Field>
Q_PROPERTY(QVariantList barcodes READ barcodesVariant CONSTANT)
Q_PROPERTY(QVariantList auxiliaryFields READ auxiliaryFieldsVariant CONSTANT)
......@@ -127,7 +125,11 @@ public:
// web service keys
QString authenticationToken() const;
QString webServiceUrl() const;
QUrl webServiceUrl() const;
/** Pass update URL.
* @see https://developer.apple.com/library/content/documentation/PassKit/Reference/PassKit_WebService/WebService.html
*/
QUrl passUpdateUrl() const;
QVector<Field> auxiliaryFields() const;
QVector<Field> backFields() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment