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
e799918a
Commit
e799918a
authored
Jun 08, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update update check service
parent
86c4928e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
UpdateCheckService.kt
...a/com/topjohnwu/magisk/model/update/UpdateCheckService.kt
+9
-13
No files found.
app/src/main/java/com/topjohnwu/magisk/model/update/UpdateCheckService.kt
View file @
e799918a
...
@@ -4,7 +4,6 @@ import androidx.work.ListenableWorker
...
@@ -4,7 +4,6 @@ import androidx.work.ListenableWorker
import
com.topjohnwu.magisk.BuildConfig
import
com.topjohnwu.magisk.BuildConfig
import
com.topjohnwu.magisk.Config
import
com.topjohnwu.magisk.Config
import
com.topjohnwu.magisk.data.repository.MagiskRepository
import
com.topjohnwu.magisk.data.repository.MagiskRepository
import
com.topjohnwu.magisk.model.entity.MagiskConfig
import
com.topjohnwu.magisk.model.worker.DelegateWorker
import
com.topjohnwu.magisk.model.worker.DelegateWorker
import
com.topjohnwu.magisk.utils.inject
import
com.topjohnwu.magisk.utils.inject
import
com.topjohnwu.magisk.view.Notifications
import
com.topjohnwu.magisk.view.Notifications
...
@@ -14,18 +13,15 @@ class UpdateCheckService : DelegateWorker() {
...
@@ -14,18 +13,15 @@ class UpdateCheckService : DelegateWorker() {
private
val
magiskRepo
:
MagiskRepository
by
inject
()
private
val
magiskRepo
:
MagiskRepository
by
inject
()
override
fun
doWork
():
ListenableWorker
.
Result
{
override
fun
doWork
():
ListenableWorker
.
Result
{
val
config
=
runCatching
{
magiskRepo
.
fetchConfig
().
blockingGet
()
}
return
runCatching
{
config
.
getOrNull
()
?.
let
{
checkUpdates
(
it
)
}
magiskRepo
.
fetchConfig
().
blockingGet
()
return
when
{
if
(
BuildConfig
.
VERSION_CODE
<
Config
.
remoteManagerVersionCode
)
config
.
isFailure
->
ListenableWorker
.
Result
.
failure
()
Notifications
.
managerUpdate
()
else
->
ListenableWorker
.
Result
.
success
()
else
if
(
Config
.
magiskVersionCode
<
Config
.
remoteManagerVersionCode
)
}
Notifications
.
magiskUpdate
()
}
ListenableWorker
.
Result
.
success
()
}.
getOrElse
{
private
fun
checkUpdates
(
config
:
MagiskConfig
)
{
ListenableWorker
.
Result
.
failure
()
when
{
BuildConfig
.
VERSION_CODE
<
config
.
app
.
versionCode
.
toIntOrNull
()
?:
-
1
->
Notifications
.
managerUpdate
()
Config
.
magiskVersionCode
<
config
.
magisk
.
versionCode
.
toIntOrNull
()
?:
-
1
->
Notifications
.
magiskUpdate
()
}
}
}
}
}
}
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