ui/common/src/commonMain/kotlin/OpenSourceLicensesViewModel.kt
changeset 80 2474591aa280
parent 51 d69bdf1ad491
equal deleted inserted replaced
79:79794afbbf95 80:2474591aa280
    38 
    38 
    39     private val licensesInfo = flow {
    39     private val licensesInfo = flow {
    40         emit(licenseInfoRepository.getLicensesInfo())
    40         emit(licenseInfoRepository.getLicensesInfo())
    41     }.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), emptyMap())
    41     }.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), emptyMap())
    42 
    42 
       
    43     /**
       
    44      * List of dependencies
       
    45      */
    43     val dependenciesList = licensesInfo.map { licensesInfo ->
    46     val dependenciesList = licensesInfo.map { licensesInfo ->
    44         licensesInfo.keys.sortedBy { it.lowercase() }
    47         licensesInfo.keys.sortedBy { it.lowercase() }
    45     }
    48     }
    46 
    49 
       
    50     /**
       
    51      * Obtain the license for [dependency]
       
    52      */
    47     fun getLicenseDependency(dependency: String) = flow {
    53     fun getLicenseDependency(dependency: String) = flow {
    48         emit(licenseInfoRepository.getLicenseFor(dependency))
    54         emit(licenseInfoRepository.getLicenseFor(dependency))
    49     }
    55     }
    50 
    56 
    51     companion object
    57     companion object