moko-network icon indicating copy to clipboard operation
moko-network copied to clipboard

TokenFeature.TokenProvider should be a fun interface

Open dalewking opened this issue 4 years ago • 0 comments

Providing a TokenFeature.TokenProvider requires creating on object like this:

object : TokenFeature.TokenProvider {
      override fun getToken() = "Bearer ${authentication.accessToken}"`
}

With the Kotlin 1.4 feature of functional interfaces, this interface should be declared as a fun interface allowing to provide a lambda so above code can be replaced with:

{ "Bearer ${authentication.accessToken}" }

dalewking avatar Sep 03 '21 07:09 dalewking