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

iOS, macOS, and js support #23

Merged
merged 77 commits into from
May 24, 2023
Merged

iOS, macOS, and js support #23

merged 77 commits into from
May 24, 2023

Conversation

luca992
Copy link
Member

@luca992 luca992 commented Aug 9, 2022

This is a draft and not finished yet. But, I have begun adding support for iOS, macOS, and js targets!

Use moko-resources to load common resources
use coroutines core in commonMain
For some reason composeable lambda functions on native macos throw an error and cause the application to crash. work around the issue by making result of composable lambdas non-null with the use of kotlin result
@luca992
Copy link
Member Author

luca992 commented Aug 10, 2022

still need rework findFetcherFor and findDecoderFor to work properly on native.... but I got it running on a macosArm64 native application 🎉

cool thing to note. The compose-ui native sample app is way smoother and kamel loads images faster on mac vs jvm

Screen.Recording.2022-08-10.at.2.58.43.AM.mov

Screen Shot 2022-08-10 at 2 48 25 AM

mapInput does not work on native. 
On native, you cannot catch the error when calling map with the wrong input type.
Rework by passing the kclass to mapInput

Store mappers in map of KClass to Mapper
Also in the mapper interface add inputKClass and outputKClass.
inputKClass is used to store a mapper in the new mappers (KClass to Mapper) map in KamelConfigBuilder
fix bitmap decoder import for android
just like in `Mapper`, in `Fetcher` store `inputDataKClass` for the input data class of each `Fetcher` and in `Decoder` store the class of the output of the decoder in `outputKClass`

use these to pick a suitable fetcher in findFetcherFor and a suitable decoder in findDecoderFor
it hides the ExperimentalKamelApi opt in requirement
There was an import error on jvm

Also add moko-resources test dependency and expose it as well
@luca992 luca992 changed the title iOS and macOS support iOS, macOS, and js support Sep 13, 2022
@luca992 luca992 marked this pull request as ready for review May 8, 2023 00:21
@luca992
Copy link
Member Author

luca992 commented May 8, 2023

@alialbaali finished everything I wanted to do 🎉. I know you said you gave me permission to merge. But did you want to take a look first?

@alialbaali
Copy link
Member

alialbaali commented May 8, 2023

Astonishing work you've done there! Thank you, really appreciated! 🎉🎉🎉

I don't have any issues at all, just a couple of things:

  • Did it ever occur to you to change the function name lazyPainterResource, because I don't think "lazy" means what it means in this context or function. It's been bugging me for a while 🥲
  • How do we go about publishing? Last time I tried to publish it, I couldn't get it to work in my other multiplatform project, even though it shows here, so I had to downgrade to 0.3.0. IIRC, it had something to do with the newer version of Kotlin.
  • Since I'm not going to be maintaining this project anymore, do you have any ideas on how things could move forward? Would you like to keep working on it? Maybe through a fork, or by just changing the dependency name? Or Should I make this repository part of an organization?

I personally don't mind, so please let me know your thoughts. 🙂

@luca992
Copy link
Member Author

luca992 commented May 8, 2023

@alialbaali

  1. Honestly a lot of the names confuse me in general so I just didn't think about it and accepted it for what it was haha. You probably are right.

  2. Really? Publishing has been working fine for me. I might have fixed some bugs though along the way. So maybe it will work as it should now for you as well. I just published again here with the latest:

implementation("io.github.luca992.com.alialbaali.kamel:kamel-image:0.5-darwinandjs4")
  1. I'm down to maintain it. I don't know of any other image loading libraries for compose-multiplatform yet... so this is something I need haha. An organization might work well that way I can tag you in questions if you want to review prs occasionally. One thing you could do if you want to keep publishing under your name would be to setup a release branch which triggers a CI job to publish whenever a PR is merged into it.

@alialbaali
Copy link
Member

  1. Makes sense, haha 🥲. Feel free to change the names to whatever suitable maybe in another PR, or discussion. Even the name of the repository if you have something better in mind 😝

  2. Well, that's good to hear!

  3. The thing is, I don't prefer to keep publishing under my name when I'm not really doing any of the work right now. It seems unfair. So, I'm thinking of moving this repo to an organization, buy a domain name, and publish it under that domain. Maybe something like media.kamel:kamel-image:1.0.0. What do you think?

@luca992
Copy link
Member Author

luca992 commented May 8, 2023

3. The thing is, I don't prefer to keep publishing under my name when I'm not really doing any of the work right now. It seems unfair. So, I'm thinking of moving this repo to an organization, buy a domain name, and publish it under that domain. Maybe something like `media.kamel:kamel-image:1.0.0`. What do you think?

that works 👍

@alialbaali
Copy link
Member

Alright then.

Do you want to stick with the name Kamel? If so, what domain would you like us use?

So far, I found these two:

  • Kamel.media
  • Kamel.run

@luca992
Copy link
Member Author

luca992 commented May 8, 2023

I'd probably choose media if it were me. But your choice haha. And I think kamel is a solid name

@alialbaali
Copy link
Member

Alright. So, I got the domain, and the repository has been transferred to an organization.

I'm guessing we're going to keep publishing on Maven Central, correct? If so, I think we might need a separate Sonatype Jira account where we can share the credentials? Or is it possible to invite someone to the project?

@alialbaali
Copy link
Member

Any thoughts @luca992?

@luca992
Copy link
Member Author

luca992 commented May 17, 2023

Alright. So, I got the domain, and the repository has been transferred to an organization.

I'm guessing we're going to keep publishing on Maven Central, correct? If so, I think we might need a separate Sonatype Jira account where we can share the credentials? Or is it possible to invite someone to the project?

I don't think there's really any other viable option besides Maven Central anymore. And if you want to share credentials that's fine. You could make a bitwarden organization if you wanted to do that. But there's no way there's not a way to give multiple accounts permission to release to maven central for an organization.... however I have no idea how that works. Sonatype Jira is so confusing 🙃 maybe you can ask in the same ticket you use to create the new repository?

@alialbaali
Copy link
Member

I just need your Sonatype username, so I can let you publish artifacts. @luca992

@alialbaali
Copy link
Member

Alright, I messaged you.

@luca992 luca992 merged commit 19f8fac into Kamel-Media:main May 24, 2023
@iadcialim
Copy link

Thank you guys for this great library! Curious if there is significant change in the usage/documentation?

@luca992
Copy link
Member Author

luca992 commented Jul 18, 2023

Thank you guys for this great library! Curious if there is significant change in the usage/documentation?

There shouldn't have been from this pr. The main README.md should be upto date

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.

7 participants