diff --git a/AGENTS.md b/AGENTS.md index 77ab5da4..d7931640 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -42,6 +42,11 @@ CrossInk 2.x bridge and the later stable BookSync releases become available (`xt - **UI calls BookSync's library interface.** Binding on the KOReader plugin, Android companion and Xteink overlay. Maintainer rule 2026-11-26, verbatim: "all API calls the UI makes should be to our own interface so that we can plumb BookOrbit / Grimmory separately." + Personal reading data follows the maintainer ruling (2026-11-26), verbatim: + "I would build it so that all UI calls for that kind of data go through our interface, which then chooses where to fetch / aggregate data from. We start with on-device info and can extend to server but the ui never needs to change." + Request a personal-data kind, never a source. Companion providers declare capabilities, + merge in registration order and deduplicate neutral identities; missing/failing providers + are skipped. Future remote providers register inside their server adapter, never in UI. UI code calls only BookSync's library interface; BookOrbit and Grimmory are adapters behind it. Gate server-dependent features on adapter capabilities, never server identity. Filters are neutral objects that adapters translate, with local fallback on the cached catalog. @@ -80,6 +85,9 @@ CrossInk 2.x bridge and the later stable BookSync releases become available (`xt ## Screen and widget performance budgets +Highlight and A year ago also inherit one-row/16 KiB budgets. Companion providers own +sidecar parsing, calendar selection, aggregation and dedupe; Lua never scans personal data. + Local optional widgets inherit one-row/16 KiB budgets too: companion-owned vocabulary selection and reading messages; native frontlight scalars only in Library. Paint never scans local history. diff --git a/ROADMAP.md b/ROADMAP.md index 75ad0e91..94d6dd60 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -18,7 +18,7 @@ CrossInk 2.x only; 1.6 is retired). | Outcome | Platforms | Status | | Finish the server-free catalog cutover: companion-owned copies, grouping, settings recommendations and end-of-book snapshots/outboxes. | Android (Xteink deferred under Android-first ruling) | building on feature/0.12 (F12-Q2 step 4) | |---|---|---| -| Word of the day, local Reading buddy and hardware Light picker widgets; Highlight and A year ago await authorized server snapshots. | Android; X4 Pro/X4/X3 deferred to firmware | building (device acceptance pending) | +| Word of the day, local Reading buddy, hardware Light, Highlight and A year ago picker widgets through companion projections and a source-aggregating personal-data interface. | Android; X4 Pro/X4/X3 deferred to firmware | building (device acceptance pending) | | Server-free Android catalog operations: companion-owned covers, refresh, copies, recommendations and end-of-book snapshots and commands. | Android; X4 Pro, X4, X3 later under Android-first ruling | building: covers, mirror planning and query/store reads migrated; copies, grouping, recommendations and finish pending | | Independent optional account, sync and OPDS logins, encrypted credentials, origin-aware sign-out and account-wide reading statistics through the library interface. | Android; X4 Pro, X4, X3 later | building (Android F12-K foundation and F12-N plugin screens implemented; device acceptance and firmware follow) | | Configure one Book list widget with presets, paged counted sources and local Custom filters in the Home editor. | Android building; X4 Pro, X4, X3 follow Android | building (approved design rev 16; device acceptance pending) | diff --git a/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/DeviceLibrary.kt b/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/DeviceLibrary.kt index b09abdec..1ea8d534 100644 --- a/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/DeviceLibrary.kt +++ b/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/DeviceLibrary.kt @@ -8,16 +8,16 @@ import java.security.MessageDigest * scans and parses native sidecars; LibraryReadModel still bounds every published window. */ class DeviceLibrary(private val roots: List) : ServerAdapter { override val id = "device" - companion object { const val OWNER = "device-local" } - private val books by lazy { - roots.distinctBy { it.canonicalPath }.flatMap { root -> - if (!root.isDirectory) emptyList() else root.walkTopDown().onEnter { + companion object { + const val OWNER = "device-local" + fun files(roots: List): Sequence = roots.distinctBy { it.canonicalPath }.asSequence().flatMap { root -> + if (!root.isDirectory) emptySequence() else root.walkTopDown().onEnter { BulkWork.checkpoint() Places.inside(it,listOf(root)) != null && !java.nio.file.Files.isSymbolicLink(it.toPath()) && !it.name.endsWith(".sdr") - }.filter { it.isFile && it.extension.lowercase() in setOf("epub","pdf","mobi","azw","azw3","fb2","djvu","cbz","cbr","txt") && - Places.inside(it,listOf(root)) != null }.map(::book).toList() - }.distinctBy { it["key"] } + }.filter { it.isFile && it.extension.lowercase() in setOf("epub","pdf","mobi","azw","azw3","fb2","djvu","cbz","cbr","txt") && Places.inside(it,listOf(root)) != null } + }.distinctBy { it.canonicalPath } } + private val books by lazy { files(roots).map(::book).toList() } private fun sidecar(file: File) = File(file.parentFile,"${file.nameWithoutExtension}.sdr") private fun book(file: File): Map { BulkWork.checkpoint() diff --git a/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/DevicePersonalReading.kt b/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/DevicePersonalReading.kt new file mode 100644 index 00000000..36e62cae --- /dev/null +++ b/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/DevicePersonalReading.kt @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: MIT +package net.fledgewing.orbitcompanion + +import java.io.File +import java.time.Instant +import java.time.ZoneId + +/** Read-only borrowed device data; executed solely on the companion worker. */ +class DevicePersonalReading(private val roots: List, private val statistics: File, + private val open: (File) -> Sql = { AndroidSql(it, readOnly = true) }) : PersonalReadingSource { + override val capabilities = PersonalReading.KINDS + override fun read(kind: String, now: Long): List = when(kind) { + "highlight" -> highlights() + "yearago" -> if (!statistics.isFile) emptyList() else open(statistics).use { yearago(it, now) } + else -> emptyList() + } + private fun highlights(): List { + val out = linkedMapOf() + for (book in DeviceLibrary.files(roots).sortedBy { it.canonicalPath }) { + BulkWork.checkpoint() + val file = File(book.parentFile, "${book.nameWithoutExtension}.sdr/metadata.${book.extension}.lua") + if (!file.isFile || file.length() > 1048576 || Places.inside(file, roots) == null) continue + val data = try { + val literal = file.readText(Charsets.ISO_8859_1).replaceFirst(Regex("\\A(?:--[^\\n]*\\n)?\\s*return\\s+"), "") + LuaValue.parse(literal.toByteArray(Charsets.ISO_8859_1)) as? Map<*, *> + } catch (e: Exception) { if(e is InterruptedException) throw e; null } ?: continue + val title = (data["doc_props"] as? Map<*, *>)?.get("title") as? String ?: LuaValue.str(book.nameWithoutExtension) + val annotations = when(val a=data["annotations"]) { is List<*> -> a; is Map<*,*> -> a.entries.sortedBy { it.key.toString() }.map { it.value }; else -> emptyList() } + for (raw in annotations) { + val a = raw as? Map<*, *> ?: continue + val passage = a["text"] as? String ?: continue + if (passage.isBlank() || a["pos0"] == null) continue // exclude bookmarks and notes without a passage + val identity = book.canonicalPath + ":" + a["pos0"] + ":" + passage + out.putIfAbsent(identity, PersonalReadingRecord(identity, mapOf( + "passage" to LuaValue.boundedText(LuaValue.utf8(passage), 900), + "source" to LuaValue.boundedText(LuaValue.utf8(title), 160), + "book" to mapOf("title" to LuaValue.boundedText(LuaValue.utf8(title),160), "local_path" to LuaValue.str(book.canonicalPath))))) + } + } + return out.values.toList() + } + companion object { + /** Same calendar day one year back in the device zone; Feb 29 clamps to Feb 28. + * SQL aggregates every visit, but decodes only the selected book's single display row. */ + fun yearago(db: Sql, now: Long, zone: ZoneId = ZoneId.systemDefault()): List { + val day = Instant.ofEpochSecond(now).atZone(zone).toLocalDate().minusYears(1) + val start = day.atStartOfDay(zone).toEpochSecond() + val end = day.plusDays(1).atStartOfDay(zone).toEpochSecond() + return db.query("""WITH visits AS ( + SELECT p.id_book,p.page,p.start_time,p.rowid AS visit_id, + MIN(?,p.start_time+MIN(p.duration,86400))-MAX(?,p.start_time) AS seconds + FROM page_stat_data p WHERE p.duration>0 AND p.start_time>0 AND p.start_time?) + SELECT b.id,substr(b.title,1,160),SUM(p.seconds), + (SELECT q.page FROM visits q WHERE q.id_book=b.id ORDER BY q.start_time DESC,q.visit_id DESC LIMIT 1) + FROM visits p JOIN book b ON b.id=p.id_book GROUP BY b.id + ORDER BY SUM(p.seconds) DESC,b.id LIMIT 1""",end,start,end,start) { + val minutes = (it.long(2) ?: 0)/60 + val page = it.long(3) + PersonalReadingRecord("history:${it.long(0)}:$day", mapOf("source" to "On this reader", + "book_title" to LuaValue.str(it.text(1) ?: "Unknown book"), "minutes" to minutes, "days_read" to 1, + "stop_page" to page, "summary" to LuaValue.str("$minutes min · 1 day · " + (page?.let { n -> "stopped at p. $n" } ?: "Position unavailable")), + "date" to day.toString())) + } + } + } +} diff --git a/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/LibraryReadModel.kt b/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/LibraryReadModel.kt index e7c5cea4..7a6d99dc 100644 --- a/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/LibraryReadModel.kt +++ b/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/LibraryReadModel.kt @@ -15,6 +15,7 @@ class LibraryReadModel( private val accountStats: (String) -> Map<*, *>? = { null }, private val vocabulary: () -> java.io.File = { java.io.File(SleepScreen.dir().parentFile, "vocabulary_builder.sqlite3") }, private val adapter: ServerAdapter? = null, + private val personalDevice: (() -> PersonalReadingSource)? = null, ) { companion object { const val MAX_BYTES = 16384 @@ -33,6 +34,11 @@ class LibraryReadModel( java.io.File(store.root.parentFile?.parentFile?.parentFile ?: store.root,it) } + DeviceStorage.downloadRoot(store.root)) else adapter ?: ServerAdapters.forStore(store, clock = clock, fallbackReadingStats = fallbackReadingStats, accountState = accountState, accountStats = accountStats) + val personal by lazy { + val roots = DeviceStorage.folders.map { java.io.File(store.root.parentFile?.parentFile?.parentFile ?: store.root,it) } + DeviceStorage.downloadRoot(store.root) + PersonalReading(listOf(personalDevice?.invoke() ?: DevicePersonalReading(roots, java.io.File(store.root.parentFile,"statistics.sqlite3"))) + + if (local) emptyList() else projection.personalReadingSources(owner)) + } val localStats by lazy { readingStats() } val storage by lazy { DeviceStorage(store, projection) } val power by lazy { battery() } @@ -49,6 +55,7 @@ class LibraryReadModel( "storage.summary" -> storage.summary(owner,(args["exclude_path"] as? String)?.let(LuaValue::utf8),(args["current_folder"] as? String)?.let(LuaValue::utf8)) "reader.controls" -> ReaderControls.project(args["native"] as? Map<*, *> ?: emptyMap()) + "personal.reading" -> personal.window(args["kind"] as? String ?: "", clock()) "reading.stats" -> stats "local.word" -> LocalWidgets.word(vocabulary(), clock()) "local.buddy" -> LocalWidgets.buddy(localStats) diff --git a/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/PersonalReading.kt b/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/PersonalReading.kt new file mode 100644 index 00000000..f5f845f2 --- /dev/null +++ b/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/PersonalReading.kt @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: MIT +package net.fledgewing.orbitcompanion + +/** Worker-only providers return neutral records. Registration order wins duplicate identities. + * Providers may read saved data only: acquisition is a separate worker operation. */ +interface PersonalReadingSource { + val capabilities: Set + fun read(kind: String, now: Long): List +} +data class PersonalReadingRecord(val identity: String, val fields: Map) + +class PersonalReading(private val sources: List) { + companion object { val KINDS = setOf("highlight", "yearago") } + fun window(kind: String, now: Long): Map { + require(kind in KINDS) + val merged = linkedMapOf() + var succeeded = false + for (source in sources) { + if (kind !in source.capabilities) continue + try { + val records = source.read(kind, now) + records.forEach { merged.putIfAbsent(it.identity, it) } + succeeded = true + } catch (e: Exception) { if (e is InterruptedException) throw e } + } + val day = java.time.Instant.ofEpochSecond(now).atZone(java.time.ZoneId.systemDefault()).toLocalDate().toEpochDay() + val records = merged.values.toList() + // Round-robin over a stable pool: no repetition within a complete cycle, no process state. + val selected = if (records.isEmpty()) null else records[if (kind == "highlight") Math.floorMod(day, records.size.toLong()).toInt() else 0] + val result = (selected?.fields ?: emptyMap()) + mapOf("state" to if (selected != null) "ready" else if (succeeded) "empty" else "error", + "message" to LuaValue.str(if (kind == "yearago") "No reading from a year ago on this device yet" else "Save a highlight while reading."), + "row_count" to 1, "freshness" to mapOf("saved" to succeeded)) + return if (LuaValue.encode(result).size <= LibraryReadModel.MAX_BYTES) result + else mapOf("state" to "error", "row_count" to 1, "message" to "Reading data exceeds this widget's budget") + } +} diff --git a/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/ServerAdapter.kt b/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/ServerAdapter.kt index 7c4e0a74..fc64f5a3 100644 --- a/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/ServerAdapter.kt +++ b/android/companion/app/src/main/java/net/fledgewing/orbitcompanion/ServerAdapter.kt @@ -6,6 +6,7 @@ import java.io.File * normalize protocol data before returning it; unsupported operations are explicit. Renderers * use LibraryReadModel, never this transport-facing interface. */ interface ServerAdapter { + fun personalReadingSources(owner: String): List = emptyList() fun recommendedSettings(): List> = emptyList() val id: String fun project(owner: String, request: Map<*, *>): Map = unsupported() diff --git a/android/companion/app/src/test/java/net/fledgewing/orbitcompanion/LocalWidgetsTest.kt b/android/companion/app/src/test/java/net/fledgewing/orbitcompanion/LocalWidgetsTest.kt index 26915e9d..36b4cd40 100644 --- a/android/companion/app/src/test/java/net/fledgewing/orbitcompanion/LocalWidgetsTest.kt +++ b/android/companion/app/src/test/java/net/fledgewing/orbitcompanion/LocalWidgetsTest.kt @@ -20,17 +20,33 @@ class LocalWidgetsTest { } val adapter=object:ServerAdapter { override val id="fixture" + override fun personalReadingSources(owner:String)=listOf(object:PersonalReadingSource { + override val capabilities=setOf("highlight","yearago") + override fun read(kind:String,now:Long)=listOf(PersonalReadingRecord("toy",mapOf("passage" to "Toy saved passage"))) + }) override fun project(owner:String,request:Map<*,*>):Map = error("no server projection") } var reads=0 val model=LibraryReadModel(store,{86400},{},readingStats={reads++; mapOf("state" to "empty")}, - vocabulary={java.io.File(dir,"missing.sqlite3")},adapter=adapter) + vocabulary={java.io.File(dir,"missing.sqlite3")},adapter=adapter,personalDevice={object:PersonalReadingSource { + override val capabilities=PersonalReading.KINDS + override fun read(kind:String,now:Long)=emptyList() + }}) val requests=listOf("local.word","local.buddy","local.light").map { op -> String(LuaValue.encode(mapOf("op" to op,"limit" to 1,"bytes" to 16384)),Charsets.ISO_8859_1) } + val personalRequests=listOf("highlight","yearago").map { kind -> + String(LuaValue.encode(mapOf("op" to "personal.reading","kind" to kind,"limit" to 1,"bytes" to 16384)),Charsets.ISO_8859_1) + } + assertTrue(model.publish("fixture",personalRequests)) + val personal=sql.query("SELECT body FROM library_views WHERE owner=?","fixture") { LuaValue.parse(it.bytes(0)!!) as Map<*,*> } + assertEquals(2,personal.size); assertTrue(personal.all { it["passage"]=="Toy saved passage" }) + assertTrue(model.publish(DeviceLibrary.OWNER,personalRequests)) + val localPersonal=sql.query("SELECT body FROM library_views WHERE owner=?",DeviceLibrary.OWNER) { LuaValue.parse(it.bytes(0)!!) as Map<*,*> } + assertTrue(localPersonal.all { it["state"]=="empty" && it["passage"]==null }) assertTrue(model.publish("fixture",requests)); assertEquals(1,reads) val rows=sql.query("SELECT body FROM library_views") { it.bytes(0)!! } - assertEquals(3,rows.size) + assertEquals(7,rows.size) for(body in rows) { assertTrue(body.size<=16384) val result=LuaValue.parse(body) as Map<*,*> @@ -39,7 +55,7 @@ class LocalWidgetsTest { assertFalse(model.publish("another-owner",requests)) assertTrue(model.publish(DeviceLibrary.OWNER,requests)) assertEquals(2,reads) - assertEquals(3,sql.query("SELECT body FROM library_views WHERE owner=?",DeviceLibrary.OWNER) { it.bytes(0)!! }.size) + assertEquals(5,sql.query("SELECT body FROM library_views WHERE owner=?",DeviceLibrary.OWNER) { it.bytes(0)!! }.size) } } finally { dir.deleteRecursively() } } @Test fun vocabularyIsOneBoundedDailyRecordWithContextAndSource() { diff --git a/android/companion/app/src/test/java/net/fledgewing/orbitcompanion/PersonalReadingTest.kt b/android/companion/app/src/test/java/net/fledgewing/orbitcompanion/PersonalReadingTest.kt new file mode 100644 index 00000000..3878355f --- /dev/null +++ b/android/companion/app/src/test/java/net/fledgewing/orbitcompanion/PersonalReadingTest.kt @@ -0,0 +1,73 @@ +// SPDX-License-Identifier: MIT +package net.fledgewing.orbitcompanion + +import org.junit.Assert.* +import org.junit.Test +import java.io.File +import java.nio.file.Files +import java.time.Instant +import java.time.ZoneOffset + +class PersonalReadingTest { + private fun toy(vararg records: PersonalReadingRecord) = object: PersonalReadingSource { + override val capabilities=PersonalReading.KINDS + override fun read(kind: String, now: Long)=records.toList() + } + private fun rec(id:String, text:String=id)=PersonalReadingRecord(id,mapOf("passage" to text)) + @Test fun orderedMergeDedupeFailureAndCapabilityIsolation() { + val broken=object:PersonalReadingSource { + override val capabilities=PersonalReading.KINDS + override fun read(kind:String,now:Long):List = error("unavailable") + } + val absent=object:PersonalReadingSource { + override val capabilities=emptySet() + override fun read(kind:String,now:Long):List = error("must skip") + } + val registry=PersonalReading(listOf(absent,toy(rec("a","first")),broken,toy(rec("a","duplicate"),rec("b","second")))) + val values=(0..3).map { registry.window("highlight",it*86400L+43200)["passage"] } + assertEquals(setOf("first","second"),values.toSet()); assertEquals(values[0],values[2]) + assertEquals("ready",PersonalReading(listOf(broken,toy(rec("a")))).window("highlight",1)["state"]) + assertEquals("error",PersonalReading(listOf(broken)).window("yearago",1)["state"]) + assertEquals("empty",PersonalReading(listOf(toy())).window("yearago",1)["state"]) + assertEquals("error",PersonalReading(listOf(toy(rec("a","x".repeat(17000))))).window("highlight",1)["state"]) + } + @Test fun sidecarDailySelectionSurvivesRestartAndChangesWithoutRepeats() { + val root=Files.createTempDirectory("personal-fixture").toFile() + try { + File(root,"moon.epub").writeText("fixture") + File(root,"moon.sdr/metadata.epub.lua").apply { + parentFile!!.mkdirs() + writeText("-- synthetic\nreturn "+String(LuaValue.encode(mapOf("doc_props" to mapOf("title" to "The Moon"),"annotations" to + listOf(mapOf("pos0" to "a","text" to "First passage"),mapOf("pos0" to "b","text" to "Second passage"),mapOf("text" to "Bookmark")))) ,Charsets.ISO_8859_1)) + } + fun window(day:Long)=PersonalReading(listOf(DevicePersonalReading(listOf(root),File(root,"missing")))).window("highlight",day*86400+43200) + assertEquals(window(100),window(100)) + assertNotEquals(window(100)["passage"],window(101)["passage"]) + assertEquals(window(100)["passage"],window(102)["passage"]) + assertTrue(LuaValue.encode(window(100)).size<=16384) + assertEquals(1,window(100)["row_count"]) + assertEquals("empty",PersonalReading(listOf(DevicePersonalReading(listOf(root),File(root,"missing")))).window("yearago",1)["state"]) + } finally { root.deleteRecursively() } + } + @Test fun historyUsesCalendarDayMinutesAndLatestStopAndLeapClamp() { + val root=Files.createTempDirectory("history-fixture").toFile() + try { JdbcSql(File(root,"stats.db")).use { db -> + db.exec("CREATE TABLE book(id INTEGER,title TEXT)") + db.exec("CREATE TABLE page_stat_data(id_book INTEGER,page INTEGER,start_time INTEGER,duration INTEGER)") + val now=Instant.parse("2024-02-29T12:00:00Z").epochSecond + assertTrue(DevicePersonalReading.yearago(db,now,ZoneOffset.UTC).isEmpty()) + db.exec("INSERT INTO book VALUES(1,'The Moon')") + val start=Instant.parse("2023-02-28T00:00:00Z").epochSecond + db.exec("INSERT INTO page_stat_data VALUES(1,7,?,120)",start+1) + db.exec("INSERT INTO page_stat_data VALUES(1,9,?,180)",start+600) + db.exec("INSERT INTO page_stat_data VALUES(1,99,?,999)",start+86400) + val row=DevicePersonalReading.yearago(db,now,ZoneOffset.UTC).single().fields + assertEquals(5L,row["minutes"]); assertEquals(1,row["days_read"]); assertEquals(9L,row["stop_page"]) + assertEquals("2023-02-28",row["date"]) + db.exec("INSERT INTO page_stat_data VALUES(1,6,?,120)",start-60) + db.exec("INSERT INTO page_stat_data VALUES(1,10,?,120)",start+86400-30) + val crossing=DevicePersonalReading.yearago(db,now,ZoneOffset.UTC).single().fields + assertEquals(6L,crossing["minutes"]); assertEquals(10L,crossing["stop_page"]) + } } finally { root.deleteRecursively() } + } +} diff --git a/android/koreader/orbit.koplugin/ko/local_widgets.lua b/android/koreader/orbit.koplugin/ko/local_widgets.lua index 5e63f8b9..3f095e37 100644 --- a/android/koreader/orbit.koplugin/ko/local_widgets.lua +++ b/android/koreader/orbit.koplugin/ko/local_widgets.lua @@ -1,6 +1,7 @@ -- SPDX-License-Identifier: AGPL-3.0-or-later -- Local native access stays behind Library; the host alone requests projections. function Library.localWidgetNeed(id) + if id=="highlight" or id=="yearago" then return {op="personal.reading",kind=id,limit=1} end local need={op="local."..id,limit=1} if id=="light" then local device=require("device") @@ -34,7 +35,28 @@ function LocalWidgets.render(p,snapshot,dispatch,rect) local pad=scale(10) local c=HomeWidgets.canvas(w,h) HomeWidgets.text(c,p.widget=="light" and plan.ready and plan.message or _(plan.title),pad,pad,w-2*pad,18,false,true) - if p.widget=="word" and plan.word then + if (p.widget=="highlight" or p.widget=="yearago") and plan.ready then + local content=p.widget=="highlight" and plan.passage or plan.book_title + if p.widget=="highlight" and p.h>1 then + local u=HomeWidgets.ui() + HomeWidgets.put(c,require("ui/widget/textboxwidget"):new{text=content or "",face=u.Font:getFace("cfont",16), + width=w-2*pad,height=math.max(scale(20),h-2*pad-scale(120)),height_adjust=false},pad,pad+scale(30)) + else + HomeWidgets.text(c,content or "",pad,pad+scale(30),w-2*pad,p.h==1 and 13 or 16) + end + if p.h>1 then + HomeWidgets.text(c,plan.summary or plan.source or "On this reader",pad,p.widget=="highlight" and h-pad-scale(76) or pad+scale(65),w-2*pad,13) + if p.widget=="highlight" and plan.book then + HomeWidgets.button(c,_("Open book ›"),pad,h-pad-scale(50),w-2*pad,scale(50),function() dispatch("book",plan.book) end) + end + elseif p.widget=="yearago" then + HomeWidgets.text(c,plan.summary or "",pad,pad+scale(53),w-2*pad,12) + elseif p.widget=="highlight" and plan.book then + table.remove(c) + HomeWidgets.text(c,plan.source or "On this reader",pad,pad+scale(22),w-2*pad,12) + HomeWidgets.button(c,content or _("Open book ›"),pad,h-pad-scale(50),w-2*pad,scale(50),function() dispatch("book",plan.book) end) + end + elseif p.widget=="word" and plan.word then if p.h==1 then HomeWidgets.button(c,plan.word.." ›",pad,h-pad-scale(50),w-2*pad,scale(50),function() dispatch("word-lookup",plan.word) end) else @@ -59,7 +81,7 @@ function LocalWidgets.render(p,snapshot,dispatch,rect) finish() return HomeWidgets.ui().Frame:new{padding=0,margin=0,bordersize=1,c} end -for _,id in ipairs({"word","light","buddy"}) do +for _,id in ipairs({"word","light","buddy","highlight","yearago"}) do local name=id HomeWidgets.register(name,LocalWidgets.render,function() return Library.localWidgetNeed(name) end) WidgetRegistry[name].renderers={['android-tablet']=LocalWidgets.render} diff --git a/android/koreader/orbit.koplugin/logic/budgets.lua b/android/koreader/orbit.koplugin/logic/budgets.lua index af71f088..7138f1e6 100644 --- a/android/koreader/orbit.koplugin/logic/budgets.lua +++ b/android/koreader/orbit.koplugin/logic/budgets.lua @@ -28,7 +28,7 @@ Budgets.screens["editor-picker"].drawNodes = 24 Budgets.screens["filter-picker"] = budget(24, 16384, 50) Budgets.libraryWindow = budget(32, 32768, 30) for _, id in ipairs({"continue-reading", "booklist", "lists", "library", "battery", "this-week", - "year-in-reading", "when-you-read", "reading-records", "clock", "word", "light", "buddy"}) do + "year-in-reading", "when-you-read", "reading-records", "clock", "word", "light", "buddy", "highlight", "yearago"}) do Budgets.widgets[id] = budget(id == "booklist" and 12 or id == "lists" and 8 or 1, 16384, 50) end -- Library summary + local storage summary are two materialized rows in one batch. diff --git a/android/koreader/orbit.koplugin/logic/local_widgets.lua b/android/koreader/orbit.koplugin/logic/local_widgets.lua index 7069ef94..ce9d64b3 100644 --- a/android/koreader/orbit.koplugin/logic/local_widgets.lua +++ b/android/koreader/orbit.koplugin/logic/local_widgets.lua @@ -5,10 +5,11 @@ function LocalWidgetPlan.build(id,snapshot) local d=snapshot.data or {} local state=d.state or snapshot.state local ready=state=="ready" or state=="offline-with-data" - local fallback={loading="Loading…",error="Couldn't load this widget",empty=id=="word" and "Look up a word while reading." or id=="light" and "Frontlight unavailable on this reader" or "Your next chapter is waiting.", + local fallback={loading="Loading…",error="Couldn't load this widget",empty=id=="yearago" and "No reading from a year ago on this device yet" or id=="highlight" and "Save a highlight while reading." or id=="word" and "Look up a word while reading." or id=="light" and "Frontlight unavailable on this reader" or "Your next chapter is waiting.", ["offline-without-data"]="Not saved yet",["not-saved"]="Not saved yet",unavailable="Frontlight unavailable on this reader"} return {title=WidgetRegistry[id].name,state=state,ready=ready, message=ready and (d.message or "On this reader") or (fallback[state] or "Unavailable"), + passage=ready and d.passage,book=ready and d.book,book_title=ready and d.book_title,summary=ready and d.summary, word=ready and d.word,context=ready and d.context,source=ready and d.source, retry=state=="error" or state=="loading" or state=="offline-without-data" or state=="not-saved"} end diff --git a/android/koreader/orbit.koplugin/logic/widget_registry.lua b/android/koreader/orbit.koplugin/logic/widget_registry.lua index 58d39e89..0885ffe2 100644 --- a/android/koreader/orbit.koplugin/logic/widget_registry.lua +++ b/android/koreader/orbit.koplugin/logic/widget_registry.lua @@ -22,6 +22,11 @@ for _,id in ipairs({"word","light","buddy"}) do widget(id, "local."..id, {{2,1},{2,2}}, {{2,1}}) WidgetRegistry[id].localOnly=true end +for _,id in ipairs({"highlight","yearago"}) do + widget(id,"personal.reading",{{2,1},{2,2}},{{2,2}}) + WidgetRegistry[id].localOnly=true + WidgetRegistry[id].refreshSeconds=60 +end WidgetRegistry.word.refreshSeconds = 60 -- daily selection is companion-owned WidgetRegistry.clock.refreshSeconds = 60 -- host-owned refresh, only while visible -- The Library tile also displays local storage; both small needs share its budget and @@ -41,6 +46,8 @@ local descriptions={ ["year-in-reading"]={"Year in reading","A calendar of your reading days."}, ["when-you-read"]={"When you read","Your reading by hour of day."}, ["reading-records"]={"Reading records","Your reading streaks and records."}, + highlight={"Highlight of the day","A daily passage from your saved highlights."}, + yearago={"A year ago","Books and reading from this date last year."}, word={"Word of the day","A daily word from your KOReader vocabulary."}, light={"Light","Control this reader's frontlight."}, buddy={"Reading buddy","A reading message from activity on this reader."}, diff --git a/android/koreader/test/local_widget_flows.lua b/android/koreader/test/local_widget_flows.lua index b1f1e501..4d0b9887 100644 --- a/android/koreader/test/local_widget_flows.lua +++ b/android/koreader/test/local_widget_flows.lua @@ -21,6 +21,25 @@ return function(test,eq,ok,E,W,withHost) host:onClose(); host:onCloseWidget(); eq(E.Library.listener,nil) end) end) + test('personal widgets: Home batches both neutral kinds with no source selection',function() + withHost(function(batches) + local kinds={} + E.LibraryAdapter.read=function(raw) + local args=E.Cache.decode(raw) + if args.op=='capabilities' then return {},2 end + eq(args.op,'personal.reading'); eq(args.limit,1); eq(args.source,nil) + kinds[args.kind]=true + return {state='empty',row_count=1,freshness={saved=true}},100 + end + E.S.home_layout=E.Layout.default() + E.S.home_layout.pages={{id='personal',tab='Home',name='Personal',placements={ + {instance='h',widget='highlight',version=1,x=0,y=0,w=2,h=2,settings={}}, + {instance='y',widget='yearago',version=1,x=2,y=0,w=2,h=2,settings={}}}}} + local host=E.HomeHost.create(); E.HomeHost.active=host; W.shown={host} + ok(kinds.highlight and kinds.yearago); eq(#batches,1); eq(#batches[1],3) + eq(host.metrics.roundTrips,1); eq(host.metrics.spawns,0); eq(host.metrics.network,0) + end) + end) test('local widgets: signed-out pending snapshots keep local loading, not account setup',function() withHost(function() E.LibraryAdapter.read=function(raw) @@ -41,14 +60,14 @@ return function(test,eq,ok,E,W,withHost) end) test('local widgets: every size/state paints immutable data without reads; 50px actions',function() withHost(function() - for _,id in ipairs({'word','light','buddy'}) do + for _,id in ipairs({'word','light','buddy','highlight','yearago'}) do ok(E.HomeWidgets.renderers[id]) local offered=false for _,name in ipairs(E.HomeEditor.available({})) do if name==id then offered=true end end ok(offered,id..' offered by installed picker') for _,size in ipairs(E.WidgetRegistry[id].sizes['android-tablet']) do for _,state in ipairs({'ready','empty','loading','error','offline-with-data','offline-without-data','unavailable'}) do - local result={state=state,word='lantern',context='the lantern room',source='The Moon',message='Light · 40%',level=40, + local result={state=state,passage='A saved passage',book_title='The Moon',summary='12 min · 1 day · stopped at p. 9',book={title='The Moon',local_path='/Books/moon.epub'},word='lantern',context='the lantern room',source='The Moon',message='Light · 40%',level=40, freshness={saved=state~='offline-without-data'}} if state=='loading' then result.pending=true end if state=='error' then result.error='unavailable' end diff --git a/android/koreader/test/test_local_widgets.lua b/android/koreader/test/test_local_widgets.lua index 9f6c5fec..b27abdc8 100644 --- a/android/koreader/test/test_local_widgets.lua +++ b/android/koreader/test/test_local_widgets.lua @@ -4,11 +4,11 @@ return function(test,eq,ok,here,Cache) for _,file in ipairs({'logic/budgets.lua','logic/widget_registry.lua','logic/local_widgets.lua'}) do setfenv(assert(loadfile(here..'/../orbit.koplugin/'..file)),e)() end - for _,id in ipairs({'word','light','buddy'}) do + for _,id in ipairs({'word','light','buddy','highlight','yearago'}) do test('local widget: '..id..' state and contract',function() eq(#e.WidgetRegistry[id].sizes['android-tablet'],2) for _,state in ipairs({'ready','empty','loading','error','offline-with-data','offline-without-data','unavailable'}) do - local p=e.LocalWidgetPlan.build(id,{state=state,data={state=state,word='lantern',message='Local message'}}) + local p=e.LocalWidgetPlan.build(id,{state=state,data={state=state,passage='A saved passage',book_title='The Moon',summary='12 min · 1 day · stopped at p. 9',book={title='The Moon',local_path='/Books/moon.epub'},word='lantern',message='Local message'}}) eq(p.ready,state=='ready' or state=='offline-with-data'); ok(#p.message>0) eq(p.word,p.ready and 'lantern' or false) end diff --git a/docs/FEATURES.md b/docs/FEATURES.md index 88801c62..eaed2208 100644 --- a/docs/FEATURES.md +++ b/docs/FEATURES.md @@ -89,7 +89,7 @@ Counts include settings exposure as separate rows; they are not feature quality | Home editor Book list configuration (0.12 foundation; unreleased) | 🟡 One Book list renderer with friendly presets, settings, paged counted sources and local Custom filters; **deliberately deferred: real-device acceptance and release follow the Android 0.12 foundation**. [android/koreader/orbit.koplugin/ko/booklist_config.lua:3](../android/koreader/orbit.koplugin/ko/booklist_config.lua#L3) | ❌ Book list settings and sources follow Android; shared cfg and focus logic are ready for firmware integration; **deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware implementation follows**. [docs/design/booksync-home/DESIGN-NOTES.md:809](../docs/design/booksync-home/DESIGN-NOTES.md#L809) | ❌ Book list settings and sources follow Android; shared cfg and focus logic are ready for firmware integration; **deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware implementation follows**. [docs/design/booksync-home/DESIGN-NOTES.md:809](../docs/design/booksync-home/DESIGN-NOTES.md#L809) | ❌ Book list settings and sources follow Android; shared cfg and focus logic are ready for firmware integration; **deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware implementation follows**. [docs/design/booksync-home/DESIGN-NOTES.md:809](../docs/design/booksync-home/DESIGN-NOTES.md#L809) | | Companion-owned Android sync and durable lifecycle upgrade replay | ✅ (0.12 (feature branch; device acceptance pending)) Server-free plugin sync; checkpointed five-phase import, offline queue and consent. [android/companion/app/src/main/java/net/fledgewing/orbitcompanion/SyncOwner.kt:6](../android/companion/app/src/main/java/net/fledgewing/orbitcompanion/SyncOwner.kt#L6) | ❌ Existing firmware sync retained; companion cutover is Android-only; **deliberately deferred: maintainer authorized Android first; firmware adapter migration comes later**. [docs/design/booksync-home/F12-Q-NOTES.md:3](../docs/design/booksync-home/F12-Q-NOTES.md#L3) | ❌ Existing firmware sync retained; companion cutover is Android-only; **deliberately deferred: maintainer authorized Android first; firmware adapter migration comes later**. [docs/design/booksync-home/F12-Q-NOTES.md:3](../docs/design/booksync-home/F12-Q-NOTES.md#L3) | ❌ Existing firmware sync retained; companion cutover is Android-only; **deliberately deferred: maintainer authorized Android first; firmware adapter migration comes later**. [docs/design/booksync-home/F12-Q-NOTES.md:3](../docs/design/booksync-home/F12-Q-NOTES.md#L3) | | Owned Storage, Library storage figures, Collections and download folder (0.12 foundation; unreleased) | 🟡 Real StatFs capacity, tracked file/cache figures, patterned bar, confirmed local removal, Collections paging and folder selection; **deliberately deferred: real-device acceptance and release follow the Android 0.12 foundation**. [android/companion/app/src/main/java/net/fledgewing/orbitcompanion/DeviceStorage.kt:12](../android/companion/app/src/main/java/net/fledgewing/orbitcompanion/DeviceStorage.kt#L12), [android/koreader/orbit.koplugin/ko/storage.lua:3](../android/koreader/orbit.koplugin/ko/storage.lua#L3) | ❌ Owned storage and Collections screens follow Android; **deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware implementation follows**. [docs/design/booksync-home/DESIGN-NOTES.md:293](../docs/design/booksync-home/DESIGN-NOTES.md#L293) | ❌ Owned storage and Collections screens follow Android; **deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware implementation follows**. [docs/design/booksync-home/DESIGN-NOTES.md:293](../docs/design/booksync-home/DESIGN-NOTES.md#L293) | ❌ Owned storage and Collections screens follow Android; **deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware implementation follows**. [docs/design/booksync-home/DESIGN-NOTES.md:293](../docs/design/booksync-home/DESIGN-NOTES.md#L293) | -| Word of the day, Reading buddy and Light picker widgets (0.12; unreleased) | 🟡 Installed 2×1 and 2×2 widgets: companion daily vocabulary/context/source, local reading message and native frontlight controls; explicit loading/empty/offline/error states.; **deliberately deferred: device appearance and latency acceptance pending; Highlight and A year ago need authorized server snapshots.**. [android/koreader/orbit.koplugin/ko/local_widgets.lua:1](../android/koreader/orbit.koplugin/ko/local_widgets.lua#L1) | ❌ Local optional widgets follow Android.; **deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware local vocabulary and controls follow.**. [docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md:1](../docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md#L1) | ❌ Local optional widgets follow Android.; **deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware local vocabulary and controls follow.**. [docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md:1](../docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md#L1) | ❌ Local optional widgets follow Android.; **deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware local vocabulary and controls follow; X3 also requires measured flash fit.**. [docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md:1](../docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md#L1) | +| Word of the day, Reading buddy, Light, Highlight and A year ago picker widgets (0.12; unreleased) | 🟡 Installed 2×1 and 2×2 widgets: vocabulary, local reading message, frontlight, daily sidecar passage and calendar-year-back reading history. Personal data uses ordered companion providers with dedupe and failure isolation; explicit loading/empty/offline/error states.; **deliberately deferred: device appearance and latency acceptance pending; no remote personal-data provider in this slice.**. [android/koreader/orbit.koplugin/ko/local_widgets.lua:1](../android/koreader/orbit.koplugin/ko/local_widgets.lua#L1) | ❌ Personal reading and local optional widgets follow Android.; **deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware uses the same kinds when hardware permits.**. [docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md:1](../docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md#L1) | ❌ Personal reading and local optional widgets follow Android.; **deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware uses the same kinds when hardware permits.**. [docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md:1](../docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md#L1) | ❌ Personal reading and local optional widgets follow Android.; **deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware uses the same kinds when hardware permits. X3 requires measured flash fit.**. [docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md:1](../docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md#L1) | ## Settings exposure diff --git a/docs/design/booksync-home/DESIGN-NOTES.md b/docs/design/booksync-home/DESIGN-NOTES.md index 1d848015..01add8b0 100644 --- a/docs/design/booksync-home/DESIGN-NOTES.md +++ b/docs/design/booksync-home/DESIGN-NOTES.md @@ -101,7 +101,8 @@ text-only line each widget becomes on the X3. | When you read | 0.13 (restored on Stats) | 2×2, 2×3, 2×1, 4×1 | 2×1, 2×2, 1×2 | **M8C 2×2 and larger: 24 hourly bars** that touch (no gaps, one gray), the peak hour black with a ▼ "22:00" marker above it, and an hour axis. That makes it unlike This week, which has separate, labelled day columns. **2×1, 4×1 and the X4:** a shaded 24-hour strip, peak ringed. "Evenings · most at 22:00". | Mostly evenings · peak 22:00 | | Reading records | Later | 3×2, 2×3, 2×2, 4×1 | 2×2, 2×3 | Pages turned as the hero number, a hairline, then four stats; the streak line fills the foot. No empty left column. | 48,210 pages · longest 3 h 12 m · streak 12 | | Clock | Optional | 1×2, 2×1, 2×2 | 2×2, 1×1, 2×1 | Time and date. Its battery is now only a small link ("▭ 78% ›") into the Battery page. 1×2 fills the column (bigger time, sync line, battery link). | 21:42 · Tue 25 Nov | -| Recommended, Highlight, Buddy, Discover, Year ago, Word, Light | Later | — | — | Picker only. | — | +| Recommended, Discover | Later | — | — | Picker only. | — | +| Highlight, Buddy, Year ago, Word, Light | Android implemented | 2×1 / 2×2 | — | Companion projections; firmware later. | Device acceptance pending. | ## 3. Book list: one widget, many lists @@ -1028,8 +1029,14 @@ KOReader vocabulary snapshot with context/source and native lookup. Buddy uses o local statistics, labelled On this reader; it does not imply account completion or achievements. Light uses native frontlight capability and cached intensity, with 50 px decrease/increase actions; unsupported hardware has an explicit explanation. -Highlight needs an authorized saved passage and A year ago a cached server snapshot -(DESIGN §3.1–3.2); both remain staged with Recommended and Discover. +Highlight and A year ago now use the neutral source-aggregating personal reading +interface, starting with device sidecars and KOReader page-stat history. Both Android +picker sizes are installed. Later remote providers register behind ServerAdapter without +changing the UI. Recommended and Discover remain separate staged work. + +Maintainer ruling (2026-11-26), verbatim: +"I would build it so that all UI calls for that kind of data go through our interface, which then chooses where to fetch / aggregate data from. We start with on-device info and can extend to server but the ui never needs to change." +See [source implementation and limits](F12-G-SOURCES.md). Each widget inherits one row, 16 KiB, zero subprocesses/render network and one shared Home batch from budgets.lua. Selection, count and messages stay in the companion; diff --git a/docs/design/booksync-home/F12-G-SOURCES.md b/docs/design/booksync-home/F12-G-SOURCES.md new file mode 100644 index 00000000..074d089c --- /dev/null +++ b/docs/design/booksync-home/F12-G-SOURCES.md @@ -0,0 +1,50 @@ +# Personal reading source aggregation (Android, unreleased 0.12) + +The approved Android-first build installs Highlight of the day and A year ago in +2×1 and 2×2 picker sizes. UI requests `personal.reading` with a neutral `kind`; +it never chooses a provider. `PersonalReading` queries capable providers in order, +keeps the first record per neutral identity, and publishes one bounded display row. +A failed provider cannot erase another provider's saved data. All failed is an error; +a successful empty device history is an explicit empty card. Cached data supports +offline display. Acquisition is outside this read-only provider contract. + +Reuse evidence on this implementation's base e93cbcc8: + +- `android/companion/app/src/main/java/net/fledgewing/orbitcompanion/ReadingStats.kt:24` + opens the existing statistics database read-only; `:52` reads timestamped + `page_stat_data` rows. Stats already delegates this aggregation to the companion. +- `android/companion/app/src/main/java/net/fledgewing/orbitcompanion/LibraryReadModel.kt:29` + retains the existing account/device ownership check; `:73` bounds published bytes + and rows; `:86` logs timing. Both personal widgets extend that same materializer. +- `android/companion/app/src/main/java/net/fledgewing/orbitcompanion/DeviceLibrary.kt:11` + already discovers device books, excludes escaping symlinks and sidecar directories; + `:24` parses bounded native metadata as literals without executing Lua. The shared + discovery function now serves both device catalog and highlight provider. +- `android/koreader/orbit.koplugin/ko/local_widgets.lua:31` and + `android/koreader/orbit.koplugin/logic/local_widgets.lua:4` supply the existing + immutable renderer/projection contracts, budgets and timing span. + +A year ago uses the same calendar day last year in the device timezone, clamping +February 29 to February 28. SQL groups timed page visits by book, selects the book +with most recorded time (book ID breaks ties), and returns minutes, days read and +the latest stop page. Visits crossing midnight contribute only their time inside +the selected day (including a visit starting the day before). No history is fabricated for a missing database or day. +This window is one calendar day, so days read is one for a populated row. + +Highlight reads local books' native annotation sidecars (read-only, ≤1 MiB each), +excludes bookmarks without a passage locator, and deduplicates by path/locator/text. +Sorted book paths and annotation order define a deterministic pool. Calendar-day +round robin survives process restarts and does not repeat until the stable pool +is exhausted. Editing the annotation pool changes the cycle. Only bounded passage, +source and book-action fields enter the published row. No sidecar IO occurs in Lua. + +ServerAdapter exposes optional `personalReadingSources(owner)` registration; its +default is empty. A future adapter can capability-gate highlights/history providers +inside its own package. This slice implements no remote provider. Toy providers +prove precedence, dedupe, capability skipping and failure fallback in tests. + +Both widgets inherit `logic/budgets.lua`: one display row, ≤16 KiB, zero render +network calls/subprocesses and one shared Home batch. Companion discovery/parsing +is worker work; these limits apply to materialized/read/display records rather +than pretending an aggregate SQL query visits only one underlying statistics row. +Device appearance/latency acceptance and firmware integration remain pending. diff --git a/docs/design/booksync-home/REVIEW-PASS-4.md b/docs/design/booksync-home/REVIEW-PASS-4.md index 8fec4098..9835f4c0 100644 --- a/docs/design/booksync-home/REVIEW-PASS-4.md +++ b/docs/design/booksync-home/REVIEW-PASS-4.md @@ -44,7 +44,7 @@ The latter remains on ROADMAP; this review does not label it shipped. | Library widget / Storage | Group and device links tested. Compact Library uses one combined count/link band so its targets fit. `ko/storage.lua` now owns real companion-projected storage figures/bar, confirmations and folder selection; the Library widget adds Collections. `DeviceStorage.kt` measures StatFs and the tracked file/cache index. Host regressions cover missing capacity and stale previews; M8C visual/timing acceptance remains pending. | | Battery widget and four tabs | Existing learning/missing/error labels, bounded daily windows, actual-level glyphs and charges retained (`test/battery_flows.lua`). Targets fixed. Grouped rates, export/compare and efficiency metrics remain explicitly deferred in `shared/features.json`. No replacement battery model. | | This week / Year / When you read / Records | Existing native paint paths and one shared materialization exercised in `test/test_reading_stats.lua` and Home flows. Retain explicit per-field provenance and separate possibly overlapping local-today minutes: more truthful than demo totals. `logic/reading_stats.lua:29` still has simplified calendar/legend, peak and records typography compared with the prototype. | -| Clock and later picker widgets | Clock now has a snapshot renderer. Word, Reading buddy and Light are installed in both Android picker sizes with local companion projections; see [local widget evidence](F12-G-LOCAL-WIDGETS.md). Highlight and Year ago require authorized server snapshots and remain staged with Recommended/Discover. | +| Clock and later picker widgets | Clock now has a snapshot renderer. Word, Reading buddy and Light are installed in both Android picker sizes with local companion projections; see [local widget evidence](F12-G-LOCAL-WIDGETS.md). Highlight and A year ago are installed in both Android picker sizes through the source-aggregating library interface, starting with device data; see [source evidence](F12-G-SOURCES.md). Recommended/Discover remain staged. | | Home editor / Rename / picker / Book list configuration | Existing geometry-only moves, draft cancellation, atomic Done, keyboard Rename and paged source windows retained; Configure touch target fixed. `ko/home_editor.lua:113` draws geometry cards rather than dimmed live previews, preserving the maintainer's zero-read move budget. Tags/toolbar/next-size copy remain visually different from the HTML. | | Owned Library / Search / filter sheet / pickers | Existing neutral filters, companion counts, exclusion context, paging and removable chips retained; check `test/booklist_flows.lua` and `test/test_filter_sheet.lua`. Chips enlarged without replacing the settled sheet. The g-series slice adds companion-materialized grouped cover rows, full-Series progress dots and an owned Series destination; cached covers and bulk transfer jobs remain staged. | | Reader top / Book info / Details | Bounded progress, missing-data states, native menu escape, async visibility guard and plain bar tested in `test/reader_panel_flows.lua`. Battery and Settings destinations fixed. The reader slice extends the same owner with the header icons, separate bottom scrubber/quick settings panel and native Contents/annotations/Go to/search/bookmark dispatch. See [reader implementation and limits](G-READER-NOTES.md); framebuffer/font fit and device latency remain unverified. | diff --git a/shared/features.json b/shared/features.json index 1dd87512..f2fe4cb1 100644 --- a/shared/features.json +++ b/shared/features.json @@ -5947,13 +5947,13 @@ }, { "id": "home-local-widgets", - "feature": "Word of the day, Reading buddy and Light picker widgets (0.12; unreleased)", + "feature": "Word of the day, Reading buddy, Light, Highlight and A year ago picker widgets (0.12; unreleased)", "category": "Behaviour", "platforms": { "android": { "status": "partial", - "note": "Installed 2×1 and 2×2 widgets: companion daily vocabulary/context/source, local reading message and native frontlight controls; explicit loading/empty/offline/error states.", - "reason": "deliberately deferred: device appearance and latency acceptance pending; Highlight and A year ago need authorized server snapshots.", + "note": "Installed 2×1 and 2×2 widgets: vocabulary, local reading message, frontlight, daily sidecar passage and calendar-year-back reading history. Personal data uses ordered companion providers with dedupe and failure isolation; explicit loading/empty/offline/error states.", + "reason": "deliberately deferred: device appearance and latency acceptance pending; no remote personal-data provider in this slice.", "evidence": [ { "path": "android/koreader/orbit.koplugin/ko/local_widgets.lua", @@ -5963,8 +5963,8 @@ }, "x4_pro": { "status": "missing", - "note": "Local optional widgets follow Android.", - "reason": "deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware local vocabulary and controls follow.", + "note": "Personal reading and local optional widgets follow Android.", + "reason": "deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware uses the same kinds when hardware permits.", "evidence": [ { "path": "docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md", @@ -5974,8 +5974,8 @@ }, "x4": { "status": "missing", - "note": "Local optional widgets follow Android.", - "reason": "deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware local vocabulary and controls follow.", + "note": "Personal reading and local optional widgets follow Android.", + "reason": "deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware uses the same kinds when hardware permits.", "evidence": [ { "path": "docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md", @@ -5985,8 +5985,8 @@ }, "x3": { "status": "missing", - "note": "Local optional widgets follow Android.", - "reason": "deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware local vocabulary and controls follow; X3 also requires measured flash fit.", + "note": "Personal reading and local optional widgets follow Android.", + "reason": "deliberately deferred: maintainer authorised Android first on 2026-11-25; firmware uses the same kinds when hardware permits. X3 requires measured flash fit.", "evidence": [ { "path": "docs/design/booksync-home/F12-G-LOCAL-WIDGETS.md",