Skip to content

Commit

Permalink
fix(Kobo): Sync fix lastModied date
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusa87 committed Aug 12, 2024
1 parent bda5e70 commit 73e2fc8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Kobo/Response/SyncResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private function createReadingState(Book $book): array
'PriorityTimestamp' => $this->syncToken->maxLastCreated($book->getCreated(), $this->syncToken->currentDate),

'StatusInfo' => [
'LastModified' => $book->getLastInteraction($this->kobo->getUser())?->getUpdated(),
'LastModified' => $this->syncToken->maxLastModified($book->getLastInteraction($this->kobo->getUser())?->getUpdated(), $this->getLastBookmarkDate($book), $this->syncToken->currentDate),
'Status' => match ($this->isReadingFinished($book)) {
true => SyncResponse::READING_STATUS_FINISHED,
false => SyncResponse::READING_STATUS_IN_PROGRESS,
Expand Down Expand Up @@ -288,4 +288,9 @@ private function createBookmark(?BookmarkUser $bookMark): array

return array_filter($values); // Remove null values
}

private function getLastBookmarkDate(Book $book): ?\DateTimeInterface
{
return $this->kobo->getUser()->getBookmarkForBook($book)?->getUpdated();
}
}

0 comments on commit 73e2fc8

Please sign in to comment.