fix crash in drafts caused by minification of DraftAttachment (#2337)

* fix crash in drafts caused by minification of DraftAttachment

* fix formatting
This commit is contained in:
Konrad Pozniak 2022-02-14 19:20:15 +01:00 committed by GitHub
parent 329df1280b
commit 97fe4f88c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View file

@ -47,12 +47,13 @@
public *;
}
-keepclassmembers class com.keylesspalace.tusky.components.conversation.ConversationAccountEntity { *; }
-keepclassmembers class com.keylesspalace.tusky.db.DraftAttachment { *; }
-keep enum com.keylesspalace.tusky.db.DraftAttachment$Type {
public *;
}
-keepclassmembers class com.keylesspalace.tusky.components.conversation.ConversationAccountEntity { *; }
# https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg
# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,

View file

@ -21,6 +21,7 @@ import androidx.core.net.toUri
import androidx.room.Entity
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.google.gson.annotations.SerializedName
import com.keylesspalace.tusky.entity.NewPoll
import com.keylesspalace.tusky.entity.Status
import kotlinx.parcelize.Parcelize
@ -40,11 +41,16 @@ data class DraftEntity(
val failedToSend: Boolean
)
/**
* The alternate names are here because we accidentally published versions were DraftAttachment was minified
* Tusky 15: uriString = e, description = f, type = g
* Tusky 16 beta: uriString = i, description = j, type = k
*/
@Parcelize
data class DraftAttachment(
val uriString: String,
val description: String?,
val type: Type
@SerializedName(value = "uriString", alternate = ["e", "i"]) val uriString: String,
@SerializedName(value = "description", alternate = ["f", "j"]) val description: String?,
@SerializedName(value = "type", alternate = ["g", "k"]) val type: Type
) : Parcelable {
val uri: Uri
get() = uriString.toUri()