File tree Expand file tree Collapse file tree 8 files changed +46
-15
lines changed
main/java/io/sentry/android/fragment
test/java/io/sentry/android/fragment
sentry-android-replay/src/main/java/io/sentry/android/replay Expand file tree Collapse file tree 8 files changed +46
-15
lines changed Original file line number Diff line number Diff line change 8
8
9
9
### Fixes
10
10
11
+ - Replace setOf with HashSet.add ([ #3801 ] ( https://github.com/getsentry/sentry-java/pull/3801 ) )
11
12
- Cache parsed Dsn ([ #3796 ] ( https://github.com/getsentry/sentry-java/pull/3796 ) )
12
13
- fix invalid profiles when the transaction name is empty ([ #3747 ] ( https://github.com/getsentry/sentry-java/pull/3747 ) )
13
14
- Deprecate ` enableTracing ` option ([ #3777 ] ( https://github.com/getsentry/sentry-java/pull/3777 ) )
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ public final class io/sentry/android/fragment/FragmentLifecycleIntegration : and
24
24
public final class io/sentry/android/fragment/FragmentLifecycleState : java/lang/Enum {
25
25
public static final field ATTACHED Lio/sentry/android/fragment/FragmentLifecycleState;
26
26
public static final field CREATED Lio/sentry/android/fragment/FragmentLifecycleState;
27
+ public static final field Companion Lio/sentry/android/fragment/FragmentLifecycleState$Companion;
27
28
public static final field DESTROYED Lio/sentry/android/fragment/FragmentLifecycleState;
28
29
public static final field DETACHED Lio/sentry/android/fragment/FragmentLifecycleState;
29
30
public static final field PAUSED Lio/sentry/android/fragment/FragmentLifecycleState;
@@ -37,6 +38,10 @@ public final class io/sentry/android/fragment/FragmentLifecycleState : java/lang
37
38
public static fun values ()[Lio/sentry/android/fragment/FragmentLifecycleState;
38
39
}
39
40
41
+ public final class io/sentry/android/fragment/FragmentLifecycleState$Companion {
42
+ public final fun getStates ()Ljava/util/HashSet;
43
+ }
44
+
40
45
public final class io/sentry/android/fragment/SentryFragmentLifecycleCallbacks : androidx/fragment/app/FragmentManager$FragmentLifecycleCallbacks {
41
46
public static final field Companion Lio/sentry/android/fragment/SentryFragmentLifecycleCallbacks$Companion;
42
47
public static final field FRAGMENT_LOAD_OP Ljava/lang/String;
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class FragmentLifecycleIntegration(
24
24
25
25
constructor (application: Application ) : this (
26
26
application = application,
27
- filterFragmentLifecycleBreadcrumbs = FragmentLifecycleState .values().toSet() ,
27
+ filterFragmentLifecycleBreadcrumbs = FragmentLifecycleState .states ,
28
28
enableAutoFragmentLifecycleTracing = false
29
29
)
30
30
@@ -34,7 +34,7 @@ class FragmentLifecycleIntegration(
34
34
enableAutoFragmentLifecycleTracing: Boolean
35
35
) : this (
36
36
application = application,
37
- filterFragmentLifecycleBreadcrumbs = FragmentLifecycleState .values().toSet()
37
+ filterFragmentLifecycleBreadcrumbs = FragmentLifecycleState .states
38
38
.takeIf { enableFragmentLifecycleBreadcrumbs }
39
39
.orEmpty(),
40
40
enableAutoFragmentLifecycleTracing = enableAutoFragmentLifecycleTracing
Original file line number Diff line number Diff line change @@ -11,5 +11,21 @@ enum class FragmentLifecycleState(internal val breadcrumbName: String) {
11
11
STOPPED (" stopped" ),
12
12
VIEW_DESTROYED (" view destroyed" ),
13
13
DESTROYED (" destroyed" ),
14
- DETACHED (" detached" )
14
+ DETACHED (" detached" );
15
+
16
+ companion object {
17
+ val states = HashSet <FragmentLifecycleState >().apply {
18
+ add(ATTACHED )
19
+ add(SAVE_INSTANCE_STATE )
20
+ add(CREATED )
21
+ add(VIEW_CREATED )
22
+ add(STARTED )
23
+ add(RESUMED )
24
+ add(PAUSED )
25
+ add(STOPPED )
26
+ add(VIEW_DESTROYED )
27
+ add(DESTROYED )
28
+ add(DETACHED )
29
+ }
30
+ }
15
31
}
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ class SentryFragmentLifecycleCallbacks(
31
31
enableAutoFragmentLifecycleTracing: Boolean
32
32
) : this (
33
33
hub = hub,
34
- filterFragmentLifecycleBreadcrumbs = FragmentLifecycleState .values().toSet()
34
+ filterFragmentLifecycleBreadcrumbs = FragmentLifecycleState .states
35
35
.takeIf { enableFragmentLifecycleBreadcrumbs }
36
36
.orEmpty(),
37
37
enableAutoFragmentLifecycleTracing = enableAutoFragmentLifecycleTracing
@@ -42,7 +42,7 @@ class SentryFragmentLifecycleCallbacks(
42
42
enableAutoFragmentLifecycleTracing: Boolean = false
43
43
) : this (
44
44
hub = HubAdapter .getInstance(),
45
- filterFragmentLifecycleBreadcrumbs = FragmentLifecycleState .values().toSet()
45
+ filterFragmentLifecycleBreadcrumbs = FragmentLifecycleState .states
46
46
.takeIf { enableFragmentLifecycleBreadcrumbs }
47
47
.orEmpty(),
48
48
enableAutoFragmentLifecycleTracing = enableAutoFragmentLifecycleTracing
Original file line number Diff line number Diff line change
1
+ package io.sentry.android.fragment
2
+
3
+ import kotlin.test.Test
4
+ import kotlin.test.assertEquals
5
+
6
+ class FragmentLifecycleStateTest {
7
+ @Test
8
+ fun `states contains all states` () {
9
+ assertEquals(FragmentLifecycleState .states, FragmentLifecycleState .values().toSet())
10
+ }
11
+ }
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ class SentryFragmentLifecycleCallbacksTest {
40
40
val span = mock<ISpan >()
41
41
42
42
fun getSut (
43
- loggedFragmentLifecycleStates : Set <FragmentLifecycleState > = FragmentLifecycleState .values().toSet() ,
43
+ loggedFragmentLifecycleStates : Set <FragmentLifecycleState > = FragmentLifecycleState .states ,
44
44
enableAutoFragmentLifecycleTracing : Boolean = false,
45
45
tracesSampleRate : Double? = 1.0,
46
46
isAdded : Boolean = true
Original file line number Diff line number Diff line change @@ -12,15 +12,13 @@ import kotlin.LazyThreadSafetyMode.NONE
12
12
public open class DefaultReplayBreadcrumbConverter : ReplayBreadcrumbConverter {
13
13
internal companion object {
14
14
private val snakecasePattern by lazy(NONE ) { " _[a-z]" .toRegex() }
15
- private val supportedNetworkData by lazy(NONE ) {
16
- setOf (
17
- " status_code" ,
18
- " method" ,
19
- " response_content_length" ,
20
- " request_content_length" ,
21
- " http.response_content_length" ,
22
- " http.request_content_length"
23
- )
15
+ private val supportedNetworkData = HashSet <String >().apply {
16
+ add(" status_code" )
17
+ add(" method" )
18
+ add(" response_content_length" )
19
+ add(" request_content_length" )
20
+ add(" http.response_content_length" )
21
+ add(" http.request_content_length" )
24
22
}
25
23
}
26
24
You can’t perform that action at this time.
0 commit comments