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

feat: Refactor screenshot capture for improved performance and reliab… #150

Closed
wants to merge 2 commits into from

Conversation

marandaneto
Copy link
Member

…ility

This commit refactors the captureScreenshot method in ScreenshotCapturer
to improve performance and reliability. The changes include:

  • Synchronous Setup: The method now performs synchronous operations first
    (getting context, render object, calculating pixel ratio, and getting the
    initial image) before executing the main process asynchronously. This
    ensures that the initial setup is done on the main UI thread, as required.

  • Asynchronous Processing: The main image processing and masking logic
    are now executed asynchronously using a Future and Completer,
    preventing UI jank.

  • Snapshot Management: The _views Expando is replaced with a
    SnapshotManager to manage the status of the view, improving code
    organization and maintainability.- feat: Refactor screenshot capture for improved performance and reliability

  • chore: process image in completable future example

💡 Motivation and Context

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

thisames and others added 2 commits January 8, 2025 09:19
…ility

This commit refactors the `captureScreenshot` method in `ScreenshotCapturer`
to improve performance and reliability. The changes include:

-   **Synchronous Setup:** The method now performs synchronous operations first
    (getting context, render object, calculating pixel ratio, and getting the
    initial image) before executing the main process asynchronously. This
    ensures that the initial setup is done on the main UI thread, as required.

-   **Asynchronous Processing:** The main image processing and masking logic
    are now executed asynchronously using a `Future` and `Completer`,
    preventing UI jank.

-   **Snapshot Management:** The `_views` Expando is replaced with a
    `SnapshotManager` to manage the status of the view, improving code
    organization and maintainability.
Copy link

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Next" section. Make sure the entry includes this PR's number.
Example:

## Next
- Refactor screenshot capture for improved performance and reliab… ([#150](https://github.com/PostHog/posthog-flutter/pull/150))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 9992590

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