Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
5b937fb1
Commit
5b937fb1
authored
Sep 05, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Random changes
parent
ff828116
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
NetworkingModule.kt
...src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt
+1
-1
RepoUpdater.kt
app/src/main/java/com/topjohnwu/magisk/tasks/RepoUpdater.kt
+11
-11
No files found.
app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt
View file @
5b937fb1
...
@@ -28,7 +28,7 @@ fun createOkHttpClient(): OkHttpClient {
...
@@ -28,7 +28,7 @@ fun createOkHttpClient(): OkHttpClient {
if
(
BuildConfig
.
DEBUG
)
{
if
(
BuildConfig
.
DEBUG
)
{
val
httpLoggingInterceptor
=
HttpLoggingInterceptor
().
apply
{
val
httpLoggingInterceptor
=
HttpLoggingInterceptor
().
apply
{
level
=
HttpLoggingInterceptor
.
Level
.
BODY
level
=
HttpLoggingInterceptor
.
Level
.
HEADERS
}
}
builder
.
addInterceptor
(
httpLoggingInterceptor
)
builder
.
addInterceptor
(
httpLoggingInterceptor
)
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/tasks/RepoUpdater.kt
View file @
5b937fb1
...
@@ -38,21 +38,21 @@ class RepoUpdater(
...
@@ -38,21 +38,21 @@ class RepoUpdater(
etag
:
String
=
""
etag
:
String
=
""
):
Flowable
<
Unit
>
=
api
.
fetchRepos
(
page
,
etag
).
flatMap
{
):
Flowable
<
Unit
>
=
api
.
fetchRepos
(
page
,
etag
).
flatMap
{
it
.
error
()
?.
also
{
throw
it
}
it
.
error
()
?.
also
{
throw
it
}
it
.
response
()
?.
run
{
it
.
response
()
?.
run
{
if
(
code
()
==
HttpURLConnection
.
HTTP_NOT_MODIFIED
)
if
(
code
()
==
HttpURLConnection
.
HTTP_NOT_MODIFIED
)
return
@run
Flowable
.
error
<
Unit
>(
CachedException
)
return
@run
Flowable
.
error
<
Unit
>(
CachedException
)
if
(
page
==
1
)
if
(
page
==
1
)
repoDB
.
etagKey
=
headers
()[
Const
.
Key
.
ETAG_KEY
].
orEmpty
().
trimEtag
()
repoDB
.
etagKey
=
headers
()[
Const
.
Key
.
ETAG_KEY
].
orEmpty
().
trimEtag
()
val
flow
=
loadRepos
(
body
()
!!
,
cached
)
val
flow
=
loadRepos
(
body
()
!!
,
cached
)
if
(
headers
()[
Const
.
Key
.
LINK_KEY
].
orEmpty
().
contains
(
"next"
))
{
if
(
headers
()[
Const
.
Key
.
LINK_KEY
].
orEmpty
().
contains
(
"next"
))
{
flow
.
mergeWith
(
loadPage
(
cached
,
page
+
1
))
flow
.
mergeWith
(
loadPage
(
cached
,
page
+
1
))
}
else
{
}
else
{
flow
flow
}
}
}
}
}
}
private
fun
forcedReload
(
cached
:
MutableSet
<
String
>)
=
private
fun
forcedReload
(
cached
:
MutableSet
<
String
>)
=
cached
.
toFlowable
().
parallel
().
runOn
(
Schedulers
.
io
()).
map
{
cached
.
toFlowable
().
parallel
().
runOn
(
Schedulers
.
io
()).
map
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment