File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed
reactive/kotlinx-coroutines-rx2 Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -137,8 +137,9 @@ public fun <T: Any> Flow<T>.asFlowable(context: CoroutineContext = EmptyCoroutin
137
137
138
138
@Deprecated(
139
139
message = " Deprecated in the favour of Flow" ,
140
- level = DeprecationLevel .ERROR , replaceWith = ReplaceWith (" this.consumeAsFlow().asObservable()" ) // Deprecated since 1.4.0
141
- )
140
+ level = DeprecationLevel .ERROR ,
141
+ replaceWith = ReplaceWith (" this.consumeAsFlow().asObservable(context)" , " kotlinx.coroutines.flow.consumeAsFlow" )
142
+ ) // Deprecated since 1.4.0
142
143
public fun <T : Any > ReceiveChannel<T>.asObservable (context : CoroutineContext ): Observable <T > = rxObservable(context) {
143
144
for (t in this @asObservable)
144
145
send(t)
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package kotlinx.coroutines.rx2
6
6
7
7
import kotlinx.coroutines.*
8
8
import kotlinx.coroutines.channels.*
9
+ import kotlinx.coroutines.flow.*
9
10
import org.junit.Assert
10
11
import org.junit.Test
11
12
import kotlin.test.*
@@ -126,7 +127,7 @@ class ConvertTest : TestBase() {
126
127
delay(50 )
127
128
send(" K" )
128
129
}
129
- val observable = c.asObservable(Dispatchers .Unconfined )
130
+ val observable = c.consumeAsFlow(). asObservable(Dispatchers .Unconfined )
130
131
checkSingleValue(observable.reduce { t1, t2 -> t1 + t2 }.toSingle()) {
131
132
assertEquals(" OK" , it)
132
133
}
@@ -140,7 +141,7 @@ class ConvertTest : TestBase() {
140
141
delay(50 )
141
142
throw TestException (" K" )
142
143
}
143
- val observable = c.asObservable(Dispatchers .Unconfined )
144
+ val observable = c.consumeAsFlow(). asObservable(Dispatchers .Unconfined )
144
145
val single = rxSingle(Dispatchers .Unconfined ) {
145
146
var result = " "
146
147
try {
@@ -155,4 +156,4 @@ class ConvertTest : TestBase() {
155
156
assertEquals(" OK" , it)
156
157
}
157
158
}
158
- }
159
+ }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package kotlinx.coroutines.rx2
6
6
7
7
import io.reactivex.*
8
8
import kotlinx.coroutines.*
9
+ import kotlinx.coroutines.flow.*
9
10
import org.junit.Test
10
11
import org.junit.runner.*
11
12
import org.junit.runners.*
@@ -92,7 +93,7 @@ class IntegrationTest(
92
93
assertFailsWith<IllegalArgumentException > { observable.awaitSingle() }
93
94
checkNumbers(n, observable)
94
95
val channel = observable.openSubscription()
95
- checkNumbers(n, channel.asObservable(ctx(coroutineContext)))
96
+ checkNumbers(n, channel.consumeAsFlow(). asObservable(ctx(coroutineContext)))
96
97
channel.cancel()
97
98
}
98
99
@@ -131,4 +132,4 @@ class IntegrationTest(
131
132
assertEquals(n, last)
132
133
}
133
134
134
- }
135
+ }
You can’t perform that action at this time.
0 commit comments