Page MenuHomePhabricator

mobile-html section offsets
Closed, ResolvedPublic

Description

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...)

Event Timeline

JoeWalsh created this task.Apr 2 2019, 5:52 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 2 2019, 5:52 PM
LGoto triaged this task as Normal priority.Apr 3 2019, 3:39 PM
Mhurd added a subscriber: Mhurd.Apr 3 2019, 4:37 PM

These change with screen dimensions (on rotation etc) and when tables are (un)collapsed. Shouldn't the offset simply be determined on click?

Mhurd added a subscriber: Dbrant.Apr 3 2019, 4:48 PM

@Dbrant answered my question above ^ it's cause Android's TOC needs to know all section offsets at once.

bearND updated the task description. (Show Details)Apr 3 2019, 4:48 PM
Dbrant added a comment.Apr 8 2019, 5:19 PM

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)

bearND added a subscriber: bearND.Apr 8 2019, 5:31 PM

Sounds like we need to have a way for the page library to know the ToC structure, right?

Still ok if I take a stab at this?

Mhurd added a comment.EditedApr 11 2019, 10:52 PM

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

MSantos claimed this task.Jun 17 2019, 5:57 PM
MSantos moved this task from To Do to Doing on the Product-Infrastructure-Team-Backlog (Kanban) board.

@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)

bearND closed this task as Resolved.Jul 16 2019, 8:55 PM