I'm glad to see that you guys have moved onto Kotlin, but a lot of the code still adopts a Java like structure. There are a few things I'm going to bring up for you to consider:
All links are based on the latest commit as of this issue
Why wrap constants in a singleton object? You can just add the values directly on the top level and also add the const
keyword so that they are truly constants added where it is used in the byte code.
if (piracyChecker != null) piracyChecker!!.start()
should be
Embrace the null operation rather than enforcing non nulls due to using var
The privacy checker as a whole probably shouldn't be nullable. Just instantiate it lazily so its not done when the check is disabled.
fun checkNetworkConnection(): Boolean? {
var isConnected = false
try {
val process = Runtime.getRuntime().exec("ping -c 1 www.google.com")
val returnVal = process.waitFor()
isConnected = returnVal == 0
} catch (e: Exception) {
// Suppress error
}
return isConnected
}
You can make this return a nonnull Boolean. At the same time, this has an O(1) retrieval time and no parameters. Kotlin's guidelines would suggest you use the var get() syntax but that is up to you. You also probably shouldn't use something like this to begin with especially if it is in the ui thread, but I didn't look any further into it.
A whole bunch of the other functions here all require Context, so use extension functions. And furthermore, none of these should be wrapped in a singleton