Merge pull request #1478 from vector-im/feature/proguard
Feature/proguard
This commit is contained in:
commit
601e11980f
|
@ -35,6 +35,10 @@ android {
|
||||||
resValue "string", "git_sdk_revision", "\"${gitRevision()}\""
|
resValue "string", "git_sdk_revision", "\"${gitRevision()}\""
|
||||||
resValue "string", "git_sdk_revision_unix_date", "\"${gitRevisionUnixDate()}\""
|
resValue "string", "git_sdk_revision_unix_date", "\"${gitRevisionUnixDate()}\""
|
||||||
resValue "string", "git_sdk_revision_date", "\"${gitRevisionDate()}\""
|
resValue "string", "git_sdk_revision_date", "\"${gitRevisionDate()}\""
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
consumerProguardFiles 'proguard-rules.pro'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -49,9 +53,6 @@ android {
|
||||||
release {
|
release {
|
||||||
buildConfigField "boolean", "LOG_PRIVATE_DATA", "false"
|
buildConfigField "boolean", "LOG_PRIVATE_DATA", "false"
|
||||||
buildConfigField "okhttp3.logging.HttpLoggingInterceptor.Level", "OKHTTP_LOGGING_LEVEL", "okhttp3.logging.HttpLoggingInterceptor.Level.NONE"
|
buildConfigField "okhttp3.logging.HttpLoggingInterceptor.Level", "OKHTTP_LOGGING_LEVEL", "okhttp3.logging.HttpLoggingInterceptor.Level.NONE"
|
||||||
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,3 +19,45 @@
|
||||||
# If you keep the line number information, uncomment this to
|
# If you keep the line number information, uncomment this to
|
||||||
# hide the original source file name.
|
# hide the original source file name.
|
||||||
#-renamesourcefileattribute SourceFile
|
#-renamesourcefileattribute SourceFile
|
||||||
|
|
||||||
|
|
||||||
|
### EVENT BUS ###
|
||||||
|
|
||||||
|
-keepattributes *Annotation*
|
||||||
|
-keepclassmembers class * {
|
||||||
|
@org.greenrobot.eventbus.Subscribe <methods>;
|
||||||
|
}
|
||||||
|
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
|
||||||
|
|
||||||
|
### MOSHI ###
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
# values() is synthesized by the Kotlin compiler and is used by EnumJsonAdapter indirectly
|
||||||
|
# Annotate enums with @JsonClass(generateAdapter = false) to use them with Moshi.
|
||||||
|
-keepclassmembers @com.squareup.moshi.JsonClass class * extends java.lang.Enum {
|
||||||
|
<fields>;
|
||||||
|
**[] values();
|
||||||
|
}
|
||||||
|
|
||||||
|
-keep class kotlin.reflect.jvm.internal.impl.builtins.BuiltInsLoaderImpl
|
||||||
|
|
||||||
|
-keepclassmembers class kotlin.Metadata {
|
||||||
|
public <methods>;
|
||||||
|
}
|
||||||
|
|
||||||
|
### OKHTTP for Android Studio ###
|
||||||
|
-keep class okhttp3.Headers { *; }
|
||||||
|
-keep interface okhttp3.Interceptor.* { *; }
|
||||||
|
|
||||||
|
### OLM JNI ###
|
||||||
|
-keep class org.matrix.olm.** { *; }
|
|
@ -17,10 +17,12 @@
|
||||||
package im.vector.matrix.android.api.session.room.model
|
package im.vector.matrix.android.api.session.room.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the membership of a user on a room
|
* Represents the membership of a user on a room
|
||||||
*/
|
*/
|
||||||
|
@JsonClass(generateAdapter = false)
|
||||||
enum class Membership(val value: String) {
|
enum class Membership(val value: String) {
|
||||||
|
|
||||||
NONE("none"),
|
NONE("none"),
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
package im.vector.matrix.android.api.session.room.model
|
package im.vector.matrix.android.api.session.room.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
|
@JsonClass(generateAdapter = false)
|
||||||
enum class RoomDirectoryVisibility {
|
enum class RoomDirectoryVisibility {
|
||||||
@Json(name = "private") PRIVATE,
|
@Json(name = "private") PRIVATE,
|
||||||
@Json(name = "public") PUBLIC
|
@Json(name = "public") PUBLIC
|
||||||
|
|
|
@ -29,6 +29,7 @@ data class RoomGuestAccessContent(
|
||||||
@Json(name = "guest_access") val guestAccess: GuestAccess? = null
|
@Json(name = "guest_access") val guestAccess: GuestAccess? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@JsonClass(generateAdapter = false)
|
||||||
enum class GuestAccess(val value: String) {
|
enum class GuestAccess(val value: String) {
|
||||||
@Json(name = "can_join")
|
@Json(name = "can_join")
|
||||||
CanJoin("can_join"),
|
CanJoin("can_join"),
|
||||||
|
|
|
@ -17,10 +17,12 @@
|
||||||
package im.vector.matrix.android.api.session.room.model
|
package im.vector.matrix.android.api.session.room.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ref: https://matrix.org/docs/spec/client_server/latest#room-history-visibility
|
* Ref: https://matrix.org/docs/spec/client_server/latest#room-history-visibility
|
||||||
*/
|
*/
|
||||||
|
@JsonClass(generateAdapter = false)
|
||||||
enum class RoomHistoryVisibility {
|
enum class RoomHistoryVisibility {
|
||||||
/**
|
/**
|
||||||
* All events while this is the m.room.history_visibility value may be shared by any
|
* All events while this is the m.room.history_visibility value may be shared by any
|
||||||
|
|
|
@ -18,10 +18,12 @@
|
||||||
package im.vector.matrix.android.api.session.room.model
|
package im.vector.matrix.android.api.session.room.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum for [RoomJoinRulesContent] : https://matrix.org/docs/spec/client_server/r0.4.0#m-room-join-rules
|
* Enum for [RoomJoinRulesContent] : https://matrix.org/docs/spec/client_server/r0.4.0#m-room-join-rules
|
||||||
*/
|
*/
|
||||||
|
@JsonClass(generateAdapter = false)
|
||||||
enum class RoomJoinRules(val value: String) {
|
enum class RoomJoinRules(val value: String) {
|
||||||
|
|
||||||
@Json(name = "public")
|
@Json(name = "public")
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
package im.vector.matrix.android.api.session.room.model.create
|
package im.vector.matrix.android.api.session.room.model.create
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
|
@JsonClass(generateAdapter = false)
|
||||||
enum class CreateRoomPreset {
|
enum class CreateRoomPreset {
|
||||||
@Json(name = "private_chat")
|
@Json(name = "private_chat")
|
||||||
PRESET_PRIVATE_CHAT,
|
PRESET_PRIVATE_CHAT,
|
||||||
|
|
|
@ -76,6 +76,7 @@ data class Fingerprint(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonClass(generateAdapter = false)
|
||||||
enum class HashType {
|
enum class HashType {
|
||||||
@Json(name = "sha-1") SHA1,
|
@Json(name = "sha-1") SHA1,
|
||||||
@Json(name = "sha-256")SHA256
|
@Json(name = "sha-256")SHA256
|
||||||
|
|
|
@ -192,8 +192,14 @@ android {
|
||||||
resValue "bool", "debug_mode", "false"
|
resValue "bool", "debug_mode", "false"
|
||||||
buildConfigField "boolean", "LOW_PRIVACY_LOG_ENABLE", "false"
|
buildConfigField "boolean", "LOW_PRIVACY_LOG_ENABLE", "false"
|
||||||
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
postprocessing {
|
||||||
|
removeUnusedCode true
|
||||||
|
removeUnusedResources true
|
||||||
|
obfuscate false
|
||||||
|
optimizeCode true
|
||||||
|
proguardFiles 'proguard-rules.pro'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,3 +19,5 @@
|
||||||
# If you keep the line number information, uncomment this to
|
# If you keep the line number information, uncomment this to
|
||||||
# hide the original source file name.
|
# hide the original source file name.
|
||||||
#-renamesourcefileattribute SourceFile
|
#-renamesourcefileattribute SourceFile
|
||||||
|
|
||||||
|
-keep class im.vector.riotx.features.** { *; }
|
|
@ -39,7 +39,7 @@ private const val SIZE_20MB = 20 * 1024 * 1024
|
||||||
private const val SIZE_50MB = 50 * 1024 * 1024
|
private const val SIZE_50MB = 50 * 1024 * 1024
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class VectorFileLogger @Inject constructor(val context: Context, private val vectorPreferences: VectorPreferences) : Timber.DebugTree() {
|
class VectorFileLogger @Inject constructor(val context: Context, private val vectorPreferences: VectorPreferences) : Timber.Tree() {
|
||||||
|
|
||||||
private val maxLogSizeByte: Int
|
private val maxLogSizeByte: Int
|
||||||
private val logRotationCount: Int
|
private val logRotationCount: Int
|
||||||
|
|
Loading…
Reference in New Issue