Created
July 10, 2019 11:06
-
-
Save littleGnAl/d33d77a42a95f12ba5996f6ef4a58a49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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