refactor(library): call the import callback onAddBook

Everything it drives now says add a book, and onOpenBook is what the
stats screen calls the callback that opens one to read. Two different
things wearing one name.

Also stop telling the reader to run --empty when the missing F-Droid
screenshot is one the tour takes itself.
This commit is contained in:
Chmouel Boudjnah 2026-08-22 13:09:07 +02:00
parent 7d8c6e6646
commit a31772209f
3 changed files with 13 additions and 9 deletions

View file

@ -699,7 +699,7 @@ private fun LibraryRoute(
LibraryScreen(
state = state,
onOpenBook = { openBook.launch(arrayOf("application/epub+zip")) },
onAddBook = { openBook.launch(arrayOf("application/epub+zip")) },
onAddFolder = { addFolder.launch(null) },
onBookSelected = { book ->
book.openableUrl?.let {

View file

@ -151,7 +151,7 @@ import com.chmouel.liseur.domain.seriesKey
@Composable
fun LibraryScreen(
state: LibraryUiState,
onOpenBook: () -> Unit,
onAddBook: () -> Unit,
onAddFolder: () -> Unit,
onBookSelected: (Book) -> Unit,
onOpenSettings: () -> Unit,
@ -478,7 +478,7 @@ fun LibraryScreen(
},
onClick = {
addMenuOpen = false
onOpenBook()
onAddBook()
},
)
// Below the line because it is a
@ -615,7 +615,7 @@ fun LibraryScreen(
)
state.books.isEmpty() && state.libraryIsEmpty -> EmptyLibrary(
onAddBook = onOpenBook,
onAddBook = onAddBook,
onAddFolder = onAddFolder,
onConnectServer = onConnectServer,
modifier = Modifier.fillMaxSize(),

View file

@ -989,11 +989,15 @@ i=1
# theme is worth more as a line in the description than as one picture
# in six that does not match the other five.
for name in 01-library 02-reading 13-series 04-typography 16-empty-library 06-highlights; do
# 16-empty-library is the one the tour cannot take, since it needs a
# shelf with nothing on it. It comes from --empty and is committed,
# so say so rather than fail on a missing file.
[[ -f "$OUT_DIR/$name.png" ]] ||
die "no $OUT_DIR/$name.png: capture it with hack/screenshots --empty"
if [[ ! -f "$OUT_DIR/$name.png" ]]; then
# Only 16-empty-library comes from somewhere other than the run
# that just finished, so it is the only one where the fix is a
# different command rather than a step that went wrong.
if [[ $name == 16-empty-library ]]; then
die "no $OUT_DIR/$name.png: capture it with hack/screenshots --empty"
fi
die "no $OUT_DIR/$name.png: the step that takes it did not run"
fi
cp "$OUT_DIR/$name.png" "$FASTLANE_DIR/$i.png"
note "$FASTLANE_DIR/$i.png"
i=$((i + 1))