mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Fix issues getting marked as opened because android minimum current page is 1
This commit is contained in:
parent
08cbb88891
commit
19e45ef9de
@ -998,7 +998,7 @@ void DBHelper::updateFromRemoteClient(qulonglong libraryId, const ComicInfo &com
|
||||
QSqlDatabase::removeDatabase(connectionName);
|
||||
}
|
||||
|
||||
QMap<qulonglong, QList<ComicDB>> DBHelper::updateFromRemoteClient(const QMap<qulonglong, QList<ComicInfo>> &comics)
|
||||
QMap<qulonglong, QList<ComicDB>> DBHelper::updateFromRemoteClient(const QMap<qulonglong, QList<ComicInfo>> &comics, bool clientSendsHasBeenOpened)
|
||||
{
|
||||
QMap<qulonglong, QList<ComicDB>> moreRecentComics;
|
||||
|
||||
@ -1050,7 +1050,11 @@ QMap<qulonglong, QList<ComicDB>> DBHelper::updateFromRemoteClient(const QMap<qul
|
||||
|
||||
comic.info.read = comic.info.read || comicInfo.read;
|
||||
|
||||
comic.info.hasBeenOpened = comic.info.hasBeenOpened || comicInfo.currentPage > 0;
|
||||
if (clientSendsHasBeenOpened) {
|
||||
comic.info.hasBeenOpened = comic.info.hasBeenOpened || comicInfo.hasBeenOpened; // android
|
||||
} else {
|
||||
comic.info.hasBeenOpened = comic.info.hasBeenOpened || comicInfo.currentPage > 0; // ios (legacy)
|
||||
}
|
||||
|
||||
if (comic.info.lastTimeOpened.toULongLong() < comicInfo.lastTimeOpened.toULongLong() && comicInfo.lastTimeOpened.toULongLong() > 0)
|
||||
comic.info.lastTimeOpened = comicInfo.lastTimeOpened;
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
static void setComicAsReading(qulonglong libraryId, const ComicInfo &comicInfo);
|
||||
[[deprecated("Server v1")]] static void updateFromRemoteClient(qulonglong libraryId, const ComicInfo &comicInfo);
|
||||
static void updateReadingRemoteProgress(const ComicInfo &comicInfo, QSqlDatabase &db);
|
||||
static QMap<qulonglong, QList<ComicDB>> updateFromRemoteClient(const QMap<qulonglong, QList<ComicInfo>> &comics);
|
||||
static QMap<qulonglong, QList<ComicDB>> updateFromRemoteClient(const QMap<qulonglong, QList<ComicInfo>> &comics, bool clientSendsHasBeenOpened);
|
||||
static void updateFromRemoteClientWithHash(const QList<ComicInfo> &comics);
|
||||
static void renameLabel(qulonglong id, const QString &name, QSqlDatabase &db);
|
||||
static void renameList(qulonglong id, const QString &name, QSqlDatabase &db);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user