Commit 96544010 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

snap: Use AppStreamIntegration for snap reviews as well

This way we won't fetch several times
parent e610cd18
......@@ -21,7 +21,7 @@
#include "SnapBackend.h"
#include "SnapTransaction.h"
#include "SnapResource.h"
#include "appstream/OdrsReviewsBackend.h"
#include "appstream/AppStreamIntegration.h"
#include <resources/StandardBackendUpdater.h>
#include <resources/SourcesModel.h>
#include <Category/Category.h>
......@@ -68,7 +68,7 @@ private:
SnapBackend::SnapBackend(QObject* parent)
: AbstractResourcesBackend(parent)
, m_updater(new StandardBackendUpdater(this))
, m_reviews(new OdrsReviewsBackend()) //TODO: use AppStreamIntegration
, m_reviews(AppStreamIntegration::global()->reviews())
{
connect(m_reviews.data(), &OdrsReviewsBackend::ratingsReady, this, [this] {
m_reviews->emitRatingFetched(this, kTransform<QList<AbstractResource*>>(m_resources.values(), [] (AbstractResource* r) { return r; }));
......
......@@ -24,7 +24,6 @@
#include <resources/AbstractResource.h>
#include <resources/AbstractResourcesBackend.h>
#include <QVariantList>
#include <QScopedPointer>
#include <Snapd/Client>
#include <functional>
......@@ -68,7 +67,7 @@ private:
QHash<QString, SnapResource*> m_resources;
StandardBackendUpdater* m_updater;
QScopedPointer<OdrsReviewsBackend> m_reviews;
QSharedPointer<OdrsReviewsBackend> m_reviews;
bool m_valid = true;
bool m_fetching = false;
......
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