ContentLoader
Checklist
- [x] I have read CONTRIBUTING.md
- [x] I have described what this PR contains
- [x] If this PR alters the UI, I have attached pictures/videos
- [ ] This PR addresses one or more open issues that were assigned to me:
Pull Request Information
Note: this PR depends on this PR; marking as draft until that's merged and tagged, at which point I will tag MlemMiddleware update the package dependency in this PR.
This PR updates ExpandedPost to be navigable using AnyPost (and therefore using any class in the PostProviding family)
It also contains a first iteration at how we can handle loading upgradable content in the form of ContentLoader. ContentLoader takes in an Upgradable (see aforementioned PR) and a @ViewBuilder that creates a view from the given Upgradable's MinimumRenderable type. If the Upgradable doesn't conform to MinimumRenderable, a loading spinner is displayed while upgrade() is performed. If the Upgradable is at least MinimumRenderable, the view is displayed; if it is not fully Upgraded, then upgrade() is called.
This system lets us neatly handle displaying upgradable content regardless of its current upgrade status by simply wrapping it in a ContentLoader. I haven't tested this, but we should in theory be able to nest one ContentLoader in the view closure of another, letting us render as fast as we can upgrade models.
The notion of MinimumRenderable does introduce rigidity in tying "renderable" directly to the model, but considering our models I do not judge at this time that that will be an issue.