OneSignal-Android-SDK icon indicating copy to clipboard operation
OneSignal-Android-SDK copied to clipboard

Kotlin multiplatform support [Feedback]:

Open salimisler28 opened this issue 1 year ago • 3 comments

What's on your mind?

It would be great to have a SDK for KMP (at least android and iOS targets).. Thank you

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

salimisler28 avatar Mar 29 '24 01:03 salimisler28

Thanks for submitting this feature request, is there a specific benefit you are looking for?

I haven't used Kotlin Multiplatform myself but from what read about it you should be able to use this OneSignal-Android-SDK directly, then for iOS you can use the OneSignal-iOS-SDK and import that as well by following Kotlin's iOS import guide: https://kotlinlang.org/docs/multiplatform-ios-dependencies.html

Having to import two libraries in different ways (OneSignal-iOS-SDK & OneSignal-Android-SDK) and use the correct one based on build time or runtime means you will probably want to encapsulate this logic into your own wrapper class. Is this basically what you are looking for to be provided by OneSignal?

jkasten2 avatar Mar 29 '24 01:03 jkasten2

Thanks for submitting this feature request, is there a specific benefit you are looking for?

I haven't used Kotlin Multiplatform myself but from what read about it you should be able to use this OneSignal-Android-SDK directly, then for iOS you can use the OneSignal-iOS-SDK and import that as well by following Kotlin's iOS import guide: https://kotlinlang.org/docs/multiplatform-ios-dependencies.html

Having to import two libraries in different ways (OneSignal-iOS-SDK & OneSignal-Android-SDK) and use the correct one based on build time or runtime means you will probably want to encapsulate this logic into your own wrapper class. Is this basically what you are looking for to be provided by OneSignal?

Hello, thanks for your quick response. Maybe my message was not clear, I would like to use some features like adding tags and the others in common part. Otherwise we have to write it separately for Android and iOS.

salimisler28 avatar Mar 29 '24 01:03 salimisler28

To set expectations, we don't plan to adding support in the short term, so I think writing your own little wrapper class around OneSignal will be your best bet for now.

As some research in understanding how KMP should work for libraries / SDKs I found a few that already support it:

  • https://developer.android.com/kotlin/multiplatform
  • https://github.com/getsentry/sentry-kotlin-multiplatform

If anyone has any other guides or documentation how to enable KMP for libraries / SDKs please feel free to share.

jkasten2 avatar Mar 29 '24 18:03 jkasten2