-
Notifications
You must be signed in to change notification settings - Fork 30
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
Update Image Loader and Implement Naive content templating #109
base: main
Are you sure you want to change the base?
Conversation
…twork/MastodonApiKtor.kt Co-authored-by: Omid Ghenatnevi <O.Ghenatnevi@gmail.com>
…/repository/timeline/HomeTimelineRepository.kt Co-authored-by: Omid Ghenatnevi <O.Ghenatnevi@gmail.com>
Co-authored-by: Omid Ghenatnevi <O.Ghenatnevi@gmail.com>
…n/DefaultRootComponent.kt Co-authored-by: Omid Ghenatnevi <O.Ghenatnevi@gmail.com>
…imelineContent.kt Co-authored-by: Omid Ghenatnevi <O.Ghenatnevi@gmail.com>
…imelineContent.kt Co-authored-by: Omid Ghenatnevi <O.Ghenatnevi@gmail.com>
…composables/SignedInRootContent.kt Co-authored-by: Omid Ghenatnevi <O.Ghenatnevi@gmail.com>
…imelineContent.kt Co-authored-by: Omid Ghenatnevi <O.Ghenatnevi@gmail.com>
…twork/MastodonApiKtor.kt Co-authored-by: Omid Ghenatnevi <O.Ghenatnevi@gmail.com>
this is stacked on my other diff |
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.
Just did a quick early review for it..
This looks really good! I think you should be able to remove the platform specific logic for loading urls now, I didn't see that code delete in this PR.
ui/signed-out/src/commonMain/kotlin/social/androiddev/signedout/landing/LandingContent.kt
Outdated
Show resolved
Hide resolved
ui/common/src/commonMain/kotlin/social/androiddev/common/utils/HtmlParser.kt
Outdated
Show resolved
Hide resolved
ui/common/src/commonMain/kotlin/social/androiddev/common/utils/HtmlParser.kt
Outdated
Show resolved
Hide resolved
ui/common/src/commonMain/kotlin/social/androiddev/common/utils/HtmlParser.kt
Outdated
Show resolved
Hide resolved
ui/common/src/commonMain/kotlin/social/androiddev/common/utils/AsyncImage.kt
Outdated
Show resolved
Hide resolved
modifier = modifier | ||
) | ||
} | ||
KamelImage( |
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.
Is this truly KMP support or just JVM?
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.
just jvm, but ios has native support afaik
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.
Cool, we should follow-up on this and change this to an expect/actual
contentDescription = "User avatar", | ||
modifier = modifier.width(48.dp).clip(RoundedCornerShape(5.dp)) | ||
modifier = modifier.width(48.dp).height(48.dp).clip(RoundedCornerShape(5.dp)) |
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.
modifier.size(48.dp) should already set it for both dimensions
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.
for some reason it was not rendering the avatars after switching to the new library. We can play with it later but yeah it never assumed a height
@@ -45,6 +48,9 @@ kotlin { | |||
implementation(compose.material) | |||
api(libs.com.arkivanov.decompose) | |||
api(libs.com.arkivanov.decompose.extensions.compose.jetbrains) | |||
implementation("com.alialbaali.kamel:kamel-image:0.4.0") | |||
implementation("it.skrape:skrapeit:1.2.2") |
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.
Is this also JVM only? Maybe we can use this as a resource and roll our own purely kotlin parser which also supports iOS
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.
yup yup jvm only. I think this gets us off the ground and agree we would need something more robust in future
@@ -26,6 +26,13 @@ android { | |||
targetCompatibility = JavaVersion.VERSION_11 | |||
} | |||
|
|||
packagingOptions { | |||
exclude ("META-INF/DEPENDENCIES") |
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've always wondering what this stuff is for? Is this generated or you had to add manually to fix a build issue?
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.
Manually to fix a build issue. My naive understanding is that multiple libraries have the same metadata file name and clash
20026c0
to
3efb36e
Compare
# Conflicts: # app-android/build.gradle.kts # data/network/build.gradle.kts # data/network/src/commonMain/kotlin/social/androiddev/common/network/model/Status.kt # data/persistence/build.gradle.kts # data/repository/build.gradle.kts # data/repository/src/commonMain/kotlin/social/androiddev/common/repository/timeline/ModelMappers.kt # data/repository/src/commonMain/kotlin/social/androiddev/common/repository/timeline/RealHomeTimelineRepository.kt # data/repository/src/commonMain/kotlin/social/androiddev/common/repository/timeline/TimelineFetcher.kt # data/repository/src/commonMain/kotlin/social/androiddev/common/repository/timeline/TimelineSourceOfTruth.kt # data/repository/src/commonTest/kotlin/social/androiddev/common/repository/timeline/RealHomeTimelineRepositoryTest.kt # data/repository/src/commonTest/kotlin/social/androiddev/common/repository/timeline/fixtures/TestFixtures.kt # di/build.gradle.kts # domain/authentication/build.gradle.kts # domain/timeline/build.gradle.kts # domain/timeline/src/commonMain/kotlin/social/androiddev/domain/timeline/model/StatusLocal.kt # gradle/libs.versions.toml # ui/common/build.gradle.kts # ui/signed-in/build.gradle.kts # ui/timeline/build.gradle.kts # ui/timeline/src/commonMain/kotlin/social/androiddev/timeline/TootContent.kt # ui/timeline/src/commonMain/kotlin/social/androiddev/timeline/navigation/TimelineViewModel.kt
|
||
val content = htmlDocument(newlineReplace) | ||
|
||
val body = content.body { |
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.
At this point, the only thing we are using skrape for is to get the paragraph body without any other tags and then for getting the list of links.
We can hand roll that logic ourselves and target ios
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.
🎉
...onTest/kotlin/social/androiddev/common/repository/timeline/RealHomeTimelineRepositoryTest.kt
Outdated
Show resolved
Hide resolved
dependencies { | ||
implementation(kotlin("test")) | ||
implementation(libs.org.jetbrains.kotlin.test.common) | ||
implementation(libs.org.jetbrains.kotlin.test.annotations.common) |
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.
Formatting here looks off, but it could be because I'm on my phone
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.
ran spotless apply just in case
modifier = modifier | ||
) | ||
} | ||
KamelImage( |
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.
Cool, we should follow-up on this and change this to an expect/actual
* Takes a String reciever of html text | ||
* converts it to an annotated string of text and links | ||
*/ | ||
fun String.renderHtml(): AnnotatedString { |
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.
This probably should be either moved to the ViewModel itself and not a public API, or renamed to something that is more descriptive. something like
fun String.extractTootContentFromHtml()
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.
renamed to extractContentFromMicroFormat
When looking at Tusky, I noticed there are a few places where we get this type of text (profile and server about is another)
Going to leave as a utility for now
ui/signed-in/build.gradle.kts
Outdated
implementation(projects.data.persistence) | ||
implementation(projects.data.repository) | ||
implementation(projects.domain.timeline) | ||
implementation(libs.io.insert.koin.core) |
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.
The koin dependency is already added at line 19.
…/repository/timeline/RealHomeTimelineRepositoryTest.kt Co-authored-by: Omid Ghenatnevi <O.Ghenatnevi@gmail.com>
📑 What does this PR do?
Adds an image loading library
Adds a html parsing library
displays the avatar
parses content html and displays as annotated string with links in blue
✅ Checklist
🧪 How can this PR been tested?
🧾 Tasks Remaining: (List of tasks remaining to be implemented)
🖼️ Screenshots (if applicable):