ww-tech / roxie

Lightweight Android library for building reactive apps.
Apache License 2.0
482 stars 36 forks source link

Fix issue with obfuscated actions/states being the same, bump to 0.2.1 #3

Closed JotraN closed 5 years ago

JotraN commented 5 years ago

Fix issue with obfuscated actions/states being the same regardless of data.

Issue was due to the hash coding occurring on the class name instead of the actual object.

Obfuscation only really applies to data classes since kotlin gives us a toString that contains the class' data (printing a normal class will output something similar to our obfuscated strings).

Sample (where comment indicates print result)

Without obfuscating:

data class ObfuscatedAction(val data: String) : BaseAction
print(ObfuscatedAction(data="test")) // ObfuscatedAction(data=test)

With obfuscating:

data class ObfuscatedAction(val data: String) : BaseAction {
    override fun toString() = obfuscatedString()
}
print(ObfuscatedAction(data="test")) // ObfuscatedAction@123 -  where 123 is the hash code.

More Stuff

Bump to 0.2.1 with fixes. Add kluent to make our tests prettier.