I am trying to create an abstract method to first check the connection
abstract class SafeRequest {
fun apiRequest(function: () -> ANRequest<ANRequest<*>>): ANRequest<out ANRequest<*>> {
var connectionQuality = AndroidNetworking.getCurrentConnectionQuality()
if(connectionQuality == ConnectionQuality.POOR){
throw NoInternet("your connection is bad")
}else{
var response = function.invoke()
return response
}
}
}