Fix issues getting marked as opened because android minimum current page is 1

This commit is contained in:
Luis Ángel San Martín
2024-02-02 13:04:38 +01:00
parent 08cbb88891
commit 19e45ef9de
4 changed files with 17 additions and 7 deletions

View File

@ -37,14 +37,18 @@ void SyncControllerV2::service(HttpRequest &request, HttpResponse &response)
auto libraries = DBHelper::getLibraries();
bool clientSendsHasBeenOpened = false;
foreach (QString comicInfo, data) {
QList<QString> comicInfoProgress = comicInfo.split("\t");
if (comicInfoProgress.length() >= 8) {
if (comicInfoProgress.length() >= 9) {
if (comicInfoProgress.at(0) != "u") {
continue;
}
clientSendsHasBeenOpened = true;
auto libraryUuid = QUuid(comicInfoProgress.at(1));
if (!libraryUuid.isNull()) {
auto libraryId = libraries.getIdFromUuid(libraryUuid);
@ -66,7 +70,9 @@ void SyncControllerV2::service(HttpRequest &request, HttpResponse &response)
lastTimeOpened = comicInfoProgress.at(6).toULong();
info.lastTimeOpened = lastTimeOpened;
info.read = comicInfoProgress.at(7).toInt();
info.hasBeenOpened = comicInfoProgress.at(7).toInt();
info.read = comicInfoProgress.at(8).toInt();
if (!comics.contains(libraryId)) {
comics[libraryId] = QList<ComicInfo>();
@ -121,7 +127,7 @@ void SyncControllerV2::service(HttpRequest &request, HttpResponse &response)
QJsonArray items;
if (!comics.isEmpty()) {
auto moreRecentComicsFound = DBHelper::updateFromRemoteClient(comics);
auto moreRecentComicsFound = DBHelper::updateFromRemoteClient(comics, clientSendsHasBeenOpened);
foreach (qulonglong libraryId, moreRecentComicsFound.keys()) {
auto libraryUuid = DBHelper::getLibraries().getLibraryIdFromLegacyId(libraryId);

View File

@ -112,6 +112,7 @@ QJsonObject YACReaderServerDataHelper::comicToJSON(const qulonglong libraryId, c
variantToJson("title", QMetaType::QString, comic.info.title, json);
variantToJson("universal_number", QMetaType::QString, comic.info.number, json);
variantToJson("last_time_opened", QMetaType::LongLong, comic.info.lastTimeOpened, json);
json["has_been_opened"] = comic.info.hasBeenOpened;
variantToJson("added", QMetaType::LongLong, comic.info.added, json);
@ -163,7 +164,6 @@ QJsonObject YACReaderServerDataHelper::fullComicToJSON(const qulonglong libraryI
variantToJson("comic_vine_id", QMetaType::QString, comic.info.comicVineID, json);
variantToJson("original_cover_size", QMetaType::QString, comic.info.originalCoverSize, json);
json["edited"] = comic.info.edited;
json["has_been_opened"] = comic.info.hasBeenOpened;
json["bookmark1"] = comic.info.bookmark1;
json["bookmark2"] = comic.info.bookmark2;
json["bookmark3"] = comic.info.bookmark3;