Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ annotation class Sp
@Dimension(unit = 3)
annotation class Pt

typealias ParamMap = HashMap<String, Any>

// ---------------------Any-------------------------------//

inline val randomUUID: String get() = UUID.randomUUID().toString()
Expand Down Expand Up @@ -331,9 +329,6 @@ fun <T> List<T>.thirdOrNull(): T? {
return if (size < 3) null else this[2]
}

fun paramMapOf(vararg pairs: Pair<String, Any>): HashMap<String, Any> =
HashMap<String, Any>(pairs.size).apply { putAll(pairs) }

fun <K, V> MutableMap<K, V>.removeFirst(): Map.Entry<K, V> {
val iterator = iterator()
val element = iterator.next()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.goooler.demoapp.main.api

import io.goooler.demoapp.base.util.ParamMap
import io.goooler.demoapp.main.bean.MainRepoListBean
import retrofit2.http.GET
import retrofit2.http.Path
Expand All @@ -11,6 +10,6 @@ interface MainCommonApi {
@GET("users/{user}/repos")
suspend fun getRepoList(
@Path("user") user: String,
@QueryMap params: ParamMap,
@QueryMap params: Map<String, @JvmSuppressWildcards Any>,
): List<MainRepoListBean>
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.goooler.demoapp.main.repository

import androidx.annotation.IntRange
import io.goooler.demoapp.base.util.paramMapOf
import io.goooler.demoapp.common.network.RetrofitHelper
import io.goooler.demoapp.common.type.CommonConstants
import io.goooler.demoapp.common.util.RoomHelper
Expand All @@ -19,7 +18,7 @@ class MainCommonRepository {
@IntRange(from = 1) page: Int = 1,
@IntRange(from = 1) pageSize: Int = CommonConstants.DEFAULT_PAGE_SIZE,
): List<MainRepoListBean> {
val params = paramMapOf(
val params = mapOf(
"page" to page,
"per_page" to pageSize,
)
Expand Down