(Go: >> BACK << -|- >> HOME <<)

Page MenuHomePhabricator

Talk Pages - display images in user messages
Open, MediumPublic

Assigned To
None
Authored By
Tsevener
Feb 16 2023, 2:55 PM
Referenced Files
F36955319: Image carousel.png
Apr 18 2023, 9:51 AM
F36955315: Image view.png
Apr 18 2023, 9:51 AM
F36955313: Open first thread.png
Apr 18 2023, 9:51 AM
F36955309: Cell's.png
Apr 18 2023, 9:51 AM
F36955307: Group 8.png
Apr 18 2023, 9:51 AM
F36939506: Screenshot 2023-04-04 at 12.41.38 PM
Apr 4 2023, 5:52 PM
F36939504: Screenshot 2023-04-04 at 12.41.21 PM
Apr 4 2023, 5:52 PM
F36939500: Screenshot 2023-04-04 at 12.40.43 PM
Apr 4 2023, 5:52 PM

Description

In our aggressive html stripping for native display of talk pages, we also strip out images. This task is to revisit that logic to allow images to come through and display as native image views on talk pages.

Test steps:

The discussion is archived / closed now, but go to Elizabeth II's talk page > Archive 45. Scroll down to "Infobox photograph for after her death". Notice https://www.figma.com/file/E7YX2N8tQ94gyAeGcyqy8C/iOS-Talk-Pages?node-id=3030%3A11568&t=roFbrzSKBMLbGKxr-1 no images display, so users cannot see what participants are talking about.

Designs

Figma Under the 'Placeholder image' page

Context:

  • Below you can see how images are displayed on mobile web and how the same page looks like the iOS app (there is no image or indication that there should be an image, see below).
Mobile webiOS app
Group 8.png (2×375 px, 471 KB)
Cell's.png (1×375 px, 168 KB)
  • Building off of Option 1from the comments we could display image icon and a link with the copy 'View image' where the image should be.

-Ideally the web view of the image will be displayed inside of the app, without kicking the contributor out to Safari.

  • Both the image icon and the link are tappable.
    • Icon is the SF symbol, name: photo, size: 28 pts
Talk pageImage viewImage carousel
Open first thread.png (812×375 px, 38 KB)
Image view.png (812×375 px, 141 KB)
Image carousel.png (812×375 px, 75 KB)

Nice to have:

  • In the video here you can see that on mobile web when there are multiple images in one gallery and you tap on one and go through the other images through an image carousel (with the image and description visible), without going back to the talk page. If this is easy it would be great to include this so that the contributor doesn't always have to tap back to the talk page to see the next image.
Technical Limitations

See prototype options here.

While it's possible to display talk page images inline within the native talk page views, due to the nature of asynchronous image fetching, we should first display a placeholder image that is its own link, and takes the user out to a web view to display the image. This is because image data can return in any order, and swapping out random <img> tags in the html without throwing off string replacement ranges might be a pain. Swapping out <img> tags with a placeholder image, on the other hand, does not rely on a network call, so we can avoid a whole chunk of careful logic to ensure ranges aren't thrown off.

Event Timeline

Option 1 (easy):

Show a temporary placeholder icon where the image tag would be. Icon can be whatever we want, something custom or an SF symbol. We can add link coloring as well. User can tap the placeholder icon and view the image in an external browser.

Screenshot 2023-04-04 at 12.40.43 PM (1×564 px, 199 KB)

Screenshot 2023-04-04 at 12.41.21 PM (1×564 px, 326 KB)

Option 2 (difficult):

Show the image inline:

Screenshot 2023-04-04 at 12.41.38 PM (1×564 px, 314 KB)

Both of these approaches were accomplished with an NSAttributedString, using an NSTextAttachment to replace the image tag with an inline UIImage. Our talk pages use NSAttributedStrings for content, so this should work. This example is in the prototype/attributed-string-image branch.

JTannerWMF added subscribers: OTichonova, JTannerWMF.

Can you have a crack at improving the placeholder image option for option 1? @OTichonova

Mazevedo subscribed.

Commits from pair programming session, to update our html > attributed string class:

1edd64 & 49453c

Waiting as I work on other tasks with higher priority for the 7.3.1 release, progress can be found on this branch https://github.com/wikimedia/wikipedia-ios/tree/talk-page-images