Skip to content

Instantly share code, notes, and snippets.

@littleGnAl
Created July 10, 2019 11:06
Show Gist options
  • Save littleGnAl/d33d77a42a95f12ba5996f6ef4a58a49 to your computer and use it in GitHub Desktop.
Save littleGnAl/d33d77a42a95f12ba5996f6ef4a58a49 to your computer and use it in GitHub Desktop.
const val SQLDELIGHT_CHANNEL = "com.littlegnal.accountingmultiplatform/sqldelight"
class SqlDelightManager(
private val accountingRepository: AccountingRepository
) : CoroutineScope {
...
fun methodCall(method: String, arguments: Map<String, Any>, result: (Any) -> Unit) {
launch(coroutineContext) {
when (method) {
...
"getMonthTotalAmount" -> {
@Suppress("UNCHECKED_CAST") val yearAndMonthList: List<String> =
arguments["yearAndMonthList"] as? List<String> ?: emptyList()
val r = accountingRepository.getMonthTotalAmount(yearAndMonthList)
result(r)
}
"getGroupingMonthTotalAmount" -> {
val yearAndMonth: String = arguments["yearAndMonth"] as? String ?: ""
val r = accountingRepository.getGroupingMonthTotalAmount(yearAndMonth)
result(r)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment