coletz
03/07/2019, 5:07 PMJdbcSqliteDriver(driver: String = "jdbc:sqlite", dbName: String = "")
and compose the url inside the constructor?pniederw
03/09/2019, 1:49 AMegorand
03/09/2019, 3:20 AMKotlinCompilerCall
which uses embeddable kotlinc https://github.com/square/moshi/blob/master/kotlin/codegen/src/test/java/com/squareup/moshi/kotlin/codegen/KotlinCompilerCall.ktegorand
03/09/2019, 3:21 AMegorand
03/09/2019, 3:21 AMNikky
03/09/2019, 10:46 AMNikky
03/09/2019, 10:47 AMcoletz
03/12/2019, 2:45 PMalec
03/12/2019, 4:39 PMalec
03/12/2019, 4:39 PMefemoney
03/13/2019, 3:53 AMpluginManagement
block of the settings file to be able to use any plugin from the plugins
block. Its even recommended practice. https://medium.com/@StefMa/its-time-to-ditch-the-buildscript-block-a1ab12e0d9cedave08
03/18/2019, 5:50 PMval
in a data class
that has JsonClass
for code generation in Moshi and it needs a backing field, is it enough to make it @Transient
so that Moshi ignores it?dave08
03/18/2019, 6:52 PM@Transient
?bdawg.io
03/18/2019, 7:25 PMKotlinJsonAdapterFactory
(or pre-generated via @JsonClass
)ghedeon
03/20/2019, 10:30 PMCoroutineCallAdapterFactory
into custom ErrorCallAdapterFactory
?
(In order to map some errors in a centralized fashion, same as RxJavaCallAdapterFactory
exceptions are being usually wrapped and rethrown. ) Eventually, in my CallAdapter
I'll have originalAdapter?.adapt(originalCall)
, where the original one gives me an instance of CompletableDeffered
I suppose. Means that try/catch
won't work on this, right?
Edit: I'm talking about Retrofit 2 CallAdapter.Factory for Kotlin coroutine's Deferred.
UPD: Solved https://kotlinlang.slack.com/archives/C1CFAFJSK/p1553160868589100?thread_ts=1553155012.582400&cid=C1CFAFJSKdave08
03/24/2019, 4:35 PMjw
03/24/2019, 4:37 PMjw
03/24/2019, 4:37 PMdave08
03/24/2019, 4:39 PM@ToJson
and @FromJson
, I can't use that right?dave08
03/24/2019, 4:40 PMjw
03/24/2019, 4:41 PMjw
03/24/2019, 4:42 PMdave08
03/24/2019, 4:42 PM@FromJson fun fromJson(json: String): PaymentResult
and @ToJson fun toJson(paymentResult: PaymentResult): String
dave08
03/24/2019, 4:43 PMYou can specify other `JsonAdapter`s as params?
jw
03/24/2019, 4:44 PMdave08
03/24/2019, 4:50 PMdata class
for Success with extra info. The Success class uses a generated JsonAdapter, and I have a custom JsonAdapter to resolve whether to serialize the Success or to return one of the error objects...dave08
03/24/2019, 4:50 PM@FromJson fun fromJson(json: String): PaymentResult =
when(json.getInteger("id")) {
200 -> jsonAdapter.fromJson(json)!!
403 -> PaymentResult.PaymentSuccededWithRegistrationNotCompleted
401 -> PaymentResult.CouponOrProductNotFound
402 -> PaymentResult.PaymentNotAccepted(json.getString("error"))
420 -> PaymentResult.SellerIdNotValid
else -> error("Invalid response from Odoo")
}
dave08
03/24/2019, 4:51 PMprivate fun String.getInteger(key: String): Int =
replace(".+?['\"]$key['\"]\\s*:\\s*(\\d+)\\s*.+".toRegex(), "$1").toInt()
private fun String.getString(key: String): String =
replace(""".+?['"]$key['"]\s*:\s*['"]([^'"]+)['"]\s*.+""".toRegex(), "$1")
dave08
03/24/2019, 4:53 PMdave08
03/24/2019, 4:54 PM