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

Fix memory leak in EnhancedMovementMethod #1086

Merged
merged 4 commits into from
Jul 22, 2024

Conversation

khaykov
Copy link
Member

@khaykov khaykov commented Jul 18, 2024

Fix

With a help from Leak Canary I found a leak in EnhancedMovementMethod.

In this PR we are using weak reference for a click listener. Task list listener is not leaking, so it's ok to keep it as is.

Test

  1. Add link tap handler to aztec instance in Main Activity like this:
 aztec = Aztec.with(visualEditor, sourceEditor, toolbar, this)
            ....
            .setLinkTapEnabled(true)
            .setOnLinkTappedListener(object : AztecText.OnLinkTappedListener {
                override fun onLinkTapped(widget: View, url: String) {
                    val intent = Intent(Intent.ACTION_VIEW)
                    intent.data = Uri.parse(url)
                    startActivity(intent)
                }
            })
            ....
  1. Open the app in tap on the link.
  2. Confirm that it works and the browser is opened.

Review

@[USER_NAME]

Make sure strings will be translated:

  • If there are new strings that have to be translated, I have added them to the client's strings.xml as a part of the integration PR.

Copy link
Contributor

@zwarm zwarm left a comment

Choose a reason for hiding this comment

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

All looks good @khaykov
I was able to tap on a link and launch the browser. 🥳

@zwarm zwarm merged commit 3c95e7b into trunk Jul 22, 2024
14 checks passed
@zwarm zwarm deleted the issue/fix-memory-leak-in-enhanced-movement-method branch July 22, 2024 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants