Skip to content

Commit a927e67

Browse files
committed
update 1.0.8
1 parent 99af292 commit a927e67

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ android {
1414
applicationId "com.shuyu.github.kotlin"
1515
minSdkVersion 21
1616
targetSdkVersion 28
17-
versionCode 7
18-
versionName "1.0.7"
17+
versionCode 8
18+
versionName "1.0.8"
1919
javaCompileOptions {
2020
annotationProcessorOptions {
2121
includeCompileClasspath = true

app/src/main/java/com/shuyu/github/kotlin/common/config/AppConfig.kt

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ object AppConfig {
1313

1414
const val GRAPHIC_HOST = "https://ghchart.rshah.org/"
1515

16+
const val API_TOKEN = "4d65e2a5626103f92a71867d7b49fea0"
17+
1618
const val PAGE_SIZE = 30
1719

1820
const val HTTP_TIME_OUT = 20 * 1000L

app/src/main/java/com/shuyu/github/kotlin/repository/ReposRepository.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import android.app.Application
44
import android.content.Context
55
import androidx.lifecycle.MutableLiveData
66
import com.shuyu.github.kotlin.R
7+
import com.shuyu.github.kotlin.common.config.AppConfig
78
import com.shuyu.github.kotlin.common.net.*
89
import com.shuyu.github.kotlin.common.utils.HtmlUtils
910
import com.shuyu.github.kotlin.common.utils.compareVersion
@@ -90,11 +91,9 @@ class ReposRepository @Inject constructor(private val retrofit: Retrofit, privat
9091

9192

9293
val trendService = retrofit.create(RepoService::class.java)
93-
.getTrendData(true, language, since)
94+
.getTrendDataAPI(true, AppConfig.API_TOKEN, since,language)
9495
.flatMap {
9596
FlatMapResponse2Result(it)
96-
}.map {
97-
TrendConversion.htmlToRepo(it)
9897
}.doOnNext {
9998
reposDao.saveTrendDao(Response.success(GsonUtils.toJsonString(it)), language, since, true)
10099
}.map {

app/src/main/java/com/shuyu/github/kotlin/service/RepoService.kt

+9-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ interface RepoService {
2121
): Observable<Response<ArrayList<Repository>>>
2222

2323

24-
2524
@GET("users/{user}/starred")
2625
fun getStarredRepos(
2726
@Header("forceNetWork") forceNetWork: Boolean,
@@ -220,6 +219,15 @@ interface RepoService {
220219
@Path("languageType") languageType: String,
221220
@Query("since") since: String): Observable<Response<String>>
222221

222+
@GET("https://guoshuyu.cn/github/trend/list")
223+
@Headers("Content-Type: text/plain;charset=utf-8")
224+
fun getTrendDataAPI(
225+
@Header("forceNetWork") forceNetWork: Boolean,
226+
@Header("api-token") apiToken: String,
227+
@Query("since") since: String,
228+
@Query("languageType") languageType: String
229+
): Observable<Response<List<TrendingRepoModel>>>
230+
223231
@GET("repos/{owner}/{repo}/readme")
224232
@Headers("Content-Type: text/plain;charset=utf-8", "Accept: application/vnd.github.html")
225233
fun getReadmeHtml(

0 commit comments

Comments
 (0)