This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface RestAdapter { | |
suspend fun upload(data: DataForRequest): DataFromResponse | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.ConcurrentHashMap | |
import kotlin.coroutines.Continuation | |
import kotlin.coroutines.resume | |
import kotlin.coroutines.suspendCoroutine | |
class KCriticalSection<T> { | |
private val suspendedJobs = ConcurrentHashMap<Int, Continuation<Boolean>>() | |
private var id = AtomicInteger(1000) | |
@Volatile private var isInsideCriticalSection = false | |
@Volatile private var _cached: T? = null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.ConcurrentHashMap | |
import kotlin.coroutines.Continuation | |
import kotlin.coroutines.resume | |
import kotlin.coroutines.suspendCoroutine | |
class KCriticalSection { | |
private val suspendedJobs = ConcurrentHashMap<Int, Continuation<Boolean>>() | |
private var id = AtomicInteger(1000) | |
@Volatile private var isInsideCriticalSection = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// root build.gradle | |
static boolean isNewTypeProject(Project project) { | |
project.ext.has("isBuildSystemProject") | |
} | |
static boolean isAndroidLibraryPlugin(Plugin plugin) { | |
plugin.getClass().canonicalName in ["com.android.build.gradle.LibraryPlugin", | |
"com.android.build.gradle.AppPlugin"] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// feature module build.gradle | |
plugins { | |
id 'convention.android-feature-impl' | |
id 'convention.starservices-sdk-permission' | |
} | |
dependencies { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id("com.android.library") | |
id("kotlin-android") | |
id("convention.kotlin-base") // this contains extra property | |
id("convention.android-base") | |
id("kotlin-kapt") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id("convention.libraries") | |
} | |
project.ext.set("isBuildSystemProject", true) // <- this is extra property | |
dependencies { | |
add("implementation", deps.base.androidx.annotation) | |
add("implementation", deps.base.di.inject) | |
add("implementation", deps.base.kotlin.stdlib) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component( | |
modules = [ | |
FakeStockListVoConverterModule::class, | |
FakeStockListFeatureModule::class | |
] | |
) | |
interface TestStockListFeatureComponent : StockListFeatureApi { | |
fun inject(target: TestStockListViewModel) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestStockListViewModel { | |
@Inject internal lateinit var viewModel: StockListViewModel | |
@get:Rule val instantExecutorRule = InstantTaskExecutorRule() | |
private val featureApi: TestStockListFeatureComponent = | |
DaggerTestStockListFeatureComponent.create() | |
init { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestTrustedLoginUserUseCase { | |
@MockK private lateinit var authTokenStorage: AuthTokenStorage | |
@MockK private lateinit var repository: AuthRepository | |
@MockK private lateinit var secureRandom: SecureRandom | |
@MockK private lateinit var schedulersFactory: SchedulersFactory | |
private lateinit var trustedLoginUserUseCase | |
@Before | |
fun setUp() { |