PR: https://github.com/wikimedia/wikipedia-ios/pull/4521
PR: https://github.com/wikimedia/wikipedia-ios-components/pull/9 (since we've already migrated to a monorepo, this work will need porting over)
Requirements:
- Add feature flag
- Add container view controller around source editor component
- Adds localized and Voice Over accessibility strings injection
- Adds unit tests and UI tests
- Ensure init sites updated with injected localized strings
Engineering notes #1 [PR: https://github.com/wikimedia/wikipedia-ios/pull/4521] :
This PR adds the native editor feature flag and implements the initial pieces of it within PageEditorViewController. I also added a full source edit button in ArticleViewController, so that we can test performance against a large set of wikitext as we build this. The entry point of this full source edit button is likely to change before release, though.
Note I found a bug in the default automatic theme switching in this branch. Marking as draft while I look into that.
Test Steps
In the Staging scheme, load the article editor, either by tapping the full source "Edit" button at the top of an article or any edit pencil.
Text formatting toolbars and input views should display like our Code Mirror editor, though state logic in the Find and Replace toolbar view will act wrong. I will fix this in a separate find & replace PR later on.
Engineering notes #2 [PR: https://github.com/wikimedia/wikipedia-ios-components/pull/9] :
This PR does a few things:
Updates the source editor components to reference a WKSourceEditorLocalizedStrings struct of strings instead of internally hardcoding them. This will allow us to inject localized strings from our client app.
Note that though the struct is injected at the public view model init point, I am referencing the strings internally like a singleton (label.text = WKSourceEditorLocalizedStrings.current.inputViewParagraph). I felt like it was nice to have the localized strings for a whole feature in one easy to read (though large) struct, instead of split up across several different view models. Referencing the singleton internally also allowed me to avoid passing the strings around everywhere in method parameters throughout the feature, which felt distracting. But it still feels a bit weird and could cause potential reuse issues down the line, so I'm definitely open to changes here.
This also adds Voice Over accessibility labels everywhere, using the same pattern.This adds unit tests and UI tests that can be run locally (WKSourceEditorTests and WKSourceEditorUITests). Note that there isn't any CI set up for this, but maybe we can discuss adding Xcode Cloud integration if we like these. For UI tests, I had to add accessibility identifiers on certain elements, which were added in a similar pattern as WKSourceEditorLocalizedStrings.
This PR is ready to review, but is a breaking change against the client app and how wikimedia/wikipedia-ios#4521 is instantiating the source editor. Since that PR is already in progress, I am marking this PR as draft until that is merged.
Testing Notes
The only thing testable with this chunk of work is Voice Over support - everything else here foundational has already been tested in the other tickets.