feat(reading-session): return session type in the per-book session list

Include whether each session was spent reading, listening to text to speech or listening to audio,
so clients can tell Read Along listening on an EPUB apart from reading it. The column was already
stored; only the per-book list left it out. Unknown stored values read as reading.

The field is optional and additive: released iOS builds ignore it, and the iOS reading timeline
treats it as optional and falls back to the file format on servers without it. The web client does
not read it yet.
This commit is contained in:
neon
2026-10-04 06:13:23 +00:00
parent 1adab58d4b
commit 74d4a669df
4 changed files with 47 additions and 1 deletions
+6
View File
@@ -6,6 +6,9 @@ export type ReadingSessionSource = (typeof READING_SESSION_SOURCES)[number];
export const CLIENT_READING_SESSION_SOURCES = ["ios", "watchos", "android"] as const;
export type ClientReadingSessionSource = (typeof CLIENT_READING_SESSION_SOURCES)[number];
export const READING_SESSION_TYPES = ["read", "tts", "listen"] as const;
export type ReadingSessionType = (typeof READING_SESSION_TYPES)[number];
export interface BookReadingSession {
id: number;
bookFileId: number | null;
@@ -19,6 +22,9 @@ export interface BookReadingSession {
// The reading attempt this session was recorded against, when one was open at the time.
// Sessions logged before attempts existed, or outside any attempt, carry null.
attemptId: number | null;
// How the session was spent: reading the text, listening to text to speech, or listening to
// audio. Optional because servers before this field omit it; clients fall back to the format.
sessionType?: ReadingSessionType;
}
export interface BookReadingSourceSlice {