Commit afd14285 authored by Volker Krause's avatar Volker Krause
Browse files

Track expiry time for generic Apple Wallet passes as well

parent 2603551c
Pipeline #185697 passed with stage
in 2 minutes and 24 seconds
......@@ -483,6 +483,7 @@ bool ApplicationController::importGenericPkPass(const KItinerary::ExtractorDocum
wrapper.setName(pass->description());
wrapper.setPkpassPassTypeIdentifier(pass->passTypeIdentifier());
wrapper.setPkpassSerialNumber(pass->serialNumber());
wrapper.setValidUntil(pass->expirationDate());
QScopedValueRollback importLocker(m_importLock, true);
m_pkPassMgr->importPassFromData(pass->rawData());
......
......@@ -5,12 +5,15 @@
#include "genericpkpass.h"
#include <QDateTime>
class GenericPkPassPrivate : public QSharedData
{
public:
QString name;
QString pkpassPassTypeIdentifier;
QString pkpassSerialNumber;
QDateTime validUntil;
};
// TODO replace this by the use of the KITINERARY_XXX implementation macros,
......@@ -56,9 +59,20 @@ void GenericPkPass::setPkpassSerialNumber(const QString &value)
d->pkpassSerialNumber = value;
}
QDateTime GenericPkPass::validUnitl() const
{
return d->validUntil;
}
void GenericPkPass::setValidUntil(const QDateTime &value)
{
d.detach();
d->validUntil = value;
}
bool GenericPkPass::operator==(const GenericPkPass &other) const
{
return d->pkpassPassTypeIdentifier == other.pkpassPassTypeIdentifier() && d->pkpassSerialNumber == other.pkpassSerialNumber();
return d->pkpassPassTypeIdentifier == other.pkpassPassTypeIdentifier() && d->pkpassSerialNumber == other.pkpassSerialNumber() && d->validUntil == other.validUnitl();
}
#include "moc_genericpkpass.cpp"
......@@ -17,6 +17,7 @@ class GenericPkPass
KITINERARY_PROPERTY(QString, name, setName)
KITINERARY_PROPERTY(QString, pkpassPassTypeIdentifier, setPkpassPassTypeIdentifier)
KITINERARY_PROPERTY(QString, pkpassSerialNumber, setPkpassSerialNumber)
KITINERARY_PROPERTY(QDateTime, validUnitl, setValidUntil)
private:
QExplicitlySharedDataPointer<GenericPkPassPrivate> d;
};
......
......@@ -41,6 +41,9 @@ QDateTime PassManager::Entry::validUntil() const
if (JsonLd::isA<KItinerary::ProgramMembership>(data)) {
return data.value<KItinerary::ProgramMembership>().validUntil();
}
if (JsonLd::isA<GenericPkPass>(data)) {
return data.value<GenericPkPass>().validUnitl();
}
if (JsonLd::isA<KItinerary::Ticket>(data)) {
return data.value<KItinerary::Ticket>().validUntil();
}
......
Supports Markdown
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