Skip to content

Commit

Permalink
Split entities into packages
Browse files Browse the repository at this point in the history
  • Loading branch information
asrovnov committed Jan 19, 2021
1 parent 0e044b6 commit 5711d83
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ru.app.incredible.pets.data.backend.dto

import com.squareup.moshi.Json
import ru.app.incredible.pets.domain.Cat
import ru.app.incredible.pets.domain.cat.Cat

data class CatDto(
@Json(name = "url") val url: String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ru.app.incredible.pets.data.backend.dto

import com.squareup.moshi.Json
import ru.app.incredible.pets.domain.Dog
import ru.app.incredible.pets.domain.dog.Dog

data class DogDto(
@Json(name = "message") val message: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import ru.app.incredible.pets.data.backend.CatApi
import ru.app.incredible.pets.data.backend.mapToEntity
import ru.app.incredible.pets.domain.Cat
import ru.app.incredible.pets.domain.cat.Cat

class RandomCatGateway(
private val api: CatApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import ru.app.incredible.pets.data.backend.DogApi
import ru.app.incredible.pets.data.backend.mapToEntity
import ru.app.incredible.pets.domain.Dog
import ru.app.incredible.pets.domain.dog.Dog

class RandomDogGateway(
private val api: DogApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ package ru.app.incredible.pets.di

import org.koin.dsl.module
import ru.app.incredible.pets.domain.*
import ru.app.incredible.pets.domain.cat.RandomCatInteractor
import ru.app.incredible.pets.domain.dog.RandomDogInteractor
import ru.app.incredible.pets.domain.DownloadImageInteractor
import ru.app.incredible.pets.domain.GetDownloadStateInteractor

object InteractorModule {

Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/ru/app/incredible/pets/domain/Cat.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ru.app.incredible.pets.domain

import io.reactivex.Observable
import ru.app.incredible.pets.data.gateway.DownloadImageGateway
import ru.app.incredible.pets.data.gateway.DownloadImageGateway.Companion.FILE_DELETED
import ru.app.incredible.pets.data.gateway.GetDownloadedImageGateway
import java.io.File

Expand All @@ -15,10 +14,10 @@ class GalleryInteractor(
return getDownloadedImageGateway.getAllImage()
.concatMap { imageList ->
downloadImageGateway.getImageDownloaded()
.map {
if (it.exists()) {
imageList.add(it)
} else if (it.name == FILE_DELETED) {
.map { file ->
if (file.exists()) {
imageList.add(file)
} else if (file.name == DownloadImageGateway.FILE_DELETED) {
imageList.removeAt(imageList.lastIndex)
}
imageList
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/ru/app/incredible/pets/domain/cat/Cat.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package ru.app.incredible.pets.domain.cat

data class Cat(val catImageUrl: String)
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package ru.app.incredible.pets.domain
package ru.app.incredible.pets.domain.cat

import io.reactivex.Single
import ru.app.incredible.pets.data.gateway.NetworkStateGateway
import ru.app.incredible.pets.data.gateway.RandomCatGateway
import ru.app.incredible.pets.domain.cat.Cat
import ru.app.incredible.pets.domain.exceptions.InternetUnavailableException

class RandomCatInteractor(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ru.app.incredible.pets.domain
package ru.app.incredible.pets.domain.dog

data class Dog(
val dogImageUrl: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package ru.app.incredible.pets.domain
package ru.app.incredible.pets.domain.dog

import io.reactivex.Single
import ru.app.incredible.pets.data.gateway.NetworkStateGateway
import ru.app.incredible.pets.data.gateway.RandomDogGateway
import ru.app.incredible.pets.domain.dog.Dog
import ru.app.incredible.pets.domain.exceptions.InternetUnavailableException

class RandomDogInteractor(
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/ru/app/incredible/pets/ui/pets/PetsPm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import me.dmdev.rxpm.state
import me.dmdev.rxpm.widget.dialogControl
import ru.app.incredible.pets.R
import ru.app.incredible.pets.domain.*
import ru.app.incredible.pets.domain.cat.Cat
import ru.app.incredible.pets.domain.cat.RandomCatInteractor
import ru.app.incredible.pets.domain.dog.Dog
import ru.app.incredible.pets.domain.dog.RandomDogInteractor
import ru.app.incredible.pets.domain.DownloadImageInteractor
import ru.app.incredible.pets.domain.GetDownloadStateInteractor
import ru.app.incredible.pets.domain.ImageDownloadState
import ru.app.incredible.pets.system.ResourceHelper
import ru.app.incredible.pets.ui.common.BasePm

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package ru.app.incredible.pets.ui.pets

import androidx.appcompat.app.AlertDialog
import androidx.core.view.isVisible
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.jakewharton.rxbinding3.view.clicks
Expand Down

0 comments on commit 5711d83

Please sign in to comment.