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
716f0684
Commit
716f0684
authored
Oct 03, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use GitHub pages URLs for public channel JSONs
parent
241f2656
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
17 deletions
+34
-17
Const.kt
app/src/main/java/com/topjohnwu/magisk/core/Const.kt
+1
-3
GithubServices.kt
.../java/com/topjohnwu/magisk/data/network/GithubServices.kt
+9
-0
MagiskRepository.kt
.../com/topjohnwu/magisk/data/repository/MagiskRepository.kt
+8
-6
NetworkingModule.kt
...src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt
+2
-0
RepositoryModule.kt
...src/main/java/com/topjohnwu/magisk/di/RepositoryModule.kt
+1
-1
build.gradle.kts
stub/build.gradle.kts
+3
-0
MainActivity.java
stub/src/main/java/com/topjohnwu/magisk/MainActivity.java
+10
-7
No files found.
app/src/main/java/com/topjohnwu/magisk/core/Const.kt
View file @
716f0684
...
@@ -47,14 +47,12 @@ object Const {
...
@@ -47,14 +47,12 @@ object Const {
object
Url
{
object
Url
{
const
val
ZIP_URL
=
"https://github.com/Magisk-Modules-Repo/%s/archive/master.zip"
const
val
ZIP_URL
=
"https://github.com/Magisk-Modules-Repo/%s/archive/master.zip"
const
val
PAYPAL_URL
=
"https://www.paypal.me/topjohnwu"
const
val
PATREON_URL
=
"https://www.patreon.com/topjohnwu"
const
val
PATREON_URL
=
"https://www.patreon.com/topjohnwu"
const
val
TWITTER_URL
=
"https://twitter.com/topjohnwu"
const
val
XDA_THREAD
=
"http://forum.xda-developers.com/showthread.php?t=3432382"
const
val
SOURCE_CODE_URL
=
"https://github.com/topjohnwu/Magisk"
const
val
SOURCE_CODE_URL
=
"https://github.com/topjohnwu/Magisk"
const
val
GITHUB_RAW_URL
=
"https://raw.githubusercontent.com/"
const
val
GITHUB_RAW_URL
=
"https://raw.githubusercontent.com/"
const
val
GITHUB_API_URL
=
"https://api.github.com/users/Magisk-Modules-Repo/"
const
val
GITHUB_API_URL
=
"https://api.github.com/users/Magisk-Modules-Repo/"
const
val
GITHUB_PAGE_URL
=
"https://topjohnwu.github.io/magisk_files/"
}
}
object
Key
{
object
Key
{
...
...
app/src/main/java/com/topjohnwu/magisk/data/network/GithubServices.kt
View file @
716f0684
...
@@ -7,6 +7,15 @@ import okhttp3.ResponseBody
...
@@ -7,6 +7,15 @@ import okhttp3.ResponseBody
import
retrofit2.Response
import
retrofit2.Response
import
retrofit2.http.*
import
retrofit2.http.*
interface
GithubPageServices
{
@GET
(
"stable.json"
)
suspend
fun
fetchStableUpdate
():
UpdateInfo
@GET
(
"beta.json"
)
suspend
fun
fetchBetaUpdate
():
UpdateInfo
}
interface
GithubRawServices
{
interface
GithubRawServices
{
//region topjohnwu/magisk_files
//region topjohnwu/magisk_files
...
...
app/src/main/java/com/topjohnwu/magisk/data/repository/MagiskRepository.kt
View file @
716f0684
...
@@ -2,27 +2,29 @@ package com.topjohnwu.magisk.data.repository
...
@@ -2,27 +2,29 @@ package com.topjohnwu.magisk.data.repository
import
com.topjohnwu.magisk.core.Config
import
com.topjohnwu.magisk.core.Config
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.data.network.GithubPageServices
import
com.topjohnwu.magisk.data.network.GithubRawServices
import
com.topjohnwu.magisk.data.network.GithubRawServices
import
retrofit2.HttpException
import
retrofit2.HttpException
import
timber.log.Timber
import
timber.log.Timber
import
java.io.IOException
import
java.io.IOException
class
MagiskRepository
(
class
MagiskRepository
(
private
val
apiRaw
:
GithubRawServices
private
val
rawSvc
:
GithubRawServices
,
private
val
pageSvc
:
GithubPageServices
)
{
)
{
suspend
fun
fetchUpdate
()
=
try
{
suspend
fun
fetchUpdate
()
=
try
{
var
info
=
when
(
Config
.
updateChannel
)
{
var
info
=
when
(
Config
.
updateChannel
)
{
Config
.
Value
.
DEFAULT_CHANNEL
,
Config
.
Value
.
STABLE_CHANNEL
->
apiRaw
.
fetchStableUpdate
()
Config
.
Value
.
DEFAULT_CHANNEL
,
Config
.
Value
.
STABLE_CHANNEL
->
pageSvc
.
fetchStableUpdate
()
Config
.
Value
.
BETA_CHANNEL
->
apiRaw
.
fetchBetaUpdate
()
Config
.
Value
.
BETA_CHANNEL
->
pageSvc
.
fetchBetaUpdate
()
Config
.
Value
.
CANARY_CHANNEL
->
apiRaw
.
fetchCanaryUpdate
()
Config
.
Value
.
CANARY_CHANNEL
->
rawSvc
.
fetchCanaryUpdate
()
Config
.
Value
.
CUSTOM_CHANNEL
->
apiRaw
.
fetchCustomUpdate
(
Config
.
customChannelUrl
)
Config
.
Value
.
CUSTOM_CHANNEL
->
rawSvc
.
fetchCustomUpdate
(
Config
.
customChannelUrl
)
else
->
throw
IllegalArgumentException
()
else
->
throw
IllegalArgumentException
()
}
}
if
(
info
.
magisk
.
versionCode
<
Info
.
env
.
magiskVersionCode
&&
if
(
info
.
magisk
.
versionCode
<
Info
.
env
.
magiskVersionCode
&&
Config
.
updateChannel
==
Config
.
Value
.
DEFAULT_CHANNEL
)
{
Config
.
updateChannel
==
Config
.
Value
.
DEFAULT_CHANNEL
)
{
Config
.
updateChannel
=
Config
.
Value
.
BETA_CHANNEL
Config
.
updateChannel
=
Config
.
Value
.
BETA_CHANNEL
info
=
apiRaw
.
fetchBetaUpdate
()
info
=
pageSvc
.
fetchBetaUpdate
()
}
}
Info
.
remote
=
info
Info
.
remote
=
info
info
info
...
...
app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt
View file @
716f0684
...
@@ -7,6 +7,7 @@ import com.topjohnwu.magisk.core.Config
...
@@ -7,6 +7,7 @@ import com.topjohnwu.magisk.core.Config
import
com.topjohnwu.magisk.core.Const
import
com.topjohnwu.magisk.core.Const
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.data.network.GithubApiServices
import
com.topjohnwu.magisk.data.network.GithubApiServices
import
com.topjohnwu.magisk.data.network.GithubPageServices
import
com.topjohnwu.magisk.data.network.GithubRawServices
import
com.topjohnwu.magisk.data.network.GithubRawServices
import
com.topjohnwu.magisk.ktx.precomputedText
import
com.topjohnwu.magisk.ktx.precomputedText
import
com.topjohnwu.magisk.net.Networking
import
com.topjohnwu.magisk.net.Networking
...
@@ -30,6 +31,7 @@ val networkingModule = module {
...
@@ -30,6 +31,7 @@ val networkingModule = module {
single
{
createRetrofit
(
get
())
}
single
{
createRetrofit
(
get
())
}
single
{
createApiService
<
GithubRawServices
>(
get
(),
Const
.
Url
.
GITHUB_RAW_URL
)
}
single
{
createApiService
<
GithubRawServices
>(
get
(),
Const
.
Url
.
GITHUB_RAW_URL
)
}
single
{
createApiService
<
GithubApiServices
>(
get
(),
Const
.
Url
.
GITHUB_API_URL
)
}
single
{
createApiService
<
GithubApiServices
>(
get
(),
Const
.
Url
.
GITHUB_API_URL
)
}
single
{
createApiService
<
GithubPageServices
>(
get
(),
Const
.
Url
.
GITHUB_PAGE_URL
)
}
single
{
createMarkwon
(
get
(),
get
())
}
single
{
createMarkwon
(
get
(),
get
())
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/di/RepositoryModule.kt
View file @
716f0684
...
@@ -7,7 +7,7 @@ import org.koin.dsl.module
...
@@ -7,7 +7,7 @@ import org.koin.dsl.module
val
repositoryModule
=
module
{
val
repositoryModule
=
module
{
single
{
MagiskRepository
(
get
())
}
single
{
MagiskRepository
(
get
()
,
get
()
)
}
single
{
LogRepository
(
get
())
}
single
{
LogRepository
(
get
())
}
single
{
StringRepository
(
get
())
}
single
{
StringRepository
(
get
())
}
}
}
stub/build.gradle.kts
View file @
716f0684
...
@@ -3,11 +3,14 @@ plugins {
...
@@ -3,11 +3,14 @@ plugins {
}
}
android
{
android
{
val
canary
=
!
Config
[
"appVersion"
].
orEmpty
().
contains
(
"."
)
defaultConfig
{
defaultConfig
{
applicationId
=
"com.topjohnwu.magisk"
applicationId
=
"com.topjohnwu.magisk"
versionCode
=
1
versionCode
=
1
versionName
=
Config
[
"appVersion"
]
versionName
=
Config
[
"appVersion"
]
buildConfigField
(
"String"
,
"DEV_CHANNEL"
,
Config
[
"DEV_CHANNEL"
]
?:
"null"
)
buildConfigField
(
"String"
,
"DEV_CHANNEL"
,
Config
[
"DEV_CHANNEL"
]
?:
"null"
)
buildConfigField
(
"boolean"
,
"CANARY"
,
if
(
canary
)
"true"
else
"false"
)
}
}
buildTypes
{
buildTypes
{
...
...
stub/src/main/java/com/topjohnwu/magisk/MainActivity.java
View file @
716f0684
...
@@ -25,12 +25,6 @@ import static android.R.string.yes;
...
@@ -25,12 +25,6 @@ import static android.R.string.yes;
public
class
MainActivity
extends
Activity
{
public
class
MainActivity
extends
Activity
{
private
static
final
boolean
CANARY
=
!
BuildConfig
.
VERSION_NAME
.
contains
(
"."
);
private
static
final
String
URL
=
BuildConfig
.
DEV_CHANNEL
!=
null
?
BuildConfig
.
DEV_CHANNEL
:
"https://raw.githubusercontent.com/topjohnwu/magisk_files/"
+
(
BuildConfig
.
DEBUG
?
"canary/debug.json"
:
(
CANARY
?
"canary/release.json"
:
"master/stable.json"
));
private
static
final
String
APP_NAME
=
"Magisk Manager"
;
private
static
final
String
APP_NAME
=
"Magisk Manager"
;
private
String
apkLink
;
private
String
apkLink
;
...
@@ -40,6 +34,15 @@ public class MainActivity extends Activity {
...
@@ -40,6 +34,15 @@ public class MainActivity extends Activity {
};
};
private
Context
themed
;
private
Context
themed
;
private
String
URL
()
{
if
(
BuildConfig
.
DEV_CHANNEL
!=
null
)
return
BuildConfig
.
DEV_CHANNEL
;
else
if
(
BuildConfig
.
CANARY
)
return
"https://raw.githubusercontent.com/topjohnwu/magisk_files/canary/release.json"
;
else
return
"https://topjohnwu.github.io/magisk_files/stable.json"
;
}
private
void
showDialog
()
{
private
void
showDialog
()
{
ProgressDialog
.
show
(
themed
,
ProgressDialog
.
show
(
themed
,
getString
(
R
.
string
.
dling
),
getString
(
R
.
string
.
dling
),
...
@@ -66,7 +69,7 @@ public class MainActivity extends Activity {
...
@@ -66,7 +69,7 @@ public class MainActivity extends Activity {
themed
=
new
ContextThemeWrapper
(
this
,
android
.
R
.
style
.
Theme_DeviceDefault
);
themed
=
new
ContextThemeWrapper
(
this
,
android
.
R
.
style
.
Theme_DeviceDefault
);
if
(
Networking
.
checkNetworkStatus
(
this
))
{
if
(
Networking
.
checkNetworkStatus
(
this
))
{
Networking
.
get
(
URL
)
Networking
.
get
(
URL
()
)
.
setErrorHandler
(
err
)
.
setErrorHandler
(
err
)
.
getAsJSONObject
(
new
JSONLoader
());
.
getAsJSONObject
(
new
JSONLoader
());
}
else
{
}
else
{
...
...
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