Skip to content

Instantly share code, notes, and snippets.

@JacquesSmuts
Created May 21, 2019 20:36
Show Gist options
  • Save JacquesSmuts/b6b45f506d001005bc8914e0925986cc to your computer and use it in GitHub Desktop.
Save JacquesSmuts/b6b45f506d001005bc8914e0925986cc to your computer and use it in GitHub Desktop.
fun saveUsernameAndPassword(username: String, password: String) {
val result = StorageService.getInstance()::saveUsernameAndPassword suspendAndInvokeWith Pair(username, password)
handleResult(result)
}
private suspend infix fun <Input1, Input2, Output> ((Input1, Input2, (Output) -> Unit) -> Unit).suspendAndInvokeWith(pair: Pair<Input1, Input2>): Output {
return suspendAsync(this, pair.first, pair.second)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment