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

Port flutter features to KMP #301

Open
9 tasks
crc-32 opened this issue Feb 6, 2025 · 13 comments
Open
9 tasks

Port flutter features to KMP #301

crc-32 opened this issue Feb 6, 2025 · 13 comments
Labels
help wanted Extra attention is needed infrastructure ui

Comments

@crc-32
Copy link
Member

crc-32 commented Feb 6, 2025

There's a ton of features in Cobble that are implemented in flutter, we want to move to Kotlin Multiplatform, both in UI (Compose Multiplatform) and implementation, so it's more maintainable and we don't have to cross the 'gap' between flutter and the native code.

Alot of work has already been done on this to remove our reliance on a flutter background worker, but we still have the UI and any business logic still in flutter to do!

These should be gradually integrated, launching the associated screen in the KMP UI when selected from flutter (as the Locker tab currently does)

@crc-32 crc-32 added help wanted Extra attention is needed infrastructure ui labels Feb 6, 2025
@gywst
Copy link

gywst commented Feb 7, 2025

How can I help?

@qichuan
Copy link

qichuan commented Feb 7, 2025

Hi @crc-32 Are you referring to Compose Multiple platform as KMP UI?

@crc-32
Copy link
Member Author

crc-32 commented Feb 7, 2025

Hi @crc-32 Are you referring to Compose Multiple platform as KMP UI?

yep! as has been done for the locker screen

@orestesgaolin
Copy link

Have you considered generating JNI bindings to the native code so that you can avoid rewriting the app? You can find some examples here. This can automate some of the native API generation and decrease the friction between Dart and Swift/Kotlin/Java. Things like PebbleKit could potentially be exposed directly in Dart.

@crc-32
Copy link
Member Author

crc-32 commented Feb 7, 2025

Have you considered generating JNI bindings to the native code so that you can avoid rewriting the app? You can find some examples here. This can automate some of the native API generation and decrease the friction between Dart and Swift/Kotlin/Java. Things like PebbleKit could potentially be exposed directly in Dart.

Potentially, the support seems lacking at least according to that page (macOS is listed with no support on flutter and there's no mention of iOS), but there are also deeper issues to consider, Flutter has scared off prospective contributors before for various reasons and has the image of being in a kind of limbo of whether it'll be killed.

@npars
Copy link

npars commented Feb 7, 2025

For reference there is an iOS + Android sample app here: https://github.com/android/kotlin-multiplatform-samples/tree/main/Fruitties

The sample app leverages Skie for Swift bindings: https://skie.touchlab.co/intro#getting-started

Touchlab also has a KMP plugin for Xcode: https://touchlab.co/xcodekotlin

@npars
Copy link

npars commented Feb 7, 2025

Hi @crc-32 Are you referring to Compose Multiple platform as KMP UI?

yep! as has been done for the locker screen

What's your opinion on where the line should be drawn for Multiplatform vs Native Code? It seems the KMP samples usually stop at the ViewModel layer, perhaps since iOS Compose is still in beta?

@crc-32
Copy link
Member Author

crc-32 commented Feb 7, 2025

Hi @crc-32 Are you referring to Compose Multiple platform as KMP UI?

yep! as has been done for the locker screen

What's your opinion on where the line should be drawn for Multiplatform vs Native Code? It seems the KMP samples usually stop at the ViewModel layer, perhaps since iOS Compose is still in beta?

As can be seen in the already written code in the 'shared' module, native code should begin when you need to call a native API e.g. the platform's calendar API, permission request, bluetooth connection, since there's really no downside to using common code up until that point.
There's some exceptions, for example notification management is different on iOS and android as android impl handles filtering notifications itself while iOS impl will simply configure the watch's filters, so there will be more platform-specific logic in that instance.

@coryellcp
Copy link

should PR's for these tasks be made against the kmp branch?

@crc-32
Copy link
Member Author

crc-32 commented Feb 7, 2025

should PR's for these tasks be made against the kmp branch?

@coryellcp that would make sense yep! I just updated that branch so it's now in line with changes from master

@mxkmn
Copy link

mxkmn commented Feb 8, 2025

Hello, Android/KMP developer is already here!

I'd like to try adding Bluetooth connectivity based on the great Kable library (my work on StackOverflow).

Can I do this without having a Pebble watch? Unfortunately, I didn't get a watch in its golden era, and right now there are only 8 watches in the whole country on Avito (Russian equivalent of Ebay), at a considerable price and with unknown working capacity. I have esp32-c3 microcontrollers on hand, also I can order nRF52840 dev board.

P.S. I STRONGLY do not recommend writing the Bluetooth stack in the app yourself, as it has always been extremely complex and unstable in Android, and in the latest SDK updates the situation has become even more ambiguous. Trust me, I've tried it. If we want to get working Bluetooth on all devices, we need to use Kable (or blue-falcon, which I like less) or we will be forced to implement ALL the developments from there (no useless code there, the amount of code in the library is due to the complex BT stack in Android).

P.P.S. Let me know if I should communicate on this issue at libpebblecommon repo.

@NWuensche
Copy link

Hey, I'm also an Android/KMM developer who would like to help. Same issue as @mxkmn , it's relatively hard for me to get a real pebble. Is there any task that I can do without one? Maybe the Settings tab #304 ?

@tallnato
Copy link

I also would like to help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed infrastructure ui
Projects
None yet
Development

No branches or pull requests

9 participants