Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is just a PoC API I wanted some thoughts on before I fully finish the implimentation for it.
We would set like this from
CommonActivity.setLocale():or later via compose, something like this:
Which is necessary to get some certain strings from the app to the library in order to eventually move some things like syncproviders into the library, but there also may be a way to avoid needing this altogether, so if there are other ideas I would also like to hear it, which is also why I am opening this PR as just a PoC for now.
It also reworks it to be more reusable and expandable in the future and expands
isDebugto allow passing any flavors or build types to the library for future access of certain things. In particular I was thinking a different error message for the outdated app error if already on prerelease. This would be used like:Not yet added in this PoC, but the plan for icons (e.g.
AniListApi.icon, currently a rawR.drawable.ic_anilist_icon) is different from strings on purpose. Icons don't change at runtime the way locale strings do, so I don't think they need to go throughAppConfigas a settable/mutable registry at all. The idea is closer to:and then the app or later, composeApp just maps it locally with an exhaustive when, no registration step, and no runtime state:
And would allow safety also, since it's an expression-form when with no else, forgetting to map a new
AppIconentry fails at compile time instead of silently returning null at runtime, which is why I'd rather do it this way than reuse theAppConfig.setStrings-style pattern for icons too. Same idea would apply for compose later withRes.drawable/DrawableResourceinstead. Again, open to better ideas for this thought as well.