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

Add preview of images in Apps catalog #815

Merged

Conversation

makeevrserg
Copy link
Collaborator

Background

Currently int application users doesn't have an ability to preiew screenshots of hub applications.

Changes

  • Created module screenshotspreview which allows to display preview images
  • Added module integration with modules inside faphub via callbacks

Test plan

  1. Open Hub->Apps
  2. Wait until apps loaded and click on the image inside app item
  3. Open app screen details and click on the image
  4. Open Hub->Apps->Search and repeat the steps 2-3 from above

@@ -250,6 +250,8 @@ decompose-jetpack = { module = "com.arkivanov.decompose:extensions-compose", ver
essenty-lifecycle = { module = "com.arkivanov.essenty:lifecycle", version.ref = "essenty" }
essenty-lifecycle-coroutines = { module = "com.arkivanov.essenty:lifecycle-coroutines", version.ref = "essenty" }

zoomable = { module = "net.engawapg.lib:zoomable", version.ref = "zoomable" }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The library looks good, updating with bot, have Modifier.Node api. In case of KMP we can create PR to add it's support later

@@ -12,7 +13,8 @@ abstract class BottomBarDecomposeComponent<C : Any> : CompositeDecomposeComponen
operator fun invoke(
componentContext: ComponentContext,
onBack: DecomposeOnBackParameter,
deeplink: Deeplink.BottomBar?
deeplink: Deeplink.BottomBar?,
screenshotsClickListener: ScreenshotsClickListener
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There's overall "little bit" callback hell right now. But even deeplinks will be required inside AssistedFactories

Copy link
Member

Choose a reason for hiding this comment

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

I think you should use LocalRootNavigation in this case. Could you, please, check this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Replaced with LocalRootNavigation

screenshots: ImmutableList<String>,
urlImageShareViewModel: UrlImageShareViewModel
) {
val itemsAmount = remember { screenshots.size }
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure that current keys in remember is correct? Maybe use screenshots as key?
Also i'm not sure if it's really necessary to use remember here. Can you check?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Previously there was different chunk of code. Indeed in ImmutableList the size is set at init and can't be changed after. So it's useless now

.size(24.dp)
.clickableRipple(bounded = false, onClick = onBack),
painter = painterResource(DesignSystem.drawable.ic_back),
contentDescription = null.orEmpty()
Copy link
Member

Choose a reason for hiding this comment

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

Why not use null here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added contentDescription

private fun Bitmap.fillBackground(): Bitmap {
val newBitmap = Bitmap.createBitmap(width, height, config)
val canvas = Canvas(newBitmap)
canvas.drawColor(Color.rgb(ACCENT_COLOR_R, ACCENT_COLOR_G, ACCENT_COLOR_B))
Copy link
Member

@LionZXY LionZXY Apr 10, 2024

Choose a reason for hiding this comment

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

Maybe reuse the colour from other place?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Replaced with accent color from DesignSystem

@makeevrserg makeevrserg marked this pull request as draft April 10, 2024 10:56
@makeevrserg makeevrserg marked this pull request as ready for review April 10, 2024 11:28
Copy link
Member

@LionZXY LionZXY left a comment

Choose a reason for hiding this comment

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

Thank you so much for your work - it's of incredible quality both in terms of code and final user experience!

@LionZXY LionZXY added this pull request to the merge queue Apr 10, 2024
Merged via the queue into flipperdevices:dev with commit 340d062 Apr 10, 2024
8 checks passed
@makeevrserg makeevrserg deleted the feature/screenshotspreview-rebased branch August 17, 2024 06:36
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.

2 participants