This file contains hidden or 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
| // Данные о фильме с бекенда | |
| data class Movie( | |
| val id: Long, | |
| val title: String? = null, | |
| ) | |
| // Данные о стоимости фильма с бекенда | |
| data class PurchaseOffer( | |
| val id: Long, | |
| val price: Float = 0, |
This file contains hidden or 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
| data class ResultApi<T>( | |
| val result: T, | |
| val errorCode: Int = 0, | |
| var errorMessage: String = "" | |
| ) | |
| class ElectroMarketService { | |
| suspend fun userLogin(login: String, pass: String): ResultApi<String> { | |
| try { | |
| delay(3_000) |
This file contains hidden or 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
| // commonMain | |
| class Network( | |
| val httpClient: HttpClient | |
| ) { | |
| val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default) | |
| val wikiFlow = MutableStateFlow("") | |
| suspend fun getWikiPage(): String { | |
| val url = "https://en.wikipedia.org/wiki/Main_Page" | |
| return httpClient.get(url).bodyAsText() |