mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Moving base use case interface into core package
This commit is contained in:
parent
cdb1a96664
commit
4c09fb747b
2 changed files with 5 additions and 5 deletions
|
@ -14,9 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.app.features.media.domain.usecase
|
||||
package im.vector.app.core.usecase
|
||||
|
||||
// TODO move into Core packages
|
||||
interface VectorInOutUseCase<T, R> {
|
||||
interface VectorBaseInOutUseCase<T, R> {
|
||||
suspend fun execute(input: T): Result<R>
|
||||
}
|
|
@ -20,6 +20,7 @@ import android.content.Context
|
|||
import androidx.core.net.toUri
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import im.vector.app.core.intent.getMimeTypeFromUri
|
||||
import im.vector.app.core.usecase.VectorBaseInOutUseCase
|
||||
import im.vector.app.core.utils.saveMedia
|
||||
import im.vector.app.features.notifications.NotificationUtils
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
@ -30,13 +31,13 @@ import javax.inject.Inject
|
|||
class DownloadMediaUseCase @Inject constructor(
|
||||
@ApplicationContext private val appContext: Context,
|
||||
private val notificationUtils: NotificationUtils
|
||||
) : VectorInOutUseCase<File, Unit> {
|
||||
) : VectorBaseInOutUseCase<File, Unit> {
|
||||
|
||||
/* ==========================================================================================
|
||||
* Public API
|
||||
* ========================================================================================== */
|
||||
|
||||
// TODO find a way to provide Dispatchers via Interface to be able to unit tests
|
||||
// TODO declare Dispatcher via an Interface provider to be able to unit tests
|
||||
override suspend fun execute(input: File): Result<Unit> = withContext(Dispatchers.IO) {
|
||||
runCatching {
|
||||
saveMedia(
|
||||
|
|
Loading…
Reference in a new issue