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
80d834fb
Commit
80d834fb
authored
Jun 01, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use kotshi instead of moshi-kotlin-codegen
parent
4122ebe1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
26 additions
and
61 deletions
+26
-61
build.gradle
app/build.gradle
+5
-2
proguard-moshi.pro
app/proguard-moshi.pro
+0
-49
proguard-rules.pro
app/proguard-rules.pro
+1
-1
NetworkingModule.kt
...src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt
+12
-1
MagiskApp.kt
.../main/java/com/topjohnwu/magisk/model/entity/MagiskApp.kt
+2
-2
MagiskConfig.kt
...in/java/com/topjohnwu/magisk/model/entity/MagiskConfig.kt
+2
-2
MagiskFlashable.kt
...java/com/topjohnwu/magisk/model/entity/MagiskFlashable.kt
+2
-2
MagiskLink.kt
...main/java/com/topjohnwu/magisk/model/entity/MagiskLink.kt
+2
-2
No files found.
app/build.gradle
View file @
80d834fb
...
@@ -26,7 +26,7 @@ android {
...
@@ -26,7 +26,7 @@ android {
minifyEnabled
true
minifyEnabled
true
shrinkResources
true
shrinkResources
true
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
proguardFiles
getDefaultProguardFile
(
'proguard-android-optimize.txt'
),
'proguard-rules.pro'
,
'proguard-
moshi.pro'
,
'proguard-
kotlin.pro'
'proguard-rules.pro'
,
'proguard-kotlin.pro'
}
}
}
}
...
@@ -86,7 +86,10 @@ dependencies {
...
@@ -86,7 +86,10 @@ dependencies {
def
vMoshi
=
"1.8.0"
def
vMoshi
=
"1.8.0"
implementation
"com.squareup.moshi:moshi:${vMoshi}"
implementation
"com.squareup.moshi:moshi:${vMoshi}"
kapt
"com.squareup.moshi:moshi-kotlin-codegen:${vMoshi}"
def
vKotshi
=
"2.0.1"
implementation
"se.ansman.kotshi:api:${vKotshi}"
kapt
"se.ansman.kotshi:compiler:${vKotshi}"
implementation
'androidx.constraintlayout:constraintlayout:1.1.3'
implementation
'androidx.constraintlayout:constraintlayout:1.1.3'
implementation
'androidx.browser:browser:1.0.0'
implementation
'androidx.browser:browser:1.0.0'
...
...
app/proguard-moshi.pro
deleted
100644 → 0
View file @
4122ebe1
# JSR 305 annotations are for embedding nullability information.
-
dontwarn
javax
.
annotation
.
**
-
keepclasseswithmembers
class
*
{
@
com
.
squareup
.
moshi
.
*
<
methods
>
;
}
-
keep
@
com
.
squareup
.
moshi
.
JsonQualifier
interface
*
# Enum field names are used by the integrated EnumJsonAdapter.
# Annotate enums with @JsonClass(generateAdapter = false) to use them with Moshi.
-
keepclassmembers
@
com
.
squareup
.
moshi
.
JsonClass
class
*
extends
java
.
lang
.
Enum
{
<
fields
>
;
}
# The name of @JsonClass types is used to look up the generated adapter.
-
keepnames
@
com
.
squareup
.
moshi
.
JsonClass
class
*
# Retain generated JsonAdapters if annotated type is retained.
-
if
@
com
.
squareup
.
moshi
.
JsonClass
class
*
-
keep
class
<
1
>
JsonAdapter
{
<
init
>
(...);
<
fields
>
;
}
-
if
@
com
.
squareup
.
moshi
.
JsonClass
class
**
$
*
-
keep
class
<
1
>
_
<
2
>
JsonAdapter
{
<
init
>
(...);
<
fields
>
;
}
-
if
@
com
.
squareup
.
moshi
.
JsonClass
class
**
$
*
$
*
-
keep
class
<
1
>
_
<
2
>
_
<
3
>
JsonAdapter
{
<
init
>
(...);
<
fields
>
;
}
-
if
@
com
.
squareup
.
moshi
.
JsonClass
class
**
$
*
$
*
$
*
-
keep
class
<
1
>
_
<
2
>
_
<
3
>
_
<
4
>
JsonAdapter
{
<
init
>
(...);
<
fields
>
;
}
-
if
@
com
.
squareup
.
moshi
.
JsonClass
class
**
$
*
$
*
$
*
$
*
-
keep
class
<
1
>
_
<
2
>
_
<
3
>
_
<
4
>
_
<
5
>
JsonAdapter
{
<
init
>
(...);
<
fields
>
;
}
-
if
@
com
.
squareup
.
moshi
.
JsonClass
class
**
$
*
$
*
$
*
$
*
$
*
-
keep
class
<
1
>
_
<
2
>
_
<
3
>
_
<
4
>
_
<
5
>
_
<
6
>
JsonAdapter
{
<
init
>
(...);
<
fields
>
;
}
\ No newline at end of file
app/proguard-rules.pro
View file @
80d834fb
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
#}
#}
# Retrofit classes
# Retrofit classes
-
keep
,
allowobfuscation
class
com
.
topjohnwu
.
magisk
.
data
.
network
.
*
*
-
keep
,
allowobfuscation
class
com
.
topjohnwu
.
magisk
.
data
.
network
.
*
# Snet
# Snet
-
keepclassmembers
class
com
.
topjohnwu
.
magisk
.
utils
.
ISafetyNetHelper
{
*
;
}
-
keepclassmembers
class
com
.
topjohnwu
.
magisk
.
utils
.
ISafetyNetHelper
{
*
;
}
...
...
app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt
View file @
80d834fb
package
com.topjohnwu.magisk.di
package
com.topjohnwu.magisk.di
import
com.squareup.moshi.JsonAdapter
import
com.squareup.moshi.Moshi
import
com.squareup.moshi.Moshi
import
com.topjohnwu.magisk.Constants
import
com.topjohnwu.magisk.Constants
import
com.topjohnwu.magisk.data.network.GithubRawApiServices
import
com.topjohnwu.magisk.data.network.GithubRawApiServices
...
@@ -11,6 +12,7 @@ import retrofit2.Converter
...
@@ -11,6 +12,7 @@ import retrofit2.Converter
import
retrofit2.Retrofit
import
retrofit2.Retrofit
import
retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import
retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import
retrofit2.converter.moshi.MoshiConverterFactory
import
retrofit2.converter.moshi.MoshiConverterFactory
import
se.ansman.kotshi.KotshiJsonAdapterFactory
val
networkingModule
=
module
{
val
networkingModule
=
module
{
single
{
createOkHttpClient
()
}
single
{
createOkHttpClient
()
}
...
@@ -31,7 +33,9 @@ fun createOkHttpClient(): OkHttpClient {
...
@@ -31,7 +33,9 @@ fun createOkHttpClient(): OkHttpClient {
}
}
fun
createConverterFactory
():
Converter
.
Factory
{
fun
createConverterFactory
():
Converter
.
Factory
{
val
moshi
=
Moshi
.
Builder
().
build
()
val
moshi
=
Moshi
.
Builder
()
.
add
(
JsonAdapterFactory
.
INSTANCE
)
.
build
()
return
MoshiConverterFactory
.
create
(
moshi
)
return
MoshiConverterFactory
.
create
(
moshi
)
}
}
...
@@ -50,6 +54,13 @@ fun createRetrofit(
...
@@ -50,6 +54,13 @@ fun createRetrofit(
.
client
(
okHttpClient
)
.
client
(
okHttpClient
)
}
}
@KotshiJsonAdapterFactory
abstract
class
JsonAdapterFactory
:
JsonAdapter
.
Factory
{
companion
object
{
val
INSTANCE
:
JsonAdapterFactory
=
KotshiJsonAdapterFactory
}
}
inline
fun
<
reified
T
>
createApiService
(
retrofitBuilder
:
Retrofit
.
Builder
,
baseUrl
:
String
):
T
{
inline
fun
<
reified
T
>
createApiService
(
retrofitBuilder
:
Retrofit
.
Builder
,
baseUrl
:
String
):
T
{
return
retrofitBuilder
return
retrofitBuilder
.
baseUrl
(
baseUrl
)
.
baseUrl
(
baseUrl
)
...
...
app/src/main/java/com/topjohnwu/magisk/model/entity/MagiskApp.kt
View file @
80d834fb
package
com.topjohnwu.magisk.model.entity
package
com.topjohnwu.magisk.model.entity
import
com.squareup.moshi.JsonClass
import
se.ansman.kotshi.JsonSerializable
@Json
Class
(
generateAdapter
=
true
)
@Json
Serializable
data class
MagiskApp
(
data class
MagiskApp
(
val
version
:
String
,
val
version
:
String
,
val
versionCode
:
String
,
val
versionCode
:
String
,
...
...
app/src/main/java/com/topjohnwu/magisk/model/entity/MagiskConfig.kt
View file @
80d834fb
package
com.topjohnwu.magisk.model.entity
package
com.topjohnwu.magisk.model.entity
import
com.squareup.moshi.JsonClass
import
se.ansman.kotshi.JsonSerializable
@Json
Class
(
generateAdapter
=
true
)
@Json
Serializable
data class
MagiskConfig
(
data class
MagiskConfig
(
val
app
:
MagiskApp
,
val
app
:
MagiskApp
,
val
uninstaller
:
MagiskLink
,
val
uninstaller
:
MagiskLink
,
...
...
app/src/main/java/com/topjohnwu/magisk/model/entity/MagiskFlashable.kt
View file @
80d834fb
package
com.topjohnwu.magisk.model.entity
package
com.topjohnwu.magisk.model.entity
import
com.squareup.moshi.Json
import
com.squareup.moshi.Json
import
com.squareup.moshi.JsonClass
import
se.ansman.kotshi.JsonSerializable
@Json
Class
(
generateAdapter
=
true
)
@Json
Serializable
data class
MagiskFlashable
(
data class
MagiskFlashable
(
val
version
:
String
,
val
version
:
String
,
val
versionCode
:
String
,
val
versionCode
:
String
,
...
...
app/src/main/java/com/topjohnwu/magisk/model/entity/MagiskLink.kt
View file @
80d834fb
package
com.topjohnwu.magisk.model.entity
package
com.topjohnwu.magisk.model.entity
import
com.squareup.moshi.JsonClass
import
se.ansman.kotshi.JsonSerializable
@Json
Class
(
generateAdapter
=
true
)
@Json
Serializable
data class
MagiskLink
(
data class
MagiskLink
(
val
link
:
String
val
link
:
String
)
)
\ No newline at end of file
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