MichaelRocks / paranoid

String obfuscator for Android applications.
Apache License 2.0
670 stars 79 forks source link

Obfuscate on extension functions #39

Closed DatL4g closed 3 years ago

DatL4g commented 3 years ago

Let's say you extend the File class with an function which creates an intentChooser for it Example:

fun File.intentChooser(): Intent {
    val intent = Intent(Intent.ACTION_VIEW)
    intent.setDataAndType(Uri.fromFile(this), "text/plain")

    return Intent.createChooser(intent, "Choose App to open file")
}

Currently you can't obfuscate this using @Obfuscate because this works on classes only. Would it be possible to enhance that, so "text/plain" and "Choose App to open file" can be obfuscated?

MichaelRocks commented 3 years ago

Hi @DATL4G,

Firstly, You can try and add @file:Obfuscate at the beginning of the file. Secondly, I'm working on a feature that will allow to specify classes to obfuscate without using an annotation (#23). Hope this feature is going to be ready soon.