Skip to content

Commit

Permalink
update utils
Browse files Browse the repository at this point in the history
  • Loading branch information
chenlu committed Jan 28, 2024
1 parent e526f9e commit f19d155
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions Network/src/main/java/com/hongwen/network/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,32 @@ package com.hongwen.network

import com.google.gson.Gson
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.cache
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onCompletion
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import retrofit2.Response

object ApiServiceImpl :ApiService by ServiceFactory.getService(url = ApiService.URL, clazz = ApiService::class.java) {

}
fun main(args: Array<String>) {
runBlocking {
val apiService =
ServiceFactory.getService(url = ApiService.URL, clazz = ApiService::class.java)
val apiService = ApiServiceImpl

flow { emit(apiService.getAdvList("huawei", "10201", "com.nanjingwx.train")) }
.onStart { }
.onEach { }
.onCompletion { }
.catch {

}

// 1
apiService.getAdvList("huawei", "10201", "com.nanjingwx.train")
Expand Down

0 comments on commit f19d155

Please sign in to comment.