All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avito.android.providers.RemoteAvitoModuleOwnersProvider.kt Maven / Gradle / Ivy

Go to download

Collection of infrastructure libraries and gradle plugins of Avito Android project

The newest version!
package com.avito.android.providers

import com.avito.android.diff.provider.OwnersProvider
import com.avito.android.model.Owner
import com.avito.android.model.network.AvitoOwnersClient

internal class RemoteAvitoModuleOwnersProvider(
    private val client: AvitoOwnersClient,
) : OwnersProvider {

    override fun get(): Set {
        return client.getAvitoOwners()
            .flatMap { owner ->
                mutableListOf().apply {
                    add(
                        RemoteAvitoCodeOwner(
                            name = owner.name,
                            id = owner.id,
                            type = owner.type,
                            parent = null
                        )
                    )
                    addAll(owner.children.map { child ->
                        RemoteAvitoCodeOwner(
                            name = child.name,
                            id = child.id,
                            type = child.type,
                            parent = owner.name
                        )
                    })
                }
            }
            .toSet()
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy