-
Notifications
You must be signed in to change notification settings - Fork 3
Kotlin multiplatform example app #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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
jkmassel
approved these changes
Jun 10, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran the demo app on-device against a new test server, and it worked fine – I added some more plugins and reloaded the plugins list and it downloaded that data too.
This is a great start!
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 PR adds a Kotlin multiplatform example app to the repository to test our integration. The app only works on desktop and Android platforms. We've looked into the Apple platforms, but it doesn't look like it'll be possible to use neither the Kotlin
uniffi
bindings nor the Swift one from it.The desktop version of the example app will use the
:api:kotlin
dependency which doesn't package the Rust binary. That's why the binary needs to be made available to it. In a real app, we'd have to do this by downloading it from a remote - maybe it can be done with a Gradle plugin - but because this example app is in the same repo, we are able to piggy-back on our existing infrastructure. I've moved generating the Rust binary and bindings from the:api:kotlin
to the root project and made the necessary connections for Gradle to make it work for both:api:kotlin
&:example:composeApp
desktop projects.Note that the desktop app doesn't support login. I am not sure how that can be achieved unless we decide to implement it per OS as it requires a callback app scheme. For now, I think it's good enough that the desktop app works only with the local test site from Docker.
For the Android app, we are able to use the
:api:android
dependency which does include the Rust binaries for all the relevant Android architectures. So, no extra configuration was necessary for it.I've put together this example app very quickly. So, it's rough around the edges and includes several TODOs. It was meant as a proof of concept rather than a showcase for now. However, we'll be looking into improving it in the very near future to at least address some of the glaring issues. I need to switch to something urgent at the moment and keeping all this in a branch will just get in the way, so I think merging this quickly is our best course of action.
Here is a set of things I'd like to address in the next couple weeks:
:api:android
to:example:composeApp
. This will further simplify the:api:android
repository and would also let us to deal with test credentials only once.:example
module. I've had that module because it's the structure generated from the KMP new project wizard, presumably because it includes an iOS app folder, but since we won't have an Xcode project in KMP, we can simplify the structure my removing the:example
module or:composeApp
- depending on whichever name we prefer to keep.wp-admin/authorize-application.php
. We'd like to do this from Rust, so this is closely related to [3]. ^App.kt
'sonSiteClicked
by using thesetAuthenticatedSite
for the relevant view models. There are so many things wrong with this approach that I don't think it's even worth explaining it. Let's just say we need to do this properly in an upcoming iteration 😅To Test
make test-server && make dump-mysql && make backup-wp-content-plugins
cd native/kotlin && ./gradlew run
(to run the Desktop app)cd native/kotlin
and run theexample.composeApp
configuration from Android Studio for the Android appAndroid App:

https://cloudup.com/cWIHvw1XmNH
Desktop App: (doesn't include login)