Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions app/src/main/java/com/dropbox/android/sample/Graph.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import com.dropbox.android.sample.data.model.RedditDb
import com.dropbox.android.sample.data.remote.Api
import com.squareup.moshi.Moshi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext
import okio.Buffer
Expand All @@ -33,8 +31,6 @@ import kotlin.time.ExperimentalTime
import kotlin.time.seconds

@OptIn(
FlowPreview::class,
ExperimentalCoroutinesApi::class,
ExperimentalTime::class,
ExperimentalStdlibApi::class
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ import com.dropbox.android.external.store4.get
import com.dropbox.android.sample.SampleApp
import com.dropbox.android.sample.data.model.Post
import com.dropbox.android.sample.utils.Lce
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.launch

@OptIn(FlowPreview::class, ExperimentalCoroutinesApi::class)
class RedditViewModel(
app: Application
) : AndroidViewModel(app) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import com.dropbox.android.sample.reddit.PostAdapter
import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.activity_store.postRecyclerView
import kotlinx.android.synthetic.main.fragment_room_store.*
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.consumeAsFlow
Expand All @@ -26,7 +24,6 @@ import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.transform
import kotlinx.coroutines.launch

@FlowPreview
class RoomFragment : Fragment() {

override fun onCreateView(
Expand All @@ -37,13 +34,11 @@ class RoomFragment : Fragment() {
return inflater.inflate(R.layout.fragment_room_store, container, false)
}

@ExperimentalCoroutinesApi
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initUI()
}

@ExperimentalCoroutinesApi
private fun initUI() {
val adapter = PostAdapter()
// lazily set the adapter when we have data the first time so that RecyclerView can
Expand Down Expand Up @@ -99,7 +94,6 @@ class RoomFragment : Fragment() {
/**
* This class should possibly be moved to a helper library but needs more API work before that.
*/
@ExperimentalCoroutinesApi
internal class StoreState<Key : Any, Output : Any>(
private val store: Store<Key, Output>
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ import com.dropbox.android.sample.R
import kotlinx.android.synthetic.main.fragment_stream.*
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.InternalCoroutinesApi
import kotlinx.coroutines.Job
import kotlinx.coroutines.cancel
import kotlinx.coroutines.delay
Expand All @@ -29,7 +26,7 @@ import kotlin.coroutines.CoroutineContext
import kotlin.time.ExperimentalTime
import kotlin.time.seconds

@ExperimentalCoroutinesApi
@ExperimentalTime
class StreamFragment : Fragment(), CoroutineScope {

override val coroutineContext: CoroutineContext = Job() + Dispatchers.Main
Expand All @@ -42,9 +39,6 @@ class StreamFragment : Fragment(), CoroutineScope {
return inflater.inflate(R.layout.fragment_stream, container, false)
}

@ExperimentalTime
@InternalCoroutinesApi
@FlowPreview
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.dropbox.android.external.fs3

import com.dropbox.android.external.fs3.filesystem.FileSystem
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.produce
import okio.BufferedSource
Expand All @@ -14,7 +13,6 @@ import java.io.FileNotFoundException
* Make sure to have keys containing same data resolve to same "path"
*
*/
@ExperimentalCoroutinesApi
class FSAllReader(internal val fileSystem: FileSystem) : DiskAllRead<BufferedSource> {

@Throws(FileNotFoundException::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ package com.dropbox.android.external.fs3

import com.dropbox.android.external.fs3.filesystem.FileSystem
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.ReceiveChannel
import okio.BufferedSource
import java.io.FileNotFoundException

@ExperimentalCoroutinesApi
class SourceAllPersister(fileSystem: FileSystem) : AllPersister<BufferedSource, Pair<String, String>> {

internal val sourceFileAllReader: FSAllReader = FSAllReader(fileSystem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.dropbox.android.external.fs3

import com.dropbox.android.external.fs3.filesystem.FileSystem
import com.dropbox.android.external.fs3.filesystem.FileSystemFactory
import kotlinx.coroutines.ExperimentalCoroutinesApi
import okio.BufferedSource
import java.io.File
import java.io.IOException
Expand All @@ -13,7 +12,6 @@ import kotlin.time.ExperimentalTime
* Factory for [SourcePersister]
*/

@ExperimentalCoroutinesApi
object SourcePersisterFactory {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import com.dropbox.android.external.fs3.filesystem.FileSystemFactory
import com.google.common.base.Charsets.UTF_8
import com.google.common.io.Files.createTempDir
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.runBlocking
import okio.BufferedSource
import okio.buffer
import okio.source
import org.junit.Test
import java.io.ByteArrayInputStream

@ExperimentalCoroutinesApi
class FSAllOperationTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package com.dropbox.flow.multicast
import com.dropbox.flow.multicast.ChannelManager.Message
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.flow.Flow

Expand Down Expand Up @@ -401,6 +400,5 @@ private class BufferImpl<T>(private val limit: Int) :
}
}

@ExperimentalCoroutinesApi
internal fun <T> ChannelManager.Message.Dispatch.Value<T>.markDelivered() =
delivered.complete(Unit)
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package com.dropbox.flow.multicast

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.ClosedSendChannelException
import kotlinx.coroutines.flow.Flow
Expand All @@ -35,7 +34,6 @@ import kotlinx.coroutines.flow.transform
* downstream value collects the latest dispatched value OR a new downstream is added while [buffer]
* is empty.
*/
@ExperimentalCoroutinesApi
class Multicaster<T>(
/**
* The [CoroutineScope] to use for upstream subscription
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package com.dropbox.flow.multicast

import com.dropbox.flow.multicast.ChannelManager.Message.Dispatch
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.coroutineScope
Expand All @@ -35,7 +34,6 @@ import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kotlin.test.fail

@ExperimentalCoroutinesApi
class ChannelManagerTest {
private val scope = TestCoroutineScope()
private val upstream: Channel<String> = Channel(Channel.UNLIMITED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package com.dropbox.flow.multicast

import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
Expand All @@ -35,7 +34,6 @@ import kotlin.test.assertEquals
* It basically waits until there is another reason to enable upstream and will receive those
* values as well.
*/
@ExperimentalCoroutinesApi
class InfiniteMulticastTest {
private val testScope = TestCoroutineScope()
private val dispatchLog = mutableListOf<String>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package com.dropbox.flow.multicast

import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
Expand All @@ -43,7 +42,6 @@ import kotlin.test.assertFailsWith
import kotlin.test.assertFalse
import kotlin.test.assertTrue

@ExperimentalCoroutinesApi
class MulticastTest {
private val testScope = TestCoroutineScope()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
*/
package com.dropbox.flow.multicast

import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.TestCoroutineScope
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue

@ExperimentalCoroutinesApi
class SharedFlowProducerTest {
private val scope = TestCoroutineScope()
private val upstreamMessages = mutableListOf<String>()
Expand Down
2 changes: 0 additions & 2 deletions store-rx2/src/main/kotlin/com/dropbox/store/rx2/RxStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import com.dropbox.android.external.store4.fresh
import com.dropbox.android.external.store4.get
import io.reactivex.Completable
import io.reactivex.Flowable
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.rx2.asFlowable
import kotlinx.coroutines.rx2.rxCompletable
import kotlinx.coroutines.rx2.rxSingle
Expand All @@ -18,7 +17,6 @@ import kotlinx.coroutines.rx2.rxSingle
* Return a [Flowable] for the given key
* @param request - see [StoreRequest] for configurations
*/
@ExperimentalCoroutinesApi
fun <Key : Any, Output : Any> Store<Key, Output>.observe(request: StoreRequest<Key>): Flowable<StoreResponse<Output>> =
stream(request).asFlowable()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ package com.dropbox.store.rx2
import com.dropbox.android.external.store4.StoreBuilder
import io.reactivex.Scheduler
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.rx2.asCoroutineDispatcher

/**
* Define what scheduler fetcher requests will be called on,
* if a scheduler is not set Store will use [GlobalScope]
*/
@FlowPreview
@ExperimentalCoroutinesApi
fun <Key : Any, Output : Any> StoreBuilder<Key, Output>.withScheduler(
scheduler: Scheduler
): StoreBuilder<Key, Output> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,16 @@ import com.google.common.truth.FailureMetadata
import com.google.common.truth.Subject
import com.google.common.truth.Truth
import com.google.common.truth.Truth.assertWithMessage
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async
import kotlinx.coroutines.cancelAndJoin
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.test.TestCoroutineScope

@OptIn(ExperimentalCoroutinesApi::class)
internal fun <T> TestCoroutineScope.assertThat(flow: Flow<T>): FlowSubject<T> {
return Truth.assertAbout(FlowSubject.Factory<T>(this)).that(flow)
}

@OptIn(ExperimentalCoroutinesApi::class)
internal class FlowSubject<T> constructor(
failureMetadata: FailureMetadata,
private val testCoroutineScope: TestCoroutineScope,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@ import com.dropbox.android.external.store4.StoreResponse
import com.dropbox.store.rx2.ofResultSingle
import com.google.common.truth.Truth.assertThat
import io.reactivex.Single
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.test.TestCoroutineScope
import kotlinx.coroutines.test.runBlockingTest
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
@FlowPreview
@ExperimentalCoroutinesApi
class HotRxSingleStoreTest {
private val testScope = TestCoroutineScope()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@ import io.reactivex.BackpressureStrategy
import io.reactivex.Completable
import io.reactivex.Flowable
import io.reactivex.schedulers.TestScheduler
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import java.util.concurrent.atomic.AtomicInteger

@RunWith(JUnit4::class)
@FlowPreview
@ExperimentalCoroutinesApi
class RxFlowableStoreTest {
private val testScheduler = TestScheduler()
private val atomicInteger = AtomicInteger(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,21 @@ import com.dropbox.android.external.store4.FetcherResult
import com.dropbox.android.external.store4.SourceOfTruth
import com.dropbox.android.external.store4.StoreBuilder
import com.dropbox.store.rx2.freshSingle
import com.dropbox.store.rx2.ofMaybe
import com.dropbox.store.rx2.getSingle
import com.dropbox.store.rx2.ofMaybe
import com.dropbox.store.rx2.ofResultSingle
import com.dropbox.store.rx2.withScheduler
import io.reactivex.Completable
import io.reactivex.Maybe
import io.reactivex.Single
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
import java.util.concurrent.atomic.AtomicInteger

@ExperimentalStoreApi
@RunWith(JUnit4::class)
@FlowPreview
@ExperimentalCoroutinesApi
class RxSingleStoreExtensionsTest {
private val atomicInteger = AtomicInteger(0)
private var fakeDisk = mutableMapOf<Int, String>()
Expand Down
Loading