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: Track buttons text only for clickable elements in Autocapture #219

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.amplitude.android.internal.locators

import android.view.View
import android.widget.TextView
import android.widget.Button
import com.amplitude.android.internal.ViewResourceUtils.resourceIdWithFallback
import com.amplitude.android.internal.ViewTarget
import com.amplitude.android.internal.ViewTarget.Type
Expand Down Expand Up @@ -31,7 +31,7 @@ internal class AndroidViewTargetLocator : ViewTargetLocator {
val tag = tag
?.takeIf { it is String || it is Number || it is Boolean || it is Char }
?.toString()
val text = (this as? TextView)?.text?.toString()
val text = (this as? Button)?.text?.toString()
return ViewTarget(this, className, resourceName, tag, text, SOURCE, hierarchy)
}

Expand Down