Skip to content

Commit 20e7088

Browse files
committed
ktlint
1 parent 0c8e6aa commit 20e7088

File tree

3 files changed

+47
-28
lines changed

3 files changed

+47
-28
lines changed

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

Lines changed: 45 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package io.sentry.flutter
22

33
import android.app.Activity
44
import android.content.Context
5-
import android.content.res.Configuration;
5+
import android.content.res.Configuration
66
import android.os.Build
77
import android.os.Looper
88
import android.util.Log
@@ -40,19 +40,23 @@ import kotlin.math.roundToInt
4040

4141
private const val APP_START_MAX_DURATION_MS = 60000
4242

43-
class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
43+
class SentryFlutterPlugin :
44+
FlutterPlugin,
45+
MethodCallHandler,
46+
ActivityAware {
4447
private lateinit var channel: MethodChannel
4548
private lateinit var context: Context
4649
private lateinit var sentryFlutter: SentryFlutter
4750
private lateinit var replay: ReplayIntegration
48-
private var replayConfig = ScreenshotRecorderConfig(
49-
recordingWidth = 0,
50-
recordingHeight = 0,
51-
scaleFactorX = 1.0f,
52-
scaleFactorY = 1.0f,
53-
frameRate = 0,
54-
bitRate = 0
55-
)
51+
private var replayConfig =
52+
ScreenshotRecorderConfig(
53+
recordingWidth = 0,
54+
recordingHeight = 0,
55+
scaleFactorX = 1.0f,
56+
scaleFactorY = 1.0f,
57+
frameRate = 0,
58+
bitRate = 0,
59+
)
5660

5761
private var activity: WeakReference<Activity>? = null
5862
private var framesTracker: ActivityFramesTracker? = null
@@ -167,7 +171,12 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
167171
recorderConfigProvider = {
168172
Log.i(
169173
"Sentry",
170-
"Replay configuration requested. Returning: %dx%d at %d FPS, %d BPS".format(replayConfig.recordingWidth, replayConfig.recordingHeight, replayConfig.frameRate, replayConfig.bitRate)
174+
"Replay configuration requested. Returning: %dx%d at %d FPS, %d BPS".format(
175+
replayConfig.recordingWidth,
176+
replayConfig.recordingHeight,
177+
replayConfig.frameRate,
178+
replayConfig.bitRate,
179+
),
171180
)
172181
replayConfig
173182
},
@@ -567,12 +576,12 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
567576
}
568577

569578
private fun Double.adjustReplaySizeToBlockSize(): Double {
570-
val remainder = this % 16
571-
return if (remainder <= 8) {
572-
this - remainder
573-
} else {
574-
this + (16 - remainder)
575-
}
579+
val remainder = this % 16
580+
return if (remainder <= 8) {
581+
this - remainder
582+
} else {
583+
this + (16 - remainder)
584+
}
576585
}
577586
}
578587

@@ -605,7 +614,10 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
605614
result.success("")
606615
}
607616

608-
private fun setReplayConfig(call: MethodCall, result: Result) {
617+
private fun setReplayConfig(
618+
call: MethodCall,
619+
result: Result,
620+
) {
609621
// Since codec block size is 16, so we have to adjust the width and height to it,
610622
// otherwise the codec might fail to configure on some devices, see
611623
// https://cs.android.com/android/platform/superproject/+/master:frameworks/base/media/java/android/media/MediaCodecInfo.java;l=1999-2001
@@ -622,17 +634,23 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware {
622634
height = newHeight
623635
}
624636

625-
replayConfig = ScreenshotRecorderConfig(
626-
recordingWidth = width.roundToInt(),
627-
recordingHeight = height.roundToInt(),
628-
scaleFactorX = 1.0f,
629-
scaleFactorY = 1.0f,
630-
frameRate = call.argument("frameRate") as? Int ?: 0,
631-
bitRate = call.argument("bitRate") as? Int ?: 0
632-
)
637+
replayConfig =
638+
ScreenshotRecorderConfig(
639+
recordingWidth = width.roundToInt(),
640+
recordingHeight = height.roundToInt(),
641+
scaleFactorX = 1.0f,
642+
scaleFactorY = 1.0f,
643+
frameRate = call.argument("frameRate") as? Int ?: 0,
644+
bitRate = call.argument("bitRate") as? Int ?: 0,
645+
)
633646
Log.i(
634647
"Sentry",
635-
"Configuring replay: %dx%d at %d FPS, %d BPS".format(replayConfig.recordingWidth, replayConfig.recordingHeight, replayConfig.frameRate, replayConfig.bitRate)
648+
"Configuring replay: %dx%d at %d FPS, %d BPS".format(
649+
replayConfig.recordingWidth,
650+
replayConfig.recordingHeight,
651+
replayConfig.frameRate,
652+
replayConfig.bitRate,
653+
),
636654
)
637655
replay.onConfigurationChanged(Configuration())
638656
result.success("")

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal class SentryFlutterReplayRecorder(
1616
// Ignore if this is the initial call before we actually got the configuration from Flutter.
1717
// We'll get another call here when the configuration is set.
1818
if (recorderConfig.recordingHeight == 0 && recorderConfig.recordingWidth == 0) {
19-
return;
19+
return
2020
}
2121

2222
val cacheDirPath = integration.replayCacheDir?.absolutePath

flutter/example/android/app/src/main/kotlin/io/sentry/samples/flutter/MainActivity.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class MainActivity : FlutterActivity() {
4444
}
4545

4646
private external fun crash()
47+
4748
private external fun message()
4849

4950
companion object {

0 commit comments

Comments
 (0)