[lib] Prevent spoiler text from appearing in MessagePreview
Summary:
With the implementation of Spoilers on both web and native, we want to prevent the spoiler text from being revealed in MessagePreview on both platforms. This diff handles replacing the text enclosed with spoiler characters with three black squares, as discussed in the parent tasks for Spoilers, ENG-1472. We previously thought about replacing the spoilers with black square emojis.
The idea with this diff is to "intercept" the raw message text before it is parsed for markdown rules, so we can replace the text enclosed within || ... || before the spoiler characters are removed for the message preview.
Addresses ENG-2193
Addresses ENG-2055
Test Plan:
[Web]:
- Restart keyserver and web
- Observe how spoilers are displayed in the message preview before the change
- Observe after the change
- Ensure other markdown functions as before
[Native]:
- Restart keyserver and native
- Observe how spoilers are displayed in the message preview before the change
- Observe after the change
- Ensure other markdown functions as before
- Check how the change looks in both light and dark mode
Reviewers: atul, ginsu, ashoat
Reviewed By: ashoat
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D5715