Skip to content

Commit 1c58e4c

Browse files
committed
chore: remove code comment
1 parent 9f094e3 commit 1c58e4c

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

app/src/main/java/global/x/weather/infrastructure/util/LiveDataExtension.kt

-22
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,6 @@ fun LiveData<Boolean>.observeAsAction(
88
action: () -> Unit,
99
onActionResolved: () -> Unit
1010
) {
11-
// LiveData will only keep one subscription per-LifecycleOwner. If one is already present the
12-
// new LiveData.observe() call will have no effect. See implementation of LiveData.observe() for
13-
// reference. If action relies on variable parameters subsequent calls would be ignored and the
14-
// old set of parameters will be used.
15-
//
16-
// The most common example is action using a CoroutineScope provided by a Composable. The
17-
// CoroutineScope can change if the Composable is recreated (not just recomposed). By default
18-
// the old scope would be used instead of the new one.
19-
//
20-
// To resolve this problem we remove previous observers on the provided LifecycleOwner is
21-
// BEFORE calling LiveData.observe() to ensure a new subscription with new parameters.
2211
this.removeObservers(lifecycleOwner)
2312
this.observe(lifecycleOwner) { isActionRequested ->
2413
if (isActionRequested == true) {
@@ -33,17 +22,6 @@ fun <T> LiveData<T?>.observeAsAction(
3322
action: (T) -> Unit,
3423
onActionResolved: () -> Unit
3524
) {
36-
// LiveData will only keep one subscription per-LifecycleOwner. If one is already present the
37-
// new LiveData.observe() call will have no effect. See implementation of LiveData.observe() for
38-
// reference. If action relies on variable parameters subsequent calls would be ignored and the
39-
// old set of parameters will be used.
40-
//
41-
// The most common example is action using a CoroutineScope provided by a Composable. The
42-
// CoroutineScope can change if the Composable is recreated (not just recomposed). By default
43-
// the old scope would be used instead of the new one.
44-
//
45-
// To resolve this problem we remove previous observers on the provided LifecycleOwner is
46-
// BEFORE calling LiveData.observe() to ensure a new subscription with new parameters.
4725
this.removeObservers(lifecycleOwner)
4826
this.observe(lifecycleOwner) { actionParams ->
4927
if (actionParams != null) {

0 commit comments

Comments
 (0)