From a51f00b808ccc5bd2e46b99803e99f626d16ab20 Mon Sep 17 00:00:00 2001 From: Sthocs Date: Sat, 27 Apr 2019 01:46:43 +0200 Subject: [PATCH] Bump version + check favs for dead stations --- harbour-bikeme.pro | 2 +- qml/pages/About.qml | 2 +- qml/pages/Favourites.qml | 14 ++++++++++++++ rpm/harbour-bikeme.changes | 5 +++++ rpm/harbour-bikeme.yaml | 5 +++-- src/parser/russia/parsermoscow.cpp | 3 ++- 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/harbour-bikeme.pro b/harbour-bikeme.pro index aeab2a8..3fa55ba 100644 --- a/harbour-bikeme.pro +++ b/harbour-bikeme.pro @@ -94,7 +94,7 @@ OTHER_FILES += harbour-bikeme.desktop \ qml/pages/db.js \ translations/*.ts -SAILFISHAPP_ICONS = 86x86 108x108 128x128 256x256 +SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172 256x256 CONFIG += sailfishapp_i18n diff --git a/qml/pages/About.qml b/qml/pages/About.qml index 1b3e6f1..029e395 100644 --- a/qml/pages/About.qml +++ b/qml/pages/About.qml @@ -105,7 +105,7 @@ Regular users: Save your favourites stations and see their status directly on th horizontalAlignment: Text.AlignHCenter font.pixelSize: Theme.fontSizeExtraSmall color: Theme.secondaryColor - text: "2014 - 2018 Sthocs" + text: "2014 - 2019 Sthocs" } Item { diff --git a/qml/pages/Favourites.qml b/qml/pages/Favourites.qml index 8d9fa77..e7402e6 100644 --- a/qml/pages/Favourites.qml +++ b/qml/pages/Favourites.qml @@ -10,6 +10,7 @@ Page { property string coverLabel: "Favourites" property int nbRefreshingStations: 0 + property int nbFavs: 0 property City city @@ -17,6 +18,18 @@ Page { id: stations onStationsLoaded: { + // Quick fix to remove invalid favs from DB + if (favouritesModel.count != nbFavs) { + console.log('Cleaning favourites DB...'); + var favs = Db.getFavourites(city.identifier); + favs.forEach(function(fav) { + if (!stations.exists(fav.number)) { + console.log('Removing invalid station ' + fav.number); + Db.removeFavourite(city.identifier, fav.number); + } + }); + } + if (!withDetails) { favouritesModel.refreshAll(); } @@ -201,6 +214,7 @@ Page { Component.onCompleted: { var favs = Db.getFavourites(city.identifier); + nbFavs = favs.length; var numbers = []; favs.forEach(function(fav) { numbers.push(fav.number); diff --git a/rpm/harbour-bikeme.changes b/rpm/harbour-bikeme.changes index 508311f..a7fc95a 100644 --- a/rpm/harbour-bikeme.changes +++ b/rpm/harbour-bikeme.changes @@ -1,3 +1,8 @@ +* Thu Mar 15 2018 Sthocs 0.9.2-1 +- New translation: Dutch (Belgium) +- Fixed Moscow stations names +- Removed dead systems (Valence (fr) and Lorient) + * Thu Mar 15 2018 Sthocs 0.9.1-1 - New translations: Dutch and Brazilian Portuguese - Blinking "center position" icon while there is no GPS fix diff --git a/rpm/harbour-bikeme.yaml b/rpm/harbour-bikeme.yaml index 60dc121..33ba684 100644 --- a/rpm/harbour-bikeme.yaml +++ b/rpm/harbour-bikeme.yaml @@ -1,6 +1,6 @@ Name: harbour-bikeme Summary: Find a bike with your Sailfish OS device! -Version: 0.9.1 +Version: 0.9.2 Release: 1 Group: Qt/Qt URL: https://openrepos.net/users/sthocs @@ -27,8 +27,9 @@ Requires: - qt5-qtdeclarative-import-positioning - sailfishsilica-qt5 >= 0.10.9 Files: +- '%defattr(644,root,root,-)' - '%{_datadir}/icons/hicolor/*/apps/%{name}.png' - '%{_datadir}/applications/%{name}.desktop' - '%{_datadir}/%{name}' -- '%{_bindir}' +- '%attr(755,-,-) %{_bindir}' PkgBR: [] diff --git a/src/parser/russia/parsermoscow.cpp b/src/parser/russia/parsermoscow.cpp index 205bd6b..44abd44 100644 --- a/src/parser/russia/parsermoscow.cpp +++ b/src/parser/russia/parsermoscow.cpp @@ -16,7 +16,8 @@ QList ParserMoscow::parseStationsList(QString allStations, bool withDe QJsonObject stationJson = stationsArray[i].toObject(); Station* station = new Station(); station->number = stationJson["Id"].toString().toInt(); - station->name = stationJson["Address"].toString(); // stationJson["Name"].toString(); + station->name = stationJson["Name"].toString().length() > 0 ? // 2019-04-26: Name field is still present but empty... + stationJson["Name"].toString() : stationJson["Address"].toString(); station->address = stationJson["Address"].toString(); QJsonObject position = stationJson["Position"].toObject(); QGeoCoordinate coord(position["Lat"].toDouble(), position["Lon"].toDouble());