Background information
To handle quick scrolling in the table of contents, the Android app needs to know the offset of every section in the article
What
getSectionOffsets(...tbd...)
To handle quick scrolling in the table of contents, the Android app needs to know the offset of every section in the article
getSectionOffsets(...tbd...)
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | None | T169242 Develop Page Content Service for Reading Clients | |||
Resolved | None | T177425 Develop General Layer of PCS | |||
Resolved | None | T177433 Develop HTML Content API to be used with companion structured JSON APIs | |||
Resolved | • Jhernandez | T222369 mobile-html: JavaScript abstraction layer | |||
Resolved | MSantos | T219909 mobile-html section offsets |
These change with screen dimensions (on rotation etc) and when tables are (un)collapsed. Shouldn't the offset simply be determined on click?
@Dbrant answered my question above ^ it's cause Android's TOC needs to know all section offsets at once.
Ideally we would need the WebView to provide us with this kind of structure:
{"sections": [ {"heading":"Barack Obama", "id":"0", "yOffset":290}, {"heading":"Early life and career", "id":"1", "yOffset":2923}, {"heading":"Education", "id":"2", "yOffset":4300}, ...
with yOffset assumed to be px units (device independent pixels)
Sounds like we need to have a way for the page library to know the ToC structure, right?
Assuming the body is present (would have to be to get offsets) the method I was thinking about would be similar to...
getSectionHeadingsData(body: HTMLBodyElement)
...and would return data structured the way @Dbrant specified.
Reminder: only needs to work against mobile-html:
https://en.wikipedia.org/api/rest_v1/page/mobile-html/Dog
@Mhurd and @bearND here is the first try for this task: https://github.com/wikimedia/wikimedia-page-library/pull/206
Testing is not ideal, would like some feedback.
Mentioned in SAL (#wikimedia-operations) [2019-07-02T17:43:34Z] <bsitzmann@deploy1001> Started deploy [mobileapps/deploy@9ca9b0f]: Update mobileapps to 941e14f (T219998 T217352 T219909)
Mentioned in SAL (#wikimedia-operations) [2019-07-02T17:49:24Z] <bsitzmann@deploy1001> Finished deploy [mobileapps/deploy@9ca9b0f]: Update mobileapps to 941e14f (T219998 T217352 T219909) (duration: 05m 49s)