-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from RajashekarRaju/feat/implement_favorite_sc…
…reen_for_actors Implemented favorite screen for Actors
- Loading branch information
Showing
24 changed files
with
420 additions
and
92 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
30 changes: 30 additions & 0 deletions
30
app/src/main/java/com/developersbreach/composeactors/data/model/ActorDetail.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,43 @@ | ||
package com.developersbreach.composeactors.data.model | ||
|
||
import androidx.compose.runtime.Immutable | ||
import androidx.compose.runtime.Stable | ||
import com.developersbreach.composeactors.data.datasource.database.entity.FavoriteActorsEntity | ||
|
||
@Immutable | ||
data class ActorDetail( | ||
@Stable val actorId: Int, | ||
val actorName: String, | ||
val profileUrl: String, | ||
val biography: String, | ||
val dateOfBirth: String, | ||
val placeOfBirth: String, | ||
val popularity: Double | ||
) | ||
|
||
fun ActorDetail.toFavoriteActor() = FavoriteActor( | ||
actorId = this.actorId, | ||
actorName = this.actorName, | ||
profileUrl = this.profileUrl, | ||
placeOfBirth = this.placeOfBirth | ||
) | ||
|
||
fun FavoriteActor.actorAsDatabaseModel(): FavoriteActorsEntity { | ||
return FavoriteActorsEntity( | ||
actorId = this.actorId, | ||
actorName = this.actorName, | ||
actorProfileUrl = this.profileUrl, | ||
actorPlaceOfBirth = this.placeOfBirth | ||
) | ||
} | ||
|
||
fun List<FavoriteActorsEntity>.actorAsDomainModel(): List<FavoriteActor> { | ||
return map { | ||
FavoriteActor( | ||
actorId = it.actorId, | ||
actorName = it.actorName, | ||
profileUrl = it.actorProfileUrl, | ||
placeOfBirth = it.actorPlaceOfBirth | ||
) | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/developersbreach/composeactors/data/model/FavoriteActor.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.developersbreach.composeactors.data.model | ||
|
||
import androidx.compose.runtime.Stable | ||
|
||
data class FavoriteActor( | ||
@Stable val actorId: Int, | ||
val actorName: String, | ||
val profileUrl: String, | ||
val placeOfBirth: String | ||
) |
This file contains 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
15 changes: 15 additions & 0 deletions
15
...ava/com/developersbreach/composeactors/domain/useCase/RemoveActorsFromFavoritesUseCase.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.developersbreach.composeactors.domain.useCase | ||
|
||
import com.developersbreach.composeactors.data.model.FavoriteActor | ||
import com.developersbreach.composeactors.data.repository.actor.ActorRepository | ||
import javax.inject.Inject | ||
|
||
class RemoveActorsFromFavoritesUseCase @Inject constructor( | ||
private val actorRepository: ActorRepository | ||
) { | ||
suspend operator fun invoke(favoriteActor: FavoriteActor) { | ||
actorRepository.deleteSelectedFavoriteActor( | ||
favoriteActor = favoriteActor | ||
) | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.