Went through all the lexicons and stuff, cleaned up naming, moved some things around a bit.
Rewrote Christian's ApiProvider and associated code. Honestly, a lot of that stayed fairly similar, just simplified and now better understood having gone through it all with a fine-toothed comb. Biggest change was moving to the built-in Ktor.io bearer authentication. Which also supports OAuth, whenever Bluesky ends up moving to that.
Swapped all the API calls to return Kotlin's Result type (with appropriate exceptions, etc.) instead of the custom AtpResponse type, which helped clean up the application code in general. Way fewer when(val response = ...) { /n is AtpResponse.Success -> {} /n is AtpResponse.Failure -> {} /n }
Rewrote the app initialization and credential caching as a side-effect of the above.
Hoping this fixes some of the login issues as a side effect. It should make things easier going forward. Still some other clean-up needed, though.
At some point I want to move the API module (currently named "butterfly") into its own repository and publish it as a standalone Kotlin library for other people to use. We'll try and feed that with new lexicons via Lexsync, once we get that working. Debating if I want to move some of the custom wrapper types for stuff like posts and facets over there, potentially replacing the refactored generated code, because they're nicer, or if they're too app-specific (would have to be careful about making them serialize and deserialize correctly for direct transmission/reception).
Got the big refactor done.
Things accomplished:
when(val response = ...) { /n is AtpResponse.Success -> {} /n is AtpResponse.Failure -> {} /n }
Hoping this fixes some of the login issues as a side effect. It should make things easier going forward. Still some other clean-up needed, though.
At some point I want to move the API module (currently named "butterfly") into its own repository and publish it as a standalone Kotlin library for other people to use. We'll try and feed that with new lexicons via Lexsync, once we get that working. Debating if I want to move some of the custom wrapper types for stuff like posts and facets over there, potentially replacing the refactored generated code, because they're nicer, or if they're too app-specific (would have to be careful about making them serialize and deserialize correctly for direct transmission/reception).