ahmedadeltito / SocialMediaApp

1 stars 0 forks source link

question #2

Open lso033c opened 5 months ago

lso033c commented 5 months ago

first, I do think this is one of the best repo on GitHub just having few question plz , just to increase my knowledge , help plz

  1. why the repo function return flow, api fetching is not a stream ?
  2. do you recommend Coordinator pattern on compose?
  3. I followed the pattern of UFD actions,effects however when the textfield in the state and changeFirstName as an action it is slow typing?
  4. do you recommend using fun as mapper instead class PostEntityToUiMapper : Mapper<PostEntity, PostUiModel> ? plz add testing
lso033c commented 5 months ago

??

lso033c commented 5 months ago

؟

mikek9084 commented 3 months ago
  1. is better to put mapper from DTO to domain in the use case or in the repo class GetPostsUseCase

    @Inject
    constructor(
    private val repository: PostRepository,
    private val mapper: PostDataSourceToEntityMapper,
    ) {
    
    suspend fun invoke(): Flow<List<PostEntity>> = repository.getPosts().map { postListDataSource ->
        postListDataSource.map { postDataSource -> mapper.map(input = postDataSource) }
    }
    }