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
da93bbc1
Commit
da93bbc1
authored
Oct 20, 2020
by
vvb2060
Committed by
John Wu
Oct 21, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix network
parent
fa2dbe98
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
RepoUpdater.kt
.../main/java/com/topjohnwu/magisk/core/tasks/RepoUpdater.kt
+2
-2
NetworkService.kt
...va/com/topjohnwu/magisk/data/repository/NetworkService.kt
+2
-8
InstallViewModel.kt
.../java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt
+7
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/core/tasks/RepoUpdater.kt
View file @
da93bbc1
...
@@ -20,7 +20,7 @@ class RepoUpdater(
...
@@ -20,7 +20,7 @@ class RepoUpdater(
val
cachedMap
=
HashMap
<
String
,
Date
>().
also
{
map
->
val
cachedMap
=
HashMap
<
String
,
Date
>().
also
{
map
->
repoDB
.
getModuleStubs
().
forEach
{
map
[
it
.
id
]
=
Date
(
it
.
last_update
)
}
repoDB
.
getModuleStubs
().
forEach
{
map
[
it
.
id
]
=
Date
(
it
.
last_update
)
}
}.
synchronized
()
}.
synchronized
()
svc
.
fetchRepoInfo
()
?.
also
{
info
->
svc
.
fetchRepoInfo
()
?.
let
{
info
->
coroutineScope
{
coroutineScope
{
info
.
modules
.
forEach
{
info
.
modules
.
forEach
{
launch
{
launch
{
...
@@ -36,7 +36,7 @@ class RepoUpdater(
...
@@ -36,7 +36,7 @@ class RepoUpdater(
}
}
}
}
}
}
repoDB
.
removeModules
(
cachedMap
.
keys
)
}
}
repoDB
.
removeModules
(
cachedMap
.
keys
)
}
}
}
}
app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt
View file @
da93bbc1
...
@@ -20,7 +20,7 @@ class NetworkService(
...
@@ -20,7 +20,7 @@ class NetworkService(
private
val
jsd
:
JSDelivrServices
,
private
val
jsd
:
JSDelivrServices
,
private
val
api
:
GithubApiServices
private
val
api
:
GithubApiServices
)
{
)
{
suspend
fun
fetchUpdate
()
=
try
{
suspend
fun
fetchUpdate
()
=
safe
{
var
info
=
when
(
Config
.
updateChannel
)
{
var
info
=
when
(
Config
.
updateChannel
)
{
DEFAULT_CHANNEL
,
STABLE_CHANNEL
->
fetchStableUpdate
()
DEFAULT_CHANNEL
,
STABLE_CHANNEL
->
fetchStableUpdate
()
BETA_CHANNEL
->
fetchBetaUpdate
()
BETA_CHANNEL
->
fetchBetaUpdate
()
...
@@ -36,12 +36,6 @@ class NetworkService(
...
@@ -36,12 +36,6 @@ class NetworkService(
}
}
Info
.
remote
=
info
Info
.
remote
=
info
info
info
}
catch
(
e
:
IOException
)
{
Timber
.
e
(
e
)
null
}
catch
(
e
:
HttpException
)
{
Timber
.
e
(
e
)
null
}
}
// UpdateInfo
// UpdateInfo
...
@@ -69,7 +63,7 @@ class NetworkService(
...
@@ -69,7 +63,7 @@ class NetworkService(
private
inline
fun
<
T
>
safe
(
factory
:
()
->
T
):
T
?
{
private
inline
fun
<
T
>
safe
(
factory
:
()
->
T
):
T
?
{
return
try
{
return
try
{
factory
()
factory
()
}
catch
(
e
:
Http
Exception
)
{
}
catch
(
e
:
Exception
)
{
Timber
.
e
(
e
)
Timber
.
e
(
e
)
null
null
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt
View file @
da93bbc1
...
@@ -18,6 +18,8 @@ import com.topjohnwu.magisk.utils.set
...
@@ -18,6 +18,8 @@ import com.topjohnwu.magisk.utils.set
import
com.topjohnwu.superuser.Shell
import
com.topjohnwu.superuser.Shell
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
import
org.koin.core.get
import
org.koin.core.get
import
timber.log.Timber
import
java.io.IOException
import
kotlin.math.roundToInt
import
kotlin.math.roundToInt
class
InstallViewModel
(
class
InstallViewModel
(
...
@@ -64,7 +66,11 @@ class InstallViewModel(
...
@@ -64,7 +66,11 @@ class InstallViewModel(
init
{
init
{
viewModelScope
.
launch
{
viewModelScope
.
launch
{
notes
=
svc
.
fetchString
(
Info
.
remote
.
magisk
.
note
)
try
{
notes
=
svc
.
fetchString
(
Info
.
remote
.
magisk
.
note
)
}
catch
(
e
:
IOException
)
{
Timber
.
e
(
e
)
}
}
}
}
}
...
...
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