While SwiftUI's `Text` view won't display these in an `AttributedString` even if they get parsed from Markdown (which would also require the use of the `.full` option instead of the `.inlineOnlyPresrevingWhitespace` option), we can improve the appearance somewhat.
Currently, list elements are clumped together with no spaces between them, and there's no indication whatsoever that the author indicated these to be a list.
Change to insert Markdown list syntax with linebreaks and dashes, so users can at least understand there's a list there.
Similar change for ordered lists.
This will still be broken for nested lists, but it didn't seem worth it to put a lot of effort into this (or other revamps, like making bold/italics/code work properly) because it seems like the current text handling in Ice Cubes is suboptimal and eventually slated for improvement (according to https://github.com/Dimillian/IceCubesApp/issues/1459#issuecomment-1638562657).
So this is more designed to make lists "less broken" in some cases, rather than be a comprehensive fix for all lists in all cases.
* improve the sensitive content overlay animation and refactor subviews
* fix alt text button and refactor views
* refactor `StatusRowMediaPreviewView.onTapGesture`
* simplify `MediaPreview` and `FeaturedImagePreView`
* make alt text button adaptable
* Automatically remove spaces in server names
If a server name includes a space (which can happen if the string is pasted /
autocompleted), this space is removed, which results in the app not crashing.
Fixes#1599
Signed-off-by: Paul Schuetz <pa.schuetz@web.de>
* Format
---------
Signed-off-by: Paul Schuetz <pa.schuetz@web.de>
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
* Add simple test for escaping markdown content in statuses
* Add ~ as markdown character to be escaped in statuses
The ~ isn't documented in the original markdown syntax docs but is
commonly used (including by AttributedString) to surround text
formatted with a strikethrough.
* Allow creation of URL objects from strings containing non-ASCII characters
Adds a new initializer for creating URL objects with a flag to specify that
non-ASCII characters found in the path or query string should first be
URL encoded.
* Add basic test for creating HTMLString objects
* Encode link paths and queries when parsing statuses
It's common to use non-ASCII characters in URLs even though they're technically
invalid characters. Every modern browser handles this by silently encoding
the invalid characters on the user's behalf. However, trying to create a URL
object with un-encoded characters will result in nil so we need to encode the
invalid characters before creating the URL object. The unencoded version
should still be shown in the displayed status.
The parsing of the URL string is a little messy because we can't use the URL
class for this scenario and need to duplicate some of its work.
* Only encode link URLs as a backup
If a URL can be created from a status href, don't try URL encoding
it as this could result in double encoding. Only encode the string
if the creation of a URL fails. This is also more efficient.
* Add StatusRowView accessibility action to open media attachment viewer
Previously, there would be no way to open QuickLook from the timeline.
Now, we add a custom accessibility action to do this.
* Work around initial accessibility focus bug in StatusDetailView
Previously, (due to identity issues?) the focus would be set on the header view. However, moving to the next element in the focus order. would skip over a random number of elements, depending on the context of the detail view.
Now, we manually set the focus once, allowing the focus order to work as intended.
* Respect filters in Timeline combined accessibility label
* Add explicit action to show filtered warnings from `filterView`
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
* Improve accessibility of StatusPollView
Previously, this view did not provide the proper context to indicate that it represented a poll.
Now, we’ve added
- A container that will stay “Active poll” or “Poll results” when the cursor first hits one of the options;
- A prefix to say “Option X of Y” before each option;
- A Selected trait on the selected option(s), if present
- Consolidating and adding an `.updatesFrequently` trait to the footer view with the countdown.
* Add poll description in StatusRowView combinedAccessibilityLabel
This largely duplicates the logic in `StatusPollView`.
* Improve accessibility of media attachments
Previously, the media attachments without alt text would not show up in the consolidated `StatusRowView`, nor would they be meaningfully explained on the status detail screen.
Now, they are presented with their attachment type.
* Change accessibilityRepresentation of AppAcountsSelectorView
* Change Notifications tab title view accessibility representation to Menu
Previously it would present as a button
* Hide layout `Rectangle`s from accessibility
* Consolidate `StatusRowDetailView` accessibility representation
* Improve readability of Poll accessibility label
* Ensure poll options don’t present as interactive when the poll is finished
* Improve accessibility of StatusRowCardView
Previously, it would present as four separate elements, including an image without a description, all interactive, none with an interactive trait.
Now, it presents as a single element with the `.link` trait
* Improve accessibility of StatusRowHeaderView
Previously, it had no traits and no actions except inherited ones.
Now it presents as a button, triggering its primary action.
It also has custom actions corresponding to its context menu
* Avoid applying the StatusRowView custom actions to every view when contained
* Provide context for the application name
* Add pauses to StatusRowView combinedAccessibilityLabel
* Hide `TimelineView.scrollToTopView` from accessibility
* Set appropriate font style on Notification header
After the change the Text needed a `.headline` style to match the prior appearance.
* Fix bug in accessibilityRepresentation of TimelineView nav bar title
Previously, it would not display the proper label for .remoteLocal filter options.
* Ensure that pop-up button nav bar titles are interactive
* Ensure TextView responds to Environment.sizeCategory
This resolves#1309
* Fix button
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>