Skip to content

Commit ed4cab2

Browse files
committed
linter issues
1 parent 301b327 commit ed4cab2

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterReplayBreadcrumbConverter.kt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import io.sentry.rrweb.RRWebSpanEvent
88
import java.util.Date
99

1010
private const val MILLIS_PER_SECOND = 1000.0
11+
private const val MAX_PATH_ITEMS = 4
12+
private const val MAX_PATH_IDENTIFIER_LENGTH = 20
1113

1214
class SentryFlutterReplayBreadcrumbConverter : DefaultReplayBreadcrumbConverter() {
1315
internal companion object {
@@ -85,16 +87,12 @@ class SentryFlutterReplayBreadcrumbConverter : DefaultReplayBreadcrumbConverter(
8587
}
8688

8789
private fun getTouchPathMessage(maybePath: Any?): String? {
88-
if (maybePath !is List<*>) {
89-
return null
90-
}
91-
92-
if (maybePath.isEmpty()) {
90+
if (maybePath !is List<*> || maybePath.isEmpty()) {
9391
return null
9492
}
9593

9694
val message = StringBuilder()
97-
for (i in Math.min(3, maybePath.size - 1) downTo 0) {
95+
for (i in Math.min(MAX_PATH_ITEMS, maybePath.size) - 1 downTo 0) {
9896
val item = maybePath[i]
9997
if (item !is Map<*, *>) {
10098
continue
@@ -104,8 +102,8 @@ class SentryFlutterReplayBreadcrumbConverter : DefaultReplayBreadcrumbConverter(
104102

105103
var identifier = item["label"] ?: item["name"]
106104
if (identifier is String && identifier.isNotEmpty()) {
107-
if (identifier.length > 20) {
108-
identifier = identifier.substring(0, 17) + "..."
105+
if (identifier.length > MAX_PATH_IDENTIFIER_LENGTH) {
106+
identifier = identifier.substring(0, MAX_PATH_IDENTIFIER_LENGTH - "...".length) + "..."
109107
}
110108
message.append("(").append(identifier).append(")")
111109
}

flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterReplayRecorder.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal class SentryFlutterReplayRecorder(
1212
private val channel: MethodChannel,
1313
private val integration: ReplayIntegration,
1414
) : Recorder {
15-
override fun start(config: ScreenshotRecorderConfig) {
15+
override fun start(recorderConfig: ScreenshotRecorderConfig) {
1616
val cacheDirPath = integration.replayCacheDir?.absolutePath
1717
if (cacheDirPath == null) {
1818
Log.w("Sentry", "Replay cache directory is null, can't start replay recorder.")
@@ -24,9 +24,9 @@ internal class SentryFlutterReplayRecorder(
2424
"ReplayRecorder.start",
2525
mapOf(
2626
"directory" to cacheDirPath,
27-
"width" to config.recordingWidth,
28-
"height" to config.recordingHeight,
29-
"frameRate" to config.frameRate,
27+
"width" to recorderConfig.recordingWidth,
28+
"height" to recorderConfig.recordingHeight,
29+
"frameRate" to recorderConfig.frameRate,
3030
"replayId" to integration.getReplayId().toString(),
3131
),
3232
)

0 commit comments

Comments
 (0)