View on Strava

.. when data is downloaded from strava we now set the metadata
   tag "StravaID" to the id of the activity on Strava.

.. On RideSummary a link is added at the bottom to view the activity
   on Strava if the "StravaID" is set.

.. if the user clicks on the link the summary is replaced with the
   strava page for the ride:
      e.g. https://www.strava.com/activities/962515512

.. this is part of a couple of updates to comply with the Strava
   guidelines for consumption of the Strava v3 API, see:
      https://developers.strava.com/guidelines/
This commit is contained in:
Mark Liversedge
2020-01-17 12:30:29 +00:00
parent 372dd5c144
commit cc91520e76
2 changed files with 9 additions and 0 deletions

View File

@@ -1517,6 +1517,12 @@ RideSummaryWindow::htmlSummary()
summary += " <li>" + i.next();
summary += "</ul>";
}
// add link to view on Strava if was downloaded from there (StravaID will be set)
if (ridesummary && rideItem && rideItem->ride() && rideItem->ride()->getTag("StravaID","") != "") {
summary += "<a href=\"https://www.strava.com/activities/" + rideItem->ride()->getTag("StravaID","") + "\">View on Strava</a>";
}
summary += "<br></center>";
return summary;

View File

@@ -859,6 +859,9 @@ Strava::prepareResponse(QByteArray* data)
// 1s samples with start time
RideFile *ride = new RideFile(starttime.toUTC(), 1.0f);
// set strava id in metadata (to show where we got it from - to add View on Strava link in Summary view
if (!each["id"].isNull()) ride->setTag("StravaID", QString("%1").arg(each["id"].toVariant().toULongLong()));
// what sport?
if (!each["type"].isNull()) {
QString stype = each["type"].toString();