Skip to content
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

Multiplatform support #208

Merged
merged 17 commits into from
May 8, 2024
Merged

Multiplatform support #208

merged 17 commits into from
May 8, 2024

Conversation

Sanlorng
Copy link

Move project to kotlin multiplatform library

Based on Compose Multiplatform 1.6.2

  1. move zoomable to common code
  2. move sample to common code and platform spec sample(accompanist)
  3. move test to common

Add desktop support

image

Testing

  1. Desktop
    image

  2. Android(Robolectric)
    image

@usuiat
Copy link
Owner

usuiat commented Apr 27, 2024

@Sanlorng
Thank you for your great contribution! 👏 👏
Please give me time to review it.

@usuiat
Copy link
Owner

usuiat commented Apr 27, 2024

@Sanlorng
I tried to running the sample android app on your branch, and I got the following error.

> Task :app:compileDebugKotlinAndroid FAILED
e: This version (1.3.2) of the Compose Compiler requires Kotlin version 1.7.20 but you appear to be using Kotlin version 1.9.23 which is not known to be compatible.  Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).

I used to specify the Compose Compiler version in build.gradle as follows, but is it unnecessary with KMP?

composeOptions {
    kotlinCompilerExtensionVersion libs.versions.composeCompiler.get()
}

@Sanlorng
Copy link
Author

@Sanlorng I tried to running the sample android app on your branch, and I got the following error.

> Task :app:compileDebugKotlinAndroid FAILED
e: This version (1.3.2) of the Compose Compiler requires Kotlin version 1.7.20 but you appear to be using Kotlin version 1.9.23 which is not known to be compatible.  Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).

I used to specify the Compose Compiler version in build.gradle as follows, but is it unnecessary with KMP?

composeOptions {
    kotlinCompilerExtensionVersion libs.versions.composeCompiler.get()
}

composeOptions was no needed for Compose Multiplatform, Compose Multiplatform Gradle Plugin will set compose compiler automaticaly, see ComposeCompilerCompatibility.

I remove the composeOptions in the app module, please fetch and compile again.

@Sanlorng
Copy link
Author

@Sanlorng
I tried to running the sample android app on your branch, and I got the following error.

> Task :app:compileDebugKotlinAndroid FAILED
e: This version (1.3.2) of the Compose Compiler requires Kotlin version 1.7.20 but you appear to be using Kotlin version 1.9.23 which is not known to be compatible.  Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).

I used to specify the Compose Compiler version in build.gradle as follows, but is it unnecessary with KMP?

composeOptions {
    kotlinCompilerExtensionVersion libs.versions.composeCompiler.get()
}

The compile error was fixed,you can fetch the branch and compile again.

@usuiat
Copy link
Owner

usuiat commented Apr 28, 2024

@Sanlorng
Thanks. Now I can run the android sample app.

In addition, could you tell me how to run the desktop sample app?
I'm a beginner of the compose multiplatform.

@usuiat
Copy link
Owner

usuiat commented Apr 28, 2024

@Sanlorng
The following commands could be used. Is this correct?

./gradlew :app:run

@usuiat
Copy link
Owner

usuiat commented Apr 29, 2024

@Sanlorng
I ran the desktop sample app on Windows to see how it worked on a multi-touch enabled display.
However, the pinch gestures did not work. Tap and double-tap worked.
Do the gestures work in your environment? If they are working, can you tell me your environment?

@Sanlorng
Copy link
Author

@Sanlorng
I ran the desktop sample app on Windows to see how it worked on a multi-touch enabled display.
However, the pinch gestures did not work. Tap and double-tap worked.
Do the gestures work in your environment? If they are working, can you tell me your environment?

I need find a Windows Pad to test it.

@Sanlorng
Copy link
Author

@Sanlorng
Thanks. Now I can run the android sample app.

In addition, could you tell me how to run the desktop sample app?
I'm a beginner of the compose multiplatform.

,The simple way is clicking the run button in the left of fun main()

@Sanlorng
Copy link
Author

@Sanlorng I ran the desktop sample app on Windows to see how it worked on a multi-touch enabled display. However, the pinch gestures did not work. Tap and double-tap worked. Do the gestures work in your environment? If they are working, can you tell me your environment?

I've tried it in the RDP with Touch mode, it doesn't works. and then i search keyword touch/pinch/zoom at the Compose Multiplatform Repository Issues , Multi-finger touch doesn't seem to be supported on desktop platforms yet, see
JetBrains/compose-multiplatform#2209
JetBrains/compose-multiplatform#1555

@usuiat
Copy link
Owner

usuiat commented Apr 29, 2024

Thanks for doing the research for the Issue.
I see that Compose for desktop does not officially support multi-touch.

By the way, the gestures were working in your environment when you created this Pull Request, correct?
What environment did you check?

@Sanlorng
Copy link
Author

Sanlorng commented Apr 29, 2024

Thanks for doing the research for the Issue.
I see that Compose for desktop does not officially support multi-touch.

By the way, the gestures were working in your environment when you created this Pull Request, correct?
What environment did you check?

I test it on Android And Windows with Mouse,the pinch gesture in the Windows was not tested at the time,because I only had mouse mode at the time.

I think input in the UI test framework can be responded to correctly and the correct test passes, which means that the code is correct on the target platform of the test. The remaining problem is that the framework cannot emit correct touch events, which should not be Obstacles to supporting target platforms.

At the same time, the project also provides a double-click zoom gesture, which can be supported on the desktop.

So I think we can make it clear in the support section on which platforms certain gestures are not available and why.

In addition, I think we can consider supporting the scroll wheel to adjust the zoom ratio in zoom mode, and hold down the ctrl key and scroll wheel to open zoom when the focus is on the zoom control, which helps better support mouse users.

@usuiat
Copy link
Owner

usuiat commented May 1, 2024

I agree with you.
I think it would be better to merge this pull request, and release the desktop version as experimental.

Again, I am new to KMP, so I am reviewing your pull request as I learn. It will take some time.
Thank you.

Copy link
Owner

@usuiat usuiat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sanlorng
Sorry it took so long.
I added some comments.

zoomable/build.gradle.kts Outdated Show resolved Hide resolved
app/build.gradle.kts Outdated Show resolved Hide resolved
gradle/libs.versions.toml Outdated Show resolved Hide resolved
Copy link
Owner

@usuiat usuiat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sanlorng
Thank you for your quick response.

I added one more question.
Could you confirm?

app/build.gradle.kts Show resolved Hide resolved
@usuiat usuiat changed the base branch from develop_v1.7 to develop-v2.0 May 8, 2024 13:33
@usuiat usuiat merged commit 0b10829 into usuiat:develop-v2.0 May 8, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants