diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2021-12-09 10:07:54 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-09 04:37:54 +0000 |
commit | 8db0b67ce9ba4a5e56c04c1bea3a738eacb176cf (patch) | |
tree | 46700b7a3da32065e073bffbf22765c7e2f30d32 /app/src | |
parent | 933558caf8266677dc26497d7c7b930254f4fb07 (diff) |
Refactor coroutine testing setup (#1583)
* coroutine-utils: init
* coroutine-utils-testing: init
* format-common: switch over to using DispatcherProvider
* Convert Binds method to an extension function
* Add Dispatcher module
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/dev/msfjarvis/aps/injection/coroutines/DispatcherModule.kt | 19 | ||||
-rw-r--r-- | app/src/main/java/dev/msfjarvis/aps/injection/totp/TotpModule.kt | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/injection/coroutines/DispatcherModule.kt b/app/src/main/java/dev/msfjarvis/aps/injection/coroutines/DispatcherModule.kt new file mode 100644 index 00000000..bf84fc27 --- /dev/null +++ b/app/src/main/java/dev/msfjarvis/aps/injection/coroutines/DispatcherModule.kt @@ -0,0 +1,19 @@ +/* + * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. + * SPDX-License-Identifier: GPL-3.0-only + */ + +package dev.msfjarvis.aps.injection.coroutines + +import dagger.Binds +import dagger.Module +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import dev.msfjarvis.aps.util.coroutines.DefaultDispatcherProvider +import dev.msfjarvis.aps.util.coroutines.DispatcherProvider + +@Module +@InstallIn(SingletonComponent::class) +interface DispatcherModule { + @Binds fun DefaultDispatcherProvider.bind(): DispatcherProvider +} diff --git a/app/src/main/java/dev/msfjarvis/aps/injection/totp/TotpModule.kt b/app/src/main/java/dev/msfjarvis/aps/injection/totp/TotpModule.kt index e02a3b86..859559cd 100644 --- a/app/src/main/java/dev/msfjarvis/aps/injection/totp/TotpModule.kt +++ b/app/src/main/java/dev/msfjarvis/aps/injection/totp/TotpModule.kt @@ -15,5 +15,5 @@ import dev.msfjarvis.aps.util.totp.UriTotpFinder @Module @InstallIn(ActivityComponent::class) interface TotpModule { - @Binds abstract fun bindTotpFinder(totpFinder: UriTotpFinder): TotpFinder + @Binds fun UriTotpFinder.bind(): TotpFinder } |