refactor(mobile): expose cover hashes instead of booleans for cache busting
Replace hasCover/hasAudiobookCover booleans with the actual coverHash/audiobookCoverHash strings. The client uses these as URL query params so cover updates bust the CachedNetworkImage cache.
This commit is contained in:
@@ -45,8 +45,8 @@ public class MobileBookDetail {
|
||||
private String primaryFileType;
|
||||
private List<String> fileTypes;
|
||||
private List<MobileBookFile> files;
|
||||
private Boolean hasCover;
|
||||
private Boolean hasAudiobookCover;
|
||||
private String coverHash;
|
||||
private String audiobookCoverHash;
|
||||
|
||||
private EpubProgress epubProgress;
|
||||
private PdfProgress pdfProgress;
|
||||
|
||||
@@ -28,6 +28,6 @@ public class MobileBookSummary {
|
||||
private Instant lastReadTime;
|
||||
private Float readProgress;
|
||||
private String primaryFileType;
|
||||
private Boolean hasCover;
|
||||
private Boolean hasAudiobookCover;
|
||||
private String coverHash;
|
||||
private String audiobookCoverHash;
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ public interface MobileBookMapper {
|
||||
@Mapping(target = "lastReadTime", source = "progress.lastReadTime")
|
||||
@Mapping(target = "readProgress", source = "progress", qualifiedByName = "mapReadProgress")
|
||||
@Mapping(target = "primaryFileType", source = "book", qualifiedByName = "mapPrimaryFileType")
|
||||
@Mapping(target = "hasCover", source = "book", qualifiedByName = "mapHasCover")
|
||||
@Mapping(target = "hasAudiobookCover", source = "book", qualifiedByName = "mapHasAudiobookCover")
|
||||
@Mapping(target = "coverHash", source = "book.bookCoverHash")
|
||||
@Mapping(target = "audiobookCoverHash", source = "book.audiobookCoverHash")
|
||||
MobileBookSummary toSummary(BookEntity book, UserBookProgressEntity progress);
|
||||
|
||||
@Mapping(target = "id", source = "book.id")
|
||||
@@ -60,8 +60,8 @@ public interface MobileBookMapper {
|
||||
@Mapping(target = "shelves", source = "book.shelves", qualifiedByName = "mapShelves")
|
||||
@Mapping(target = "readProgress", source = "progress", qualifiedByName = "mapReadProgress")
|
||||
@Mapping(target = "primaryFileType", source = "book", qualifiedByName = "mapPrimaryFileType")
|
||||
@Mapping(target = "hasCover", source = "book", qualifiedByName = "mapHasCover")
|
||||
@Mapping(target = "hasAudiobookCover", source = "book", qualifiedByName = "mapHasAudiobookCover")
|
||||
@Mapping(target = "coverHash", source = "book.bookCoverHash")
|
||||
@Mapping(target = "audiobookCoverHash", source = "book.audiobookCoverHash")
|
||||
@Mapping(target = "fileTypes", source = "book", qualifiedByName = "mapFileTypes")
|
||||
@Mapping(target = "files", source = "book", qualifiedByName = "mapFiles")
|
||||
@Mapping(target = "epubProgress", source = "progress", qualifiedByName = "mapEpubProgress")
|
||||
@@ -98,18 +98,6 @@ public interface MobileBookMapper {
|
||||
return "/api/books/" + book.getId() + "/cover";
|
||||
}
|
||||
|
||||
@Named("mapHasCover")
|
||||
default Boolean mapHasCover(BookEntity book) {
|
||||
if (book == null) return false;
|
||||
return book.getBookCoverHash() != null && !book.getBookCoverHash().isBlank();
|
||||
}
|
||||
|
||||
@Named("mapHasAudiobookCover")
|
||||
default Boolean mapHasAudiobookCover(BookEntity book) {
|
||||
if (book == null) return false;
|
||||
return book.getAudiobookCoverHash() != null && !book.getAudiobookCoverHash().isBlank();
|
||||
}
|
||||
|
||||
@Named("mapShelves")
|
||||
default List<MobileShelfSummary> mapShelves(Set<ShelfEntity> shelves) {
|
||||
if (shelves == null || shelves.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user